File tree Expand file tree Collapse file tree 3 files changed +5
-3
lines changed
plugin/src/main/java/dev/matrix/agp/rust Expand file tree Collapse file tree 3 files changed +5
-3
lines changed Original file line number Diff line number Diff line change @@ -6,6 +6,7 @@ plugins {
66
77android {
88 compileSdk = 33
9+ ndkVersion = " 25.2.9519653"
910
1011 defaultConfig {
1112 applicationId = " dev.matrix.rust"
Original file line number Diff line number Diff line change @@ -22,7 +22,6 @@ class AndroidRustPlugin : Plugin<Project> {
2222 val androidExtension = project.getAndroidExtension()
2323 val androidComponents = project.getAndroidComponentsExtension()
2424 val tasksByBuildType = HashMap <String , ArrayList <TaskProvider <RustBuildTask >>>()
25- val minimumSupportedRustVersion = SemanticVersion (extension.minimumSupportedRustVersion)
2625
2726 androidComponents.finalizeDsl { dsl ->
2827 val allRustAbiSet = mutableSetOf<Abi >()
@@ -82,6 +81,7 @@ class AndroidRustPlugin : Plugin<Project> {
8281 dsl.sourceSets.findByName(buildType.name)?.jniLibs?.srcDir(variantJniLibsDirectory)
8382 }
8483
84+ val minimumSupportedRustVersion = SemanticVersion (extension.minimumSupportedRustVersion)
8585 installRustComponentsIfNeeded(project, minimumSupportedRustVersion, allRustAbiSet)
8686 }
8787
Original file line number Diff line number Diff line change @@ -13,7 +13,7 @@ internal fun installRustComponentsIfNeeded(
1313 return
1414 }
1515
16- if (minimalVersion != null ) {
16+ if (minimalVersion != null && minimalVersion.isValid ) {
1717 val actualVersion = readRustCompilerVersion(project)
1818 if (actualVersion < minimalVersion) {
1919 installRustUp(project)
@@ -90,10 +90,11 @@ private fun readRustCompilerVersion(project: Project): SemanticVersion {
9090 }.assertNormalExitValue()
9191
9292 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 )
9494 val match = checkNotNull(regex.matchEntire(outputText)) {
9595 " failed to parse rust compiler version: $outputText "
9696 }
97+
9798 return SemanticVersion (match.groupValues[1 ])
9899}
99100
You can’t perform that action at this time.
0 commit comments