[Gradle, JS] Add fish for js only lib-app test
This commit is contained in:
+29
@@ -0,0 +1,29 @@
|
|||||||
|
plugins {
|
||||||
|
id("org.jetbrains.kotlin.multiplatform").version("<pluginMarkerVersion>")
|
||||||
|
id("maven-publish")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.example"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
maven { setUrl("https://dl.bintray.com/kotlin/kotlinx.html/") }
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
val nodeJs = js("nodeJs")
|
||||||
|
sourceSets {
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
implementation("com.example:sample-lib:1.0")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeJs.compilations["main"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
implementation("org.jetbrains.kotlin:kotlin-stdlib-js")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
rootProject.name = "sample-app"
|
||||||
|
|
||||||
|
enableFeaturePreview("GRADLE_METADATA")
|
||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.example.app
|
||||||
|
|
||||||
|
import com.example.lib.expectedFun
|
||||||
|
import com.example.lib.id
|
||||||
|
|
||||||
|
fun idUsage(x: Int): Int = id(x)
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
expectedFun()
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import com.example.lib.expectedFun
|
||||||
|
import com.example.lib.id
|
||||||
|
import com.example.lib.idUsage
|
||||||
|
import kotlin.js.Console
|
||||||
|
|
||||||
|
external val console: Console
|
||||||
|
|
||||||
|
fun nodeJsMain(args: Array<String>) {
|
||||||
|
console.info(id(123), idUsage(), expectedFun())
|
||||||
|
}
|
||||||
+35
@@ -0,0 +1,35 @@
|
|||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin-multiplatform'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
// NB: Build of this module depends on 'sample-lib' publication. You need to add the local
|
||||||
|
// repository where 'sample-lib' artifacts are published.
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js('nodeJs', '<js-compiler-type>')
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
implementation 'com.example:sample-lib:1.0'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeJsMain {
|
||||||
|
dependencies {
|
||||||
|
implementation 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
enableFeaturePreview('GRADLE_METADATA')
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.example.app
|
||||||
|
|
||||||
|
import com.example.lib.expectedFun
|
||||||
|
import com.example.lib.id
|
||||||
|
|
||||||
|
fun idUsage(x: Int): Int = id(x)
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
expectedFun()
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
import com.example.lib.expectedFun
|
||||||
|
import com.example.lib.id
|
||||||
|
import com.example.lib.idUsage
|
||||||
|
import kotlin.js.Console
|
||||||
|
|
||||||
|
external val console: Console
|
||||||
|
|
||||||
|
fun nodeJsMain(args: Array<String>) {
|
||||||
|
console.info(id(123), idUsage(), expectedFun())
|
||||||
|
}
|
||||||
+44
@@ -0,0 +1,44 @@
|
|||||||
|
plugins {
|
||||||
|
id("org.jetbrains.kotlin.multiplatform").version("<pluginMarkerVersion>")
|
||||||
|
id("maven-publish")
|
||||||
|
}
|
||||||
|
|
||||||
|
group = "com.example"
|
||||||
|
version = "1.0"
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
maven { setUrl("https://dl.bintray.com/kotlin/kotlinx.html/") }
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
val js = js("nodeJs")
|
||||||
|
|
||||||
|
targets.all {
|
||||||
|
mavenPublication(Action<MavenPublication> {
|
||||||
|
pom.withXml(Action<XmlProvider> {
|
||||||
|
asNode().appendNode("name", "Sample MPP library")
|
||||||
|
})
|
||||||
|
})
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
val commonMain by getting {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-common"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
js.compilations["main"].defaultSourceSet {
|
||||||
|
dependencies {
|
||||||
|
api(kotlin("stdlib-js"))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven { setUrl("file://${projectDir.absolutePath.replace('\\', '/')}/repo") }
|
||||||
|
}
|
||||||
|
}
|
||||||
+11
@@ -0,0 +1,11 @@
|
|||||||
|
rootProject.name = "sample-lib"
|
||||||
|
|
||||||
|
enableFeaturePreview("GRADLE_METADATA")
|
||||||
|
|
||||||
|
pluginManagement {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
gradlePluginPortal()
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -0,0 +1,5 @@
|
|||||||
|
package com.example.lib
|
||||||
|
|
||||||
|
fun <T> id(t: T): T = t
|
||||||
|
|
||||||
|
expect fun expectedFun(): Unit
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
resource
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.lib
|
||||||
|
|
||||||
|
fun idUsage() = id("123")
|
||||||
|
|
||||||
|
actual fun expectedFun() = Unit
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
expectedFun()
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
resource
|
||||||
+57
@@ -0,0 +1,57 @@
|
|||||||
|
group 'com.example'
|
||||||
|
version '1.0'
|
||||||
|
|
||||||
|
buildscript {
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
}
|
||||||
|
dependencies {
|
||||||
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
apply plugin: 'kotlin-multiplatform'
|
||||||
|
|
||||||
|
repositories {
|
||||||
|
mavenLocal()
|
||||||
|
jcenter()
|
||||||
|
maven { url "https://dl.bintray.com/kotlin/kotlinx.html/" }
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin {
|
||||||
|
js('nodeJs', '<js-compiler-type>')
|
||||||
|
|
||||||
|
targets {
|
||||||
|
all {
|
||||||
|
mavenPublication {
|
||||||
|
pom.withXml {
|
||||||
|
asNode().appendNode('name', 'Sample MPP library')
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
sourceSets {
|
||||||
|
commonMain {
|
||||||
|
dependencies {
|
||||||
|
api 'org.jetbrains.kotlin:kotlin-stdlib-common'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
nodeJsMain {
|
||||||
|
dependencies {
|
||||||
|
api 'org.jetbrains.kotlin:kotlin-stdlib-js'
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
kotlin.sourceSets.each { println it.kotlin.srcDirs }
|
||||||
|
|
||||||
|
apply plugin: 'maven-publish'
|
||||||
|
|
||||||
|
publishing {
|
||||||
|
repositories {
|
||||||
|
maven { url "file://${projectDir.absolutePath.replace('\\', '/')}/repo" }
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
enableFeaturePreview('GRADLE_METADATA')
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.lib
|
||||||
|
|
||||||
|
fun <T> id(t: T): T = t
|
||||||
|
|
||||||
|
expect fun expectedFun(): Unit
|
||||||
|
|
||||||
|
fun main() {
|
||||||
|
println(">>> Common.kt >>> main()")
|
||||||
|
}
|
||||||
+1
@@ -0,0 +1 @@
|
|||||||
|
resource
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
package com.example.lib
|
||||||
|
|
||||||
|
fun idUsage() = id("123")
|
||||||
|
|
||||||
|
actual fun expectedFun() = Unit
|
||||||
|
|
||||||
|
fun main(args: Array<String>) {
|
||||||
|
expectedFun()
|
||||||
|
}
|
||||||
Reference in New Issue
Block a user