Skip to content
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@

function generatejdkdeps() {
echo "Generating JDK deps"
$JAVA_HOME/bin/java --list-modules > java-modules.txt
< java-modules.txt sed "s/\\@.*//" > modules.txt
grep -Fx -f stripped-deps.txt modules.txt | tr '\n' ',' | tr -d "[:space:]" > module-deps.txt
echo "jdk.zipfs" >> module-deps.txt
$JAVA_HOME/bin/java --list-modules > $S2I_JLINK_TEMP_PATH/java-modules.txt
< $S2I_JLINK_TEMP_PATH/java-modules.txt sed "s/\\@.*//" > $S2I_JLINK_TEMP_PATH/modules.txt
grep -Fx -f $S2I_JLINK_TEMP_PATH/stripped-deps.txt $S2I_JLINK_TEMP_PATH/modules.txt | tr '\n' ',' | tr -d "[:space:]" > $S2I_JLINK_TEMP_PATH/module-deps.txt
echo "jdk.zipfs" >> $S2I_JLINK_TEMP_PATH/module-deps.txt
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ function generate_deps() {
--module-path dependencies \
"$JAVA_APP_JAR" \
"$JAVA_LIB_DIR"/**/*.jar \
> deps.txt
> $S2I_JLINK_TEMP_PATH/deps.txt
else
$JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \
--module-path dependencies \
"$JAVA_APP_JAR" \
> deps.txt
cat deps.txt
> $S2I_JLINK_TEMP_PATH/deps.txt
cat $S2I_JLINK_TEMP_PATH/deps.txt
fi
}
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# TODO: Still Needed?
set -euo pipefail

depsfile="module-deps.txt"
depsfile="$S2I_JLINK_TEMP_PATH/module-deps.txt"

function generate_jre_image() {
test -f $depsfile
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -euo pipefail

function mkstrippeddeps() {
if [ -f "deps.txt" ]; then
if [ -f "$S2I_JLINK_TEMP_PATH/deps.txt" ]; then
echo "deps exists, filtering"
<deps.txt \
grep 'java\|jdk\.' | # mostly removes target/, but also jdk8internals
Expand All @@ -11,7 +11,7 @@ function mkstrippeddeps() {
sed -E "s/.*\.jar//" | # remove extraneous dependencies
sed "s#/.*##" | # delete anything after a slash. in practice target/..
sort | uniq |
tee stripped-deps.txt
tee $S2I_JLINK_TEMP_PATH/stripped-deps.txt
echo "Stripping dependencies complete"
else
echo "deps does not exist"
Expand Down
2 changes: 2 additions & 0 deletions modules/jlink/module.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ envs:
value: /opt/jboss/container/java/jlink
- name: S2I_JLINK_OUTPUT_PATH
value: /tmp/jre
- name: S2I_JLINK_TEMP_PATH
value: /tmp/jlink

modules:
install:
Expand Down
12 changes: 12 additions & 0 deletions modules/s2i/bash/artifacts/usr/local/s2i/assemble
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,11 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then
jlink_techpreview_warning
jlink_preflight_check

if [ ! -d "${S2I_JLINK_TEMP_PATH}" ]; then
log_info "S2I_JLINK_TEMP_PATH does not exist, creating ${S2I_JLINK_TEMP_PATH}"
mkdir -pm 775 "${S2I_JLINK_TEMP_PATH}"
fi

source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
echo "Invoking mkdeps"
generate_deps || {
Expand Down Expand Up @@ -54,3 +59,10 @@ if [ "$S2I_ENABLE_JLINK" = "true" ]; then
}

fi

if [ "$S2I_DELETE_SOURCE" == "true" ]; then
if [ -n "$(find $S2I_JLINK_TEMP_PATH -maxdepth 0 -type d ! -empty 2> /dev/null)" ]; then
log_info "Cleaning up temporary file directory $S2I_JLINK_TEMP_PATH"
rm -rf $S2I_JLINK_TEMP_PATH
fi
fi
Loading