-
Notifications
You must be signed in to change notification settings - Fork 64
Replace the Ant build with Gradle, output verified byte-identical #326
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
base: main
Are you sure you want to change the base?
Changes from all commits
8a2dc59
24c96f5
29c5df7
64e1a98
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,13 @@ | ||
| # Line-ending rules for files where endings are functional. | ||
| # (Pattern follows PR #214 by NicoPiel.) | ||
|
|
||
| # Unix start scripts must stay LF | ||
| /gradlew text eol=lf | ||
| oieserver text eol=lf | ||
| configure-from-env text eol=lf | ||
|
|
||
| # Windows scripts must stay CRLF | ||
| *.bat text eol=crlf | ||
|
|
||
| # Binary files are left untouched | ||
| *.jar binary | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,3 @@ | ||
| # Enable auto-env through the sdkman_auto_env config | ||
| # Add key=value pairs of SDKs to use below | ||
| java=17.0.17.fx-zulu | ||
| ant=1.10.14 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -26,8 +26,45 @@ git checkout -b feature/your-feature-name | |
| ``` | ||
|
|
||
| ### 5. Install Tooling | ||
| OIE specifies the working versions of Java and Ant in [.sdkmanrc](./.sdkmanrc). To take advantage of this, install [SDKMAN](https://sdkman.io/) and run `sdk env install` | ||
| in the project's root directory. | ||
| OIE specifies the working Java version in [.sdkmanrc](./.sdkmanrc). To take advantage of this, install [SDKMAN](https://sdkman.io/) and run `sdk env install` | ||
| in the project's root directory. No other tooling is required. | ||
|
|
||
| ### 5a. Build | ||
| The build is driven by Gradle through the included wrapper; no separate Gradle install is needed: | ||
| ```bash | ||
| ./gradlew build -PdisableSigning=true # full build without jar signing | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Follow-up: should disableSigning be true by default?
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think that's okay. Nobody signs JARs during development; signing explicitly better represents how we do things, imho.
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This matches existing convention (primarily to allow testing with MCAL, which requires signing). I agree with changing the default, but would request we do so in a separate PR to avoid hanging up this one. |
||
| ./gradlew test # run the unit tests (-Pcoverage=true for JaCoCo) | ||
| ./gradlew dist # build the distribution extension zips | ||
| ``` | ||
| On Windows use `gradlew.bat` instead of `./gradlew`. The assembled distribution lands in `server/setup`, the same location the previous Ant build used. For release artifacts, run a clean build: `./gradlew clean build dist`. Windows with SDKMan may generate an error about the file path being too long in the javadoc step, skip this by adding `-x :server:userApiJavadoc` to your Gradle command. | ||
|
|
||
| Dependencies are pinned and checksum-verified. To change a dependency version: edit `gradle/libs.versions.toml`, then refresh the checksum metadata **with a cold dependency cache and CI's flags**: | ||
| ```bash | ||
| GRADLE_USER_HOME=$(mktemp -d) ./gradlew --write-verification-metadata sha256 build dist -PdisableSigning=true -Pcoverage=true | ||
| ``` | ||
| The cold cache matters: a warm cache skips re-resolving already-cached parent POMs, so they never get recorded, and the build then fails verification only in CI (this bit us once during the migration). The run downloads everything once and takes a few minutes. Only when adding a **new** artifact that ships in the distribution does `gradle/vendored-layout.json` need a one-line placement entry, and the build fails with a message telling you so. | ||
|
|
||
| ### Changing build logic | ||
|
|
||
| The build's correctness is guarded by output comparison, not by unit | ||
| tests of the build scripts. When you change build logic (staging, | ||
| packaging, jar definitions), confirm the change does not alter the | ||
| product: build `server/setup` before and after, and compare the two | ||
| trees. The [oie-build-parity](https://github.com/pacmano1/oie-build-parity) | ||
| tooling does this at the archive-entry level (and can reproduce the | ||
| original byte-identical comparison against the pre-Gradle Ant baseline). | ||
| Only the changes you intended should appear. | ||
|
|
||
| ### Run and debug | ||
|
|
||
| ```bash | ||
| ./gradlew :server:createDerbyDb # one-time: create the embedded database | ||
| ./gradlew :server:devRun # run the server from the development tree | ||
| ./gradlew :server:devLauncher # run the server the way production starts it (from server/setup) | ||
| ./gradlew :client:devClient # run the administrator client against https://localhost:8443 | ||
| ``` | ||
|
|
||
| Add `--debug-jvm` to any of these to suspend on JVM start and attach a debugger on port 5005. The JDK module flags come from `server/conf/default_modules.vmoptions`, the same file the production launcher uses. For IDEs, import the repository as a Gradle project (IntelliJ does this natively; Eclipse via Buildship); the old `.classpath`/`.project` files are gone on purpose. | ||
|
|
||
| ### 6. Implement your changes | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Unrelated to this PR, but a very welcome correction. This bit me last week!