altavir
04/29/2024, 4:53 PMgildor
04/30/2024, 4:41 AMnativeBuild {
dependencies {
cppSource("some:dep:1.0@zip")
}
}
Even without Declarative Gradle, it looks like a thing, which should be handled on plugin level, not on level of build filesaltavir
04/30/2024, 5:38 AMgildor
04/30/2024, 6:02 AMval cppSourcesConfiguration = project.configurations.register("cppSources") {
isCanBeResolved = true
isCanBeDeclared = true
}
val resolveCoursesTaskProvider = project.tasks.register<Copy>("resolveCppSources") {
from(cppSourcesConfiguration.get().map(project::tarTree))
into(project.layout.buildDirectory.dir("target/dir"))
}
project.plugins.withType<BasePlugin>().configureEach {
project.tasks.named("preBuild") {
dependsOn(resolveCoursesTaskProvider)
}
}
Additionally, it requires custom repo from where it downloaded (if your repo doesn't follow Maven convention, you can use Ivy, it allows custom convention), but maven would be the easiest one
And to use, something like:
dependencies {
cppSources("my:dep:1.0@tgz")
}
gildor
04/30/2024, 6:03 AM