Darryl Miles
06/27/2024, 8:46 AMdependencies {
implementation(project(":project1"))
}
// I have a working publishToMavenLocal
// I have MavenLocal setup with a filter to only lookup group="com.mydomain.myproject"
// I have MavenCentral blocked/excluded for group="com.mydomain.myproject"
// assume this project operates in this group namespace
// I am trying to convert the original config at the top of this command into:
val CONFIG_BOOLEAN = true // picked up from gradle.properties
fun DependencyHandler.myproject(path: String): ProjectDependency {
if(CONFIG_BOOLEAN) {
val p = path.removePrefix(":")
// I am after a compatible GAV that will resolve the location of this dependency from MavenLocal
// by performing a standard Maven resolution on the Dependency descriptor, how do I instantiate what is needed ?
return ??????(group=project.group, module=path, version=project.version)
} else {
return project(path)
}
}
// So this is a Kotlin extension function I am attempted to provide into the DSL that will modify behaviour
// from configuration and resolve the dependency from an internal project or resolve it from MavenLocal.
dependencies {
implementation(myproject(":project1"))
}
The purpose of this is to use a trick from Maven days, to not have Gradle build all projects when you are not making side-effect changes to most projects, it should instead use the pre-created JAR from Maven Local to resolve dependency.Niels Doucet
06/27/2024, 9:14 AMDarryl Miles
06/27/2024, 9:18 AMDarryl Miles
06/27/2024, 9:19 AMDarryl Miles
06/27/2024, 9:20 AM// Having some success if I drop the idea of being type safe, just putting it thought its paces now
fun DependencyHandler.myproject(path: String): Any {
if(CONFIG_BOOLEAN) {
val module = path.removePrefix(":")
// I am after a compatible GAV that will resolve the location of this dependency from MavenLocal
// by performing a standard Maven resolution on the Dependency descriptor, how do I instantiate what is needed ?
return "$group:$module:$version"
} else {
return project(path)
}
}Niels Doucet
06/27/2024, 9:20 AMDarryl Miles
06/27/2024, 9:21 AMNiels Doucet
06/27/2024, 9:22 AMNiels Doucet
06/27/2024, 9:23 AMNiels Doucet
06/27/2024, 9:24 AMNiels Doucet
06/27/2024, 9:26 AMDarryl Miles
06/27/2024, 9:29 AMSergej Koščejev
06/27/2024, 9:46 AMNiels Doucet
06/27/2024, 9:47 AMVampire
06/27/2024, 10:29 AMis that not enabled by default for 8.5No, build cache is not enabled by default, as badly configured inputs / outputs of tasks would cause poisened cache entries and thus wrong and non-deterministic build results. You do not need to use a remote build cache, just enabling build cache would already enable the local build cache.
Darryl Miles
06/27/2024, 1:22 PM