Provide a method for common publishing configuration.
This commit is contained in:
+59
-23
@@ -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,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')
|
||||
|
||||
@@ -3,6 +3,8 @@ description = 'Kotlin Test JUnit'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-test:kotlin-test-jvm')
|
||||
|
||||
@@ -4,6 +4,7 @@ description = 'Kotlin Test'
|
||||
apply plugin: 'kotlin-platform-jvm'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
dependencies {
|
||||
implement project(':kotlin-test:kotlin-test-common')
|
||||
|
||||
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
sourceSets {
|
||||
builtins {
|
||||
|
||||
@@ -2,6 +2,8 @@ description = 'Kotlin Common Standard Library'
|
||||
|
||||
apply plugin: 'kotlin-platform-common'
|
||||
|
||||
configurePublishing(project)
|
||||
|
||||
ext.commonSrcDir = "${buildDir}/common-sources"
|
||||
|
||||
sourceSets {
|
||||
|
||||
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library JRE 7 extension'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib')
|
||||
|
||||
@@ -3,6 +3,7 @@ description = 'Kotlin Standard Library JRE 8 extension'
|
||||
apply plugin: 'kotlin'
|
||||
|
||||
configureJvmProject(project)
|
||||
configurePublishing(project)
|
||||
|
||||
dependencies {
|
||||
compile project(':kotlin-stdlib')
|
||||
|
||||
@@ -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"
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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')
|
||||
|
||||
Reference in New Issue
Block a user