Following my recent problems with Gradle 2.4 (see Change of behaviour for @Finalize between 2.3 and 2.4 release - #2 by Francois_Guillot), I’m trying to transition all my plugin logic to the new rule based model configuration.
I’m struggling with one thing I want to do:
Before, I was adding all the project repositories to the PublishExtension repositories, like that:
project.repositories.all { repo -> if (repo instanceof IvyArtifactRepository) { project.getExtensions().configure(PublishingExtension, new ClosureBackedAction<PublishingExtension>({ repositories.add(repo) })) } }
This seems to cause problem now (see the linked post and my attempt at understanding the problem)
So I’m trying to change it to a rule, like that
static class Rule extends RuleSource {
/** * Add all Ivy repo from project repo to the publishing repo * @param publishRepos */ @Mutate public void addProjectRepoToPublishRepo(PublishingExtension publishingExtension, xxxxxxx){ }
}
I’m struggling to fine the correct input parameter to put in the @Mutate method.
I want to add some repos to the PublishingExtension, so the PublishingExtension is definitely the subject here.
I want to get the project’s repositories as input, so I tried
public void addProjectRepoToPublishRepo(PublishingExtension publishingExtension, @Path(“repositories”) RepositoryHandler projectRepos)
But this fails to bound
I can I get hold on the project repos, as a rule input, in order to copy its content to the publishing extension repos ?