189 lines
6.4 KiB
Groovy
189 lines
6.4 KiB
Groovy
/*
|
|
* Copyright 2010-2017 JetBrains s.r.o.
|
|
*
|
|
* Licensed under the Apache License, Version 2.0 (the "License");
|
|
* you may not use this file except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*/
|
|
|
|
import org.jetbrains.kotlin.konan.KonanVersion
|
|
|
|
/**
|
|
* One may use bintrayUser/bintrayKey project properties or BINTRAY_USER/BINTRAY_KEY environment variables to upload
|
|
* built plugin to bintray repository.
|
|
*/
|
|
|
|
buildscript {
|
|
ext.rootBuildDirectory = file('../../')
|
|
|
|
apply from: "$rootBuildDirectory/gradle/loadRootProperties.gradle"
|
|
apply from: "$rootBuildDirectory/gradle/kotlinGradlePlugin.gradle"
|
|
|
|
repositories {
|
|
maven {
|
|
url = 'https://cache-redirector.jetbrains.com/jcenter'
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
classpath "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
|
|
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
|
|
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
|
|
}
|
|
}
|
|
apply plugin: 'java-gradle-plugin'
|
|
apply plugin: 'kotlin'
|
|
apply plugin: 'groovy'
|
|
apply plugin: 'maven-publish'
|
|
apply plugin: 'com.jfrog.bintray'
|
|
apply plugin: 'com.github.johnrengelman.shadow'
|
|
|
|
group = 'org.jetbrains.kotlin'
|
|
version = KonanVersion.Companion.CURRENT.toString()
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
maven {
|
|
url kotlinCompilerRepo
|
|
}
|
|
}
|
|
|
|
configurations {
|
|
bundleDependencies {
|
|
transitive = false
|
|
}
|
|
}
|
|
|
|
dependencies {
|
|
compile "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
|
|
compile "org.jetbrains.kotlin:kotlin-stdlib:$buildKotlinVersion"
|
|
compile "org.jetbrains.kotlin:kotlin-gradle-plugin:$buildKotlinVersion"
|
|
|
|
bundleDependencies "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
|
|
|
|
testCompile 'junit:junit:4.12'
|
|
testCompile "org.jetbrains.kotlin:kotlin-test:$buildKotlinVersion"
|
|
testCompile "org.jetbrains.kotlin:kotlin-test-junit:$buildKotlinVersion"
|
|
testCompile "org.tools4j:tools4j-spockito:1.6"
|
|
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
|
|
exclude module: 'groovy-all'
|
|
}
|
|
}
|
|
|
|
jar {
|
|
appendix = "no-shared"
|
|
}
|
|
|
|
shadowJar {
|
|
configurations = [project.configurations.bundleDependencies]
|
|
classifier = null
|
|
}
|
|
|
|
assemble.dependsOn shadowJar
|
|
|
|
test {
|
|
systemProperty("kotlin.version", buildKotlinVersion)
|
|
if (project.hasProperty("konan.home")) {
|
|
systemProperty("konan.home", project.property("konan.home"))
|
|
} else {
|
|
// The Koltin/Native compiler must be built before test execution.
|
|
systemProperty("konan.home", distDir.absolutePath)
|
|
}
|
|
if (project.hasProperty("konan.jvmArgs")) {
|
|
systemProperty("konan.jvmArgs", project.property("konan.jvmArgs"))
|
|
}
|
|
// Uncomment for debugging.
|
|
//testLogging.showStandardStreams = true
|
|
if (project.hasProperty("maxParallelForks")) {
|
|
maxParallelForks=project.property("maxParallelForks")
|
|
}
|
|
if (project.hasProperty("filter")) {
|
|
filter.includeTestsMatching project.property("filter")
|
|
}
|
|
|
|
}
|
|
|
|
processResources {
|
|
// We add konanVersion as a task input to avoid considering this task up-to-date when
|
|
// konanVersion is actually changed and should be updated in the plugin jar.
|
|
from(file("$rootBuildDirectory/utilities/env_blacklist"))
|
|
}
|
|
|
|
compileTestGroovy.dependsOn.remove('compileTestJava')
|
|
compileTestKotlin.dependsOn compileTestGroovy
|
|
compileTestKotlin.classpath += files(compileTestGroovy.destinationDir)
|
|
|
|
// TODO: Get rid of manual pom generation.
|
|
publishing {
|
|
publications {
|
|
gradlePlugin(MavenPublication) {
|
|
artifact shadowJar
|
|
pom.withXml { XmlProvider xml ->
|
|
def deps = xml.asNode().appendNode("dependencies")
|
|
|
|
def stdlibDep = deps.appendNode("dependency")
|
|
stdlibDep.appendNode("groupId", "org.jetbrains.kotlin")
|
|
stdlibDep.appendNode("artifactId", "kotlin-stdlib")
|
|
stdlibDep.appendNode("version", "$buildKotlinVersion")
|
|
|
|
def kotlinPluginDep = deps.appendNode("dependency")
|
|
kotlinPluginDep.appendNode("groupId", "org.jetbrains.kotlin")
|
|
kotlinPluginDep.appendNode("artifactId", "kotlin-gradle-plugin")
|
|
kotlinPluginDep.appendNode("version", "$buildKotlinVersion")
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
bintray {
|
|
user = project.hasProperty('bintrayUser') ? project.property('bintrayUser') : System.getenv('BINTRAY_USER')
|
|
key = project.hasProperty('bintrayKey') ? project.property('bintrayKey') : System.getenv('BINTRAY_KEY')
|
|
pkg {
|
|
repo = 'kotlin-native-dependencies'
|
|
name = 'kotlin-native-gradle-plugin'
|
|
userOrg = 'jetbrains'
|
|
licenses = ['Apache-2.0']
|
|
vcsUrl = 'https://github.com/JetBrains/kotlin-native'
|
|
version {
|
|
name = project.version
|
|
desc = "Kotlin Native Gradle plugin $konanVersion"
|
|
}
|
|
publish = project.findProperty("bintrayPublish").toString().toBoolean()
|
|
override = project.findProperty("bintrayOverride").toString().toBoolean()
|
|
}
|
|
publications = ['gradlePlugin']
|
|
}
|
|
|
|
gradlePlugin {
|
|
plugins {
|
|
create("konan") {
|
|
id = 'konan'
|
|
implementationClass = 'org.jetbrains.kotlin.gradle.plugin.KonanPlugin'
|
|
}
|
|
create("kotlin-native") {
|
|
id = 'kotlin-native'
|
|
implementationClass = 'org.jetbrains.kotlin.gradle.plugin.experimental.plugins.KotlinNativePlugin'
|
|
}
|
|
create("kotlin-platform-native") {
|
|
id = 'kotlin-platform-native'
|
|
implementationClass = 'org.jetbrains.kotlin.gradle.plugin.experimental.plugins.KotlinPlatformNativePlugin'
|
|
}
|
|
create("org.jetbrains.kotlin.native"){
|
|
id = 'org.jetbrains.kotlin.native'
|
|
implementationClass = 'org.jetbrains.kotlin.gradle.plugin.experimental.plugins.KotlinNativePlugin'
|
|
}
|
|
create("org.jetbrains.kotlin.platform.native") {
|
|
id = 'org.jetbrains.kotlin.platform.native'
|
|
implementationClass = 'org.jetbrains.kotlin.gradle.plugin.experimental.plugins.KotlinPlatformNativePlugin'
|
|
}
|
|
}
|
|
}
|