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

Gradle Plugin as composite build breaks reckon #74

Closed
rodney757 opened this issue Apr 15, 2018 · 7 comments
Closed

Gradle Plugin as composite build breaks reckon #74

rodney757 opened this issue Apr 15, 2018 · 7 comments
Labels
Milestone

Comments

@rodney757
Copy link

I recently migrated to reckon from you're older plugin and am running into an issue.

I have a gradle plugin that I include in a composite build

Both of these repos (plugin & main project) use reckon for version inferencing. However when I try and release the main project, I get the following error b/c reckon is "reckoning" the gradle plugin.

Cannot re-release a final version 1.3.0 as a pre-release: 2.0.0-beta.1

I've tried running the task with the : prefix to only run it for the root project w/ no luck

@ajoberstar
Copy link
Owner

I haven't used composite builds much myself, but I tried to reproduce this quickly and it seemed to reckon each project correctly. It's possible you're just running into some new validation in reckon 0.5.0.

To help figure out if this is tied to composite builds or 0.5.0, can you provide some more information?

  • Output of git describe in both repositories
  • Value of reckon.scope and reckon.stage that you are passing in

@rodney757
Copy link
Author

gradle version: 4.6
reckon version: 0.5.0

plugin build.gradle:

reckon {
    normal = scopeFromProp()
    preRelease = stageFromProp('beta', 'rc', 'final')
}

git describe plugin: 1.3.0
git describe project: 1.0.0-beta.1-1-ge901882

gradle command: gw build -Preckon.scope=major -Preckon.stage=beta

cmd fail evaluating the plugin project.

The plugin applies the reckon plugin to the main project, so at the point of failure, reckon isn't even configured on the main project. However I was able to reproduce the issue by adding reckon to mainProject build.gradle and removing the apply step from the plugin

@ajoberstar
Copy link
Owner

I wonder if it has to do with it being a plugin project. I'll try to reproduce it that way. Thanks for the info!

@ajoberstar
Copy link
Owner

Ah, I think I see the issue now... Both projects are reading the -Preckon.* properties and trying to increment based on them. But, ideally you only want those properties to apply to the primary build within the composite.

I'll try a few things to see if there's a way to do this. May need to try to detect whether your part of a composite build within the plugin.

@ajoberstar
Copy link
Owner

FYI, I expect you'll run into the lack of composite build support for plugins once you get past this.

ajoberstar added a commit that referenced this issue Apr 15, 2018
Composite builds that include multiple builds that use reckon can run
into unexpected behavior, because any reckon.* props passed in on the
command line are used by all builds. This can cause it to try to
increment a version incorrectly.

The new behavior makes it so that only the main build within a composite
will actually respect the gradle properties.

This does imply that you can't really release a version of an included
build, but the expectation is that that's not what anyone would intend
to do. That could be proven wrong, but it would require something more
involved to support.

This fixes #74.
@ajoberstar ajoberstar added the bug label Apr 15, 2018
@ajoberstar ajoberstar added this to the 0.6.0 milestone Apr 15, 2018
ajoberstar added a commit that referenced this issue Apr 15, 2018
Composite builds that include multiple builds that use reckon can run
into unexpected behavior, because any reckon.* props passed in on the
command line are used by all builds. This can cause it to try to
increment a version incorrectly.

The new behavior makes it so that only the main build within a composite
will actually respect the gradle properties.

This does imply that you can't really release a version of an included
build, but the expectation is that that's not what anyone would intend
to do. That could be proven wrong, but it would require something more
involved to support.

This fixes #74.
@ajoberstar
Copy link
Owner

You can test out 0.6.0-rc.1 to see if it solves your issue.

@rodney757
Copy link
Author

Thanks for the speedy fix!

Thanks for the head up on the composite issue. I remember running into it about a year ago, I we have some custom logic to make it work (though I can't remember the details, I would need to look at the code)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants