Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

release task re-applies all project plugins? #126

Closed
mttkay opened this issue Aug 21, 2015 · 5 comments
Closed

release task re-applies all project plugins? #126

mttkay opened this issue Aug 21, 2015 · 5 comments

Comments

@mttkay
Copy link

mttkay commented Aug 21, 2015

I'm not sure I understand what I'm seeing. Essentially, I'm writing a plugin that applies other plugins, including the gradle-release plugin:

// in my plugin
void apply(Project project) {
   ...
    def rootProject = project.rootProject
    if (!rootProject.plugins.hasPlugin('net.researchgate.release')) {
      rootProject.apply plugin: 'net.researchgate.release'
     ...
   }
}

The problem is that the conditional should only pass once, but it doesn't. The release task appears to be recreating all the project graphs, which leads to it applying itself again because of the above code. This leads to the task getting stuck in a loop and it keeps asking me for the current release version.
At least I'm seeing build output during the release task that I should only see once, during the initial configuration phase so I reckon it must somehow reconfigure the whole project?

Am I missing something?

@danez
Copy link
Contributor

danez commented Aug 23, 2015

I really don't know whats happening. maybe in your plugin you can print the plugins of the root project. I'm also not sure if you can apply plugins to the root project. Not sure how the exact lifecycle with root and sub-projects work.

@townsfolk
Copy link
Contributor

If I had to hazard a guess, this might be due to the plugin using the GradleBuild task type.

@danez
Copy link
Contributor

danez commented Sep 1, 2015

I don't think this is an issue with the release plugin, but more like how you are applying it. We successfully apply the release plugin in our own plugin here at researchgate, though we don't have projects with subprojects.

@danez
Copy link
Contributor

danez commented Sep 22, 2015

This is probably fixed after #116 got merged. If you want you can test it.

buildscript {
    repositories {
        maven { url 'http://oss.jfrog.org/artifactory/oss-snapshot-local' }
    }
    dependencies {
        classpath 'net.researchgate:gradle-release:2.3.0-SNAPSHOT'
    }
}

@mttkay
Copy link
Author

mttkay commented Sep 23, 2015

Sweet, I'll give it another go soon and report back.

@danez danez closed this as completed May 4, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants