diff --git a/build.gradle b/build.gradle index 9d38190b..d9ed1661 100644 --- a/build.gradle +++ b/build.gradle @@ -52,6 +52,10 @@ allprojects { tasks.withType(Javadoc) { options.addBooleanOption('Xdoclint:all,-missing', true) } + + tasks.withType(JavaCompile) { + options.compilerArgs << "-Xlint:unchecked" << "-Xlint:deprecation" + } } gradlePlugin { @@ -109,6 +113,6 @@ examplesFolder.eachFile { File file -> jar.finalizedBy zipExamples wrapper { - gradleVersion = '8.10.2' + gradleVersion = '8.11' distributionType = Wrapper.DistributionType.BIN } diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index df97d72b..94113f20 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,6 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-8.11-bin.zip networkTimeout=10000 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME diff --git a/src/main/java/edu/wpi/first/gradlerio/deploy/roborio/FRCJNILibraryArtifact.java b/src/main/java/edu/wpi/first/gradlerio/deploy/roborio/FRCJNILibraryArtifact.java index 58d034df..1f9e529f 100644 --- a/src/main/java/edu/wpi/first/gradlerio/deploy/roborio/FRCJNILibraryArtifact.java +++ b/src/main/java/edu/wpi/first/gradlerio/deploy/roborio/FRCJNILibraryArtifact.java @@ -74,7 +74,7 @@ public void deploy(DeployContext arg0) { } public FileCollection computeFiles() { - Set configFileCaches = configuration.get().getResolvedConfiguration().getFiles(); + Set configFileCaches = configuration.get().getIncoming().getFiles().getFiles(); if (zipped) { Optional allFiles = configFileCaches.stream().map(file -> getTarget().getProject().zipTree(file).matching(filter)).filter(x -> x != null).reduce((a, b) -> a.plus(b)); if (allFiles.isPresent()) { diff --git a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/WPIDependenciesPlugin.java b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/WPIDependenciesPlugin.java index 62b4c1bb..8ee3f703 100644 --- a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/WPIDependenciesPlugin.java +++ b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/WPIDependenciesPlugin.java @@ -67,7 +67,7 @@ private Set getFiles() { for (Configuration cfg : configs) { if (cfg.isCanBeResolved()) { logger.info("Resolving Deps Configuration: " + cfg.getName()); - files.addAll(cfg.getResolvedConfiguration().getFiles()); + files.addAll(cfg.getIncoming().getFiles().getFiles()); } else { logger.info("Can't resolve: " + cfg.getName()); } diff --git a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/CppToolRunTask.java b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/CppToolRunTask.java index 6641d2a1..70958c30 100644 --- a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/CppToolRunTask.java +++ b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/CppToolRunTask.java @@ -15,12 +15,14 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.internal.os.OperatingSystem; +import org.gradle.process.ExecOperations; import edu.wpi.first.gradlerio.SingletonTask; public class CppToolRunTask extends DefaultTask implements SingletonTask { private final Property toolName; private final DirectoryProperty toolsFolder; + private final ExecOperations operations; @Internal public Property getToolName() { @@ -33,11 +35,12 @@ public DirectoryProperty getToolsFolder() { } @Inject - public CppToolRunTask(ObjectFactory objects) { + public CppToolRunTask(ObjectFactory objects, ExecOperations execOperations) { setGroup("GradleRIO"); this.toolName = objects.property(String.class); toolsFolder = objects.directoryProperty(); + operations = execOperations; } @TaskAction @@ -78,7 +81,7 @@ private void runToolUnix() { Directory toolsFolder = this.toolsFolder.get(); String toolName = this.toolName.get(); File outputFile = toolsFolder.file(toolName + ".sh").getAsFile(); - getProject().exec(spec -> { + operations.exec(spec -> { spec.setExecutable(outputFile.getAbsolutePath()); spec.args(getArgumentPath(toolName.toLowerCase())); }); diff --git a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolInstallTask.java b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolInstallTask.java index 11807039..16eb09df 100644 --- a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolInstallTask.java +++ b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolInstallTask.java @@ -22,6 +22,7 @@ import org.gradle.api.Project; import org.gradle.api.artifacts.Configuration; import org.gradle.api.artifacts.Dependency; +import org.gradle.api.artifacts.component.ModuleComponentIdentifier; import org.gradle.api.file.CopySpec; import org.gradle.api.file.Directory; import org.gradle.api.file.DirectoryProperty; @@ -30,6 +31,7 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.internal.os.OperatingSystem; +import org.gradle.process.ExecOperations; import org.gradle.process.ExecSpec; public class ToolInstallTask extends DefaultTask { @@ -41,6 +43,7 @@ public class ToolInstallTask extends DefaultTask { private final Property configuration; private final Property toolName; private final Property artifactName; + private final ExecOperations operations; @Internal public DirectoryProperty getToolsFolder() { @@ -80,13 +83,14 @@ private static class ToolConfig { } @Inject - public ToolInstallTask(ObjectFactory objects) { + public ToolInstallTask(ObjectFactory objects, ExecOperations execOperations) { setGroup("GradleRIO"); toolsFolder = objects.directoryProperty(); configuration = objects.property(Configuration.class); toolName = objects.property(String.class); artifactName = objects.property(String.class); + operations = execOperations; } private static synchronized Optional getExistingToolVersion(Directory toolsFolder, String toolName) { @@ -178,9 +182,19 @@ public void installTool() { } } - private static void extractAndInstall(Project project, String toolName, Directory toolsFolder, + private void extractAndInstall(Project project, String toolName, Directory toolsFolder, Dependency dependency, Configuration configuration) { - File jarfile = configuration.files(dependency).iterator().next(); + + File jarfile = configuration.getIncoming().artifactView(viewCfg -> { + viewCfg.componentFilter(filter -> { + if (filter instanceof ModuleComponentIdentifier idf) { + return idf.getGroup().equals(dependency.getGroup()) && idf.getModule().equals(dependency.getName()) + && idf.getVersion().equals(dependency.getVersion()); + } + return false; + }); + }).getFiles().iterator().next(); + File of = toolsFolder.getAsFile(); of.mkdirs(); project.copy(new Action() { @@ -212,14 +226,15 @@ private static void extractScriptWindows(Directory toolsFolder, String toolName) } } - private static void extractScriptUnix(Project project, Directory toolsFolder, String toolName) { + private void extractScriptUnix(Project project, Directory toolsFolder, String toolName) { File outputFile = toolsFolder.file(toolName + ".sh").getAsFile(); try (InputStream it = ToolInstallTask.class.getResourceAsStream("/ScriptBase.sh")) { ResourceGroovyMethods.setText(outputFile, IOGroovyMethods.getText(it)); } catch (IOException e) { throw new RuntimeException(e); } - project.exec(new Action() { + + operations.exec(new Action() { @Override public void execute(ExecSpec spec) { diff --git a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolRunTask.java b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolRunTask.java index cc14c530..055d6af1 100644 --- a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolRunTask.java +++ b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/ToolRunTask.java @@ -15,6 +15,7 @@ import org.gradle.api.tasks.Internal; import org.gradle.api.tasks.TaskAction; import org.gradle.internal.os.OperatingSystem; +import org.gradle.process.ExecOperations; import edu.wpi.first.gradlerio.SingletonTask; import groovy.transform.CompileStatic; @@ -24,6 +25,7 @@ public class ToolRunTask extends DefaultTask implements SingletonTask { private final Property toolName; private final DirectoryProperty toolsFolder; + private final ExecOperations operations; @Internal public Property getToolName() { @@ -36,11 +38,12 @@ public DirectoryProperty getToolsFolder() { } @Inject - public ToolRunTask(ObjectFactory objects) { + public ToolRunTask(ObjectFactory objects, ExecOperations execOperations) { setGroup("GradleRIO"); toolName = objects.property(String.class); toolsFolder = objects.directoryProperty(); + operations = execOperations; } @TaskAction @@ -77,7 +80,7 @@ private void runToolUnix() { Directory toolsFolder = this.toolsFolder.get(); String toolName = this.toolName.get(); File outputFile = toolsFolder.file(toolName + ".sh").getAsFile(); - getProject().exec(spec -> { + operations.exec(spec -> { spec.setExecutable(outputFile.getAbsolutePath()); }); } diff --git a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/WPICppTool.java b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/WPICppTool.java index d569e1c6..a8d4dc89 100644 --- a/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/WPICppTool.java +++ b/src/main/java/edu/wpi/first/gradlerio/wpi/dependencies/tools/WPICppTool.java @@ -2,7 +2,6 @@ import org.gradle.api.Named; import org.gradle.api.Project; -import org.gradle.api.artifacts.Configuration; import org.gradle.api.file.Directory; import org.gradle.api.provider.Provider; import org.gradle.api.tasks.TaskProvider; @@ -18,7 +17,7 @@ public class WPICppTool implements Named { private final Provider version; public WPICppTool(Project project, String name, Provider version, String artifactId, Provider toolsFolder) { - Configuration config = project.getConfigurations().getByName("wpiCppTools"); + //Configuration config = project.getConfigurations().getByName("wpiCppTools"); String toolsClassifier = project.getExtensions().getByType(WPIExtension.class).getCppToolsClassifier(); Provider fullId = project.getProviders().provider(() -> { String id = artifactId;