Skip to content

Commit 330689e

Browse files
committed
setup build script for generating natives
1 parent 0dfbf53 commit 330689e

File tree

5 files changed

+120
-12
lines changed

5 files changed

+120
-12
lines changed

.github/workflows/rust.yml

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
on:
2+
pull_request:
3+
push:
4+
branches:
5+
- main
6+
7+
env:
8+
CARGO_TERM_COLOR: always
9+
10+
jobs:
11+
fmt:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
- uses: dtolnay/rust-toolchain@stable
16+
with:
17+
components: rustfmt
18+
- run: cargo fmt --check
19+
20+
taplo:
21+
runs-on: ubuntu-latest
22+
steps:
23+
- uses: actions/checkout@v4
24+
- uses: uncenter/setup-taplo@v1
25+
with:
26+
version: "0.8.1"
27+
- run: taplo fmt --check
28+
29+
typos:
30+
runs-on: ubuntu-latest
31+
steps:
32+
- uses: actions/checkout@v4
33+
- uses: crate-ci/typos@master
34+
35+
shear:
36+
runs-on: ubuntu-latest
37+
steps:
38+
- uses: actions/checkout@v4
39+
- uses: dtolnay/rust-toolchain@stable
40+
- uses: cargo-bins/cargo-binstall@main
41+
- run: cargo binstall --no-confirm cargo-shear
42+
- run: cargo shear
43+
44+
clippy:
45+
runs-on: ubuntu-latest
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: dtolnay/rust-toolchain@stable
49+
with:
50+
components: clippy
51+
- run: cargo clippy --workspace --all-features -- -Dwarnings
52+
53+
doc:
54+
runs-on: ubuntu-latest
55+
env:
56+
RUSTDOCFLAGS: "-Dwarnings"
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: dtolnay/rust-toolchain@stable
60+
- run: cargo doc --workspace --all-features
61+
62+
check:
63+
runs-on: ubuntu-latest
64+
steps:
65+
- uses: actions/checkout@v4
66+
- uses: dtolnay/rust-toolchain@stable
67+
- uses: ./.github/actions/install-bevy-deps
68+
- run: cargo check --workspace --all-features
69+
70+
test:
71+
runs-on: ubuntu-latest
72+
env:
73+
RUST_BACKTRACE: 1
74+
steps:
75+
- uses: actions/checkout@v4
76+
- uses: dtolnay/rust-toolchain@stable
77+
- run: cargo test --workspace --all-features

Cargo.toml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -106,11 +106,9 @@ zbus = { version = "5.5", default-features = false }
106106
[workspace.metadata.cargo-shear]
107107
ignored = ["bzip2"]
108108

109-
[workspace.metadata.cross.build.env]
110-
volumes = ["LINDERA_CACHE=lindera-cache"]
111-
passthrough = ["CARGO_TARGET_DIR=target/cross"]
112-
113-
[workspace.metadata.cross.target.aarch64-linux-android]
109+
[workspace.metadata.cross.build]
110+
env.volumes = ["LINDERA_CACHE=lindera-cache"]
111+
env.passthrough = ["CARGO_TARGET_DIR=target/cross"]
114112
pre-build = [
115113
"dpkg --add-architecture $CROSS_DEB_ARCH",
116114
"apt-get update && apt-get --assume-yes install libssl-dev:$CROSS_DEB_ARCH",

justfile

Lines changed: 36 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,13 +5,43 @@ bindings:
55
--language kotlin \
66
--out-dir wordbase-android/app/build/generated/
77

8-
build-aarch64 profile="debug":
8+
android-lib rust_target android_target profile="debug":
99
cross build \
10-
--target-dir target/cross \
11-
--target aarch64-linux-android \
10+
--target-dir "target/cross/{{ rust_target }}" \
11+
--target "{{ rust_target }}" \
1212
--package wordbase-sys \
1313
{{ if profile == "release" { "--release" } else { "" } }}
14-
mkdir -p wordbase-android/app/build/generated/lib/arm64-v8a/
14+
mkdir -p "wordbase-android/app/build/generated/lib/{{ android_target }}/"
1515
cp \
16-
target/cross/aarch64-linux-android/{{ profile }}/libwordbase.so \
17-
wordbase-android/app/build/generated/lib/arm64-v8a/
16+
"target/cross/{{ rust_target }}/{{ rust_target }}/{{ profile }}/libwordbase.so" \
17+
"wordbase-android/app/build/generated/lib/{{ android_target }}/"
18+
19+
android-lib-armv7 profile="debug": (android-lib "armv7-linux-androideabi" "armeabi-v7a" profile)
20+
android-lib-aarch64 profile="debug": (android-lib "aarch64-linux-android" "arm64-v8a" profile)
21+
android-lib-x86 profile="debug": (android-lib "i686-linux-android" "x86" profile)
22+
android-lib-x86_64 profile="debug": (android-lib "x86_64-linux-android" "x86_64" profile)
23+
android-libs profile="debug":
24+
echo '\
25+
layout { \
26+
pane split_direction="vertical" { \
27+
pane split_direction="horizontal" { \
28+
pane name="armv7" command="just" { \
29+
args "android-lib-armv7" "{{ profile }}"; \
30+
}; \
31+
pane name="aarch64" command="just" { \
32+
args "android-lib-aarch64" "{{ profile }}"; \
33+
}; \
34+
}; \
35+
pane split_direction="horizontal" { \
36+
pane name="x86" command="just" { \
37+
args "android-lib-x86" "{{ profile }}"; \
38+
}; \
39+
pane name="x86_64" command="just" { \
40+
args "android-lib-x86_64" "{{ profile }}"; \
41+
}; \
42+
}; \
43+
}; \
44+
} \
45+
' > /tmp/wordbase-zellij-run.kdl
46+
-zellij delete-session wordbase
47+
zellij --new-session-with-layout /tmp/wordbase-zellij-run.kdl

wordbase-android/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,6 @@
99
.externalNativeBuild
1010
.cxx
1111
local.properties
12+
13+
app/release
14+
app/build

wordbase-android/app/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ android {
1414
minSdk = 24
1515
targetSdk = 35
1616
versionCode = 1
17-
versionName = "1.0"
17+
versionName = "0.1.0"
1818

1919
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
2020
}

0 commit comments

Comments
 (0)