Skip to content

Add setting to remove the "jar" option in the gradle command#2710

Closed
LyzardKing wants to merge 5 commits into
canonical:masterfrom
LyzardKing:master
Closed

Add setting to remove the "jar" option in the gradle command#2710
LyzardKing wants to merge 5 commits into
canonical:masterfrom
LyzardKing:master

Conversation

@LyzardKing

@LyzardKing LyzardKing commented Sep 11, 2019

Copy link
Copy Markdown

This is needed to build using the new java11 module launcher
Is it something that can be included in snapcraft?
I've made the default to be as it is now, so nothing has to be changed.

At the moment I've added a "custom plugin" in the project I need this in (JabRef/jabref#5305)

The static tests are succesful in the test environment.
The other tests are having issues mainly because of my internet connection.
I'm running them again...

  • Have you followed the guidelines for contributing?
  • Have you signed the CLA?
  • Have you successfully run ./runtests.sh static?
  • Have you successfully run ./runtests.sh tests/unit?

This is needed to build using the new java11 module launcher

@sergiusens sergiusens left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This is a good start, thanks.

would you mind adding some unit tests (tests/unit/plugins/test_gradle.py) and a spread test (tests/spread/plugins/gradle)

fix missing [] in gradle plugin
@LyzardKing

Copy link
Copy Markdown
Author

@sergiusens I added a single unit test to verify if setting the option to false actually removes the jar parameter...Is it enough?
About the spread test...I'm not sure how to add that...I'll look into it a bit.

@LyzardKing

Copy link
Copy Markdown
Author

For the spread tests, is it cheating if I developed a test in which I have a bash script that prints hello gradle, and use the gradle copy method to simply copy that (so I don't need the "jar", but I'm not technically compiling java...)

@LyzardKing

Copy link
Copy Markdown
Author

@sergiusens I assume I have to sign the CLA, since it's my first contribution to a canonical project...
It's not clear to me what the Project contact field should be..

@LyzardKing

LyzardKing commented Sep 13, 2019

Copy link
Copy Markdown
Author

@sergiusens This plugin change is needed to enable the jlink java builds, which are bundles (folders)
with a launcher and all the necessary java libs (taken from the build system).
So another thing needed is to remove the openjdk jre from the stage-packages list.

Locally I added the same condition build-jre to not automatically add the openjdk-jre as a stage-package if it's set as true(like the default) but it could be set as a different option (something like no_system_jvm?)

I changed the spread test to actually compile a jlink java hello world...and it works with the changes I made..

EDIT: the flag to disable adding the jre as a stage package could be stage_latest_jre, set to true by default.
Or, another proposal could be to add a flag "runtime_image" that does both remove the jre option and the stage pachage, and that would be in line with the description in https://docs.oracle.com/javase/9/tools/jlink.htm

LyzardKing and others added 2 commits September 13, 2019 22:32
This is mainly used for modular/packaged jlink builds
These include the needed java libs from the build system
so copy the ubuntu libraries already.
@LyzardKing LyzardKing mentioned this pull request Sep 22, 2019
6 tasks
@LyzardKing

Copy link
Copy Markdown
Author

This has been superseded by packaging the snap, but it might be useful for other applications using gradle without building jar files.
I hit a roadblock with the tests, if there are suggestions I'm open for any tips ;)

@LyzardKing LyzardKing closed this Mar 28, 2020
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