diff --git a/.gitignore b/.gitignore index 1065701..ece8587 100644 --- a/.gitignore +++ b/.gitignore @@ -222,3 +222,5 @@ gradle-app.setting .vscode/ !src/resources/DefFileGenerator.exe + +testing/cpp/vendordeps diff --git a/build.gradle b/build.gradle index 98343f5..fd3a792 100644 --- a/build.gradle +++ b/build.gradle @@ -13,7 +13,7 @@ java { allprojects { group = "edu.wpi.first" - version = "2025.3.0" + version = "2025.4.0" if (project.hasProperty('publishVersion')) { version = project.publishVersion diff --git a/src/main/java/edu/wpi/first/nativeutils/vendordeps/VendorDepTask.java b/src/main/java/edu/wpi/first/nativeutils/vendordeps/VendorDepTask.java index a1494e6..b102020 100644 --- a/src/main/java/edu/wpi/first/nativeutils/vendordeps/VendorDepTask.java +++ b/src/main/java/edu/wpi/first/nativeutils/vendordeps/VendorDepTask.java @@ -1,5 +1,6 @@ package edu.wpi.first.nativeutils.vendordeps; +import java.io.BufferedReader; import java.io.File; import java.io.IOException; import java.nio.file.Files; @@ -11,7 +12,10 @@ import org.gradle.api.tasks.TaskAction; import org.gradle.api.tasks.options.Option; +import com.google.gson.GsonBuilder; + import de.undercouch.gradle.tasks.download.DownloadAction; +import edu.wpi.first.nativeutils.vendordeps.WPIVendorDepsExtension.JsonDependency; /** * A task type for downloading vendordep JSON files from the vendor URL. @@ -41,6 +45,25 @@ public void install() throws IOException { getLogger().info("Remotely fetching " + filename); downloadRemote(dest); } + + var destString = dest.toString(); + var gson = new GsonBuilder().create(); + String newFilename; + try (BufferedReader reader = Files.newBufferedReader(dest)) { + newFilename = gson.fromJson(reader, JsonDependency.class).fileName; + } catch (IOException e) { + throw new RuntimeException(e); + } + File file = new File(destString); + int lastPathSeperator = dest.toString().lastIndexOf('/'); + File rename = new File(dest.toString().substring(0, lastPathSeperator + 1) + newFilename); + System.out.println(rename.toString()); + boolean didRename = file.renameTo(rename); + if (didRename == true) { + getLogger().info("File Succesfully Renamed"); + } else { + getLogger().warn("Failed to rename file"); + } } /** diff --git a/testing/cpp/build.gradle b/testing/cpp/build.gradle index 50f9535..3707000 100644 --- a/testing/cpp/build.gradle +++ b/testing/cpp/build.gradle @@ -1,8 +1,9 @@ import edu.wpi.first.toolchain.NativePlatforms +import edu.wpi.first.nativeutils.vendordeps.WPIVendorDepsPlugin plugins { id "cpp" - id "edu.wpi.first.NativeUtils" version "2025.3.0" + id "edu.wpi.first.NativeUtils" version "2025.4.0" } nativeUtils.addWpiNativeUtils() @@ -14,6 +15,8 @@ nativeUtils.crossCompilers.getByName(NativePlatforms.roborio).optional = false nativeUtils.crossCompilers.getByName(NativePlatforms.linuxarm32).optional = false nativeUtils.crossCompilers.getByName(NativePlatforms.linuxarm64).optional = false +project.getPlugins().apply(WPIVendorDepsPlugin.class) + model { components { all {