Skip to content

Commit 1c0aee7

Browse files
authored
build: upgrade Unity to support Android 16KB page sizes (#1409)
* build: upgrade unity to support NDK23+ * build: remove unused 2d dependencies * fix: keep using an old version of Unity to build packages on CI
1 parent f7d125f commit 1c0aee7

File tree

11 files changed

+135
-116
lines changed

11 files changed

+135
-116
lines changed

.github/ISSUE_TEMPLATE/bug_report.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ body:
2424
id: unity_version
2525
attributes:
2626
label: Unity Version
27-
placeholder: 6000.0.33f1
27+
placeholder: 6000.0.58f2
2828
validations:
2929
required: true
3030

.github/ISSUE_TEMPLATE/build-install-issue.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ body:
2424
id: unity_version
2525
attributes:
2626
label: Unity Version
27-
placeholder: 6000.0.33f1
27+
placeholder: 6000.0.58f2
2828
validations:
2929
required: true
3030

.github/ISSUE_TEMPLATE/support.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ body:
2525
id: unity_version
2626
attributes:
2727
label: Unity Version
28-
placeholder: 6000.0.33f1
28+
placeholder: 6000.0.58f2
2929
validations:
3030
required: true
3131

.github/workflows/linux-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ jobs:
106106
os:
107107
- ubuntu-24.04
108108
unityVersion:
109-
- 6000.0.33f1
110-
- 2022.3.55f1
109+
- 6000.0.33f1 # FIXME: use >= 6000.0.58f2
110+
- 2022.3.55f1 # FIXME: use >= 2022.3.62f2
111111
steps:
112112
- name: Install UnityEditor
113113
run: |

.github/workflows/macos-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,8 +98,8 @@ jobs:
9898
os:
9999
- macos-13
100100
unity:
101-
- { version: "6000.0.33f1", changeset: "433b0a79340b" }
102-
- { version: "2022.3.55f1", changeset: "9f374180d209" }
101+
- { version: "6000.0.33f1", changeset: "433b0a79340b" } # FIXME: use >= 6000.0.58f2
102+
- { version: "2022.3.55f1", changeset: "9f374180d209" } # FIXME: use >= 2022.3.62f2
103103
steps:
104104
- name: Install UnityEditor
105105
run: |

.github/workflows/package.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,7 @@ jobs:
218218
- name: Install UnityEditor
219219
if: ${{ env.BUILD_UNITYPACKAGE == '1' }}
220220
run: |
221+
# FIXME: use >= 6000.0.58f2
221222
sudo docker cp $(docker create --rm unityci/editor:6000.0.33f1-base-3):/opt/unity /opt/unity
222223
sudo chown -R $(id -u):$(id -g) /opt/unity
223224
@@ -291,6 +292,17 @@ jobs:
291292
run: |
292293
rm MediaPipeUnityPlugin-all.zip
293294
295+
# NOTE: a workaround to keep using Unity 6000.0.33f1
296+
- name: Patch dependencies
297+
run: |
298+
echo "$(jq '.dependencies["com.unity.test-framework"] = "1.4.5"' Packages/manifest.json)" > Packages/manifest.json
299+
echo "$(jq '
300+
.dependencies["com.unity.test-framework"].version = "1.4.5" |
301+
.dependencies["com.unity.test-framework"].source = "registry" |
302+
.dependencies["com.unity.test-framework"].url = "https://packages.unity.com"
303+
' Packages/packages-lock.json)" > Packages/packages-lock.json
304+
305+
294306
# NOTE: this step will overwrite AppSettings.asset
295307
- name: Export unitypackage
296308
if: ${{ env.BUILD_UNITYPACKAGE == '1' }}

.github/workflows/windows-test.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -92,8 +92,8 @@ jobs:
9292
os:
9393
- windows-2022
9494
unity:
95-
- { version: "6000.0.33f1", changeset: "433b0a79340b" }
96-
- { version: "2022.3.55f1", changeset: "9f374180d209" }
95+
- { version: "6000.0.33f1", changeset: "433b0a79340b" } # FIXME: use >= 6000.0.58f2
96+
- { version: "2022.3.55f1", changeset: "9f374180d209" } # FIXME: use >= 2022.3.62f2
9797
steps:
9898
- name: Install UnityHub
9999
uses: crazy-max/ghaction-chocolatey@v3

Assets/Plugins/Android/mainTemplate.gradle

Lines changed: 77 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -42,10 +42,83 @@ android {
4242
}**PACKAGING**
4343

4444
// Include libc++_shared.so
45-
task copyLibcppShared(type: Copy) {
46-
def ndkDir = android.ndkDirectory
47-
from("$ndkDir/sources/cxx-stl/llvm-libc++/libs") { include '**/libc++_shared.so' }
48-
into("$projectDir/src/main/jniLibs")
45+
task copyLibcppShared {
46+
doLast {
47+
def ndkDir = android.ndkDirectory
48+
def abiFilters = android.defaultConfig.ndk.abiFilters
49+
def destDir = file("$projectDir/src/main/jniLibs")
50+
51+
// Mapping from ABI to architecture triple (for NDK 23+)
52+
def abiToTriple = [
53+
'arm64-v8a': 'aarch64-linux-android',
54+
'armeabi-v7a': 'arm-linux-androideabi',
55+
'x86': 'i686-linux-android',
56+
'x86_64': 'x86_64-linux-android',
57+
'riscv64': 'riscv64-linux-android'
58+
]
59+
60+
// Find the prebuilt directory (usually there's only one)
61+
def prebuiltDir = null
62+
def prebuiltBase = file("$ndkDir/toolchains/llvm/prebuilt")
63+
if (prebuiltBase.exists()) {
64+
def prebuiltDirs = prebuiltBase.listFiles()?.findAll { it.isDirectory() }
65+
if (prebuiltDirs && prebuiltDirs.size() > 0) {
66+
prebuiltDir = prebuiltDirs[0]
67+
}
68+
}
69+
70+
abiFilters.each { abi ->
71+
def copied = false
72+
73+
// Try NDK 23+ path first
74+
if (prebuiltDir != null) {
75+
def triple = abiToTriple[abi]
76+
if (triple != null) {
77+
def libcppPath = file("$prebuiltDir/sysroot/usr/lib/$triple/libc++_shared.so")
78+
if (libcppPath.exists()) {
79+
def destAbiDir = file("$destDir/$abi")
80+
copy {
81+
from libcppPath
82+
into destAbiDir
83+
}
84+
copied = true
85+
}
86+
}
87+
}
88+
89+
// Fallback to old NDK path (NDK 22 and earlier)
90+
if (!copied) {
91+
def libcppPath = file("$ndkDir/sources/cxx-stl/llvm-libc++/libs/$abi/libc++_shared.so")
92+
if (libcppPath.exists()) {
93+
def destAbiDir = file("$destDir/$abi")
94+
copy {
95+
from libcppPath
96+
into destAbiDir
97+
}
98+
copied = true
99+
}
100+
}
101+
102+
if (!copied) {
103+
logger.warn("Could not find libc++_shared.so for $abi in NDK")
104+
}
105+
}
106+
}
107+
}
108+
109+
task cleanCopyLibcppShared {
110+
doLast {
111+
def destDir = file("$projectDir/src/main/jniLibs")
112+
def abiFilters = android.defaultConfig.ndk.abiFilters
113+
114+
abiFilters.each { abi ->
115+
def libcppFile = file("$destDir/$abi/libc++_shared.so")
116+
if (libcppFile.exists()) {
117+
libcppFile.delete()
118+
println "Deleted libc++_shared.so for $abi"
119+
}
120+
}
121+
}
49122
}
50123
clean.dependsOn 'cleanCopyLibcppShared'
51124

Packages/manifest.json

Lines changed: 8 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,16 @@
11
{
22
"dependencies": {
3-
"com.unity.2d.animation": "10.1.4",
4-
"com.unity.2d.pixel-perfect": "5.0.3",
5-
"com.unity.2d.psdimporter": "9.0.3",
6-
"com.unity.2d.sprite": "1.0.0",
7-
"com.unity.2d.spriteshape": "10.0.7",
8-
"com.unity.2d.tilemap": "1.0.0",
9-
"com.unity.ai.navigation": "2.0.5",
10-
"com.unity.collab-proxy": "2.6.0",
11-
"com.unity.ide.rider": "3.0.31",
12-
"com.unity.ide.visualstudio": "2.0.22",
3+
"com.unity.ai.navigation": "2.0.9",
4+
"com.unity.collab-proxy": "2.9.3",
5+
"com.unity.ide.rider": "3.0.38",
6+
"com.unity.ide.visualstudio": "2.0.23",
137
"com.unity.mathematics": "1.3.2",
14-
"com.unity.memoryprofiler": "1.1.1",
8+
"com.unity.memoryprofiler": "1.1.8",
159
"com.unity.multiplayer.center": "1.0.0",
16-
"com.unity.settings-manager": "2.0.1",
17-
"com.unity.test-framework": "1.4.5",
10+
"com.unity.settings-manager": "2.1.0",
11+
"com.unity.test-framework": "1.5.1",
1812
"com.unity.testtools.codecoverage": "1.2.6",
19-
"com.unity.timeline": "1.8.7",
13+
"com.unity.timeline": "1.8.9",
2014
"com.unity.toolchain.linux-x86_64": "2.0.10",
2115
"com.unity.toolchain.macos-x86_64-linux-x86_64": "2.0.10",
2216
"com.unity.ugui": "2.0.0",

Packages/packages-lock.json

Lines changed: 27 additions & 87 deletions
Original file line numberDiff line numberDiff line change
@@ -9,77 +9,8 @@
99
"com.unity.test-framework": "1.0.0"
1010
}
1111
},
12-
"com.unity.2d.animation": {
13-
"version": "10.1.4",
14-
"depth": 0,
15-
"source": "registry",
16-
"dependencies": {
17-
"com.unity.2d.common": "9.0.7",
18-
"com.unity.2d.sprite": "1.0.0",
19-
"com.unity.collections": "1.2.4",
20-
"com.unity.modules.animation": "1.0.0",
21-
"com.unity.modules.uielements": "1.0.0"
22-
},
23-
"url": "https://packages.unity.com"
24-
},
25-
"com.unity.2d.common": {
26-
"version": "9.0.7",
27-
"depth": 1,
28-
"source": "registry",
29-
"dependencies": {
30-
"com.unity.burst": "1.8.4",
31-
"com.unity.2d.sprite": "1.0.0",
32-
"com.unity.mathematics": "1.1.0",
33-
"com.unity.modules.animation": "1.0.0",
34-
"com.unity.modules.uielements": "1.0.0"
35-
},
36-
"url": "https://packages.unity.com"
37-
},
38-
"com.unity.2d.pixel-perfect": {
39-
"version": "5.0.3",
40-
"depth": 0,
41-
"source": "registry",
42-
"dependencies": {},
43-
"url": "https://packages.unity.com"
44-
},
45-
"com.unity.2d.psdimporter": {
46-
"version": "9.0.3",
47-
"depth": 0,
48-
"source": "registry",
49-
"dependencies": {
50-
"com.unity.2d.common": "9.0.4",
51-
"com.unity.2d.sprite": "1.0.0"
52-
},
53-
"url": "https://packages.unity.com"
54-
},
55-
"com.unity.2d.sprite": {
56-
"version": "1.0.0",
57-
"depth": 0,
58-
"source": "builtin",
59-
"dependencies": {}
60-
},
61-
"com.unity.2d.spriteshape": {
62-
"version": "10.0.7",
63-
"depth": 0,
64-
"source": "registry",
65-
"dependencies": {
66-
"com.unity.2d.common": "9.0.7",
67-
"com.unity.mathematics": "1.1.0",
68-
"com.unity.modules.physics2d": "1.0.0"
69-
},
70-
"url": "https://packages.unity.com"
71-
},
72-
"com.unity.2d.tilemap": {
73-
"version": "1.0.0",
74-
"depth": 0,
75-
"source": "builtin",
76-
"dependencies": {
77-
"com.unity.modules.tilemap": "1.0.0",
78-
"com.unity.modules.uielements": "1.0.0"
79-
}
80-
},
8112
"com.unity.ai.navigation": {
82-
"version": "2.0.5",
13+
"version": "2.0.9",
8314
"depth": 0,
8415
"source": "registry",
8516
"dependencies": {
@@ -88,8 +19,8 @@
8819
"url": "https://packages.unity.com"
8920
},
9021
"com.unity.burst": {
91-
"version": "1.8.18",
92-
"depth": 2,
22+
"version": "1.8.24",
23+
"depth": 1,
9324
"source": "registry",
9425
"dependencies": {
9526
"com.unity.mathematics": "1.2.1",
@@ -98,7 +29,7 @@
9829
"url": "https://packages.unity.com"
9930
},
10031
"com.unity.collab-proxy": {
101-
"version": "2.6.0",
32+
"version": "2.9.3",
10233
"depth": 0,
10334
"source": "registry",
10435
"dependencies": {},
@@ -126,12 +57,11 @@
12657
"com.unity.ext.nunit": {
12758
"version": "2.0.5",
12859
"depth": 1,
129-
"source": "registry",
130-
"dependencies": {},
131-
"url": "https://packages.unity.com"
60+
"source": "builtin",
61+
"dependencies": {}
13262
},
13363
"com.unity.ide.rider": {
134-
"version": "3.0.31",
64+
"version": "3.0.38",
13565
"depth": 0,
13666
"source": "registry",
13767
"dependencies": {
@@ -140,7 +70,7 @@
14070
"url": "https://packages.unity.com"
14171
},
14272
"com.unity.ide.visualstudio": {
143-
"version": "2.0.22",
73+
"version": "2.0.23",
14474
"depth": 0,
14575
"source": "registry",
14676
"dependencies": {
@@ -156,10 +86,14 @@
15686
"url": "https://packages.unity.com"
15787
},
15888
"com.unity.memoryprofiler": {
159-
"version": "1.1.1",
89+
"version": "1.1.8",
16090
"depth": 0,
16191
"source": "registry",
16292
"dependencies": {
93+
"com.unity.burst": "1.8.0",
94+
"com.unity.collections": "1.2.3",
95+
"com.unity.mathematics": "1.2.1",
96+
"com.unity.profiling.core": "1.0.0",
16397
"com.unity.editorcoroutines": "1.0.0"
16498
},
16599
"url": "https://packages.unity.com"
@@ -179,8 +113,15 @@
179113
"dependencies": {},
180114
"url": "https://packages.unity.com"
181115
},
116+
"com.unity.profiling.core": {
117+
"version": "1.0.2",
118+
"depth": 1,
119+
"source": "registry",
120+
"dependencies": {},
121+
"url": "https://packages.unity.com"
122+
},
182123
"com.unity.settings-manager": {
183-
"version": "2.0.1",
124+
"version": "2.1.0",
184125
"depth": 0,
185126
"source": "registry",
186127
"dependencies": {},
@@ -203,22 +144,21 @@
203144
"url": "https://packages.unity.com"
204145
},
205146
"com.unity.test-framework": {
206-
"version": "1.4.5",
147+
"version": "1.5.1",
207148
"depth": 0,
208-
"source": "registry",
149+
"source": "builtin",
209150
"dependencies": {
210151
"com.unity.ext.nunit": "2.0.3",
211152
"com.unity.modules.imgui": "1.0.0",
212153
"com.unity.modules.jsonserialize": "1.0.0"
213-
},
214-
"url": "https://packages.unity.com"
154+
}
215155
},
216156
"com.unity.test-framework.performance": {
217-
"version": "3.0.3",
157+
"version": "3.1.0",
218158
"depth": 2,
219159
"source": "registry",
220160
"dependencies": {
221-
"com.unity.test-framework": "1.1.31",
161+
"com.unity.test-framework": "1.1.33",
222162
"com.unity.modules.jsonserialize": "1.0.0"
223163
},
224164
"url": "https://packages.unity.com"
@@ -234,7 +174,7 @@
234174
"url": "https://packages.unity.com"
235175
},
236176
"com.unity.timeline": {
237-
"version": "1.8.7",
177+
"version": "1.8.9",
238178
"depth": 0,
239179
"source": "registry",
240180
"dependencies": {

0 commit comments

Comments
 (0)