Slackbot
02/22/2023, 10:19 AMCristianGM
02/22/2023, 10:22 AMdependencies {
val projectB = project(":B")
if(??? == "server") add("server", projectB)
}
b/build.gradle
??? = "server"
c/build.gradle
??? = "client"CristianGM
02/22/2023, 10:23 AMVampire
02/22/2023, 10:38 AM??? be in a?CristianGM
02/22/2023, 10:45 AMCristianGM
02/22/2023, 10:45 AMprojectB.attributesCristianGM
02/22/2023, 10:46 AMCristianGM
02/22/2023, 10:49 AMprojectB here is ProjectDependency not Project)CristianGM
02/22/2023, 11:01 AMVampire
02/22/2023, 11:01 AMVampire
02/22/2023, 11:02 AMb that you could check.Vampire
02/22/2023, 11:02 AMserver cofniguration in a, you could use attributes or the higher level feature variantsVampire
02/22/2023, 11:03 AMb and c and resolve it lenient so that it is not an error if the dependency cannot be resolved.CristianGM
02/22/2023, 11:05 AMCristianGM
02/22/2023, 11:06 AMCristianGM
02/22/2023, 11:06 AMVampire
02/22/2023, 11:10 AMserverConfiguration.resolvedConfiguration.lenientConfiguration?Vampire
02/22/2023, 11:10 AMCristianGM
02/22/2023, 11:12 AMCristianGM
02/22/2023, 11:14 AMVampire
02/22/2023, 11:17 AMa can use the information of that build service.CristianGM
02/22/2023, 11:26 AMVampire
02/22/2023, 11:37 AMa, no need for a build service actually if only a needs the information.
You could probably even do the dependency adding from the settings script, but that would imho be out of its scope.CristianGM
02/22/2023, 2:54 PMsync task instead of directly classpath (I didn't mention it because I wanted to drop it) I've found another approach...
into(it.name) {
eachFile {
JarFile(file).use { jar ->
if (...) {
exclude()
}
}
}
from(it - (configurations["runtimeClasspath"] + jarFiles.get()))
}CristianGM
02/22/2023, 2:54 PMCristianGM
02/22/2023, 2:56 PMVampire
02/22/2023, 2:56 PMCristianGM
02/22/2023, 2:57 PMVampire
02/22/2023, 2:59 PMVampire
02/22/2023, 2:59 PMCristianGM
02/22/2023, 3:03 PMCristianGM
02/22/2023, 3:05 PMVampire
02/22/2023, 3:05 PMVampire
02/22/2023, 3:05 PMCristianGM
02/22/2023, 3:09 PMsync because it's working already and add a task to replace it with transform because it will save some timeCristianGM
02/22/2023, 3:11 PMproject(path).dependencyProject.blablabla but I think that will eventually break with CC or later with project isolationCristianGM
02/22/2023, 3:11 PMVampire
02/22/2023, 3:13 PMVampire
02/22/2023, 3:14 PMCristianGM
02/22/2023, 3:17 PMCristianGM
02/22/2023, 3:19 PMCristianGM
02/22/2023, 3:19 PMCristianGM
02/28/2023, 2:51 PMcompatibilityRules was the best solution, even if it required a little more work. Thanks again for the ideas!Vampire
02/28/2023, 3:44 PMCristianGM
02/28/2023, 3:46 PM*it*._incoming_.artifactView *{* lenient(true) *}*._files_CristianGM
02/28/2023, 3:48 PMCristianGM
02/28/2023, 3:51 PMVampire
02/28/2023, 3:53 PMCristianGM
02/28/2023, 3:54 PMCristianGM
02/28/2023, 8:44 PMCristianGM
02/28/2023, 8:44 PMCristianGM
02/28/2023, 8:45 PMCristianGM
02/28/2023, 10:20 PMCristianGM
03/01/2023, 9:39 AMproject("producer" , configuration = "myConfiguration")
it works fine, compatibility rule is executed for non-equal values, but if I depend on project("producer") it doesn't exclude any dependency
I tried even removing my custom attribute from the producer, and... it resolves the dependency anywayCristianGM
03/01/2023, 9:39 AMCristianGM
03/01/2023, 10:26 AMCristianGM
03/01/2023, 11:29 AMCristianGM
03/01/2023, 11:37 AMnull == ["one","two] according to gradleCristianGM
03/01/2023, 11:56 AM--------------------------------------------------
Variant myConfiguration
--------------------------------------------------
Capabilities
- org.exampleproducer1.0-SNAPSHOT (default capability)
Artifacts
- build/libs/producer-1.0-SNAPSHOT.jar (artifactType = jar)and can be consumed from consumer:
--------------------------------------------------
Configuration producer
--------------------------------------------------
Attributes
- features = one,two
- org.gradle.category = library
- org.gradle.usage = java-runtime
Vampire
03/01/2023, 2:28 PMVampire
03/01/2023, 2:28 PMVampire
03/01/2023, 2:28 PMEach candidate’s attribute value is compared to the consumer’s requested attribute value. A candidate is considered compatible if its value matches the consumer’s value exactly, passes the attribute’s compatibility rule or is not provided.
Vampire
03/01/2023, 2:29 PM