[Gradle, JS] Add test on local project dependency

#KT-38592 fixed
This commit is contained in:
Ilya Goncharov
2020-05-20 19:34:45 +03:00
parent 985623eac5
commit 3c9207a2cd
10 changed files with 143 additions and 2 deletions
@@ -169,6 +169,21 @@ class HierarchicalMppIT : BaseGradleIT() {
} }
} }
@Test
fun testHmppWithProjectJsIrDependency() {
with(Project("hierarchical-mpp-with-js-project-dependency", gradleVersion)) {
setupWorkingDir()
gradleBuildScript().modify(::transformBuildScriptWithPluginsDsl)
build(
"assemble",
options = defaultBuildOptions().copy(jsCompilerType = KotlinJsCompilerType.IR)
) {
assertSuccessful()
}
}
}
private fun publishThirdPartyLib( private fun publishThirdPartyLib(
projectName: String = "third-party-lib", projectName: String = "third-party-lib",
directoryPrefix: String = "hierarchical-mpp-published-modules", directoryPrefix: String = "hierarchical-mpp-published-modules",
@@ -1,3 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.foo package com.example.foo
import com.example.thirdparty.thirdPartyFun import com.example.thirdparty.thirdPartyFun
@@ -7,4 +12,4 @@ actual fun foo() = fooJvmAndJs()
fun fooJvmAndJs(): String { fun fooJvmAndJs(): String {
thirdPartyFun() thirdPartyFun()
return fooCommon() return fooCommon()
} }
@@ -1,3 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.foo package com.example.foo
import com.example.thirdparty.thirdPartyFun import com.example.thirdparty.thirdPartyFun
@@ -7,4 +12,4 @@ actual fun foo() = fooJvmAndJs()
fun fooJvmAndJs(): String { fun fooJvmAndJs(): String {
thirdPartyFun() thirdPartyFun()
return fooCommon() return fooCommon()
} }
@@ -0,0 +1,10 @@
plugins {
kotlin("multiplatform").version("<pluginMarkerVersion>").apply(false)
}
allprojects {
repositories {
mavenLocal()
jcenter()
}
}
@@ -0,0 +1,2 @@
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.mpp.enableCompatibilityMetadataVariant=true
@@ -0,0 +1,43 @@
plugins {
kotlin("multiplatform")
}
repositories {
mavenLocal()
jcenter()
}
group = "com.example.app"
version = "1.0"
kotlin {
js()
sourceSets {
val commonMain by getting {
dependencies {
implementation(kotlin("stdlib-common"))
}
}
val commonTest by getting {
dependencies {
implementation(kotlin("test-common"))
implementation(kotlin("test-annotations-common"))
}
}
js().compilations["main"].defaultSourceSet {
dependencies {
implementation(project(":my-lib-foo"))
implementation(kotlin("stdlib-js"))
}
}
js().compilations["test"].defaultSourceSet {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
@@ -0,0 +1,12 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.app
import com.example.foo.foo
fun appJs() {
foo()
}
@@ -0,0 +1,29 @@
plugins {
kotlin("js")
`maven-publish`
}
repositories {
mavenLocal()
jcenter()
}
group = "com.example.foo"
version = "1.0"
kotlin {
js()
sourceSets {
js().compilations["main"].defaultSourceSet {
dependencies {
implementation(kotlin("stdlib-js"))
}
}
js().compilations["test"].defaultSourceSet {
dependencies {
implementation(kotlin("test-js"))
}
}
}
}
@@ -0,0 +1,8 @@
/*
* Copyright 2010-2020 JetBrains s.r.o. and Kotlin Programming Language contributors.
* Use of this source code is governed by the Apache 2.0 license that can be found in the license/LICENSE.txt file.
*/
package com.example.foo
fun foo() = "foo"
@@ -0,0 +1,12 @@
pluginManagement {
repositories {
mavenLocal()
gradlePluginPortal()
}
}
rootProject.name = "hierarchical-mpp-with-js"
include("my-lib-foo", "my-app")
enableFeaturePreview("GRADLE_METADATA")