File tree 3 files changed +5
-3
lines changed
plugin/src/main/java/dev/matrix/agp/rust
3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ plugins {
6
6
7
7
android {
8
8
compileSdk = 33
9
+ ndkVersion = " 25.2.9519653"
9
10
10
11
defaultConfig {
11
12
applicationId = " dev.matrix.rust"
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ class AndroidRustPlugin : Plugin<Project> {
22
22
val androidExtension = project.getAndroidExtension()
23
23
val androidComponents = project.getAndroidComponentsExtension()
24
24
val tasksByBuildType = HashMap <String , ArrayList <TaskProvider <RustBuildTask >>>()
25
- val minimumSupportedRustVersion = SemanticVersion (extension.minimumSupportedRustVersion)
26
25
27
26
androidComponents.finalizeDsl { dsl ->
28
27
val allRustAbiSet = mutableSetOf<Abi >()
@@ -82,6 +81,7 @@ class AndroidRustPlugin : Plugin<Project> {
82
81
dsl.sourceSets.findByName(buildType.name)?.jniLibs?.srcDir(variantJniLibsDirectory)
83
82
}
84
83
84
+ val minimumSupportedRustVersion = SemanticVersion (extension.minimumSupportedRustVersion)
85
85
installRustComponentsIfNeeded(project, minimumSupportedRustVersion, allRustAbiSet)
86
86
}
87
87
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ internal fun installRustComponentsIfNeeded(
13
13
return
14
14
}
15
15
16
- if (minimalVersion != null ) {
16
+ if (minimalVersion != null && minimalVersion.isValid ) {
17
17
val actualVersion = readRustCompilerVersion(project)
18
18
if (actualVersion < minimalVersion) {
19
19
installRustUp(project)
@@ -90,10 +90,11 @@ private fun readRustCompilerVersion(project: Project): SemanticVersion {
90
90
}.assertNormalExitValue()
91
91
92
92
val outputText = String (output.toByteArray())
93
- val regex = Regex (" ^rustc (\\ d+\\ .\\ d+\\ .\\ d+) .*$" , RegexOption .DOT_MATCHES_ALL )
93
+ val regex = Regex (" ^rustc (\\ d+\\ .\\ d+\\ .\\ d+)(-nightly)? .*$" , RegexOption .DOT_MATCHES_ALL )
94
94
val match = checkNotNull(regex.matchEntire(outputText)) {
95
95
" failed to parse rust compiler version: $outputText "
96
96
}
97
+
97
98
return SemanticVersion (match.groupValues[1 ])
98
99
}
99
100
You can’t perform that action at this time.
0 commit comments