Skip to content

Commit 1d5399e

Browse files
committed
Fix ordering of pathfinder, add logging, add configure script
1 parent 10691f5 commit 1d5399e

File tree

8 files changed

+51
-13
lines changed

8 files changed

+51
-13
lines changed

modules/jlink/artifacts/opt/jboss/container/java/jlink/generatejdkdeps.sh

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
#!/bin/bash
22

33
function generatejdkdeps() {
4+
echo "Generating JDK deps"
45
$JAVA_HOME/bin/java --list-modules > java-modules.txt
56
< java-modules.txt sed "s/\\@.*//" > modules.txt
67
grep -Fx -f stripped-deps.txt modules.txt | tr '\n' ',' | tr -d "[:space:]" > module-deps.txt

modules/jlink/artifacts/opt/jboss/container/java/jlink/mkdeps.sh

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,15 @@ function generate_deps() {
1010
if [[ -v JAVA_LIB_DIR ]]; then
1111
# copy dependencies found in libs to dependencies
1212
find $JAVA_LIB_DIR -type f -name '*.jar' -print0 | xargs -r0 cp -vt dependencies
13+
echo "Working with: "
14+
echo $JAVA_APP_JAR
15+
echo $JAVA_LIB_DIR
1316
# generate the dependency list
1417
$JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \
1518
--module-path dependencies \
1619
"$JAVA_APP_JAR" \
1720
"$JAVA_LIB_DIR"/**/*.jar \
1821
> deps.txt
19-
cat deps.txt
2022
else
2123
$JAVA_HOME/bin/jdeps --multi-release $JAVA_VERSION -R -s \
2224
--module-path dependencies \

modules/run/artifacts/opt/jboss/container/java/run/run-java.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,16 @@ load_env() {
2626
# Configuration stuff is read from this file
2727
local run_env_sh="run-env.sh"
2828

29-
# Load JAVA_APP_JAR and JAVA_LIB_DIR
30-
if [ -f "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" ]; then
31-
source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh"
32-
fi
3329
# Load default default config
3430
if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then
3531
source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}"
3632
fi
33+
34+
# Load JAVA_APP_JAR and JAVA_LIB_DIR
35+
if [ -f "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh" ]; then
36+
source "$JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE/pathfinder.sh"
37+
setup_java_app_and_lib
38+
fi
3739
}
3840

3941
# Combine all java options

modules/s2i/bash/artifacts/usr/local/s2i/assemble

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,12 +11,14 @@ source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/s2i-core-hooks"
1111
# inject our overridden maven_s2i_*() functions
1212
source "${JBOSS_CONTAINER_JAVA_S2I_MODULE}/maven-s2i-overrides"
1313

14-
# run the pathfinder scripts to define JAVA_APP_JAR and JAVA_LIB_DIR
15-
source "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh"
16-
1714
# invoke the build
1815
maven_s2i_build
1916

17+
# run the pathfinder scripts to define JAVA_APP_JAR and JAVA_LIB_DIR
18+
source "${JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE}/pathfinder.sh"
19+
echo "Setting up java app and lib variables"
20+
setup_java_app_and_lib
21+
2022
# include our jlink scripts
2123
source "${JBOSS_CONTAINER_JAVA_JLINK_MODULE}/mkdeps.sh"
2224
echo "Invoking mkdeps"

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,6 @@ function s2i_core_copy_data() {
8282
# copy deployment (binary) files
8383
# $1 - the base directory to which $S2I_SOURCE_DEPLOYMENTS_DIR is appended
8484
function s2i_core_copy_deployments() {
85-
echo "Copying deployments"
8685
if [ -d "${1}/${S2I_SOURCE_DEPLOYMENTS_DIR}" ]; then
8786
if [ -z "${S2I_TARGET_DEPLOYMENTS_DIR}" ]; then
8887
log_warning "Unable to copy deployment files. No target directory specified for S2I_TARGET_DEPLOYMENTS_DIR"

modules/util/pathfinder/artifacts/opt/jboss/container/util/pathfinder/pathfinder.sh

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,11 @@
1-
1+
# Error is indicated with a prefix in the return value
2+
check_error() {
3+
local msg=$1
4+
if echo ${msg} | grep -q "^ERROR:"; then
5+
log_error ${msg}
6+
exit 1
7+
fi
8+
}
29

310
# detect Quarkus fast-jar package type (OPENJDK-631)
411
is_quarkus_fast_jar() {
@@ -59,6 +66,14 @@ get_jar_file() {
5966
}
6067

6168
setup_java_app_and_lib() {
69+
# Configuration stuff is read from this file
70+
local run_env_sh="run-env.sh"
71+
72+
# Load default default config
73+
if [ -f "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}" ]; then
74+
source "${JBOSS_CONTAINER_JAVA_RUN_MODULE}/${run_env_sh}"
75+
fi
76+
6277
# Check also $JAVA_APP_DIR. Overrides other defaults
6378
# It's valid to set the app dir in the default script
6479
if [ -z "${JAVA_APP_DIR}" ]; then

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: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ description: ^
77
as well as library directories"
88

99
envs:
10-
- name: JBOSS_CONTAINER_JAVA_S2I_MODULE
10+
- name: JBOSS_CONTAINER_UTIL_PATHFINDER_MODULE
1111
value: /opt/jboss/container/util/pathfinder
12-
12+
1313
- name: JAVA_APP_DIR
1414
description: ^
1515
The directory where the application resides. All paths in your application
@@ -28,4 +28,7 @@ envs:
2828
Directory holding the Java jar files as well an optional `classpath` file
2929
which holds the classpath. Either as a single line classpath (colon
3030
separated) or with jar files listed line-by-line. If not set
31-
**JAVA_LIB_DIR** is the same as **JAVA_APP_DIR**.
31+
**JAVA_LIB_DIR** is the same as **JAVA_APP_DIR**.
32+
33+
execute:
34+
- script: configure.sh

0 commit comments

Comments
 (0)