Provide a method for common publishing configuration.

This commit is contained in:
Ilya Gorbunov
2017-03-29 06:50:18 +03:00
parent 92ef26606b
commit 0b2cadc638
14 changed files with 84 additions and 28 deletions
+59 -23
View File
@@ -1,4 +1,3 @@
buildscript {
ext.kotlin_version = "1.1-SNAPSHOT"
ext.kotlin_language_version = "1.1"
@@ -17,14 +16,12 @@ 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 {
allprojects {
group = 'org.jetbrains.kotlin'
version = "$kotlin_version"
}
subprojects {
apply plugin: 'maven'
apply plugin: 'signing'
repositories {
mavenCentral()
@@ -47,25 +44,6 @@ subprojects {
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
}
}
}
}
}
static def configureJvmProject(Project project) {
@@ -108,6 +86,64 @@ static def manifestAttributes(Manifest manifest, Project project, String compone
}
}
static def configurePublishing(Project project) {
project.configure(project) {
apply plugin: 'maven'
apply plugin: 'signing'
signing {
required { (project.properties["signingRequired"] ?: false) }
sign configurations.archives
}
signArchives {
enabled signing.required
}
uploadArchives {
repositories {
mavenDeployer {
beforeDeployment { MavenDeployment deployment -> signing.signPom(deployment) }
repository(url: project.properties["deployRepoUrl"] ?: "file://${rootProject.buildDir}/repo") {
authentication(
userName: project.properties["deployRepoUsername"],
password: project.properties["deployRepoPassword"]
)
}
pom.project {
name "${project.group}:${project.name}"
packaging 'jar'
// optionally artifactId can be defined here
description project.description
url 'https://kotlinlang.org/'
licenses {
license {
name 'The Apache License, Version 2.0'
url 'http://www.apache.org/licenses/LICENSE-2.0.txt'
}
}
scm {
url 'https://github.com/JetBrains/kotlin'
connection 'scm:git:https://github.com/JetBrains/kotlin.git'
developerConnection 'scm:git:https://github.com/JetBrains/kotlin.git'
}
developers {
developer {
name 'Kotlin Team'
organization = 'JetBrains'
organizationUrl 'https://www.jetbrains.com'
}
}
}
}
}
}
task publish(dependsOn: uploadArchives)
}
}
def createPreprocessorTask(Project project, def name, def sourceDir, def targetDir, def profile = "JS") {
return project.tasks.create("preprocessSources$name", JavaExec) {
inputs.dir(sourceDir)
@@ -2,6 +2,9 @@ description = 'Kotlin Test Common'
apply plugin: 'kotlin-platform-common'
configurePublishing(project)
dependencies {
compile project(':kotlin-stdlib-common')
}
+2
View File
@@ -2,6 +2,8 @@ description = 'Kotlin Test for JS'
apply plugin: 'kotlin-platform-js'
configurePublishing(project)
dependencies {
implement project(':kotlin-test:kotlin-test-common')
compile project(':kotlin-stdlib-js')
+2
View File
@@ -3,6 +3,8 @@ description = 'Kotlin Test JUnit'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
dependencies {
compile project(':kotlin-test:kotlin-test-jvm')
+1
View File
@@ -4,6 +4,7 @@ description = 'Kotlin Test'
apply plugin: 'kotlin-platform-jvm'
configureJvmProject(project)
configurePublishing(project)
dependencies {
implement project(':kotlin-test:kotlin-test-common')
+1
View File
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
sourceSets {
builtins {
+2
View File
@@ -2,6 +2,8 @@ description = 'Kotlin Common Standard Library'
apply plugin: 'kotlin-platform-common'
configurePublishing(project)
ext.commonSrcDir = "${buildDir}/common-sources"
sourceSets {
+1
View File
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library JRE 7 extension'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
dependencies {
compile project(':kotlin-stdlib')
+1
View File
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library JRE 8 extension'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
dependencies {
compile project(':kotlin-stdlib')
+3
View File
@@ -6,6 +6,9 @@ description = 'Kotlin Standard Library for JS'
apply plugin: 'kotlin2js'
configurePublishing(project)
def builtinsSrcDir = "${buildDir}/builtin-sources"
def commonSrcDir = "${buildDir}/common-sources"
def commonTestSrcDir = "${buildDir}/common-test-sources"
+3 -2
View File
@@ -16,6 +16,7 @@ apply plugin: 'com.github.johnrengelman.shadow'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
def core = "${rootDir}/../core"
@@ -99,7 +100,7 @@ task reflectShadowJar(type: ShadowJar) {
createScriptTask(project, "stripMetadata") {
dependsOn reflectShadowJar
def inputJar = reflectShadowJar.archivePath
def outputJar = "${buildDir}/libs/kotlin-reflect-stripped.jar"
def outputJar = "${libsDir}/kotlin-reflect-stripped.jar"
inputs.file(inputJar)
outputs.file(outputJar)
args += [
@@ -113,7 +114,7 @@ createScriptTask(project, "stripMetadata") {
def mainArchiveName = "${archivesBaseName}-${project.version}.jar"
def outputJarPath = "${buildDir}/libs/${mainArchiveName}"
def outputJarPath = "${libsDir}/${mainArchiveName}"
def rtJar = ['jre/lib/rt.jar', '../Classes/classes.jar'].collect { new File(JDK_16, it) }.find { it.isFile() }
task proguard(type: proguard.gradle.ProGuardTask) {
+4 -3
View File
@@ -10,14 +10,15 @@ buildscript {
}
}
apply plugin: 'base'
apply plugin: 'com.github.johnrengelman.shadow'
def protobufVersion = "2.6.1"
def outputJarPath = "$buildDir/libs/${archivesBaseName}-${protobufVersion}.jar"
version = protobufVersion
def outputJarPath = "${libsDir}/${archivesBaseName}-${protobufVersion}.jar"
configurations {
protobuf
protobufSrc
+1
View File
@@ -3,6 +3,7 @@ description 'Kotlin Runtime (deprecated, use koltin-stdlib artifact instead)'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
dependencies {
compile group: 'org.jetbrains', name: 'annotations', version:'13.0'
@@ -3,6 +3,7 @@ description 'Kotlin Script Runtime'
apply plugin: 'kotlin'
configureJvmProject(project)
configurePublishing(project)
dependencies {
compileOnly project(':kotlin-stdlib')