1- import java.io.FileInputStream
2- import java.util.Properties
3- import org.gradle.jvm.tasks.Jar
4- import org.jetbrains.dokka.Platform
5- import org.jetbrains.dokka.gradle.DokkaTask
6-
7-
81plugins {
9- kotlin(" multiplatform" ) version " 1.6.20"
10- `maven- publish`
11- signing
12- id(" org.jetbrains.dokka" ) version " 1.6.21"
132 id(" io.github.gradle-nexus.publish-plugin" ) version " 1.1.0"
143}
154
16- group = " io.github.whathecode.kotlinx.interval"
17- version = " 1.0.0-alpha.2"
18-
19- repositories {
20- mavenCentral()
21- gradlePluginPortal()
22- }
23-
24- kotlin {
25- jvm {
26- compilations.all {
27- kotlinOptions.jvmTarget = " 1.8"
28- }
29- withJava()
30- testRuns[" test" ].executionTask.configure {
31- useJUnitPlatform()
32- }
33- }
34- js(BOTH ) {
35- browser { }
36- }
37- val hostOs = System .getProperty(" os.name" )
38- val isMingwX64 = hostOs.startsWith(" Windows" )
39- val nativeTarget = when {
40- hostOs == " Mac OS X" -> macosX64(" native" )
41- hostOs == " Linux" -> linuxX64(" native" )
42- isMingwX64 -> mingwX64(" native" )
43- else -> throw GradleException (" Host OS is not supported in Kotlin/Native." )
44- }
45-
46-
47- sourceSets {
48- val commonMain by getting
49- val commonTest by getting {
50- dependencies {
51- implementation(kotlin(" test" ))
52- }
53- }
54- val jvmMain by getting
55- val jvmTest by getting
56- val jsMain by getting
57- val jsTest by getting
58- val nativeMain by getting
59- val nativeTest by getting
60- }
61- }
62-
63-
645// Publish configuration.
656// For signing and publishing to work, a 'publish.properties' file needs to be added to the root containing:
667// The OpenPGP credentials to sign all artifacts:
@@ -69,70 +10,13 @@ kotlin {
6910// A username and password to upload artifacts to the Sonatype repository:
7011// > repository.username=<SONATYPE USERNAME>
7112// > repository.password=<SONATYPE PASSWORD>
72- val publishProperties = Properties ()
13+ val publishProperties = java.util. Properties ()
7314val publishPropertiesFile = File (" publish.properties" )
7415if (publishPropertiesFile.exists()) {
75- publishProperties.load(FileInputStream (publishPropertiesFile))
76- }
77- val dokkaJvmJavadoc by tasks.creating(DokkaTask ::class ) {
78- dokkaSourceSets {
79- register(" jvm" ) {
80- platform.set(Platform .jvm)
81- sourceRoots.from(kotlin.sourceSets.getByName(" jvmMain" ).kotlin.srcDirs)
82- }
83- }
84- }
85- val javadocJar by tasks.creating(Jar ::class ) {
86- group = JavaBasePlugin .DOCUMENTATION_GROUP
87- description = " Create javadoc jar using Dokka"
88- archiveClassifier.set(" javadoc" )
89- from(dokkaJvmJavadoc)
90- }
91- publishing {
92- repositories {
93- maven {
94- name = " local"
95- url = uri(" $buildDir /repo" )
96- }
97- }
98- publications.filterIsInstance<MavenPublication >().forEach {
99- if (it.name == " jvm" ) {
100- it.artifact(javadocJar)
101- }
102- it.pom {
103- name.set(" kotlinx.interval" )
104- description.set(" Kotlin multiplatform bounded open/closed generic intervals." )
105- url.set(" https://github.com/Whathecode/kotlinx.interval" )
106- licenses {
107- license {
108- name.set(" The Apache Licence, Version 2.0" )
109- url.set(" http://www.apache.org/licenses/LICENSE-2.0.txt" )
110- }
111- }
112- developers {
113- developer {
114- id.set(" Whathecode" )
115- name.set(" Steven Jeuris" )
116- email.set(" steven.jeuris@gmail.com" )
117- }
118- }
119- scm {
120- connection.set(" scm:git:git://github.com/Whathecode/kotlinx.interval.git" )
121- developerConnection.set(" scm:git:ssh://github.com/Whathecode/carp.core-kotlin.git" )
122- url.set(" https://github.com/Whathecode/kotlinx.interval" )
123- }
124- }
125- }
126- }
127- signing {
128- val signingKeyFile = publishProperties[" signing.keyFile" ] as ? String
129- if (signingKeyFile != null ) {
130- val signingKey = File (signingKeyFile).readText()
131- val signingPassword = publishProperties[" signing.password" ] as ? String
132- useInMemoryPgpKeys(signingKey, signingPassword)
133- sign(publishing.publications)
134- }
16+ publishProperties.load(java.io.FileInputStream (publishPropertiesFile))
13517}
18+ group = " io.github.whathecode.kotlinx.interval"
19+ version = " 1.0.0-alpha.3"
13620nexusPublishing {
13721 repositories {
13822 sonatype {
@@ -143,10 +27,12 @@ nexusPublishing {
14327 }
14428 }
14529}
146- val setSnapshotVersion by tasks.creating {
30+ val setSnapshotVersion: Task by tasks.creating {
14731 doFirst {
14832 val versionSplit = version.toString().split(" -" )
14933 val snapshotVersion = " ${versionSplit[0 ]} -SNAPSHOT"
15034 version = snapshotVersion
35+
36+ rootProject.subprojects.forEach { it.version = snapshotVersion }
15137 }
15238}
0 commit comments