Skip to content

Commit 301f596

Browse files
committed
Initial commit
0 parents  commit 301f596

57 files changed

Lines changed: 22207 additions & 0 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/build.yml

Lines changed: 114 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,114 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
paths-ignore:
6+
- 'README.md'
7+
branches: [ "main" ]
8+
pull_request:
9+
paths-ignore:
10+
- 'README.md'
11+
branches: [ "main" ]
12+
workflow_dispatch:
13+
14+
jobs:
15+
build:
16+
name: Build (${{ matrix.os }})
17+
runs-on: ${{ matrix.os }}
18+
defaults:
19+
run:
20+
shell: bash
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
include:
25+
- os: windows-latest
26+
cli: packobf_cli.exe
27+
java-lib: rust.dll
28+
- os: macos-latest
29+
cli: packobf_cli
30+
java-lib: librust.dylib
31+
- os: ubuntu-latest
32+
cli: packobf_cli
33+
java-lib: librust.so
34+
steps:
35+
- name: Checkout sources
36+
uses: actions/checkout@v4
37+
- name: Install Rust
38+
uses: dtolnay/rust-toolchain@stable
39+
with:
40+
toolchain: stable
41+
- name: Rust Cache
42+
uses: Swatinem/rust-cache@v2
43+
- uses: taiki-e/install-action@v2
44+
with:
45+
tool: cargo-about
46+
- name: Build
47+
run: cargo build --release
48+
- name: Prepare License
49+
run: cargo about generate about.hbs | perl -0777 -pe 's/\s+$/\n/' | tee -a LICENSE.md > /dev/null
50+
- name: Prepare CLI Executable
51+
# Always make sure files that are published contain the license files
52+
run: |
53+
mkdir -p dist
54+
cp target/release/${{ matrix.cli }} dist/
55+
cp LICENSE.md dist/
56+
- name: Upload CLI Executable
57+
uses: actions/upload-artifact@v4
58+
with:
59+
name: cli-${{ matrix.os }}
60+
path: dist/*
61+
- name: Prepare Java Native Library
62+
run: |
63+
rm -rf dist && mkdir -p dist
64+
cp target/release/${{ matrix.java-lib }} dist/
65+
cp LICENSE.md dist/
66+
- name: Upload Java Native Library
67+
uses: actions/upload-artifact@v4
68+
with:
69+
name: java-lib-${{ matrix.os }}
70+
path: dist/*
71+
buildJava:
72+
name: Build Java Library
73+
runs-on: ubuntu-latest
74+
needs: build
75+
steps:
76+
- name: Checkout sources
77+
uses: actions/checkout@v4
78+
- name: Setup Java
79+
uses: graalvm/setup-graalvm@v1
80+
with:
81+
java-version: '21'
82+
distribution: 'graalvm'
83+
cache: 'gradle'
84+
- name: Download Linux native
85+
uses: actions/download-artifact@v4
86+
with:
87+
name: java-lib-ubuntu-latest
88+
path: artifacts/native/linux
89+
- name: Download MacOS native
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: java-lib-macos-latest
93+
path: artifacts/native/macos
94+
- name: Download Windows native
95+
uses: actions/download-artifact@v4
96+
with:
97+
name: java-lib-windows-latest
98+
path: artifacts/native/windows
99+
- name: Copy native libraries
100+
run: |
101+
mkdir -p java/build/external-natives
102+
cp artifacts/native/linux/librust.so java/build/external-natives/
103+
cp artifacts/native/macos/librust.dylib java/build/external-natives/
104+
cp artifacts/native/windows/rust.dll java/build/external-natives/
105+
cp artifacts/native/linux/LICENSE.md java/build/external-natives/
106+
- name: Build
107+
run: |
108+
cd java
109+
./gradlew build
110+
- name: Upload jar
111+
uses: actions/upload-artifact@v4
112+
with:
113+
name: java-package
114+
path: java/build/libs/*.jar

.gitignore

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
target
2+
.idea
3+
4+
# keep your zip files!
5+
**/*.zip

0 commit comments

Comments
 (0)