[Build] Change comparison for binary libraries
Instead of size we will compare hash of the `imgui-binding/src/main` folder.
This commit is contained in:
4 files changed
+31
-36
No files matched your search
+14
-15
@@ -2,11 +2,8 @@ name: CI
|
|||||||
on: [ push, pull_request ]
|
on: [ push, pull_request ]
|
||||||
jobs:
|
jobs:
|
||||||
build-java:
|
build-java:
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
os: [ ubuntu-latest, macos-latest ]
|
|
||||||
name: Build Java
|
name: Build Java
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository
|
- name: Checkout Repository
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@@ -33,6 +30,7 @@ jobs:
|
|||||||
imgui-lwjgl3/build/libs/*.jar
|
imgui-lwjgl3/build/libs/*.jar
|
||||||
|
|
||||||
build-natives:
|
build-natives:
|
||||||
|
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
os: [ ubuntu-latest, macos-latest ]
|
os: [ ubuntu-latest, macos-latest ]
|
||||||
@@ -52,7 +50,6 @@ jobs:
|
|||||||
type: windows
|
type: windows
|
||||||
- os: macos-latest
|
- os: macos-latest
|
||||||
type: linux
|
type: linux
|
||||||
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
|
|
||||||
runs-on: ${{ matrix.os }}
|
runs-on: ${{ matrix.os }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout Repository and Submodules
|
- name: Checkout Repository and Submodules
|
||||||
@@ -113,25 +110,27 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
path: /tmp/artifacts
|
path: /tmp/artifacts
|
||||||
|
|
||||||
- name: Equal Artifacts
|
# Job compares sha1 hash of the imgui-binding/src/main directory.
|
||||||
id: equal-artifacts
|
# If there are any changes, then we update native libraries.
|
||||||
|
# We do not rely on git in terms of comparing binaries,
|
||||||
|
# since DLL files will always have versioning difference.
|
||||||
|
- name: Compare Binding Hash
|
||||||
|
id: cmp-binding-hash
|
||||||
continue-on-error: true
|
continue-on-error: true
|
||||||
run: |
|
run: |
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/imgui-java64.dll bin/imgui-java64.dll
|
touch bin/binding.sha1
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.dylib bin/libimgui-java64.dylib
|
cat bin/binding.sha1 > /tmp/hash
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.so bin/libimgui-java64.so
|
find imgui-binding/src/main -type f -print0 | xargs -0 sha1sum > bin/binding.sha1
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/imgui-java64.dll bin/freetype/imgui-java64.dll
|
cmp /tmp/hash bin/binding.sha1
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.dylib bin/freetype/libimgui-java64.dylib
|
|
||||||
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.so bin/freetype/libimgui-java64.so
|
|
||||||
|
|
||||||
- name: Update
|
- name: Update
|
||||||
if: steps.equal-artifacts.outcome != 'success'
|
if: steps.cmp-binding-hash.outcome != 'success'
|
||||||
run: |
|
run: |
|
||||||
mv /tmp/artifacts/native-libraries/* bin/
|
mv /tmp/artifacts/native-libraries/* bin/
|
||||||
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
|
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
|
||||||
|
|
||||||
- name: Commit
|
- name: Commit
|
||||||
if: steps.equal-artifacts.outcome != 'success'
|
if: steps.cmp-binding-hash.outcome != 'success'
|
||||||
uses: EndBug/add-and-commit@v9
|
uses: EndBug/add-and-commit@v9
|
||||||
with:
|
with:
|
||||||
default_author: github_actions
|
default_author: github_actions
|
||||||
|
|||||||
@@ -0,0 +1,17 @@
|
|||||||
|
Folder contains libraries used by the binding and `binding.sha1` sum of the `imgui-binding/src/main` directory libraries has been built upon.
|
||||||
|
|
||||||
|
Provide `imgui.library.path` (or `java.library.path`) VM option to the folder with one of those file (ex: `-Dimgui.library.path=./folder/path`).
|
||||||
|
In the same way you can use 'java.library.path' option instead.
|
||||||
|
|
||||||
|
By default, binding expects `imgui-java64` file name.
|
||||||
|
You can change that by using `imgui.library.name` VM option (ex: `-Dimgui.library.name=custom-lib-name.dll`).
|
||||||
|
|
||||||
|
| OS | Library |
|
||||||
|
|---------|-----------------------|
|
||||||
|
| Windows | imgui-java64.dll |
|
||||||
|
| Linux | libimgui-java64.so |
|
||||||
|
| macOS | libimgui-java64.dylib |
|
||||||
|
|
||||||
|
Freetype directory contains same libraries, but with Freetype support.
|
||||||
|
|
||||||
|
Hash sum in the `binding.sha1` file is used in CI to see, if there is a need to update native binaries.
|
||||||
@@ -1,13 +0,0 @@
|
|||||||
Folder contains libraries used by the binding.
|
|
||||||
|
|
||||||
Provide 'imgui.library.path' VM option to the folder with one of those file (ex: -Dimgui.library.path=./some/folder).
|
|
||||||
In the same way you can use 'java.library.path' option instead.
|
|
||||||
|
|
||||||
By default binding expects 'imgui-java64' file name.
|
|
||||||
You can change that by using 'imgui.library.name' VM option (ex: -Dimgui.library.name=custom-lib-name).
|
|
||||||
|
|
||||||
- imgui-java64.dll << Windows
|
|
||||||
- libimgui-java64.so << Linux
|
|
||||||
- libimgui-java64.dylib << MacOS
|
|
||||||
|
|
||||||
Freetype folder contains same libraries, but with Freetype support.
|
|
||||||
@@ -1,8 +0,0 @@
|
|||||||
import sys
|
|
||||||
import os
|
|
||||||
|
|
||||||
# A python script to compare file size of two files.
|
|
||||||
# Used to compare sizes of binaries to see, if there is a difference between them.
|
|
||||||
# Shell scripts are not used, since Python is a more portable solution.
|
|
||||||
|
|
||||||
os.path.getsize(sys.argv[1]) == os.path.getsize(sys.argv[2]) if sys.exit(0) else sys.exit(1)
|
|
||||||
Reference in new issue
Block a user