-
Notifications
You must be signed in to change notification settings - Fork 199
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
Add zip+tar to publishable artifacts and add a run.sh
script
#1082
Open
snazy
wants to merge
1
commit into
apache:main
Choose a base branch
from
snazy:quarkus-run-script
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
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 |
---|---|---|
|
@@ -28,6 +28,14 @@ plugins { | |
id("distribution") | ||
} | ||
|
||
val runScript by configurations.creating { description = "Used to reference the run.sh script" } | ||
|
||
val distributionZip by | ||
configurations.creating { description = "Used to reference the distribution zip" } | ||
|
||
val distributionTar by | ||
configurations.creating { description = "Used to reference the distribution tarball" } | ||
|
||
dependencies { | ||
implementation(project(":polaris-core")) | ||
implementation(project(":polaris-version")) | ||
|
@@ -53,10 +61,12 @@ dependencies { | |
|
||
testRuntimeOnly(project(":polaris-eclipselink")) | ||
testRuntimeOnly("org.postgresql:postgresql") | ||
|
||
runScript(project(":polaris-quarkus-run-script", "runScript")) | ||
} | ||
|
||
quarkus { | ||
quarkusBuildProperties.put("quarkus.package.type", "uber-jar") | ||
quarkusBuildProperties.put("quarkus.package.type", "fast-jar") | ||
// Pull manifest attributes from the "main" `jar` task to get the | ||
// release-information into the jars generated by Quarkus. | ||
quarkusBuildProperties.putAll( | ||
|
@@ -72,28 +82,48 @@ quarkus { | |
) | ||
} | ||
|
||
publishing { | ||
publications { | ||
named<MavenPublication>("maven") { | ||
val quarkusBuild = tasks.getByName<QuarkusBuild>("quarkusBuild") | ||
artifact(quarkusBuild.runnerJar) { | ||
classifier = "runner" | ||
builtBy(quarkusBuild) | ||
} | ||
distributions { | ||
main { | ||
contents { | ||
from(runScript) | ||
from(project.layout.buildDirectory.dir("quarkus-app")) | ||
from("../../NOTICE") | ||
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. IMHO it's better to square the license/notice on the target artifacts. I can change that in second step along with license/notice. |
||
from("../../LICENSE-BINARY-DIST").rename("LICENSE-BINARY-DIST", "LICENSE") | ||
} | ||
} | ||
} | ||
|
||
tasks.named("distZip") { dependsOn("quarkusBuild") } | ||
val quarkusBuild = tasks.named<QuarkusBuild>("quarkusBuild") | ||
|
||
tasks.named("distTar") { dependsOn("quarkusBuild") } | ||
val distTar = | ||
tasks.named<Tar>("distTar") { | ||
dependsOn(quarkusBuild) | ||
// Trigger resolution (and build) of the run-script artifact | ||
inputs.files(runScript) | ||
compression = Compression.GZIP | ||
} | ||
|
||
distributions { | ||
main { | ||
contents { | ||
from("../../NOTICE") | ||
from("../../LICENSE-BINARY-DIST").rename("LICENSE-BINARY-DIST", "LICENSE") | ||
from(project.layout.buildDirectory) { include("polaris-quarkus-admin-*-runner.jar") } | ||
val distZip = | ||
tasks.named<Zip>("distZip") { | ||
dependsOn(quarkusBuild) | ||
// Trigger resolution (and build) of the run-script artifact | ||
inputs.files(runScript) | ||
} | ||
|
||
// Expose runnable jar via quarkusRunner configuration for integration-tests that require the | ||
// server. | ||
artifacts { | ||
add(distributionTar.name, provider { distTar.get().archiveFile }) { builtBy(distTar) } | ||
add(distributionZip.name, provider { distZip.get().archiveFile }) { builtBy(distZip) } | ||
} | ||
|
||
afterEvaluate { | ||
publishing { | ||
publications { | ||
named<MavenPublication>("maven") { | ||
artifact(distTar.get().archiveFile) { builtBy(distTar) } | ||
artifact(distZip.get().archiveFile) { builtBy(distZip) } | ||
} | ||
} | ||
} | ||
} |
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,36 @@ | ||
/* | ||
* Licensed to the Apache Software Foundation (ASF) under one | ||
* or more contributor license agreements. See the NOTICE file | ||
* distributed with this work for additional information | ||
* regarding copyright ownership. The ASF licenses this file | ||
* to you under the Apache License, Version 2.0 (the | ||
* "License"); you may not use this file except in compliance | ||
* with the License. You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, | ||
* software distributed under the License is distributed on an | ||
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
* KIND, either express or implied. See the License for the | ||
* specific language governing permissions and limitations | ||
* under the License. | ||
*/ | ||
|
||
val runScript by | ||
configurations.creating { description = "Used to provide the run.sh script" } | ||
|
||
description = "Provides run.sh script for Quarkus fast-jar for distribution tar/zip" | ||
|
||
// This is a separate project that only provides run scripts (run.sh). | ||
// It is a separate project, because it is not good practice to directly | ||
// reference files outside any project. | ||
// | ||
// Artifacts are NOT published as a Maven artifacts. | ||
|
||
artifacts { | ||
add(runScript.name, project.layout.projectDirectory.file("scripts/run.sh")) | ||
} | ||
|
||
// Need this task to be present, there are no checks/tests in this project though | ||
tasks.register("check") |
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,39 @@ | ||
#!/usr/bin/env bash | ||
# | ||
# Licensed to the Apache Software Foundation (ASF) under one | ||
# or more contributor license agreements. See the NOTICE file | ||
# distributed with this work for additional information | ||
# regarding copyright ownership. The ASF licenses this file | ||
# to you under the Apache License, Version 2.0 (the | ||
# "License"); you may not use this file except in compliance | ||
# with the License. You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, | ||
# software distributed under the License is distributed on an | ||
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY | ||
# KIND, either express or implied. See the License for the | ||
# specific language governing permissions and limitations | ||
# under the License. | ||
# | ||
|
||
# Linux Quarkus fast-jar run script for Apache Polaris | ||
|
||
set -e | ||
|
||
script_dir="$(dirname "$0")" | ||
|
||
if [ -z "$JAVA_HOME" ] ; then | ||
JAVACMD="`\\unset -f command; \\command -v java`" | ||
else | ||
JAVACMD="$JAVA_HOME/bin/java" | ||
fi | ||
|
||
if [ ! -x "$JAVACMD" ] ; then | ||
echo "The JAVA_HOME environment variable is not defined correctly," >&2 | ||
echo "this environment variable is needed to run this program." >&2 | ||
exit 1 | ||
fi | ||
|
||
exec "${JAVACMD}" -jar "${script_dir}/quarkus-run.jar" |
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
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Isn't this going to complicate the tool usage? It's easier to download and run a single jar than to download a zip, unpack, then run.
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.
I agree that uber-jar is more convenient for the admin tool.
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.
AFAIU the current approach it is already a tgz/zip file that needs to be extracted, because of the necessary LICENSE/NOTICE files.
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.
Could we include the NOTICE test into the user jar and have a CLI option to print it?
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.
Uber jar is also an option: we can ship LICENSE/NOTICE in the meta-inf. By the way, I'm working on the license and notice content for binary distributions.