Slackbot
04/18/2022, 7:04 PMephemient
04/18/2022, 7:22 PMLaurence Gonsalves
04/19/2022, 6:16 PMephemient
04/19/2022, 6:20 PMephemient
04/19/2022, 6:22 PMephemient
04/19/2022, 6:22 PMLaurence Gonsalves
04/19/2022, 8:21 PMabstract class GraphQLJavaAlignmentRule implements ComponentMetadataRule {
void execute(ComponentMetadataContext ctx) {
def group = "com.graphql-java"
ctx.details.with {
if (id.group.startsWith(group)) {
// declare that group's modules all belong to
// the same virtual platform
belongsTo("$group:virtual-platform:${id.version}")
}
}
}
}
dependencies {
components.all(GraphQLJavaAlignmentRule)
}
Laurence Gonsalves
04/19/2022, 8:42 PMLaurence Gonsalves
04/19/2022, 8:43 PMdependencies {
components.all(alignGroup("com.graphql-java"))
components.all(alignGroup("com.example.foo"))
components.all(alignGroup("org.example.bar"))
}
?ephemient
04/19/2022, 8:45 PMLaurence Gonsalves
04/19/2022, 9:00 PMalignGroup
in the plugin, and then have each project just have a one-liner for each group it wants to align. I’m not sure how to do that given that components.all()
apparently takes a class rather than an instance or closure, though.ephemient
04/19/2022, 9:15 PMclass AlignGroupRule implements Action<ComponentMetadataRule> {
String group
@Override
void execute(ComponentMetadataContext ctx) { ... }
}
dependencies {
components.all(new AlignGroupRule(group: "com.graphql-java"))
ephemient
04/19/2022, 9:15 PMLaurence Gonsalves
04/19/2022, 9:39 PMLaurence Gonsalves
04/20/2022, 6:09 PMcom.graphql-java:graphql-java:17.2
one needs to use com.graphql-java:graphql-java-extended-scalars:17.0
(the latter has no 17.2 version).
So it looks like I’d need to somehow tell Gradle to round down the version of graphql-java that’s being pulled in transitively to determine which version of graphql-java-extended-scalars we want. I don’t know how to express that as an alignment rule, or if it’s even possible.ephemient
04/20/2022, 6:33 PMLaurence Gonsalves
04/20/2022, 6:38 PM