Files
kotlin-fork/tools/kotlin-native-gradle-plugin/build.gradle
T
2017-09-19 16:29:00 +03:00

140 lines
4.3 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 {
apply from: "$rootDir/gradle/kotlinGradlePlugin.gradle"
repositories {
jcenter()
}
dependencies {
classpath 'com.jfrog.bintray.gradle:gradle-bintray-plugin:1.7.3'
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'groovy'
apply plugin: 'maven-publish'
apply plugin: 'com.jfrog.bintray'
group = 'org.jetbrains.kotlin'
version = konanVersion
// TODO: move this code to top level (the same for backend.native)
// Copied from backend.native
allprojects {
repositories {
maven { url kotlinCompilerRepo }
}
configurations.all {
// kotlin-compiler module includes Kotlin runtime bundled;
// make Gradle aware of this to avoid multiple Kotlin runtimes in classpath:
resolutionStrategy.dependencySubstitution {
substitute module('org.jetbrains.kotlin:kotlin-runtime') with module(kotlinCompilerModule)
substitute module('org.jetbrains.kotlin:kotlin-stdlib') with module(kotlinCompilerModule)
substitute module('org.jetbrains.kotlin:kotlin-reflect') with module(kotlinCompilerModule)
}
// TODO: probably we should use kotlin-compiler without bundled runtime
}
}
repositories {
mavenCentral()
}
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")
}
}
}
dependencies {
compile project(':shared')
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
compile gradleApi()
testCompile gradleTestKit()
testCompile 'junit:junit:4.12'
testCompile('org.spockframework:spock-core:1.1-groovy-2.4') {
exclude module: 'groovy-all'
}
testRuntime files(pluginMetadata)
}
test {
dependsOn ':cross_dist'
//testLogging.showStandardStreams = true
systemProperty("konan.home", rootProject.file('dist').canonicalPath)
}
jar {
from (rootProject.findProject(':shared').sourceSets.main.output)
}
processResources {
expand('konanVersion': konanVersion)
}
publishing {
publications {
gradlePlugin(MavenPublication) {
artifact jar
pom.withXml { XmlProvider xml ->
def stdlibDep = xml.asNode().appendNode("dependencies").appendNode("dependency")
stdlibDep.appendNode("groupId", "org.jetbrains.kotlin")
stdlibDep.appendNode("artifactId", "kotlin-stdlib")
stdlibDep.appendNode("version", "$kotlin_version")
}
}
}
}
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']
}