Files
kotlin-fork/tools/kotlin-native-gradle-plugin/build.gradle
T

163 lines
5.0 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.
*/
/**
* 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 {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
classpath 'com.github.jengelman.gradle.plugins:shadow:2.0.2'
}
}
apply plugin: 'java'
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
repositories {
mavenCentral()
maven {
url kotlinCompilerRepo
}
}
task pluginMetadata {
def outputDir = file("$buildDir/$name")
inputs.files sourceSets.main.runtimeClasspath
outputs.dir outputDir
doLast {
outputDir.mkdirs()
def metadata = new Properties()
metadata.put("implementation-classpath", sourceSets.main.runtimeClasspath.join(File.pathSeparator))
file("$outputDir/plugin-under-test-metadata.properties").withPrintWriter {
metadata.store(it, "Plugin metadata")
}
}
}
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"
compile gradleApi()
bundleDependencies "org.jetbrains.kotlin:kotlin-native-shared:$konanVersion"
testCompile gradleTestKit()
testCompile 'junit:junit:4.12'
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
exclude module: 'groovy-all'
}
testRuntime files(pluginMetadata)
}
shadowJar {
configurations = [project.configurations.bundleDependencies]
classifier = null
}
test {
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 {
expand('konanVersion': konanVersion)
from(file("$rootBuildDirectory/utilities/env_blacklist"))
}
// 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 = konanVersion
desc = "Kotlin Native Gradle plugin $konanVersion"
}
publish = true // project.hasProperty("publish")
override = project.hasProperty("override")
}
publications = ['gradlePlugin']
}