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

Port most of the build to gradle. #343

Merged
merged 26 commits into from Jun 20, 2019
Merged

Conversation

marshallpierce
Copy link
Contributor

This is still missing some stuff but I wanted to get feedback on if this was useful / interesting before sinking more time into it.

Typical gradle subproject structure plus:

  • Multi-release jar for shims subproject
  • Move examples into typical src/main/java and set up tasks for each one, removing the need for a separate shell script
  • Move JMH benchmarks from src/main/java to src/jmh/java since that's how the JMH plugin prefers it. (This allows benchmarks to live in the same module as the normal code, if desired.)

Missing things:

  • Deploying releases (use Bintray to avoid Sonatype Nexus pain?)
  • jxr
  • perhaps other subtleties I missed/forgot

This is still missing some stuff but I wanted to get feedback on if this was useful / interesting before sinking more time into it.

Typical gradle subproject structure plus:

- Multi-release jar for shims subproject
- Move examples into typical `src/main/java` and set up tasks for each one, removing the need for a separate shell script
- Move JMH benchmarks from `src/main/java` to `src/jmh/java` since that's how the JMH plugin prefers it. (This allows benchmarks to live in the same module as the normal code, if desired.)

Missing things:

- Deploying releases (use Bintray to avoid Sonatype Nexus pain?)
- jxr
- perhaps other subtleties I missed/forgot
@richardstartin
Copy link
Member

This looks very promising.

Regarding the multi release functionality, benchmarks still needs to be multi release so the right implementation gets loaded (maven-shade took care of this).

The reason for targeting JDK11+ in shims was to simplify testing, as the functionality was introduced after JDK10 was officially retired. Since we couldn't build with JDK8 any more, the idea was that building with JDK10 would exercise the JDK8 implementation. There are probably other ways to achieve this effect.

@marshallpierce
Copy link
Contributor Author

Ah, k. We can drop in the shadow plugin to do more fancy uberjaring than the jmh plugin does out of the box.

I imagine most people who are on Java > 8 and care about performance are on Java 11 by this point anyway, so while we could get fancy to enable multi-release shim for Java 9, that seems like rapidly diminishing ROI.

@lemire
Copy link
Member

lemire commented May 26, 2019

JDK10 may die soon.

@marshallpierce
Copy link
Contributor Author

Both 9 and 10 are not supported long term IIRC... 10 may continue to serve as "not java 8 but not java 11" for some time I suspect :)

@richardstartin
Copy link
Member

That's exactly what it's doing. The only question is how long Travis will make JDK10 available. By that time JDK11 may have more widespread adoption.

@richardstartin
Copy link
Member

Multi release jars may not be the best solution for using new features while supporting old ones. Multiple build targets may be a better option.

@marshallpierce
Copy link
Contributor Author

Cedric has thoughts on the matter: https://blog.gradle.org/mrjars. Haven't tangled with them before personally.

@richardstartin
Copy link
Member

I just checked out your branch and ran ./gradlew build and the fuzz tests ran. Currently these are enabled only by a profile because it takes hours to run them. We'll need an environment variable to enable them.

@marshallpierce
Copy link
Contributor Author

If this is looking good so far, the next step would be to set up deploying released artifacts.

I suggest switching to Bintray:

  • I haven't had any issues with certain artifacts out of the group for a particular release going missing
  • When you publish a new version, it "stages" those files so you can click around in the web ui and make sure all the files you expect are there before it really publishes them
  • It will GPG sign for you so you don't have to deal with that, though you can still do it yourself if you're fond of GPG for some reason
  • It will sync your Bintray project to jcenter, which is a superset of maven central
  • And it's free for open source use

If you're OK with that, I can drop in the setup I have here: https://bitbucket.org/marshallpierce/gcp-logging-enhancers/src/master/build.gradle. My workflow is ./gradlew release. It asks me for the new version number, does the various alterations/commits/tags, uploads artifacts to bintray, and sets the next version number snapshot.

@lemire
Copy link
Member

lemire commented May 27, 2019

I am fine with switching to a new release setup.

