-
Notifications
You must be signed in to change notification settings - Fork 122
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add an option to not publish test fixtures #779
Comments
However, I've found a workaround: // Exclude test fixtures from publication, as we use it only internally
plugins.withId("org.gradle.java-test-fixtures") {
val component = components["java"] as AdhocComponentWithVariants
component.withVariantsFromConfiguration(configurations["testFixturesApiElements"]) { skip() }
component.withVariantsFromConfiguration(configurations["testFixturesRuntimeElements"]) { skip() }
// Workaround to not publish test fixtures sources added by com.vanniktech.maven.publish plugin
// TODO: Remove as soon as https://github.com/vanniktech/gradle-maven-publish-plugin/issues/779 closed
afterEvaluate {
component.withVariantsFromConfiguration(configurations["testFixturesSourcesElements"]) { skip() }
}
} |
Having one of the 2 options built into the plugin is reasonable, I'll look into that. Could you also open a feature request for Gradle directly? This would be benefitial for either option, for option 1 it would mean that we could read whatever config they have to disable the publication and for option 2 it would mean we can use their API internally. It would also remove the need to access internal types like |
Created the issue for Gradle: |
Oh, it looks like it is actually possible to disable test fixtures publication without internal APIs, so I've updated the workaround to get rid of internal APIs usage. |
Context
I need to use test fixtures only internally between modules, so I don't want to publish them into Maven Central. I have the following code to exclude test fixtures from publication:
However, gradle-maven-publish-plugin forces publication of
testFixturesSourcesElements
whether or not other test fixture components are published.Proposal
I see two options:
testFixturesSourcesElements
publication if other test fixtures components are skipped from publicationThe text was updated successfully, but these errors were encountered: