-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Configure JVM toolchain to Java 16 Prevents any errors arising from accidentally loading the project in a Java 11 environment. * Cleanup buildscript Removes some pesky warnings in IDEA, uses java.withSourcesJar instead of manually defining the sources task (so the proper Gradle module information is included and created). * Update dependencies - securejarhandler, from 0.9.44 to 0.9.54 - Gradle Versions Plugin, from 0.38.0 to 0.39.0 - gradle-modules-plugin, from 1.8.3 to 1.8.10 * Update to Gradle 7.2 * Improve debug messages, cleanup code readability Uses proper names instead of shorthands when possible. Debug messages are more structured, for improved readability. * Add documentation in the form of comments Some areas which are more self-explanatory (being simple code or having nearby debug messages which explain it) are not commented. * Add README * Fix publishing block Somehow the developers block was moved outside the pom block. * tweak readme Signed-off-by: cpw <[email protected]> Co-authored-by: Marc Hermans <[email protected]> Co-authored-by: cpw <[email protected]>
- Loading branch information
1 parent
fde1128
commit 8ea1310
Showing
6 changed files
with
177 additions
and
85 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# BootstrapLauncher | ||
|
||
> Allows bootstrapping a modularized environment from a classpath one. | ||
BootstrapLauncher (BSL for short) uses the following information: | ||
|
||
- The **(legacy) classpath information.** This is retrieved from the following, in descending order of priority: | ||
- The `legacyClassPath.file` system property, containing a _path list_ (paths separated by `;` on Windows and `:` on | ||
UNIX, as defined by [`File.pathSeparatorChar`][path_separator]) | ||
- The `legacyClassPath` system property, containing a path list | ||
- The `java.class.path` system property. | ||
|
||
If none of the above is present, then an exception is thrown. | ||
|
||
- The **ignore list**, specified by the `ignoreList` system property, as a comma-separated list of values. For any path | ||
within the classpath (as retrieved above) whose filename begins with any value in the ignore list, the path is ignored | ||
by BSL and not included in the bootstrap module layer created by BSL. | ||
|
||
By default, the ignore list is set to ignore filenames that start with `asm` or `securejarhandler` (the dependencies | ||
of BSL). | ||
|
||
- The optional **module merge information**, specified by the `mergeModules` system property. This is used to combine | ||
multiple JAR files into a single logical module in the eyes of the module system. This property is a list of groups of | ||
comma-separated paths, where each group is separated by semicolons and denotes one module. | ||
|
||
For example: `a.jar,b.jar;b.jar,c.jar` means `a.jar` and `b.jar` are combined into one module, and `b.jar` and `c.jar` | ||
are combined into another module. | ||
|
||
- The **bootstrap service**, which is a `Consumer<String[]>` service provided by a module in the bootstrap module layer. | ||
At least one such bootstrap service must exist, otherwise an exception is thrown. [ModLauncher][modlauncher] provides | ||
one such service: `BootstrapLaunchConsumer`. | ||
|
||
Each JAR (unless included in the above module merge information) maps to one module in the bootstrap module layer. | ||
Because all modules share the same classloader, no module may share a package with another module. Therefore, packages | ||
are tracked and the first JAR which contains the module effectively 'owns' that package, and later JARs will not be | ||
searched for the same package. | ||
|
||
BSL creates a new module layer which has the following properties: | ||
|
||
- The name of the module layer is `MC-BOOTSTRAP`. | ||
- Its parent layer and configuration is the boot configuration (from [`ModuleLayer#boot()`][bootmodule]). | ||
- It contains all the modules as provided in the classpath information (excluded from which the JARs who match the | ||
ignore list) and mapped according to the optional module merge information. | ||
|
||
For easier debugging, additional debugging information is printed to `System.out` if the `bsl.debug` system property is | ||
defined (regardless of its actual value). | ||
|
||
[path_separator]: https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/io/File.html#pathSeparatorChar | ||
[modlauncher]: https://github.com/McModLauncher/modlauncher | ||
[bootmodule]: https://docs.oracle.com/en/java/javase/16/docs/api/java.base/java/lang/ModuleLayer.html#boot() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
plugins { | ||
id 'net.minecraftforge.gradleutils' version '2.+' | ||
id 'com.github.ben-manes.versions' version '0.38.0' | ||
id 'org.javamodularity.moduleplugin' version '1.8.3' | ||
id 'com.github.ben-manes.versions' version '0.39.0' | ||
id 'org.javamodularity.moduleplugin' version '1.8.10' | ||
id 'java-library' | ||
id 'maven-publish' | ||
id 'eclipse' | ||
|
@@ -10,7 +10,7 @@ plugins { | |
group 'cpw.mods' | ||
|
||
version = gradleutils.getTagOffsetVersion() | ||
logger.lifecycle('Version: ' + version) | ||
logger.lifecycle("Version: $version") | ||
|
||
repositories { | ||
mavenLocal() | ||
|
@@ -19,36 +19,35 @@ repositories { | |
url 'https://maven.minecraftforge.net/' | ||
} | ||
} | ||
|
||
dependencies { | ||
implementation('cpw.mods:securejarhandler:0.9.54') | ||
} | ||
|
||
|
||
task sourcesJar(type: Jar) { | ||
archiveClassifier = 'sources' | ||
from sourceSets.main.allSource | ||
java { | ||
toolchain.languageVersion = JavaLanguageVersion.of(16) | ||
withSourcesJar() | ||
} | ||
|
||
changelog { | ||
fromTag "0.1" | ||
} | ||
|
||
jar { | ||
manifest { | ||
attributes( | ||
'Specification-Title': 'bootstraplauncher', | ||
'Specification-Vendor': 'forge', | ||
'Specification-Version': '1', // We are version 1 of ourselves | ||
'Implementation-Title': project.name, | ||
'Implementation-Version': "${project.version}+${System.getenv("BUILD_NUMBER")?:0}+${gradleutils.gitInfo.branch}.${gradleutils.gitInfo.abbreviatedId}", | ||
'Implementation-Vendor':'forge', | ||
'Implementation-Timestamp': java.time.Instant.now().toString(), | ||
'Git-Commit': gradleutils.gitInfo.abbreviatedId, | ||
'Git-Branch': gradleutils.gitInfo.branch, | ||
'Build-Number': "${System.getenv("BUILD_NUMBER")?:0}", | ||
'Main-Class': 'cpw.mods.bootstraplauncher.BootstrapLauncher' | ||
) | ||
} | ||
//noinspection UnnecessaryQualifiedReference | ||
manifest.attributes( | ||
'Specification-Title': 'bootstraplauncher', | ||
'Specification-Vendor': 'forge', | ||
'Specification-Version': '1', // We are version 1 of ourselves | ||
'Implementation-Title': project.name, | ||
'Implementation-Version': "${project.version}+${System.getenv("BUILD_NUMBER") ?: 0}+${gradleutils.gitInfo.branch}.${gradleutils.gitInfo.abbreviatedId}", | ||
'Implementation-Vendor': 'forge', | ||
'Implementation-Timestamp': java.time.Instant.now().toString(), | ||
'Git-Commit': gradleutils.gitInfo.abbreviatedId, | ||
'Git-Branch': gradleutils.gitInfo.branch, | ||
'Build-Number': "${System.getenv("BUILD_NUMBER") ?: 0}", | ||
'Main-Class': 'cpw.mods.bootstraplauncher.BootstrapLauncher' | ||
) | ||
} | ||
|
||
artifacts { | ||
|
@@ -57,29 +56,26 @@ artifacts { | |
} | ||
|
||
publishing { | ||
publications { | ||
mavenJava(MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
pom { | ||
name = 'Bootstrap launcher' | ||
description = 'Allows bootstrapping a modularized environment from a classpath one' | ||
publications.register('mavenJava', MavenPublication) { | ||
from components.java | ||
artifact sourcesJar | ||
pom { | ||
name = 'Bootstrap launcher' | ||
description = 'Allows bootstrapping a modularized environment from a classpath one' | ||
url = 'https://github.com/McModLauncher/bootstraplauncher' | ||
scm { | ||
url = 'https://github.com/McModLauncher/bootstraplauncher' | ||
scm { | ||
url = 'https://github.com/McModLauncher/bootstraplauncher' | ||
connection = 'scm:git:[email protected]:McModLauncher/bootstraplauncher.git' | ||
developerConnection = 'scm:git:[email protected]:McModLauncher/bootstraplauncher.git' | ||
} | ||
issueManagement { | ||
system = 'github' | ||
url = 'https://github.com/McModLauncher/bootstraplauncher/issues' | ||
} | ||
|
||
developers { | ||
developer { | ||
id = 'cpw' | ||
name = 'cpw' | ||
} | ||
connection = 'scm:git:[email protected]:McModLauncher/bootstraplauncher.git' | ||
developerConnection = 'scm:git:[email protected]:McModLauncher/bootstraplauncher.git' | ||
} | ||
issueManagement { | ||
system = 'github' | ||
url = 'https://github.com/McModLauncher/bootstraplauncher/issues' | ||
} | ||
developers { | ||
developer { | ||
id = 'cpw' | ||
name = 'cpw' | ||
} | ||
} | ||
} | ||
|
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.1.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -72,7 +72,7 @@ case "`uname`" in | |
Darwin* ) | ||
darwin=true | ||
;; | ||
MINGW* ) | ||
MSYS* | MINGW* ) | ||
msys=true | ||
;; | ||
NONSTOP* ) | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters