Skip to content

Commit

Permalink
add workaround for test fixtures issue (#490)
Browse files Browse the repository at this point in the history
* add workaround for test fixtures issue

* call get on properties because I expected more Gradle magic than there is

* unused import
  • Loading branch information
gabrielittner committed Jan 2, 2023
1 parent 418ca13 commit 64e5c73
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ abstract class MavenPublishBaseExtension(

private val sonatypeHost: Property<SonatypeHost> = project.objects.property(SonatypeHost::class.java)
private val signing: Property<Boolean> = project.objects.property(Boolean::class.java)
private val groupId: Property<String> = project.objects.property(String::class.java)
internal val groupId: Property<String> = project.objects.property(String::class.java)
.convention(project.provider { project.group.toString() })
private val version: Property<String> = project.objects.property(String::class.java)
internal val version: Property<String> = project.objects.property(String::class.java)
.convention(project.provider { project.version.toString() })
private val pomFromProperties: Property<Boolean> = project.objects.property(Boolean::class.java)
private val platform: Property<Platform> = project.objects.property(Platform::class.java)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,14 @@ private fun setupTestFixtures(project: Project, sourcesJar: Boolean) {
it.suppressPomMetadataWarningsFor("testFixturesRuntimeElements")
it.suppressPomMetadataWarningsFor("testFixturesSourcesElements")
}

project.afterEvaluate {
// Gradle will put the project group and version into capabilities instead of using
// the publication, this can lead to invalid published metadata
// TODO remove after https://github.com/gradle/gradle/issues/23354 is resolved
project.group = project.baseExtension.groupId.get()
project.version = project.baseExtension.version.get()
}
}
}

Expand Down

0 comments on commit 64e5c73

Please sign in to comment.