128 lines
3.7 KiB
Groovy
128 lines
3.7 KiB
Groovy
|
|
buildscript {
|
|
ext.kotlin_version = "1.1-SNAPSHOT"
|
|
ext.kotlin_language_version = "1.1"
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
dependencies {
|
|
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.1.1"
|
|
}
|
|
}
|
|
|
|
ext.JDK_16 = System.getenv("JDK_16")
|
|
ext.JDK_17 = System.getenv("JDK_17")
|
|
ext.JDK_18 = System.getenv("JDK_18")
|
|
ext.bootstrapCompilerFile = project.file("${rootDir}/../dist/kotlinc/lib/kotlin-compiler.jar")
|
|
|
|
allprojects {
|
|
group = 'org.jetbrains.kotlin'
|
|
version = "$kotlin_version"
|
|
}
|
|
|
|
subprojects {
|
|
apply plugin: 'maven'
|
|
apply plugin: 'signing'
|
|
|
|
repositories {
|
|
mavenCentral()
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.AbstractKotlinCompile) {
|
|
compilerJarFile = bootstrapCompilerFile
|
|
}
|
|
|
|
task javadocJar(type: Jar) {
|
|
classifier = 'javadoc'
|
|
}
|
|
|
|
signing {
|
|
required { project.ext.has('signing.keyId') }
|
|
sign configurations.archives
|
|
}
|
|
|
|
uploadArchives {
|
|
repositories {
|
|
mavenDeployer {
|
|
repository(url: "file://${rootDir}/localRepo")
|
|
uniqueVersion = false
|
|
pom.version = kotlin_version
|
|
pom.project {
|
|
groupId = project.group
|
|
artifactId = project.name
|
|
version = project.version
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
// plain kotlin jvm projects
|
|
configure(subprojects.findAll {it.name in [
|
|
'kotlin-runtime', 'kotlin-script-runtime',
|
|
'kotlin-stdlib', 'kotlin-stdlib-jre7', 'kotlin-stdlib-jre8',
|
|
'kotlin-test-junit',
|
|
'kotlin-reflect']}) {
|
|
|
|
apply plugin: 'kotlin'
|
|
|
|
commonJvmProjectConfiguration(project)
|
|
|
|
}
|
|
|
|
static def commonJvmProjectConfiguration(Project project) {
|
|
project.configure(project) {
|
|
jar {
|
|
manifest {
|
|
attributes 'Implementation-Vendor': 'JetBrains',
|
|
'Implementation-Title': "${project.description ?: project.name}", // TODO: project.description is resolved after evaluating this, therefore this attribute is repeated in the projects; seek for a solution
|
|
'Implementation-Version': version,
|
|
'Build-Jdk': System.getProperty('java.version'),
|
|
'Built-By': 'JetBrains'
|
|
}
|
|
from("${rootDir}/../dist/kotlinc/build.txt") { into("META-INF/") }
|
|
}
|
|
|
|
|
|
task sourcesJar(type: Jar, dependsOn:classes) {
|
|
classifier = 'sources'
|
|
from sourceSets.main.kotlin
|
|
}
|
|
|
|
tasks.withType(JavaCompile) {
|
|
sourceCompatibility = 1.6
|
|
targetCompatibility = 1.6
|
|
options.fork = true
|
|
options.forkOptions.executable = "${JDK_16}/bin/javac"
|
|
}
|
|
|
|
tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile) {
|
|
kotlinOptions.jdkHome = JDK_16
|
|
}
|
|
|
|
test {
|
|
executable = "$JDK_16/bin/java"
|
|
}
|
|
}
|
|
}
|
|
|
|
static def manifestAttributes(Manifest manifest, Project project, String component) {
|
|
project.configure(manifest) {
|
|
attributes \
|
|
'Kotlin-Runtime-Component': component,
|
|
'Kotlin-Version': "${project.kotlin_language_version}",
|
|
'Implementation-Title': "${project.description ?: project.name}"
|
|
}
|
|
}
|
|
|
|
def createPreprocessorTask(Project project, def name, def sourceDir, def targetDir, def profile = "JS") {
|
|
return project.tasks.create("preprocessSources$name", JavaExec) {
|
|
inputs.dir(sourceDir)
|
|
outputs.dir(targetDir)
|
|
classpath = project.files(bootstrapCompilerFile)
|
|
main = "org.jetbrains.kotlin.preprocessor.PreprocessorCLI"
|
|
args = [sourceDir, targetDir, profile]
|
|
}
|
|
}
|