Getting all the archives in a RuleSource plugin?

I have a RuleSource plugin that looks for archives to deploy. What I want to do is inspect all the archives generated by jar/war/assemble or whatever. I’m not familiar enough with the RuleSource stuff and have been having an especially difficult time finding any documentation on @Binary...… annotations (whether they are relevant or not).

Are there any examples or documentation on how to process a gradle project’s artifacts after they are generated from a RuleSource plugin task?

1 Like

I too would be interested in this. I am in the middle of converting a plugin to use the new rules based. I am looking to replace the line getProject().getConfigurations().getByName("archives").getAllArtifacts().getFiles();

Actually looking through gradle sources to see if I could find any tricks, I found JvmComponentPlugin which has a JarBinarySpec, presumably an addition to the java plugin? Couldn’t find anything yet for wars though. :telescope:

I ended up figuring it out manually and passing it into my custom action

Set<File> artifacts = new HashSet<>();

for(Task task : tasks){
        if(task instanceof AbstractArchiveTask){
          myTask.dependsOn(task);
          artifacts.add(((AbstractArchiveTask)task).getArchivePath());
        }
      }
      
myTask.getActions().add(new myAction(myConfig, artifacts));