Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Kotlin dsl kotlin conventions #2484

Merged
merged 2 commits into from
Jan 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/
import org.jetbrains.kotlin.konan.target.HostManager
import org.gradle.util.VersionNumber
Expand Down Expand Up @@ -183,7 +183,7 @@ allprojects {
configure(subprojects.findAll { !sourceless.contains(it.name) && it.name != coreModule }) {
evaluationDependsOn(":$coreModule")
def platform = PlatformKt.platformOf(it)
apply from: rootProject.file("gradle/compile-${platform}.gradle")
apply plugin: "kotlin-${platform}-conventions"
dependencies {
// See comment below for rationale, it will be replaced with "project" dependency
compile project(":$coreModule")
Expand Down
40 changes: 40 additions & 0 deletions buildSrc/src/main/kotlin/kotlin-js-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
/*
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

// Platform-specific configuration to compile JS modules

import org.jetbrains.kotlin.gradle.dsl.KotlinJsCompile

plugins {
kotlin("js")
}

dependencies {
testImplementation(kotlin("test-js"))
}

kotlin {
js(LEGACY) {
moduleName = project.name.removeSuffix("-js")
}

sourceSets {
main {
kotlin.srcDirs("src")
resources.srcDirs("resources")
}
test {
kotlin.srcDirs("test")
resources.srcDirs("test-resources")
}
}
}

tasks.withType<KotlinJsCompile> {
kotlinOptions {
moduleKind = "umd"
sourceMap = true
metaInfo = true
}
}
46 changes: 46 additions & 0 deletions buildSrc/src/main/kotlin/kotlin-jvm-conventions.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

// Platform-specific configuration to compile JVM modules

import org.gradle.api.*

plugins {
kotlin("jvm")
}

java {
sourceCompatibility = JavaVersion.VERSION_1_6
targetCompatibility = JavaVersion.VERSION_1_6
}

if (rootProject.extra.get("jvm_ir_enabled") as Boolean) {
kotlin.target.compilations.configureEach {
qwwdfsad marked this conversation as resolved.
Show resolved Hide resolved
kotlinOptions.useIR = true
}
}

dependencies {
testCompile(kotlin("test"))
// Workaround to make addSuppressed work in tests
testCompile(kotlin("reflect"))
testCompile(kotlin("stdlib-jdk7"))
testCompile(kotlin("test-junit"))
testCompile("junit:junit:${version("junit")}")
}

tasks.compileKotlin {
kotlinOptions {
freeCompilerArgs += listOf("-Xexplicit-api=strict")
}
}

tasks.withType<Test> {
testLogging {
showStandardStreams = true
events("passed", "failed")
}
val stressTest = project.properties["stressTest"]
if (stressTest != null) systemProperties["stressTest"] = stressTest
}
32 changes: 0 additions & 32 deletions gradle/compile-js.gradle

This file was deleted.

40 changes: 0 additions & 40 deletions gradle/compile-jvm.gradle

This file was deleted.

10 changes: 6 additions & 4 deletions integration-testing/build.gradle
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType

/*
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
* Copyright 2016-2021 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
*/

apply from: rootProject.file("gradle/compile-jvm.gradle")
import org.jetbrains.kotlin.gradle.plugin.KotlinPlatformType

plugins {
id("kotlin-jvm-conventions")
}

repositories {
mavenLocal()
Expand Down