Skip to content

Commit 1c08868

Browse files
committed
[Build] Change comparison for binary libraries
Instead of size we will compare hash of the `imgui-binding/src/main` folder.
1 parent c71ed6f commit 1c08868

File tree

4 files changed

+31
-36
lines changed

4 files changed

+31
-36
lines changed

.github/workflows/ci.yml

Lines changed: 14 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@ name: CI
22
on: [ push, pull_request ]
33
jobs:
44
build-java:
5-
strategy:
6-
matrix:
7-
os: [ ubuntu-latest, macos-latest ]
85
name: Build Java
9-
runs-on: ${{ matrix.os }}
6+
runs-on: ubuntu-latest
107
steps:
118
- name: Checkout Repository
129
uses: actions/checkout@v3
@@ -33,6 +30,7 @@ jobs:
3330
imgui-lwjgl3/build/libs/*.jar
3431
3532
build-natives:
33+
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
3634
strategy:
3735
matrix:
3836
os: [ ubuntu-latest, macos-latest ]
@@ -52,7 +50,6 @@ jobs:
5250
type: windows
5351
- os: macos-latest
5452
type: linux
55-
name: Build Native (${{ matrix.type }}${{ matrix.freetype && ', freetype' || '' }})
5653
runs-on: ${{ matrix.os }}
5754
steps:
5855
- name: Checkout Repository and Submodules
@@ -113,25 +110,27 @@ jobs:
113110
with:
114111
path: /tmp/artifacts
115112

116-
- name: Equal Artifacts
117-
id: equal-artifacts
113+
# Job compares sha1 hash of the imgui-binding/src/main directory.
114+
# If there are any changes, then we update native libraries.
115+
# We do not rely on git in terms of comparing binaries,
116+
# since DLL files will always have versioning difference.
117+
- name: Compare Binding Hash
118+
id: cmp-binding-hash
118119
continue-on-error: true
119120
run: |
120-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/imgui-java64.dll bin/imgui-java64.dll
121-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.dylib bin/libimgui-java64.dylib
122-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries/libimgui-java64.so bin/libimgui-java64.so
123-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/imgui-java64.dll bin/freetype/imgui-java64.dll
124-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.dylib bin/freetype/libimgui-java64.dylib
125-
python3 buildSrc/scripts/equal_file_size.py /tmp/artifacts/native-libraries-with-freetype/libimgui-java64.so bin/freetype/libimgui-java64.so
121+
touch bin/binding.sha1
122+
cat bin/binding.sha1 > /tmp/hash
123+
ls -alR imgui-binding/src/main | sha1sum > bin/binding.sha1
124+
cmp /tmp/hash bin/binding.sha1
126125
127126
- name: Update
128-
if: steps.equal-artifacts.outcome != 'success'
127+
if: steps.cmp-binding-hash.outcome != 'success'
129128
run: |
130129
mv /tmp/artifacts/native-libraries/* bin/
131130
mv /tmp/artifacts/native-libraries-with-freetype/* bin/freetype/
132131
133132
- name: Commit
134-
if: steps.equal-artifacts.outcome != 'success'
133+
if: steps.cmp-binding-hash.outcome != 'success'
135134
uses: EndBug/add-and-commit@v9
136135
with:
137136
default_author: github_actions

bin/README.md

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Folder contains libraries used by the binding and `binding.sha1` sum of the `imgui-binding/src/main` directory libraries has been built upon.
2+
3+
Provide `imgui.library.path` (or `java.library.path`) VM option to the folder with one of those file (ex: `-Dimgui.library.path=./folder/path`).
4+
In the same way you can use 'java.library.path' option instead.
5+
6+
By default, binding expects `imgui-java64` file name.
7+
You can change that by using `imgui.library.name` VM option (ex: `-Dimgui.library.name=custom-lib-name.dll`).
8+
9+
| OS | Library |
10+
|---------|-----------------------|
11+
| Windows | imgui-java64.dll |
12+
| Linux | libimgui-java64.so |
13+
| macOS | libimgui-java64.dylib |
14+
15+
Freetype directory contains same libraries, but with Freetype support.
16+
17+
Hash sum in the `binding.sha1` file is used in CI to see, if there is a need to update native binaries.

bin/README.txt

Lines changed: 0 additions & 13 deletions
This file was deleted.

buildSrc/scripts/equal_file_size.py

Lines changed: 0 additions & 8 deletions
This file was deleted.

0 commit comments

Comments
 (0)