/* * 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" } } } // These two flags are enabled in train builds for JVM IR compiler testing ext.jvm_ir_enabled = rootProject.properties['enable_jvm_ir'] != null ext.native_targets_enabled = rootProject.properties['disable_native_targets'] == null repositories { jcenter() maven { url "https://plugins.gradle.org/m2/" } // Future replacement for kotlin-dev, with cache redirector maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } } 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() // Future replacement for kotlin-dev, with cache redirector maven { url "https://cache-redirector.jetbrains.com/maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } maven { url "https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev" } } 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/publishing.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))