From 061fa9f227d9a4cd32bf491f03af5fe00096c7ef Mon Sep 17 00:00:00 2001 From: Neil C Smith Date: Mon, 6 Nov 2023 13:52:02 +0000 Subject: [PATCH] Switch from AppAssembler to Maven Assembly plugin. --- .github/workflows/tests.yml | 24 ++- pom.xml | 2 +- praxiscore-bin/pom.xml | 46 ++-- praxiscore-bin/src/assembly/_dist.xml | 23 ++ praxiscore-bin/src/assembly/bin.xml | 31 +++ .../unixBinTemplate => assembly/bin/praxis} | 31 ++- .../bin/praxis.cmd} | 202 ++++++++++-------- praxiscore-bin/src/assembly/dir.xml | 32 +++ 8 files changed, 264 insertions(+), 127 deletions(-) create mode 100644 praxiscore-bin/src/assembly/_dist.xml create mode 100644 praxiscore-bin/src/assembly/bin.xml rename praxiscore-bin/src/{bin/unixBinTemplate => assembly/bin/praxis} (71%) rename praxiscore-bin/src/{bin/windowsBinTemplate => assembly/bin/praxis.cmd} (58%) create mode 100644 praxiscore-bin/src/assembly/dir.xml diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index a3398b22..324d191f 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -5,24 +5,30 @@ on: jobs: build: - runs-on: ubuntu-latest + name: Build and test on ${{ matrix.os }}, JDK ${{ matrix.java }} + + strategy: + matrix: + java: [ '21' ] + os: [ 'ubuntu-latest' ] + + runs-on: ${{ matrix.os }} steps: - name: Checkout uses: actions/checkout@v3 - - name: Set up JDK 17 + - name: Set up JDK uses: actions/setup-java@v3 with: - java-version: '17' + java-version: ${{ matrix.java }} distribution: 'temurin' cache: 'maven' - name: Build with Maven - run: ./mvnw --batch-mode --update-snapshots install - - name: Assemble PraxisCORE + run: ./mvnw --batch-mode --update-snapshots verify + - name: Move and verify PraxisCORE run: | - ./mvnw --batch-mode -f ./praxiscore-bin package appassembler:assemble - mv ./praxiscore-bin/target/appassembler ./CORE - ./CORE/bin/praxis --show-environment + mv ./praxiscore-bin/target/praxiscore ./ + ./praxiscore/bin/praxis --show-environment - name: Run Test Suite - run: ./CORE/bin/praxis -f ./testsuite/ + run: ./praxiscore/bin/praxis -f ./testsuite/ diff --git a/pom.xml b/pom.xml index c38589da..848b3615 100644 --- a/pom.xml +++ b/pom.xml @@ -29,7 +29,6 @@ praxiscore-hub praxiscore-script praxiscore-launcher - praxiscore-bin praxiscore-data praxiscore-video praxiscore-video-code @@ -50,6 +49,7 @@ praxiscore-code-ivy praxiscore-launcher-jline praxiscore-purl + praxiscore-bin diff --git a/praxiscore-bin/pom.xml b/praxiscore-bin/pom.xml index 80e9dd83..16e8994e 100644 --- a/praxiscore-bin/pom.xml +++ b/praxiscore-bin/pom.xml @@ -12,24 +12,6 @@ - - org.codehaus.mojo - appassembler-maven-plugin - 2.1.0 - - flat - mods - true - ${project.basedir}/src/bin/unixBinTemplate - ${project.basedir}/src/bin/windowsBinTemplate - - - org.praxislive.bin.Main - praxis - - - - org.apache.maven.plugins maven-dependency-plugin @@ -48,6 +30,28 @@ + + org.apache.maven.plugins + maven-assembly-plugin + 3.6.0 + + + make-bin-dir + package + + single + + + praxiscore + + ${basedir}/src/assembly/dir.xml + + false + false + + + + @@ -174,6 +178,12 @@ ${project.groupId} praxiscore-video-pgl-natives ${project.version} + + + * + * + + diff --git a/praxiscore-bin/src/assembly/_dist.xml b/praxiscore-bin/src/assembly/_dist.xml new file mode 100644 index 00000000..d4fae8c1 --- /dev/null +++ b/praxiscore-bin/src/assembly/_dist.xml @@ -0,0 +1,23 @@ + + + + + mods + + + + + src/assembly/bin/praxis + bin + unix + 0755 + + + src/assembly/bin/praxis.cmd + bin + dos + + + diff --git a/praxiscore-bin/src/assembly/bin.xml b/praxiscore-bin/src/assembly/bin.xml new file mode 100644 index 00000000..f80ccc47 --- /dev/null +++ b/praxiscore-bin/src/assembly/bin.xml @@ -0,0 +1,31 @@ + + + + bin + + tar.gz + zip + + + src/assembly/_dist.xml + + diff --git a/praxiscore-bin/src/bin/unixBinTemplate b/praxiscore-bin/src/assembly/bin/praxis similarity index 71% rename from praxiscore-bin/src/bin/unixBinTemplate rename to praxiscore-bin/src/assembly/bin/praxis index b128ed2a..02027393 100644 --- a/praxiscore-bin/src/bin/unixBinTemplate +++ b/praxiscore-bin/src/assembly/bin/praxis @@ -1,5 +1,22 @@ #!/usr/bin/env sh -@LICENSE_HEADER@ +# ---------------------------------------------------------------------------- +# Copyright (c) 2023 Neil C Smith. +# +# Licensed 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. +# ---------------------------------------------------------------------------- +# +# Derived from AppAssembler plugin launcher script +# Copyright (c) 2001-2006 The Apache Software Foundation. # resolve links - $0 may be a softlink PRG="$0" @@ -19,7 +36,7 @@ BASEDIR=`cd "$PRGDIR/.." >/dev/null; pwd` # Reset the REPO variable. If you need to influence this use the environment setup file. REPO= -@ENV_SETUP@ + if [ -z "$JAVACMD" ] ; then if [ -x "$BASEDIR/jdk/" ] ; then @@ -83,7 +100,7 @@ fi if [ -z "$REPO" ] then - REPO="$BASEDIR"/@REPO@ + REPO="$BASEDIR"/mods fi # For Cygwin, switch paths to Windows format before running java @@ -94,12 +111,12 @@ if $cygwin; then [ -n "$REPO" ] && REPO=`cygpath --path --windows "$REPO"` fi -exec "$JAVACMD" $JAVA_OPTS @EXTRA_JVM_ARGUMENTS@ \ +exec "$JAVACMD" $JAVA_OPTS \ -p "$REPO" \ - -Dapp.name="@APP_NAME@" \ + -Dapp.name="praxis" \ -Dapp.pid="$$" \ -Dapp.repo="$REPO" \ -Dapp.home="$BASEDIR" \ -Dbasedir="$BASEDIR" \ - -m org.praxislive.bin/@MAINCLASS@ \ - @APP_ARGUMENTS@"$@"@UNIX_BACKGROUND@ + -m org.praxislive.bin/org.praxislive.bin.Main \ + "$@" diff --git a/praxiscore-bin/src/bin/windowsBinTemplate b/praxiscore-bin/src/assembly/bin/praxis.cmd similarity index 58% rename from praxiscore-bin/src/bin/windowsBinTemplate rename to praxiscore-bin/src/assembly/bin/praxis.cmd index 254e9041..7c54a904 100644 --- a/praxiscore-bin/src/bin/windowsBinTemplate +++ b/praxiscore-bin/src/assembly/bin/praxis.cmd @@ -1,92 +1,110 @@ -#LICENSE_HEADER# -@echo off - -set ERROR_CODE=0 - -:init -@REM Decide how to startup depending on the version of windows - -@REM -- Win98ME -if NOT "%OS%"=="Windows_NT" goto Win9xArg - -@REM set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" @setlocal - -@REM -- 4NT shell -if "%eval[2+2]" == "4" goto 4NTArgs - -@REM -- Regular WinNT shell -set CMD_LINE_ARGS=%* -goto WinNTGetScriptDir - -@REM The 4NT Shell from jp software -:4NTArgs -set CMD_LINE_ARGS=%$ -goto WinNTGetScriptDir - -:Win9xArg -@REM Slurp the command line arguments. This loop allows for an unlimited number -@REM of arguments (up to the command line limit, anyway). -set CMD_LINE_ARGS= -:Win9xApp -if %1a==a goto Win9xGetScriptDir -set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 -shift -goto Win9xApp - -:Win9xGetScriptDir -set SAVEDIR=%CD% -%0\ -cd %0\..\.. -set BASEDIR=%CD% -cd %SAVEDIR% -set SAVE_DIR= -goto repoSetup - -:WinNTGetScriptDir -for %%i in ("%~dp0..") do set "BASEDIR=%%~fi" - -:repoSetup -set REPO= -#ENV_SETUP# - -if exist %BASEDIR%\jdk set JAVA_HOME=%BASEDIR%\jdk - -if not "%JAVA_HOME%"=="" set JAVACMD=%JAVA_HOME%\bin\#JAVA_BINARY# - -if "%JAVACMD%"=="" set JAVACMD=#JAVA_BINARY# - -if "%REPO%"=="" set REPO=%BASEDIR%\#REPO# - -@REM Reaching here means variables are defined and arguments have been captured -:endInit - -"%JAVACMD%" %JAVA_OPTS% #EXTRA_JVM_ARGUMENTS# -p "%REPO%" -Dapp.name="#APP_NAME#" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -m "org.praxislive.bin/#MAINCLASS#" #APP_ARGUMENTS#%CMD_LINE_ARGS% -if %ERRORLEVEL% NEQ 0 goto error -goto end - -:error -if "%OS%"=="Windows_NT" @endlocal -set ERROR_CODE=%ERRORLEVEL% - -:end -@REM set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" goto endNT - -@REM For old DOS remove the set variables from ENV - we assume they were not set -@REM before we started - at least we don't leave any baggage around -set CMD_LINE_ARGS= -goto postExec - -:endNT -@REM If error code is set to 1 then the endlocal was done already in :error. -if %ERROR_CODE% EQU 0 @endlocal - - -:postExec - -if "%FORCE_EXIT_ON_ERROR%" == "on" ( - if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% -) - -exit /B %ERROR_CODE% +@REM ---------------------------------------------------------------------------- +@REM Copyright (c) 2023 Neil C Smith. +@REM +@REM Licensed under the Apache License, Version 2.0 (the "License"); +@REM you may not use this file except in compliance with the License. +@REM You may obtain a copy of the License at +@REM +@REM http://www.apache.org/licenses/LICENSE-2.0 +@REM +@REM Unless required by applicable law or agreed to in writing, software +@REM distributed under the License is distributed on an "AS IS" BASIS, +@REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +@REM See the License for the specific language governing permissions and +@REM limitations under the License. +@REM ---------------------------------------------------------------------------- +@REM +@REM Derived from AppAssembler plugin launcher script +@REM Copyright (c) 2001-2006 The Apache Software Foundation. + +@echo off + +set ERROR_CODE=0 + +:init +@REM Decide how to startup depending on the version of windows + +@REM -- Win98ME +if NOT "%OS%"=="Windows_NT" goto Win9xArg + +@REM set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" @setlocal + +@REM -- 4NT shell +if "%eval[2+2]" == "4" goto 4NTArgs + +@REM -- Regular WinNT shell +set CMD_LINE_ARGS=%* +goto WinNTGetScriptDir + +@REM The 4NT Shell from jp software +:4NTArgs +set CMD_LINE_ARGS=%$ +goto WinNTGetScriptDir + +:Win9xArg +@REM Slurp the command line arguments. This loop allows for an unlimited number +@REM of arguments (up to the command line limit, anyway). +set CMD_LINE_ARGS= +:Win9xApp +if %1a==a goto Win9xGetScriptDir +set CMD_LINE_ARGS=%CMD_LINE_ARGS% %1 +shift +goto Win9xApp + +:Win9xGetScriptDir +set SAVEDIR=%CD% +%0\ +cd %0\..\.. +set BASEDIR=%CD% +cd %SAVEDIR% +set SAVE_DIR= +goto repoSetup + +:WinNTGetScriptDir +for %%i in ("%~dp0..") do set "BASEDIR=%%~fi" + +:repoSetup +set REPO= + + +if exist %BASEDIR%\jdk set JAVA_HOME=%BASEDIR%\jdk + +if not "%JAVA_HOME%"=="" set JAVACMD=%JAVA_HOME%\bin\java + +if "%JAVACMD%"=="" set JAVACMD=java + +if "%REPO%"=="" set REPO=%BASEDIR%\mods + +@REM Reaching here means variables are defined and arguments have been captured +:endInit + +"%JAVACMD%" %JAVA_OPTS% -p "%REPO%" -Dapp.name="praxis" -Dapp.repo="%REPO%" -Dapp.home="%BASEDIR%" -Dbasedir="%BASEDIR%" -m "org.praxislive.bin/org.praxislive.bin.Main" %CMD_LINE_ARGS% +if %ERRORLEVEL% NEQ 0 goto error +goto end + +:error +if "%OS%"=="Windows_NT" @endlocal +set ERROR_CODE=%ERRORLEVEL% + +:end +@REM set local scope for the variables with windows NT shell +if "%OS%"=="Windows_NT" goto endNT + +@REM For old DOS remove the set variables from ENV - we assume they were not set +@REM before we started - at least we don't leave any baggage around +set CMD_LINE_ARGS= +goto postExec + +:endNT +@REM If error code is set to 1 then the endlocal was done already in :error. +if %ERROR_CODE% EQU 0 @endlocal + + +:postExec + +if "%FORCE_EXIT_ON_ERROR%" == "on" ( + if %ERROR_CODE% NEQ 0 exit %ERROR_CODE% +) + +exit /B %ERROR_CODE% diff --git a/praxiscore-bin/src/assembly/dir.xml b/praxiscore-bin/src/assembly/dir.xml new file mode 100644 index 00000000..07139aca --- /dev/null +++ b/praxiscore-bin/src/assembly/dir.xml @@ -0,0 +1,32 @@ + + + + dir + + dir + + false + + src/assembly/_dist.xml + + +