Skip to content

Commit f811c07

Browse files
committed
Re-add files from a bad automerge.
1 parent 29c0dfd commit f811c07

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

43 files changed

+4350
-0
lines changed
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
function generatejdkdeps() {
4+
echo "Generating JDK deps"
5+
$JAVA_HOME/bin/java --list-modules > java-modules.txt
6+
< java-modules.txt sed "s/\\@.*//" > modules.txt
7+
grep -Fx -f stripped-deps.txt modules.txt | tr '\n' ',' | tr -d "[:space:]" > module-deps.txt
8+
echo "jdk.zipfs" >> module-deps.txt
9+
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#!/bin/bash
2+
# TODO: Still Needed?
3+
set -euo pipefail
4+
5+
depsfile="module-deps.txt"
6+
7+
function generate_jre_image() {
8+
test -f $depsfile
9+
modules="$(cat $depsfile)"
10+
11+
$JAVA_HOME/bin/jlink --output "$S2I_JLINK_OUTPUT_PATH" \
12+
--add-modules "$modules" \
13+
--strip-debug --no-header-files --no-man-pages \
14+
--compress=2
15+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
function mkstrippeddeps() {
5+
if [ -f "deps.txt" ]; then
6+
echo "deps exists, filtering"
7+
<deps.txt \
8+
grep 'java\|jdk\.' | # mostly removes target/, but also jdk8internals
9+
sed -E "s/Warning: .*//" | #remove extraneous warnings
10+
sed -E "s/.*-> //" | # remove src of src -> dep
11+
sed -E "s/.*\.jar//" | # remove extraneous dependencies
12+
sed "s#/.*##" | # delete anything after a slash. in practice target/..
13+
sort | uniq |
14+
tee stripped-deps.txt
15+
echo "Stripping dependencies complete"
16+
else
17+
echo "deps does not exist"
18+
fi
19+
}

modules/jlink/configure.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# Configure module
3+
set -e
4+
5+
SCRIPT_DIR=$(dirname $0)
6+
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts
7+
8+
chown -R default:root $SCRIPT_DIR
9+
chmod -R ug+rwX $SCRIPT_DIR
10+
chmod ug+x ${ARTIFACTS_DIR}/opt/jboss/container/java/jlink/*
11+
12+
pushd ${ARTIFACTS_DIR}
13+
cp -pr * /
14+
popd

modules/jlink/module.yaml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
schema_version: 1
2+
3+
name: "jboss.container.java.jlink"
4+
version: "2.0"
5+
description: ^
6+
"Provides support for building custom JREs with a slimmed
7+
down set of modules by making use of Jdeps and Jlink"
8+
9+
execute:
10+
- script: configure.sh
11+
12+
envs:
13+
- name: JBOSS_CONTAINER_JAVA_JLINK_MODULE
14+
value: /opt/jboss/container/java/jlink
15+
- name: S2I_JLINK_OUTPUT_PATH
16+
value: /tmp/jre
17+
18+
modules:
19+
install:
20+
- name: jboss.container.java.run
21+
- name: jboss.container.util.pathfinder
22+
23+
packages:
24+
install:
25+
- binutils # for objcopy

modules/s2i/bash/module.yaml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ modules:
1616
- name: jboss.container.maven.s2i
1717
- name: jboss.container.java.run
1818
- name: jboss.container.util.logging
19+
- name: jboss.container.java.jlink
20+
- name: jboss.container.util.pathfinder
1921

2022
packages:
2123
install:

modules/s2i/core/artifacts/opt/jboss/container/s2i/core/s2i-core

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ function s2i_core_env_init() {
3333
S2I_IMAGE_SOURCE_MOUNTS="${S2I_IMAGE_SOURCE_MOUNTS:-${CUSTOM_INSTALL_DIRECTORIES}}"
3434
S2I_ENABLE_INCREMENTAL_BUILDS="${S2I_ENABLE_INCREMENTAL_BUILDS:-true}"
3535
S2I_DELETE_SOURCE="${S2I_DELETE_SOURCE:-true}"
36+
S2I_ENABLE_JLINK="${S2I_ENABLE_JLINK:-false}"
3637
}
3738

3839
# extensions may override this method to initialize environment variables
@@ -88,11 +89,13 @@ function s2i_core_copy_deployments() {
8889
if [ ! -d "${S2I_TARGET_DEPLOYMENTS_DIR}" ]; then
8990
log_info "S2I_TARGET_DEPLOYMENTS_DIR does not exist, creating ${S2I_TARGET_DEPLOYMENTS_DIR}"
9091
mkdir -pm 775 "${S2I_TARGET_DEPLOYMENTS_DIR}"
92+
echo "created $S2I_TARGET_DEPLOYMENTS_DIR"
9193
fi
9294
local relative_source=$(realpath --relative-to "${S2I_SOURCE_DIR}" "${1}/${S2I_SOURCE_DEPLOYMENTS_DIR}")
9395
log_info "Copying deployments from $relative_source to ${S2I_TARGET_DEPLOYMENTS_DIR}..."
9496
for filter in ${S2I_SOURCE_DEPLOYMENTS_FILTER:-*}; do
9597
find "${S2I_SOURCE_DIR}/${relative_source}/" -maxdepth 1 -name "${filter}" | xargs -I '{}' -r cp -Lrpv '{}' "${S2I_TARGET_DEPLOYMENTS_DIR}"
98+
echo "Copying $filter to $S2I_TARGET_DEPLOYMENTS_DIR"
9699
done
97100
fi
98101
fi

modules/util/pathfinder/configure.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
# Configure module
3+
set -e
4+
5+
SCRIPT_DIR=$(dirname $0)
6+
ARTIFACTS_DIR=${SCRIPT_DIR}/artifacts
7+
8+
chown -R default:root $SCRIPT_DIR
9+
chmod -R ug+rwX $SCRIPT_DIR
10+
chmod ug+x ${ARTIFACTS_DIR}/opt/jboss/container/util/pathfinder/*
11+
12+
pushd ${ARTIFACTS_DIR}
13+
cp -pr * /
14+
popd

modules/util/pathfinder/module.yaml

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
schema_version: 1
2+
3+
name: "jboss.container.util.pathfinder"
4+
version: "1.0"
5+
description: ^
6+
"Provides support for determining Java application jar locations
7+
as well as library directories"
8+
9+
envs:
10+
- name: JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE
11+
value: /opt/jboss/container/util/pathfinder
12+
13+
- name: JAVA_APP_DIR
14+
description: ^
15+
The directory where the application resides. All paths in your application
16+
are relative to this directory.
17+
example: "myapplication/"
18+
19+
- name: JAVA_MAIN_CLASS
20+
description: ^
21+
A main class to use as argument for `java`. When this environment variable
22+
is given, all jar files in **JAVA_APP_DIR** are added to the classpath as
23+
well as **JAVA_LIB_DIR**.
24+
example: "com.example.MainClass"
25+
26+
- name: JAVA_LIB_DIR
27+
description: ^
28+
Directory holding the Java jar files as well an optional `classpath` file
29+
which holds the classpath. Either as a single line classpath (colon
30+
separated) or with jar files listed line-by-line. If not set
31+
**JAVA_LIB_DIR** is the same as **JAVA_APP_DIR**.
32+
33+
execute:
34+
- script: configure.sh

tests/OPENJDK-1549/README.md

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Test for OPENJDK-1549
2+
3+
<https://issues.redhat.com/browse/OPENJDK-1549>
4+
5+
This is a minimal Maven project for which the `validate` target will fail
6+
if the environment variable `MAVEN_ARGS` is defined.
7+
8+
This is achieved using the Enforcer plugin. We could not use the
9+
`requireEnvironmentVariable` built-in rule as it can only fail if a variable
10+
is undefined, rather than if it is. Instead we use `evaluateBeanshell` and
11+
a very short Beanshell expression.
12+
13+
Maven expands strings of the form `${env.foo}` within the POM only if the
14+
variable is defined. That is, when `MAVEN_ARGS` is not defined in the
15+
environment, the string `${env.MAVEN_ARGS}` is passed through unaltered.
16+
If the variable is defined (including defined but empty), Maven will expand
17+
it. Some string concatenation trickery is needed to match against the
18+
un-expanded form.

0 commit comments

Comments
 (0)