@marshallpierce
Copy link
Contributor Author

I've created a bintray org. Let me know your usernames and I can add you.

@marshallpierce
Copy link
Contributor Author

I let it try to release a 0.0 version into Bintray (we can delete the version once we're done testing).

I did: ./gradlew release with the version temporarily set to 0.0-SNAPSHOT and other settings altered to allow me to run it with local changes and not on the master branch:

Output (with think time for me to press enter at the right places):

> Task :RoaringBitmap:checkCommitNeeded
!!WARNING!! You have uncommitted files:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 M build.gradle.kts
 M gradle.properties
AM release.gradle
R  pom.xml -> zpom.xml
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

> Task :RoaringBitmap:confirmReleaseVersion

??> This release version: [0.0]  (WAITING FOR INPUT BELOW)
<=====--------> 40% EXECUTING [4s]

> Task :RoaringBitmap:RoaringBitmap:shims:bintrayUpload
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0-sources.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0-sources.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0-javadoc.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0-javadoc.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0.pom...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/shims/0.0/shims-0.0.pom'.

> Task :RoaringBitmap:RoaringBitmap:roaringbitmap:bintrayUpload
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0-sources.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0-sources.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0-javadoc.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0-javadoc.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0.jar...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0.jar'.
Uploading to https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0.pom...
Uploaded to 'https://api.bintray.com/content/roaringbitmap/maven/RoaringBitmap/0.0/org/roaringbitmap/roaringbitmap/0.0/roaringbitmap-0.0.pom'.

> Task :RoaringBitmap:updateVersion

??> Enter the next version (current one released as [0.0]): [0.1-SNAPSHOT]  (WAITING FOR INPUT BELOW)
<============-> 93% EXECUTING [35s]

BUILD SUCCESSFUL in 38s
1 actionable task: 1 executed

In other words, it figured out that 0.0-SNAPSHOT should be released as 0.0, created and uploaded jars, and set the next version as 0.1-SNAPSHOT. The jars are unpublished but waiting in https://bintray.com/roaringbitmap/maven/RoaringBitmap. Once you're in the organization you should be able to see them and make sure things look ok.

@richardstartin
Copy link
Member

I have some reservations about publishing to jcenter via bintray - it’s usually impossible to pull in dependencies from jcenter within more security conscious organisations. Maven central is more widely trusted.

@marshallpierce
Copy link
Contributor Author

If you give bintray your maven central credentials it can auto-push there.

@richardstartin
Copy link
Member

OK that sounds very reasonable to me.

@marshallpierce
Copy link
Contributor Author

OK, to make sure I'm following:

  • ./gradlew release correctly uploads stuff to Bintray, which also signs them
  • Clicking publish in bintray (you should be able to click just once, from the level of the maven repo, and have it take effect for both packages) confirms that you do want to keep those artifacts.
    • I agree it is a second step which is clumsy, but I've found it valuable to be able to give the artifacts a once-over before I publish them. Maybe we can turn that off if you prefer?
  • But then pushing them to maven central fails because of inscrutable nexus problems?

@lemire
Copy link
Member

lemire commented Jun 20, 2019

./gradlew release correctly uploads stuff to Bintray, which also signs them

I cannot sign with my keys, but I apparently can sign with bintray's keys.

Or rather, I could sign with my keys, but that would require me writing a REST app.

Clicking publish in bintray confirms that you do want to keep those artifacts. I agree it is a second step which is clumsy, but I've found it valuable to be able to give the artifacts a once-over before I publish them.

You mean that at this stage, you run additional checks? What kind of checks?

(you should be able to click just once, from the level of the maven repo, and have it take effect for both packages)

I don't know how to do so. It seems that I have to go into the package, the exact version number, then click on maven central then click on sync... and I have to do with each "sub" package individually.

There is no "do everything" button. I have to click, click, click... that's what I mean by the fact that it is not automated.

But then pushing them to maven central fails because of inscrutable nexus problems?

Correct.

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Ok. Now a new error...

Last Sync Errors: Missing MD5: '/org/roaringbitmap/shims/0.8.9/shims-0.8.9-sources.jar.md5' Missing Signature: '/org/roaringbitmap/shims/0.8.9/shims-0.8.9-sources.jar.asc' does not exist for 'shims-0.8.9-sources.jar'. Dropping existing partial staging repository.

That's when trying to sync RoaringBitmap (and not shims).

@marshallpierce
Copy link
Contributor Author

You mean that at this stage, you run additional checks? What kind of checks?

I'll look around at the upload files for the new version and see that they look right (.jar, -sources.jar, etc). Nothing too heavy.

I haven't gone this far down the path of trying to appease Nexus, but I can take a look at generating .md5s of all jars automatically. (MD5? really?)

@lemire
Copy link
Member

lemire commented Jun 20, 2019

New error (after trying again):

Last Sync Errors: Missing: no sources jar found in folder '/org/roaringbitmap/shims/0.8.9' Dropping existing partial staging repository.

@marshallpierce
Copy link
Contributor Author

@lemire
Copy link
Member

lemire commented Jun 20, 2019

@marshallpierce

Presumably, you have access to the page, right...?

https://bintray.com/roaringbitmap/maven/org.roaringbitmap%3ARoaringBitmap#central

@lemire
Copy link
Member

lemire commented Jun 20, 2019

My guess is that I can keep going all day, getting random errors one after the other. There is probably a fun script at the other end with a random message generator.

@marshallpierce
Copy link
Contributor Author

Yep, I can see that page. Maybe hand off to bintray support again? The sources jar is definitely there.

@marshallpierce
Copy link
Contributor Author

This kind of stuff is why I gave up on syncing to maven central for my own projects. :/

@lemire
Copy link
Member

lemire commented Jun 20, 2019

@marshallpierce Well... is it though? Because that's not the shim package, that's the RoaringBitmap package.

Normally, in the maven release cycle, we upload everything in one go. There is one unified release. Now we have to proceed in two steps, but the steps are interdependent.

@lemire
Copy link
Member

lemire commented Jun 20, 2019

@marshallpierce ... because the message comes from maven central. It is maven central saying that we are missing shims sources.

@marshallpierce
Copy link
Contributor Author

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Ok. I'll open a new issue.

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Please see #345

@lemire
Copy link
Member

lemire commented Jun 20, 2019

@marshallpierce BTW the shims package is now on maven...
https://repo1.maven.org/maven2/org/roaringbitmap/shims/0.8.9/

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Success... after trying all afternoon, everything is on maven, finally.

@marshallpierce Can you merge the PR I have issued against your PR... ? Then we will merge your PR.

We know that if we are very patient, we can issue a working release from bintray to maven central. And I have checked that it is functional.

marshallpierce and others added 2 commits June 20, 2019 14:50
I guess that this is needed to keep things in sync.
@lemire
Copy link
Member

lemire commented Jun 20, 2019

@marshallpierce Can you merge once more? I have updated the docs.

I have already sent a Roaring Bitmap sticker to @richardstartin , if you want one, just share your mailing address with me...

@blacelle
Copy link
Member

Happy success guys !

@lemire
Copy link
Member

lemire commented Jun 20, 2019

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Let us wait to make sure that the tests pass, and then we can merge...

This must have been the hardest PR to merge, ever.

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Tests are failing. Restarting.

@lemire
Copy link
Member

lemire commented Jun 20, 2019

Tests are passing. Merging.

@lemire lemire merged commit bda3d06 into RoaringBitmap:master Jun 20, 2019
Smallhi pushed a commit to Smallhi/RoaringBitmap that referenced this pull request Jun 14, 2021
* Port most of the build to gradle.

This is still missing some stuff but I wanted to get feedback on if this was useful / interesting before sinking more time into it.

Typical gradle subproject structure plus:

- Multi-release jar for shims subproject
- Move examples into typical `src/main/java` and set up tasks for each one, removing the need for a separate shell script
- Move JMH benchmarks from `src/main/java` to `src/jmh/java` since that's how the JMH plugin prefers it. (This allows benchmarks to live in the same module as the normal code, if desired.)
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.

None yet

4 participants