2019-03-27 20:43:01 +03:00
|
|
|
import com.moowork.gradle.node.NodeExtension
|
|
|
|
import com.moowork.gradle.node.npm.NpmTask
|
|
|
|
import com.moowork.gradle.node.task.NodeTask
|
2019-01-27 17:12:46 +03:00
|
|
|
import org.jetbrains.kotlin.gradle.dsl.KotlinMultiplatformExtension
|
2019-03-27 20:43:01 +03:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.Kotlin2JsCompile
|
2019-03-07 09:52:04 +03:00
|
|
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
2018-12-11 18:49:08 +03:00
|
|
|
|
2019-01-27 17:12:46 +03:00
|
|
|
buildscript {
|
2019-03-01 22:10:17 +03:00
|
|
|
val kotlinVersion: String by rootProject.extra("1.3.21")
|
|
|
|
val ioVersion: String by rootProject.extra("0.1.5")
|
2019-01-27 17:12:46 +03:00
|
|
|
val coroutinesVersion: String by rootProject.extra("1.1.1")
|
2019-03-01 22:10:17 +03:00
|
|
|
val atomicfuVersion: String by rootProject.extra("0.12.1")
|
|
|
|
val dokkaVersion: String by rootProject.extra("0.9.17")
|
|
|
|
val serializationVersion: String by rootProject.extra("0.10.0")
|
2018-12-11 18:49:08 +03:00
|
|
|
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
2019-03-01 22:10:17 +03:00
|
|
|
maven("https://dl.bintray.com/kotlin/kotlin-eap")
|
2018-12-11 18:49:08 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
dependencies {
|
|
|
|
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
|
|
|
|
classpath("org.jfrog.buildinfo:build-info-extractor-gradle:4+")
|
2019-03-01 22:10:17 +03:00
|
|
|
classpath("com.jfrog.bintray.gradle:gradle-bintray-plugin:1.8.4")
|
|
|
|
classpath("org.jetbrains.dokka:dokka-gradle-plugin:$dokkaVersion")
|
|
|
|
classpath("org.jetbrains.kotlin:kotlin-frontend-plugin:0.0.45")
|
|
|
|
classpath("org.openjfx:javafx-plugin:0.0.7")
|
2018-12-11 18:49:08 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
plugins {
|
|
|
|
id("com.jfrog.artifactory") version "4.8.1" apply false
|
2019-03-27 20:43:01 +03:00
|
|
|
id("com.moowork.node") version "1.3.1" apply false
|
2018-12-11 18:49:08 +03:00
|
|
|
// id("org.jetbrains.kotlin.multiplatform") apply false
|
|
|
|
}
|
|
|
|
|
|
|
|
allprojects {
|
2019-03-01 22:10:17 +03:00
|
|
|
apply(plugin = "maven")
|
2018-12-11 18:49:08 +03:00
|
|
|
apply(plugin = "maven-publish")
|
|
|
|
apply(plugin = "com.jfrog.artifactory")
|
|
|
|
|
|
|
|
repositories {
|
|
|
|
jcenter()
|
|
|
|
maven("https://kotlin.bintray.com/kotlinx")
|
|
|
|
}
|
|
|
|
|
|
|
|
group = "hep.dataforge"
|
2019-03-31 17:39:44 +03:00
|
|
|
version = "0.1.2-dev-3"
|
2019-01-27 17:12:46 +03:00
|
|
|
|
2019-03-01 22:10:17 +03:00
|
|
|
// apply bintray configuration
|
|
|
|
apply(from = "${rootProject.rootDir}/gradle/bintray.gradle")
|
|
|
|
|
|
|
|
//apply artifactory configuration
|
|
|
|
apply(from = "${rootProject.rootDir}/gradle/artifactory.gradle")
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
subprojects {
|
|
|
|
|
|
|
|
// dokka {
|
|
|
|
// outputFormat = "html"
|
|
|
|
// outputDirectory = javadoc.destinationDir
|
|
|
|
// }
|
|
|
|
//
|
|
|
|
// task dokkaJar (type: Jar, dependsOn: dokka) {
|
|
|
|
// from javadoc . destinationDir
|
|
|
|
// classifier = "javadoc"
|
|
|
|
// }
|
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
// Create empty jar for sources classifier to satisfy maven requirements
|
|
|
|
val stubSources by tasks.registering(Jar::class) {
|
|
|
|
archiveClassifier.set("sources")
|
|
|
|
//from(sourceSets.main.get().allSource)
|
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
// Create empty jar for javadoc classifier to satisfy maven requirements
|
|
|
|
val stubJavadoc by tasks.registering(Jar::class) {
|
|
|
|
archiveClassifier.set("javadoc")
|
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
tasks.withType<KotlinCompile> {
|
2019-03-27 20:43:01 +03:00
|
|
|
kotlinOptions {
|
2019-03-07 09:52:04 +03:00
|
|
|
jvmTarget = "1.8"
|
2019-03-01 22:10:17 +03:00
|
|
|
}
|
2019-03-07 09:52:04 +03:00
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
|
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
afterEvaluate {
|
2019-03-01 22:10:17 +03:00
|
|
|
extensions.findByType<KotlinMultiplatformExtension>()?.apply {
|
2019-03-28 09:56:11 +03:00
|
|
|
apply(plugin = "com.moowork.node")
|
2019-03-07 09:52:04 +03:00
|
|
|
jvm {
|
|
|
|
compilations.all {
|
|
|
|
kotlinOptions {
|
|
|
|
jvmTarget = "1.8"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
js {
|
|
|
|
compilations.all {
|
|
|
|
tasks.getByName(compileKotlinTaskName) {
|
|
|
|
kotlinOptions {
|
|
|
|
metaInfo = true
|
|
|
|
sourceMap = true
|
|
|
|
sourceMapEmbedSources = "always"
|
|
|
|
moduleKind = "umd"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
configure(listOf(compilations["main"])) {
|
|
|
|
tasks.getByName(compileKotlinTaskName) {
|
|
|
|
kotlinOptions {
|
|
|
|
main = "call"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-03-27 20:43:01 +03:00
|
|
|
|
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
val runJsTests by ext(false)
|
|
|
|
|
|
|
|
if(runJsTests) {
|
|
|
|
|
|
|
|
configure<NodeExtension> {
|
|
|
|
nodeModulesDir = file("$buildDir/node_modules")
|
|
|
|
}
|
2019-03-27 20:43:01 +03:00
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
val compileKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
|
|
|
val compileTestKotlinJs by tasks.getting(Kotlin2JsCompile::class)
|
2019-03-27 20:43:01 +03:00
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
val populateNodeModules by tasks.registering(Copy::class) {
|
|
|
|
dependsOn(compileKotlinJs)
|
|
|
|
from(compileKotlinJs.destinationDir)
|
2019-03-27 20:43:01 +03:00
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
compilations["test"].runtimeDependencyFiles.forEach {
|
|
|
|
if (it.exists() && !it.isDirectory) {
|
|
|
|
from(zipTree(it.absolutePath).matching { include("*.js") })
|
|
|
|
}
|
2019-03-27 20:43:01 +03:00
|
|
|
}
|
2019-03-31 17:39:44 +03:00
|
|
|
|
|
|
|
into("$buildDir/node_modules")
|
2019-03-27 20:43:01 +03:00
|
|
|
}
|
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
val installMocha by tasks.registering(NpmTask::class) {
|
|
|
|
setWorkingDir(buildDir)
|
|
|
|
setArgs(listOf("install", "mocha"))
|
|
|
|
}
|
2019-03-27 20:43:01 +03:00
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
val runMocha by tasks.registering(NodeTask::class) {
|
|
|
|
dependsOn(compileTestKotlinJs, populateNodeModules, installMocha)
|
|
|
|
setScript(file("$buildDir/node_modules/mocha/bin/mocha"))
|
|
|
|
setArgs(listOf(compileTestKotlinJs.outputFile))
|
|
|
|
}
|
2019-03-27 20:43:01 +03:00
|
|
|
|
2019-03-31 17:39:44 +03:00
|
|
|
tasks["jsTest"].dependsOn(runMocha)
|
2019-03-27 20:43:01 +03:00
|
|
|
}
|
2019-03-07 09:52:04 +03:00
|
|
|
}
|
|
|
|
|
2019-03-26 12:21:33 +03:00
|
|
|
sourceSets {
|
|
|
|
|
|
|
|
val commonMain by getting {
|
|
|
|
dependencies {
|
|
|
|
api(kotlin("stdlib"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val commonTest by getting {
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("test-common"))
|
|
|
|
implementation(kotlin("test-annotations-common"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val jvmMain by getting {
|
|
|
|
dependencies {
|
|
|
|
api(kotlin("stdlib-jdk8"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val jvmTest by getting {
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("test"))
|
|
|
|
implementation(kotlin("test-junit"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val jsMain by getting {
|
|
|
|
dependencies {
|
|
|
|
api(kotlin("stdlib-js"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
val jsTest by getting {
|
|
|
|
dependencies {
|
|
|
|
implementation(kotlin("test-js"))
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
targets.all {
|
|
|
|
sourceSets.all {
|
|
|
|
languageSettings.progressiveMode = true
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
configure<PublishingExtension> {
|
2019-03-01 22:10:17 +03:00
|
|
|
|
2019-03-07 09:52:04 +03:00
|
|
|
publications.filterIsInstance<MavenPublication>().forEach { publication ->
|
|
|
|
if (publication.name == "kotlinMultiplatform") {
|
|
|
|
// for our root metadata publication, set artifactId with a package and project name
|
|
|
|
publication.artifactId = project.name
|
|
|
|
} else {
|
|
|
|
// for targets, set artifactId with a package, project name and target name (e.g. iosX64)
|
|
|
|
publication.artifactId = "${project.name}-${publication.name}"
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
targets.all {
|
|
|
|
val publication = publications.findByName(name) as MavenPublication
|
|
|
|
|
|
|
|
// Patch publications with fake javadoc
|
|
|
|
publication.artifact(stubJavadoc.get())
|
|
|
|
}
|
2019-03-01 22:10:17 +03:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-03-06 18:15:30 +03:00
|
|
|
}
|