From 4fb5e3ffa7b79dfdb6090f6453461f9fc186cea2 Mon Sep 17 00:00:00 2001 From: Mateusz Pietryga Date: Fri, 10 Nov 2023 22:00:22 +0100 Subject: [PATCH] Copy native libraries to source tree with Maven action executed only on explicit demand and after a test phase (#153) Copy native libraries to source tree only on explicit demand and after a test phase --- .github/workflows/cross-compile.yml | 4 ++-- CMakeLists.txt | 5 +---- ant/build.xml | 6 ++++++ pom.xml | 21 +++++++++++++++++++++ 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/.github/workflows/cross-compile.yml b/.github/workflows/cross-compile.yml index 9a8060f7f..e05f278ae 100644 --- a/.github/workflows/cross-compile.yml +++ b/.github/workflows/cross-compile.yml @@ -118,7 +118,7 @@ jobs: ${{ matrix.image }} \ bash -c \ 'apt-get update && apt-get install --yes maven openjdk-11-jdk-headless && \ - mvn -B clean install -P dockcross \ + mvn -B clean install -P dockcross,update-resources-precompiled \ -Dos.target.name=${{ matrix.os_target_name }} \ -Dos.target.arch=${{ matrix.os_target_arch }} \ -Dos.target.bitness=${{ matrix.os_target_bitness }} \ @@ -171,7 +171,7 @@ jobs: export SDKROOT=$XCODE_12_DEVELOPER_DIR/Platforms/MacOSX.platform/Developer/SDKs/${{ matrix.sdk-version }} export CMAKE_OSX_SYSROOT=$SDKROOT - name: Build with Maven - run: mvn -B clean install -P ${{ matrix.profile }} + run: mvn -B clean install -P ${{ matrix.profile }},update-resources-precompiled - name: Push recompiled binaries run: | diff --git a/CMakeLists.txt b/CMakeLists.txt index 528e37651..c7ab0cb24 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -191,11 +191,8 @@ if(CMAKE_STRIP AND NOT CMAKE_BUILD_TYPE MATCHES "Deb") add_custom_command(TARGET jssc POST_BUILD COMMAND "${CMAKE_STRIP}" ${STRIP_ARGS} $) endif() - +# Copy native library to target/classes for processing by junit, maven add_custom_command(TARGET jssc POST_BUILD - # Copy native library back to source tree - COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/natives/ ${CMAKE_CURRENT_SOURCE_DIR}/src/main/resources-precompiled/natives/ - # Copy native library back to target/classes tree COMMAND ${CMAKE_COMMAND} -E copy_directory ${CMAKE_CURRENT_BINARY_DIR}/natives/ ${CMAKE_CURRENT_BINARY_DIR}/../classes/natives/ ) diff --git a/ant/build.xml b/ant/build.xml index bd8f85cdd..9fa2b07bf 100644 --- a/ant/build.xml +++ b/ant/build.xml @@ -289,4 +289,10 @@ + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 728a27139..f5a20a102 100644 --- a/pom.xml +++ b/pom.xml @@ -72,6 +72,7 @@ 1.1 3.0.1 3.0.0-M4 + true @@ -247,6 +248,18 @@ + + update-resources-precompiled + prepare-package + run + + ${update-resources-precompiled.skip} + + + + + + show-file-info install @@ -432,6 +445,14 @@ + + + update-resources-precompiled + + false + + + package