/* * Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license. */ import org.jetbrains.kotlin.konan.target.HostManager buildscript { /* * These property group is used to build kotlinx.atomicfu against Kotlin compiler snapshot. * How does it work: * When build_snapshot_train is set to true, kotlin_version property is overridden with kotlin_snapshot_version, * Additionally, mavenLocal and Sonatype snapshots are added to repository list (the former is required for AFU and public * the latter is required for compiler snapshots). * DO NOT change the name of these properties without adapting kotlinx.train build chain. */ def prop = rootProject.properties['build_snapshot_train'] ext.build_snapshot_train = prop != null && prop != "" if (build_snapshot_train) { ext.kotlin_version = rootProject.properties['kotlin_snapshot_version'] if (kotlin_version == null) { throw new IllegalArgumentException("'kotlin_snapshot_version' should be defined when building with snapshot compiler") } repositories { mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } repositories { jcenter() maven { url "https://plugins.gradle.org/m2/" } maven { url "https://kotlin.bintray.com/kotlin-dev" credentials { username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" } } maven { url "https://kotlin.bintray.com/kotlin-eap" } maven { url "https://jetbrains.bintray.com/kotlin-native-dependencies" } } dependencies { classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "com.moowork.gradle:gradle-node-plugin:$gradle_node_version" } } allprojects { // the only place where HostManager could be instantiated project.ext.hostManager = new HostManager() if (build_snapshot_train) { kotlin_version = rootProject.properties['kotlin_snapshot_version'] repositories { mavenLocal() maven { url "https://oss.sonatype.org/content/repositories/snapshots" } } } println "Using Kotlin $kotlin_version for project $it" repositories { jcenter() maven { url "https://kotlin.bintray.com/kotlin-eap" } maven { url "https://kotlin.bintray.com/kotlin-dev" credentials { username = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER') ?: "" password = project.hasProperty('bintrayApiKey') ? project.property('bintrayApiKey') : System.getenv('BINTRAY_API_KEY') ?: "" } } maven { url "https://kotlin.bintray.com/kotlinx" } } def deployVersion = properties['DeployVersion'] if (deployVersion != null) version = deployVersion // 'atomicfu-native' check is a kludge so that existing YouTrack config works, todo: remove if (project != rootProject && project.name != 'atomicfu-native') { apply from: rootProject.file("gradle/publish-bintray.gradle") } // This fixes "org.gradle.jvm.version" in Gradle metadata plugins.withType(JavaPlugin) { java { sourceCompatibility = JavaVersion.VERSION_1_8 targetCompatibility = JavaVersion.VERSION_1_8 } } } println("Using Kotlin compiler version: $org.jetbrains.kotlin.config.KotlinCompilerVersion.VERSION") if (build_snapshot_train) { afterEvaluate { println "Manifest of kotlin-compiler-embeddable.jar for atomicfu" configure(subprojects.findAll { it.name == "atomicfu" }) { configurations.matching { it.name == "kotlinCompilerClasspath" }.all { resolvedConfiguration.getFiles().findAll { it.name.contains("kotlin-compiler-embeddable") }.each { def manifest = zipTree(it).matching { include 'META-INF/MANIFEST.MF' }.getFiles().first() manifest.readLines().each { println it } } } } } } // main deployment task task deploy(dependsOn: getTasksByName("publish", true) + getTasksByName("publishNpm", true))