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

fix: use custom start scripts instead of brittle patch files #639

Merged
merged 8 commits into from
May 2, 2021

Conversation

skaldarnar
Copy link
Member

@skaldarnar skaldarnar commented May 2, 2021

Okay, I've ended up going down the path suggested in #547 and adding custom templates based on the default start scripts provided by Gradle to this repo.

They contain a minimal addition to set JAVA_HOME local to the jre folder in APP_HOME. That way, the local JRE should be picked up when starting the launcher.

How to test

  • gradlew install...Dist (with ... being Linux64, Windows64, or Mac) to build the distribution for Windows
  • start the launcher via bin/TerasologyLauncher.bat or bin/TerasologyLauncher
  • download a game and start it
  • check logs that it is using the local Java

Resolves #547


Original PR description:

The start scripts are generated by gradlew startScripts, and the patch logic hooks up to it via doLast. I've updated the patch files by adjusting the .orig files as required, and then running diff -u on it (from within build/scripts/).

After this update, I at least don't see any rejections .rej anymore.

The start scripts are generated by `gradlew startScripts`, and the patch logic hooks up to it via `doLast`. I've updated the _patch_ files by adjusting the `.orig` files as required, and then running `diff -u` on it (from within `build/scripts/`).

```
diff -u TerasologyLauncher.orig TerasologyLauncher > ../../buildres/scripts/TerasologyLauncher.patch
```

After this update, I at least don't see any rejections `.rej` anymore.

Contributes to #547
@skaldarnar
Copy link
Member Author

Although this "solves" #547 I don't want to close that issue, as it describes the fact that this patch-workaround is quite brittle and will like break again in the future 🙈

My comment over there still holds - I want to move the launcher to jlink/jpackage rather than maintaining a custom copy of the start scripts. If anybody who understands Gradle a bit better (@keturn 😉) happens to find the time for a PR to add customized scripts that contribution is very welcome.

@jdrueckert
Copy link
Member

// for spf4j dependencies that haven't been merged upstream
// i.e. org.apache.avro:avro
name "spf4j dependencies"
url "https://dl.bintray.com/zolyfarkas/core"
Copy link
Member Author

Choose a reason for hiding this comment

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

This bintray repository is shut down. We've published org.apache.avro:avro:1.9.0.20p as manual release to our Artifactory.

Comment on lines +90 to +93
# Use bundled JRE when available
if [ -d "\$APP_HOME/jre" ] ; then
JAVA_HOME="\$APP_HOME/jre"
fi
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only semantic addition to this script.

Comment on lines +43 to +44
@rem Use bundled JRE when available
if exist "%APP_HOME%/jre/" set JAVA_HOME="%APP_HOME%/jre/"
Copy link
Member Author

Choose a reason for hiding this comment

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

This is the only semantic addition to this script.

@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-6.8.2-all.zip
Copy link
Member Author

Choose a reason for hiding this comment

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

Uses the same Gradle version as engine. Used the start script templates from that Gradle version as well.

Copy link
Member

@Cervator Cervator left a comment

Choose a reason for hiding this comment

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

Tested on Windows 10, gradlew installWindows64Dist, launched game was using Java: 11.0.8 in D:\Dev\Terasology\Git_WS\TerasologyLauncher\build\install\TerasologyLauncher-windows64\jre

🚀

@skaldarnar skaldarnar changed the title fix: update patch files to match latest start scripts fix: use custom start scripts instead of brittle patch files May 2, 2021
@skaldarnar skaldarnar added the Type: Bug Bug reports for launcher releases (reproducible from master) label May 2, 2021
Copy link
Member

@keturn keturn left a comment

Choose a reason for hiding this comment

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

confirmed that the generated script seems to have only the intended diff when compared to the upstream default. 👍

@keturn
Copy link
Member

keturn commented May 2, 2021

A note about that avro dependency: The fork has updated its documentation at https://github.com/zolyfarkas/avro and there is a new repo available for those, hosted by GitHub Packages.

The disadvantage is that using a GitHub Packages repository requires setting the credentials in your build environment: https://docs.github.com/en/packages/working-with-a-github-packages-registry/working-with-the-gradle-registry

@skaldarnar skaldarnar merged commit 4e7f71d into master May 2, 2021
@skaldarnar skaldarnar deleted the fix/547-rejected-patch-fragments branch May 2, 2021 19:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Type: Bug Bug reports for launcher releases (reproducible from master)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

release contains rejected patch fragment
4 participants