Closed Ghamza-Jd closed 5 months ago
I think the last line should be File(manifestPath.parentFile, "maven").toURI()
.
You can check it here: https://github.com/flisky/jnidemo/commit/b98b670c9f93c00da8d1967d0c03034772de9806
I think the last line should be
File(manifestPath.parentFile, "maven").toURI()
.You can check it here: flisky/jnidemo@b98b670
Thanks @flisky! It worked when I made the same changes in your commit; moved it to settings.gradle.kts
Thank you for jumping in here over the weekend @flisky.
We also use gradle.kts
at work but I didn't know if enough people had adopted Kotlin Gradle Scripts to include snippets here as well. I apologize for that inconvenience.
If its any help, here's the contents of our app's build.gradle.kts
that imports this repository:
import kotlinx.serialization.decodeFromString
import kotlinx.serialization.json.Json
import kotlinx.serialization.json.JsonObject
import kotlinx.serialization.json.jsonArray
import kotlinx.serialization.json.jsonObject
import kotlinx.serialization.json.jsonPrimitive
buildscript {
dependencies {
classpath(libs.kotlinx.serialization.json)
}
}
repositories {
rustlsPlatformVerifier()
}
fun RepositoryHandler.rustlsPlatformVerifier(): MavenArtifactRepository {
@Suppress("UnstableApiUsage")
val manifestPath = let {
val dependencyJson = providers.exec {
workingDir = File(project.rootDir, "../")
commandLine("cargo", "metadata", "--format-version", "1", "--filter-platform", "aarch64-linux-android", "--manifest-path", "internal-crate/Cargo.toml")
}.standardOutput.asText
val path = Json.decodeFromString<JsonObject>(dependencyJson.get())
.getValue("packages")
.jsonArray
.first { element ->
element.jsonObject.getValue("name").jsonPrimitive.content == "rustls-platform-verifier-android"
}.jsonObject.getValue("manifest_path").jsonPrimitive.content
File(path)
}
return maven {
url = uri(File(manifestPath.parentFile, "maven").path)
metadataSources.artifact()
}
}
And then finally, the dependency import:
implementation(libs.rustls.platform.verifier)
[libraries]
rustls-platform-verifier = { group = "rustls", name = "rustls-platform-verifier", version = "latest.release" }
Hey 👋
I'm trying to set this package for android. I've followed the instructions, but I'm using
gradle.kts
.Here's my
build.gradle.kts
:If it try to log the uri I get
file:/Users/hamzajadid/.cargo/registry/src/index.crates.io-6f17d22bba15001f/rustls-platform-verifier-android-0.1.0/
which seems correct.But I'm getting
Failed to resolve: rustls:rustls-platform-verifier:latest.release
(andFailed to resolve: rustls:rustls-platform-verifier:0.1.0
when setting the version to that). I've also attached a screenshot of the failure of downloadAny idea how this issue can be resolved? Thanks!