Skip to content

Commit defea62

Browse files
committed
Revert "Let's try cross-compiling"
This reverts commit c07b0c1.
1 parent dc7924e commit defea62

File tree

2 files changed

+47
-5
lines changed

2 files changed

+47
-5
lines changed

.github/workflows/ci.yml

Lines changed: 37 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,41 @@ 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
1045
build-windows:
1146
environment: UnityTranslate Build
1247
runs-on: windows-latest
@@ -21,7 +56,6 @@ jobs:
2156
- uses: actions-rust-lang/setup-rust-toolchain@v1
2257
with:
2358
rustflags: ''
24-
target: 'x86_64-unknown-linux-gnu'
2559
# Taken from https://github.com/CaffeineMC/sodium-fabric/blob/1.19.3/dev/.github/workflows/gradle.yml
2660
- name: Cache/Uncache
2761
uses: actions/cache@v4
@@ -34,12 +68,12 @@ jobs:
3468
restore-keys: |
3569
${{ runner.os }}-gradle-
3670
- name: Build and publish artifacts
37-
run: ./gradlew publish
71+
run: ./gradlew :native:publish
3872
env:
3973
MAVEN_USER: ${{ secrets.MAVEN_USER }}
4074
MAVEN_PASS: ${{ secrets.MAVEN_PASS }}
4175
- name: Upload build artifacts
4276
uses: actions/upload-artifact@v4
4377
with:
44-
name: Natives JAR
78+
name: Windows x86-64 Natives
4579
path: native/build/libs/UnityTranslateLib-*.jar

native/build.gradle.kts

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

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

168171
val args = mutableListOf(
169172
"build", "--release",
@@ -198,6 +201,9 @@ tasks {
198201
for (target in RUST_TARGETS) {
199202
val utNativesDir = nativesDir.dir("unitytranslate").dir("${target.systemName}-${target.architecture}")
200203

204+
if (!target.isHost())
205+
continue
206+
201207
if (!utNativesDir.asFile.exists())
202208
utNativesDir.asFile.mkdirs()
203209

@@ -234,7 +240,9 @@ tasks {
234240
}
235241

236242
jar {
243+
val target = RUST_TARGETS.first { it.isHost() }
244+
237245
archiveBaseName.set("UnityTranslateLib")
238-
archiveClassifier.set("natives")
246+
archiveClassifier.set("natives-${target.systemName}-${target.architecture}")
239247
}
240248
}

0 commit comments

Comments
 (0)