Reorder MPP plugin logic to fix eager publishing configuration

In Gradle 5.0, the `publishing` extension is configured eagerly, so
we need to make sure everything we use in publishing setup is already
available at the point when it's triggered:

* the `metadata` target
* the source JARs

Issue #KT-28520 Fixed
This commit is contained in:
Sergey Igushkin
2018-11-29 20:00:56 +03:00
parent 0f670f806f
commit 8cec50e6e2
2 changed files with 15 additions and 2 deletions
@@ -188,6 +188,18 @@ class NewMultiplatformIT : BaseGradleIT() {
}
}
@Test
fun testMavenPublishAppliedBeforeMultiplatformPlugin() =
with(Project("sample-lib", GradleVersionRequired.AtLeast("5.0"), "new-mpp-lib-and-app")) {
setupWorkingDir()
gradleBuildScript().modify { "apply plugin: 'maven-publish'\n$it" }
build {
assertSuccessful()
}
}
@Test
fun testResourceProcessing() = with(Project("sample-lib", gradleVersion, "new-mpp-lib-and-app")) {
val targetsWithResources = listOf("jvm6", "nodeJs", "wasm32", nativeHostTargetName)
@@ -80,14 +80,15 @@ class KotlinMultiplatformPlugin(
configureSourceSets(project)
setUpConfigurationAttributes(project)
configurePublishingWithMavenPublish(project)
configureSourceJars(project)
// set up metadata publishing
targetsFromPreset.fromPreset(
KotlinMetadataTargetPreset(project, instantiator, fileResolver, kotlinPluginVersion),
METADATA_TARGET_NAME
)
configureSourceJars(project)
configurePublishingWithMavenPublish(project)
// propagate compiler plugin options to the source set language settings
setupCompilerPluginOptions(project)