File tree Expand file tree Collapse file tree 4 files changed +14
-10
lines changed
plugin/src/test/groovy/com/nishtahir Expand file tree Collapse file tree 4 files changed +14
-10
lines changed Original file line number Diff line number Diff line change @@ -13,15 +13,18 @@ class CargoBuildTest extends AbstractTest {
13
13
@Unroll
14
14
def " cargoBuild is invoked with #gradleVersion and Android plugin #androidVersion" () {
15
15
given :
16
+ def ndkVersion = " 21.4.7075529"
16
17
SimpleAndroidApp . builder(temporaryFolder. root, cacheDir)
17
18
.withAndroidVersion(androidVersion)
18
19
.withKotlinDisabled()
20
+ .withNdkVersion(ndkVersion)
19
21
// TODO: .withCargo(...)
20
22
.build()
21
23
.writeProject()
22
24
23
25
SimpleCargoProject . builder(temporaryFolder. root)
24
26
.withTargets([" x86_64" ])
27
+ .selectChannelFromNdkVersion(ndkVersion)
25
28
.build()
26
29
.writeProject()
27
30
Original file line number Diff line number Diff line change @@ -12,10 +12,6 @@ class CargoTargetTest extends AbstractTest {
12
12
given :
13
13
def androidVersion = TestVersions . latestAndroidVersionForCurrentJDK()
14
14
def ndkVersion = " 21.4.7075529"
15
- def ndkVersionMajor = ndkVersion. split(' \\ .' )[0 ] as int
16
- // Toolchain 1.68 or later versions are not compatible to old NDK prior to r23
17
- // https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html
18
- def channel = ndkVersionMajor >= 23 ? " stable" : " 1.67"
19
15
20
16
SimpleAndroidApp . builder(temporaryFolder. root, cacheDir)
21
17
.withAndroidVersion(androidVersion)
@@ -27,7 +23,7 @@ class CargoTargetTest extends AbstractTest {
27
23
28
24
SimpleCargoProject . builder(temporaryFolder. root)
29
25
.withTargets([target])
30
- .withChannel(channel )
26
+ .selectChannelFromNdkVersion(ndkVersion )
31
27
.build()
32
28
.writeProject()
33
29
Original file line number Diff line number Diff line change @@ -13,10 +13,6 @@ class NdkVersionTest extends AbstractTest {
13
13
def androidVersion = TestVersions . latestAndroidVersionForCurrentJDK()
14
14
def target = " x86_64"
15
15
def location = " android/x86_64/librust.so"
16
- def ndkVersionMajor = ndkVersion. split(' \\ .' )[0 ] as int
17
- // Toolchain 1.68 or later versions are not compatible to old NDK prior to r23
18
- // https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html
19
- def channel = ndkVersionMajor >= 23 ? " stable" : " 1.67"
20
16
21
17
SimpleAndroidApp . builder(temporaryFolder. root, cacheDir)
22
18
.withAndroidVersion(androidVersion)
@@ -28,7 +24,7 @@ class NdkVersionTest extends AbstractTest {
28
24
29
25
SimpleCargoProject . builder(temporaryFolder. root)
30
26
.withTargets([target])
31
- .withChannel(channel )
27
+ .selectChannelFromNdkVersion(ndkVersion )
32
28
.build()
33
29
.writeProject()
34
30
Original file line number Diff line number Diff line change @@ -30,6 +30,15 @@ class SimpleCargoProject {
30
30
return this
31
31
}
32
32
33
+ def selectChannelFromNdkVersion (ndkVersion ) {
34
+ def ndkVersionMajor = ndkVersion. split(' \\ .' )[0 ] as int
35
+ // Toolchain 1.68 or later versions are not compatible to old NDK prior to r23
36
+ // https://blog.rust-lang.org/2023/01/09/android-ndk-update-r25.html
37
+ this . channel = ndkVersionMajor >= 23 ? " stable" : " 1.67"
38
+ return this
39
+
40
+ }
41
+
33
42
def build () {
34
43
if (targets. isEmpty()) {
35
44
throw new IllegalStateException (" No targets provided" )
You can’t perform that action at this time.
0 commit comments