diff --git a/.github/workflows/assemble-java-combined.yml b/.github/workflows/assemble-java-combined.yml new file mode 100644 index 0000000..8e15833 --- /dev/null +++ b/.github/workflows/assemble-java-combined.yml @@ -0,0 +1,86 @@ +name: Assemble combined all-platform jar + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + push: + branches: [ combine-workflow ] + #pull_request: + # branches: [ master ] + + # Allows you to run this workflow manually from the Actions tab + workflow_dispatch: + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + + build-linux: + uses: ./.github/workflows/build-java-linux.yml + + build-macos: + uses: ./.github/workflows/build-java-macos.yml + with: + cross_build: y + + build-win32: + uses: ./.github/workflows/build-java-win32.yml + + assemble: + needs: [build-linux, build-macos, build-win32] + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + + - uses: actions/checkout@v3 + + - name: Download hdf5-build-linux + uses: actions/download-artifact@v3 + with: + name: hdf5-build-linux + path: hdf5-build-linux + + - name: Download hdf5-build-macos + uses: actions/download-artifact@v3 + with: + name: hdf5-build-macos + path: hdf5-build-macos + + - name: Download hdf5-build-win32 + uses: actions/download-artifact@v3 + with: + name: hdf5-build-win32 + path: hdf5-build-win32 + + - name: Download Java source + uses: actions/download-artifact@v3 + with: + name: hdf5-java-source + path: java-combined/src/main/java + + - name: List + run: | + ./releng/prepare_java_project.sh + ls -l + tree + + # Could build and publish here but for now just provide maven project + # For manual build and deploy + + # - name: Set up JDK 17 + # uses: actions/setup-java@v3 + # with: + # java-version: '17' + # distribution: 'temurin' + + # - name: Build with Maven + # run: mvn --batch-mode clean verify + # working-directory: java-combined + + - name: Upload artifacts + uses: actions/upload-artifact@v3 + with: + name: prepared-maven-project + path: "java-combined" + diff --git a/.github/workflows/build-java-linux.yml b/.github/workflows/build-java-linux.yml index b0fc937..e90b453 100644 --- a/.github/workflows/build-java-linux.yml +++ b/.github/workflows/build-java-linux.yml @@ -12,6 +12,9 @@ on: # Allows you to run this workflow manually from the Actions tab workflow_dispatch: + # Reusable workflow + workflow_call: + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" diff --git a/.github/workflows/build-java-macos.yml b/.github/workflows/build-java-macos.yml index 29a8fc0..391d4d8 100644 --- a/.github/workflows/build-java-macos.yml +++ b/.github/workflows/build-java-macos.yml @@ -22,6 +22,15 @@ on: required: false default: false + # Reusable workflow + workflow_call: + inputs: + cross_build: + description: 'Cross compile for universal2 (n/y)' + required: false + default: n + type: string + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" diff --git a/.github/workflows/build-java-win32.yml b/.github/workflows/build-java-win32.yml index b246e62..be7a6c3 100644 --- a/.github/workflows/build-java-win32.yml +++ b/.github/workflows/build-java-win32.yml @@ -18,6 +18,9 @@ on: required: false default: false + # Reusable workflow + workflow_call: + # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: # This workflow contains a single job called "build" diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 961d1f3..0000000 --- a/LICENSE +++ /dev/null @@ -1,28 +0,0 @@ -BSD 3-Clause License - -Copyright (c) 2023, Diamond Light Source - -Redistribution and use in source and binary forms, with or without -modification, are permitted provided that the following conditions are met: - -1. Redistributions of source code must retain the above copyright notice, this - list of conditions and the following disclaimer. - -2. Redistributions in binary form must reproduce the above copyright notice, - this list of conditions and the following disclaimer in the documentation - and/or other materials provided with the distribution. - -3. Neither the name of the copyright holder nor the names of its - contributors may be used to endorse or promote products derived from - this software without specific prior written permission. - -THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" -AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE -IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE -DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE -FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL -DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR -SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER -CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, -OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE -OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/LICENSE b/LICENSE new file mode 120000 index 0000000..2f236e3 --- /dev/null +++ b/LICENSE @@ -0,0 +1 @@ +java-combined/src/main/resources/META-INF/LICENSE \ No newline at end of file diff --git a/java-combined/.gitignore b/java-combined/.gitignore new file mode 100644 index 0000000..2f7896d --- /dev/null +++ b/java-combined/.gitignore @@ -0,0 +1 @@ +target/ diff --git a/java-combined/pom.xml b/java-combined/pom.xml new file mode 100644 index 0000000..cfe589c --- /dev/null +++ b/java-combined/pom.xml @@ -0,0 +1,117 @@ + + 4.0.0 + uk.ac.diamond.hdf5 + hdf5-all + 1.10.10-SNAPSHOT + bundle + + Diamond Light Source + + HDF5 Java Native Bindings + Wrapping of HDF5 Java API containing native libries and several HDF5 plugins + https://github.com/DiamondLightSource/dawn-hdf5-build + + + BSD 3-Clause License + https://opensource.org/license/bsd-3-clause/ + + + + + Peter Chang + peter.chang@diamond.ac.uk + Diamond Light Source + https://www.diamond.ac.uk + + + + scm:git:git://github.com/DiamondLightSource/dawn-hdf5-build.git + scm:git:ssh://github.com:DiamondLightSource/dawn-hdf5-build.git + https://github.com/DiamondLightSource/dawn-hdf5-build/tree/main + + + UTF-8 + + + + + maven-compiler-plugin + 3.8.1 + + 1.8 + 1.8 + + + + org.apache.felix + maven-bundle-plugin + 5.1.9 + true + + + hdf* + dir + hdf.hdf5lib + lib/linux-x86_64/libhdf5.so; lib/linux-x86_64/libhdf5_java.so;osname=Linux; processor=x86_64, + lib/macosx-x86_64/libhdf5.103.dylib; lib/macosx-x86_64/libhdf5_java.dylib;osname=MacOSX; processor=x86_64, + lib/win32-x86_64/hdf5.dll; lib/win32-x86_64/hdf5_java.dll;osname=Win32; processor=x86_64, + lib/linux-aarch64/libhdf5.so; lib/linux-aarch64/libhdf5_java.so;osname=Linux; processor=aarch64, + lib/macosx-aarch64/libhdf5.103.dylib; lib/macosx-aarch64/libhdf5_java.dylib;osname=MacOSX; processor=aarch64 + ,* + + + + + org.apache.maven.plugins + maven-source-plugin + 3.2.1 + + + + jar + + + + + lib/ + + + ${project.name} Source + hdf.hdf5lib.source + ${project.version} + ${project.organization.name} + hdf.hdf5lib;version="${project.version}" + + + + + + org.apache.maven.plugins + maven-javadoc-plugin + 3.5.0 + + + + jar + + + + + false + + + + + + + + org.slf4j + slf4j-api + 1.7.30 + + + + + diff --git a/java-combined/src/main/resources/META-INF/LICENSE b/java-combined/src/main/resources/META-INF/LICENSE new file mode 100644 index 0000000..961d1f3 --- /dev/null +++ b/java-combined/src/main/resources/META-INF/LICENSE @@ -0,0 +1,28 @@ +BSD 3-Clause License + +Copyright (c) 2023, Diamond Light Source + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are met: + +1. Redistributions of source code must retain the above copyright notice, this + list of conditions and the following disclaimer. + +2. Redistributions in binary form must reproduce the above copyright notice, + this list of conditions and the following disclaimer in the documentation + and/or other materials provided with the distribution. + +3. Neither the name of the copyright holder nor the names of its + contributors may be used to endorse or promote products derived from + this software without specific prior written permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" +AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE +DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE +FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL +DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR +SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER +CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, +OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE +OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/releng/build_codecs.sh b/releng/build_codecs.sh index 2474a54..08cce53 100755 --- a/releng/build_codecs.sh +++ b/releng/build_codecs.sh @@ -78,7 +78,9 @@ download_check_extract_pushd() { exit 1 fi fi + set +e # Allow this to exit with non-zero for win32 strangeness tar xzf $DL_TARBALL + set -e fi pushd $DL_SRC } diff --git a/releng/prepare_java_project.sh b/releng/prepare_java_project.sh new file mode 100755 index 0000000..a673a17 --- /dev/null +++ b/releng/prepare_java_project.sh @@ -0,0 +1,32 @@ +#!/usr/bin/env bash + +set -e + +# Transfom artifacts from platform builds into the structure +# required for the final bundle/jar. + +# Copy native artifacts into Maven resources location +resources_location=java-combined/src/main/resources + +mkdir -pv ${resources_location}/lib/linux-aarch64 +mkdir -pv ${resources_location}/lib/linux-x86_64 +mkdir -pv ${resources_location}/lib/macosx-aarch64 +mkdir -pv ${resources_location}/lib/macosx-x86_64 +mkdir -pv ${resources_location}/lib/win32-x86_64 + +cp -a hdf5-build-linux/*/linux/aarch64/* ${resources_location}/lib/linux-aarch64 +cp -a hdf5-build-linux/*/linux/x86_64/* ${resources_location}/lib/linux-x86_64 +cp -a hdf5-build-macos/*/macos/arm64/* ${resources_location}/lib/macosx-aarch64 +cp -a hdf5-build-macos/*/macos/x86_64/* ${resources_location}/lib/macosx-x86_64 +cp -a hdf5-build-win32/*/win32/x86_64/* ${resources_location}/lib/win32-x86_64 + +# Delete original jars +find ${resources_location}/lib -name *.jar -exec rm -v {} \; + +# Delete unrequired files from java souce +rm java-combined/src/main/java/CMakeLists.txt +rm java-combined/src/main/java/hdf/CMakeLists.txt +rm java-combined/src/main/java/hdf/hdf5lib/CMakeLists.txt +rm java-combined/src/main/java/Makefile.am +rm java-combined/src/main/java/Makefile.in +rm -r java-combined/src/main/java/jni