Skip to content

Commit c07b0c1

Browse files
committed
Let's try cross-compiling
1 parent 0d9e444 commit c07b0c1

File tree

2 files changed

+5
-47
lines changed

2 files changed

+5
-47
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -7,41 +7,6 @@ permissions:
77
contents: read
88

99
jobs:
10-
build-linux:
11-
environment: UnityTranslate Build
12-
runs-on: ubuntu-latest
13-
14-
steps:
15-
- uses: actions/checkout@v4
16-
- name: Set up JDK 17
17-
uses: actions/setup-java@v3
18-
with:
19-
java-version: '17'
20-
distribution: 'temurin'
21-
- uses: actions-rust-lang/setup-rust-toolchain@v1
22-
with:
23-
rustflags: ''
24-
# Taken from https://github.com/CaffeineMC/sodium-fabric/blob/1.19.3/dev/.github/workflows/gradle.yml
25-
- name: Cache/Uncache
26-
uses: actions/cache@v4
27-
with:
28-
path: |
29-
~/.gradle/caches
30-
~/.gradle/loom-cache
31-
~/.gradle/wrapper
32-
key: ${{ runner.os }}-gradle-${{ hashFiles('**/gradle-wrapper.properties') }}
33-
restore-keys: |
34-
${{ runner.os }}-gradle-
35-
- name: Build and publish artifacts
36-
run: ./gradlew publish
37-
env:
38-
MAVEN_USER: ${{ secrets.MAVEN_USER }}
39-
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
40-
- name: Upload build artifacts
41-
uses: actions/upload-artifact@v4
42-
with:
43-
name: Linux x86-64 Natives
44-
path: native/build/libs/UnityTranslateLib-*.jar
4510
build-windows:
4611
environment: UnityTranslate Build
4712
runs-on: windows-latest
@@ -56,6 +21,7 @@ jobs:
5621
- uses: actions-rust-lang/setup-rust-toolchain@v1
5722
with:
5823
rustflags: ''
24+
target: 'x86_64-unknown-linux-gnu'
5925
# Taken from https://github.com/CaffeineMC/sodium-fabric/blob/1.19.3/dev/.github/workflows/gradle.yml
6026
- name: Cache/Uncache
6127
uses: actions/cache@v4
@@ -68,12 +34,12 @@ jobs:
6834
restore-keys: |
6935
${{ runner.os }}-gradle-
7036
- name: Build and publish artifacts
71-
run: ./gradlew :native:publish
37+
run: ./gradlew publish
7238
env:
7339
MAVEN_USER: ${{ secrets.MAVEN_USER }}
7440
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
7541
- name: Upload build artifacts
7642
uses: actions/upload-artifact@v4
7743
with:
78-
name: Windows x86-64 Natives
44+
name: Natives JAR
7945
path: native/build/libs/UnityTranslateLib-*.jar

native/build.gradle.kts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -162,11 +162,8 @@ tasks {
162162

163163
doFirst {
164164
for (target in RUST_TARGETS) {
165-
if (!target.isHost()) // TODO: figure out cross-compilation.
166-
continue
167-
168165
execOperations.exec {
169-
commandLine(if (target.isHost()) "cargo" else "cross")
166+
commandLine("cargo")
170167

171168
val args = mutableListOf(
172169
"build", "--release",
@@ -201,9 +198,6 @@ tasks {
201198
for (target in RUST_TARGETS) {
202199
val utNativesDir = nativesDir.dir("unitytranslate").dir("${target.systemName}-${target.architecture}")
203200

204-
if (!target.isHost())
205-
continue
206-
207201
if (!utNativesDir.asFile.exists())
208202
utNativesDir.asFile.mkdirs()
209203

@@ -240,9 +234,7 @@ tasks {
240234
}
241235

242236
jar {
243-
val target = RUST_TARGETS.first { it.isHost() }
244-
245237
archiveBaseName.set("UnityTranslateLib")
246-
archiveClassifier.set("natives-${target.systemName}-${target.architecture}")
238+
archiveClassifier.set("natives")
247239
}
248240
}

0 commit comments

Comments
 (0)