Given an instance of `org.gradle.api.publish.maven...
# community-support
a
Given an instance of
org.gradle.api.publish.maven.MavenPublication
is it possible to programatically get the dependencies that will eventually be used to create the
pom.xml
or GMM
.module
files? I want to implement a custom up-to-date check that post-processes an arbitrary
org.gradle.api.publish.maven.tasks.PublishToMavenRepository
task, so a task only re-runs if the dependencies change.
👀 1
j
I think the
runtimeElements
configuration contains these
a
yes, but that's only for Java projects. I need to also get the info for other projects like KMP.
m
Not answering your question but why do you need a custom up-to-date check? If the
pom.xlm
or
.module
files are inputs to your task and nothing changed then your task should be up-to-date
If you only care about the dependencies, maybe you can transform the inputs to discard the things that changed (jar checksums I guess?)?
a
basically, I need the check for https://github.com/adamko-dev/dev-publish-plugin I found a bug where if the dependencies of a project changes then the publication doesn't re-run.
I think Gradle doesn't provide a public API to compute the dependencies of a SoftwareComponent, so I have to rely on the convention that Gradle creates a
GenerateModuleMetadata
for each publication.
m
I found a bug where if the dependencies of a project changes then the publication doesn’t re-run.
I’ll upvote that issue
> I think Gradle doesn’t provide a public API to compute the dependencies of a SoftwareComponent Yea, I haven’t been down this rabbit hole but the configuration -> SoftwareComponent -> pom translation has always intrigued me
GenerateModuleMetadata
sounds reasonnable
v
I'm not sure you can at all do this generically, because I'm not sure whether KMP uses standard things. Iirc it for example produces one artifact per platform and has a platform independent artifact where the GMM points to the files of the other coordinates or something like that. I don't think this is Gradle built-in, so KMP might do it's own things to create these.
p
Might be a stupid question, but why do you don't just use an includedBuild?
v
I guess you have to elaborate what you mean. At least I'm not sure how that would help here.
p
Not for this question, but instead of publishing it to a local maven repository at all.
m
I understand this is for integration testing your plugins
☝️ 1
You want to test "like your users do"