[Gradle, JS] Add test on local project dependency
#KT-38592 fixed
This commit is contained in:
+15
@@ -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(
|
||||
projectName: String = "third-party-lib",
|
||||
directoryPrefix: String = "hierarchical-mpp-published-modules",
|
||||
|
||||
+6
-1
@@ -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
|
||||
|
||||
import com.example.thirdparty.thirdPartyFun
|
||||
@@ -7,4 +12,4 @@ actual fun foo() = fooJvmAndJs()
|
||||
fun fooJvmAndJs(): String {
|
||||
thirdPartyFun()
|
||||
return fooCommon()
|
||||
}
|
||||
}
|
||||
|
||||
+6
-1
@@ -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
|
||||
|
||||
import com.example.thirdparty.thirdPartyFun
|
||||
@@ -7,4 +12,4 @@ actual fun foo() = fooJvmAndJs()
|
||||
fun fooJvmAndJs(): String {
|
||||
thirdPartyFun()
|
||||
return fooCommon()
|
||||
}
|
||||
}
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
plugins {
|
||||
kotlin("multiplatform").version("<pluginMarkerVersion>").apply(false)
|
||||
}
|
||||
|
||||
allprojects {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
jcenter()
|
||||
}
|
||||
}
|
||||
+2
@@ -0,0 +1,2 @@
|
||||
kotlin.mpp.enableGranularSourceSetsMetadata=true
|
||||
kotlin.mpp.enableCompatibilityMetadataVariant=true
|
||||
+43
@@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+12
@@ -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()
|
||||
}
|
||||
+29
@@ -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"))
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+8
@@ -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"
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
pluginManagement {
|
||||
repositories {
|
||||
mavenLocal()
|
||||
gradlePluginPortal()
|
||||
}
|
||||
}
|
||||
|
||||
rootProject.name = "hierarchical-mpp-with-js"
|
||||
|
||||
include("my-lib-foo", "my-app")
|
||||
|
||||
enableFeaturePreview("GRADLE_METADATA")
|
||||
Reference in New Issue
Block a user