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: fix creation of wrapper #18

Closed
wants to merge 1 commit into from
Closed

Conversation

jburel
Copy link
Member

@jburel jburel commented Dec 9, 2020

When creating the wrapper in the current directory, gradle already tries to build with the version currently installed (5.6.1).
I only discovered the problem when working on omero-blitz.
When this is merged, we can update the gradle.yml file in the various repositories or wait for the publication steps
to be included.

Tested changes on all ubuntu, windows and mac: https://github.com/jburel/omero-model/actions/runs/411333070

@jburel jburel changed the title fix creation of wrapper Gradle: fix creation of wrapper Dec 9, 2020
@sbesson
Copy link
Member

sbesson commented Dec 9, 2020

@jburel i have not seen the error but have you tried moving the action checking out the repository after the ones setting up the Java environment including Gradle?

@jburel
Copy link
Member Author

jburel commented Dec 9, 2020

you will still need to move gradlew to the folder where the code is checked out in order to work so it is not going to really simplify things

@jburel
Copy link
Member Author

jburel commented Dec 9, 2020

The error is the following

A problem occurred evaluating root project 'omero-blitz'.
> Could not create task ':generateObjectFactoryRegistrarPsql'.
   > Could not create task of type 'FileGeneratorTask'.
      > Please use the ObjectFactory.mapProperty() method to create a property of type Map<K, V>.

cf. https://github.com/jburel/omero-blitz/runs/1525813901

This is an error that occurs with gradle 6.x. That error also means that the build.gradle is checked.

@jburel
Copy link
Member Author

jburel commented Dec 10, 2020

I did some test using my current PR of omero-blitz see https://github.com/jburel/omero-blitz/actions/runs/412338740
running the - uses: actions/checkout@v2 after the rest.
If we use the current directory as the place to wrap, the content is then deleted during the checkout phase, so unless we move gradlew to another folder like /tmp, it is not going to work i.e. it is not going to be much simpler that the solution suggested in this PR

Copy link
Member

@sbesson sbesson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Understood, thanks for the error I was able to reproduce locally. So the issue is not about building than simply evaluating the root project which is indeed incompatible with Gradle 6.x for omero-blitz. It's unfortunate there is not built-in way to install the specified version before evaluating the project.

Looking at ome/omero-blitz#113, the omero-blitz is already itself an extension of this template as it requires extra dependencies installed. Apart from omero-blitz, how many repositories require a version of Gradle that differs from the default?

- name: Wrap without version
run: gradle wrapper
run: |
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In case the default installed version of Gradle is used, is this custom installation necessary?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it is otherwise we cannot use gradlew in the following step

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I failed to find a failing build in these circumstances as it looks like all the omero-* workflows are overriding gradle_version.

@jburel
Copy link
Member Author

jburel commented Dec 10, 2020

omero-blitz is the only one so far, so we could keep the template as it is
and aim at adjusting the code to use a more recent version of gradle. Gradle 7 is out so, I think we should work on the code to allow an upgrade

@sbesson
Copy link
Member

sbesson commented Dec 10, 2020

Understood, if omero-blitz is the only one, I would also be inclined to keep this workflow as generic as possible and create an an issue to review and upgrade omero-blitz build.gradle and make it compatible with Gradle 6.x or 7.x depending on the target.

In case it's useful, while reviewing wrapper, I also discovered https://docs.gradle.org/current/dsl/org.gradle.api.tasks.wrapper.Wrapper.html#org.gradle.api.tasks.wrapper.Wrapper:gradleVersion. This won't help solving this particular issue but could help reducing the number of variables maintained in the workflow by pushing down the Gradle version to the configuration file.

@jburel
Copy link
Member Author

jburel commented Dec 10, 2020

It is still generic with the change proposed in this PR. It makes sure it works.

@jburel
Copy link
Member Author

jburel commented Apr 19, 2021

That strategy no longer works with Gradle7!

@jburel jburel closed this Apr 19, 2021
@jburel jburel deleted the gradle_review branch March 22, 2022 10:32
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

Successfully merging this pull request may close these issues.

2 participants