Skip to content

Commit

Permalink
Release: Change classifier of fat/uber JAR from "with-deps" to "app".
Browse files Browse the repository at this point in the history
  • Loading branch information
smarkwal committed Sep 27, 2024
1 parent ac10b53 commit cd10705
Show file tree
Hide file tree
Showing 11 changed files with 1,625 additions and 1,625 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ Its main purpose is to analyze a set of JAR files (\*.jar) and check whether the
It is available as [Gradle plugin](https://github.com/smarkwal/jarhc-gradle-plugin), or as standalone Java application run from the command line:

```
java -jar jarhc-with-deps.jar [options] <artifact> [<artifact>]*
java -jar jarhc-app.jar [options] <artifact> [<artifact>]*
```

More information can be found in the [wiki](https://github.com/smarkwal/jarhc/wiki).
Expand Down
6 changes: 3 additions & 3 deletions docs/example-reports.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
#!/bin/bash
cd ..
java -jar jarhc/build/libs/jarhc-2.2.0-with-deps.jar --options docs/example-report-asm-7.0-options.txt
java -jar jarhc/build/libs/jarhc-2.2.0-with-deps.jar --options docs/example-report-asm-commons-7.0-options.txt
java -jar jarhc/build/libs/jarhc-2.2.0-with-deps.jar --options docs/example-report-asm-7.0-provided-options.txt
java -jar jarhc/build/libs/jarhc-3.0.0-app.jar --options docs/example-report-asm-7.0-options.txt
java -jar jarhc/build/libs/jarhc-3.0.0-app.jar --options docs/example-report-asm-commons-7.0-options.txt
java -jar jarhc/build/libs/jarhc-3.0.0-app.jar --options docs/example-report-asm-7.0-provided-options.txt
6 changes: 3 additions & 3 deletions jarhc-release-tests/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@ tasks {
description = "Prepares the release test suite."

// run release tests after JAR and fat/uber JAR have been built
dependsOn(":jarhc:jar", ":jarhc:jar-with-deps", ":jarhc:generatePomFileForMavenPublication")
dependsOn(":jarhc:jar", ":jarhc:jar-app", ":jarhc:generatePomFileForMavenPublication")

doLast {

Expand Down Expand Up @@ -157,7 +157,7 @@ tasks {
commandLine(
"docker", "run",
"--rm",
"-v", "$rootDir/jarhc/build/libs/jarhc-$version-with-deps.jar:/jarhc/jarhc.jar",
"-v", "$rootDir/jarhc/build/libs/jarhc-$version-app.jar:/jarhc/jarhc.jar",
"-v", "$rootDir:/src",
"-w", "/jarhc",
"eclipse-temurin:11-jre",
Expand All @@ -167,7 +167,7 @@ tasks {
)

// run test after fat/uber JAR has been built
dependsOn(":jarhc:jar-with-deps")
dependsOn(":jarhc:jar-app")
}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,9 +54,9 @@ void jar() throws IOException {
}

@Test
void jarWithDeps() throws IOException {
File jarFile = getProjectFile(JARHC_BUILD + "/libs/jarhc-" + getJarHcVersion() + "-with-deps.jar");
testJar(jarFile, "jar-with-deps-toc.txt");
void jarApp() throws IOException {
File jarFile = getProjectFile(JARHC_BUILD + "/libs/jarhc-" + getJarHcVersion() + "-app.jar");
testJar(jarFile, "jar-app-toc.txt");
}

private void testJar(File jarFile, String resourceName) throws IOException {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ Collection<DynamicContainer> test() {

// TODO: find a better solution than relative paths
File jarFile = getProjectFile("../jarhc/build/libs/jarhc-" + getJarHcVersion() + ".jar");
File jarWithDepsFile = getProjectFile("../jarhc/build/libs/jarhc-" + getJarHcVersion() + "-with-deps.jar");
File jarAppFile = getProjectFile("../jarhc/build/libs/jarhc-" + getJarHcVersion() + "-app.jar");
File minimalJarFile = getProjectFile("src/main/resources/minimal.jar");

for (AbstractTestRunner runner : runners) {

runner.installFile(jarFile, "jarhc.jar");
runner.installFile(jarWithDepsFile, "jarhc-with-deps.jar");
runner.installFile(jarAppFile, "jarhc-app.jar");
runner.installFile(minimalJarFile, "minimal.jar");

// prepare a collection of tests
Expand Down Expand Up @@ -276,7 +276,7 @@ private void jarhc_forJarHC_fat(AbstractTestRunner runner) {
"-o", outputPath,
"-s", "-jr", // exclude section Java Runtime
"--skip-empty", // exclude empty sections
"jarhc-with-deps.jar"
"jarhc-app.jar"
);

// override JarHC version for reproducible test output
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public static Command java(String... arguments) {
public static Command jarHc(String... arguments) {
Command command = new Command();
command.jarHcArguments.add("-jar");
command.jarHcArguments.add("jarhc-with-deps.jar");
command.jarHcArguments.add("jarhc-app.jar");
command.jarHcArguments.addAll(Arrays.asList(arguments));
return command;
}
Expand Down
1,034 changes: 517 additions & 517 deletions jarhc-release-tests/src/main/resources/reports/all/11/jarhc-fat.txt

Large diffs are not rendered by default.

1,084 changes: 542 additions & 542 deletions jarhc-release-tests/src/main/resources/reports/all/17/jarhc-fat.txt

Large diffs are not rendered by default.

1,090 changes: 545 additions & 545 deletions jarhc-release-tests/src/main/resources/reports/all/21/jarhc-fat.txt

Large diffs are not rendered by default.

14 changes: 7 additions & 7 deletions jarhc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ val integrationTestRuntimeOnly: Configuration by configurations.getting {
)
}

val includeInJarWithDeps: Configuration by configurations.creating
val includeInJarApp: Configuration by configurations.creating

// dependencies ----------------------------------------------------------------

Expand All @@ -153,7 +153,7 @@ dependencies {
api("org.slf4j:slf4j-api:2.0.16")

// additional libraries to be added to jar-with-deps
includeInJarWithDeps("org.slf4j:slf4j-simple:2.0.16")
includeInJarApp("org.slf4j:slf4j-simple:2.0.16")

// test dependencies (available in unit and integration tests)
testFixturesApi("org.junit.jupiter:junit-jupiter:5.11.1")
Expand Down Expand Up @@ -340,20 +340,20 @@ tasks {
}

assemble {
dependsOn(jarWithDeps)
dependsOn(jarApp)
}

}

val jarWithDeps = task("jar-with-deps", type = Jar::class) {
val jarApp = task("jar-app", type = Jar::class) {
group = "build"
description = "Assembles a fat/uber jar archive with all runtime dependencies."

// make sure that license report has been generated
dependsOn(tasks.generateLicenseReport)

// append classifier "-with-deps"
archiveClassifier.set("with-deps")
// append classifier "-app"
archiveClassifier.set("app")

// set Main-Class in MANIFEST.MF
manifest {
Expand All @@ -368,7 +368,7 @@ val jarWithDeps = task("jar-with-deps", type = Jar::class) {
from(configurations.runtimeClasspath.get().map { if (it.isDirectory) it else zipTree(it) })

// add all additional libraries
from(includeInJarWithDeps.map { if (it.isDirectory) it else zipTree(it) })
from(includeInJarApp.map { if (it.isDirectory) it else zipTree(it) })

// add additional resources for jar-with-deps
from("src/app/resources")
Expand Down

0 comments on commit cd10705

Please sign in to comment.