Skip to content

Commit 18ec990

Browse files
committed
Update to latest Kotlin and Gradle
1 parent eb4a90e commit 18ec990

31 files changed

+423
-324
lines changed

CHANGELOG.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
# Changelog
2+
All notable changes to this project will be documented in this file.
3+
4+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/).
5+
6+
## [unreleased]
7+
- Update dependencies.
8+
9+
[unreleased]: https://github.com/virtlink/disjoint-map/compare/v0.1...HEAD
10+
[0.1]: https://github.com/virtlink/disjoint-map/releases/tag/v0.1

CONTRIBUTING.md

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,19 @@
11
## How to Contribute
22
Thank you for wanting to contribute to this project! :tada::+1:
33

4-
> **Note**: This is a personal project for which I voluntarily give my time.
5-
> I may not deal with your issue or pull request in a timely manner, or at all.
6-
> I also reserve the right to change your contribution in any way I deem fit
4+
> **Note**:
5+
> We may not deal with your issue or pull request in a timely manner, or at all.
6+
> We also reserve the right to change your contribution in any way we deem fit
77
> for this project, or even outright reject it.
88
99
#### **You have a question?**
10-
Please go to [Stackoverflow](https://stackoverflow.com/) and ask your question there.
10+
Search the [Discussions][1] and [Stackoverflow][3] to see whether your question
11+
has already been answered, or ask your question there.
1112
Please do **not** make an issue on the Github repository.
1213

14+
1315
#### **You found a bug**
14-
Search the [Issues](https://github.com/Virtlink/disjoint-map/issues) to ensure the bug has not been reported before.
16+
Search the [Issues][2] to ensure the bug has not been reported before.
1517

1618
If the bug is new, open a new issue with a _clear title and description_.
1719
Please indicate:
@@ -44,4 +46,8 @@ Thank you! Please open a GitHub pull request with the patch.
4446

4547
Thanks! :heart: :heart: :heart:
4648

47-
Daniel A. A. Pelsmaeker
49+
Daniel
50+
51+
[1]: https://github.com/Virtlink/disjoint-map/discussions
52+
[2]: https://github.com/Virtlink/disjoint-map/issues
53+
[3]: https://stackoverflow.com/

build.gradle.kts

Lines changed: 136 additions & 136 deletions
Original file line numberDiff line numberDiff line change
@@ -1,160 +1,160 @@
1-
import org.jetbrains.dokka.gradle.DokkaTask
2-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
3-
//import com.jfrog.bintray.gradle.BintrayPlugin
4-
//import com.jfrog.bintray.gradle.BintrayExtension
5-
import java.util.Date
1+
//import org.jetbrains.dokka.gradle.DokkaTask
2+
import com.adarshr.gradle.testlogger.theme.ThemeType
63

74
plugins {
8-
java
5+
`java-library`
96
`maven-publish`
10-
kotlin("jvm") version "1.5.31"
11-
id("org.jetbrains.dokka") version "0.10.1"
7+
signing
8+
alias(libs.plugins.kotlin.jvm)
9+
// alias(libs.plugins.dokka) // Generate documentation
10+
alias(libs.plugins.gitVersion) // Set gitVersion() from last Git repository tag
11+
alias(libs.plugins.benmanesVersions) // Check for dependency updates
12+
alias(libs.plugins.testlogger) // Pretty-print test results live to console
13+
alias(libs.plugins.nexuspublish) // Publish on Maven Central
14+
alias(libs.plugins.dependencycheck) // Gradle dependency check
1215
}
1316

14-
repositories {
15-
mavenCentral()
16-
}
1717

18-
val junitVersion = "5.8.1"
18+
allprojects {
19+
apply(plugin = "java-library")
20+
apply(plugin = "maven-publish")
21+
apply(plugin = "signing")
22+
apply(plugin = "kotlin")
23+
apply(plugin = "com.palantir.git-version")
24+
apply(plugin = "com.github.ben-manes.versions")
25+
apply(plugin = "com.adarshr.test-logger")
1926

20-
dependencies {
21-
implementation (kotlin("stdlib-jdk8"))
22-
implementation ("org.jetbrains.kotlinx:kotlinx-collections-immutable-jvm:0.3.4")
27+
val gitVersion: groovy.lang.Closure<String> by extra
2328

24-
compileOnly ("com.google.code.findbugs:jsr305:3.0.2")
29+
group = "dev.pelsmaeker"
30+
version = gitVersion()
31+
description = "A disjoint map implementation for the JVM."
2532

26-
testImplementation ("org.junit.jupiter:junit-jupiter-api:$junitVersion")
27-
testRuntimeOnly ("org.junit.jupiter:junit-jupiter-engine:$junitVersion")
28-
}
33+
extra["isSnapshotVersion"] = version.toString().endsWith("-SNAPSHOT")
34+
extra["isDirtyVersion"] = version.toString().endsWith(".dirty")
35+
extra["isCI"] = !System.getenv("CI").isNullOrEmpty()
2936

30-
configure<JavaPluginExtension> {
31-
sourceCompatibility = JavaVersion.VERSION_1_8
32-
targetCompatibility = JavaVersion.VERSION_1_8
33-
}
37+
repositories {
38+
mavenCentral()
39+
}
3440

35-
tasks.withType<KotlinCompile>().configureEach {
36-
kotlinOptions.jvmTarget = "1.8"
37-
}
41+
tasks.test {
42+
useJUnitPlatform()
43+
testlogger {
44+
theme = ThemeType.MOCHA
45+
}
46+
}
3847

39-
tasks.named<Test>("test") {
40-
useJUnitPlatform()
41-
}
48+
kotlin {
49+
jvmToolchain(11)
50+
}
51+
52+
configure<JavaPluginExtension> {
53+
withSourcesJar()
54+
// withJavadocJar()
55+
}
56+
57+
publishing {
58+
publications {
59+
create<MavenPublication>("mavenJava") {
60+
from(components["java"])
4261

43-
tasks.dokka {
44-
outputFormat = "html"
45-
outputDirectory = "$buildDir/javadoc"
46-
configuration {
47-
sourceLink {
48-
path = "src/main/kotlin"
49-
url = "https://github.com/virtlink/disjoint-map/tree/master/src/main/kotlin"
50-
lineSuffix = "#L"
62+
pom {
63+
name.set("Disjoint Map")
64+
description.set(project.description)
65+
url.set("https://github.com/Virtlink/disjoint-map")
66+
inceptionYear.set("2023")
67+
licenses {
68+
// From: https://spdx.org/licenses/
69+
license {
70+
name.set("Apache-2.0")
71+
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
72+
distribution.set("repo")
73+
}
74+
}
75+
developers {
76+
developer {
77+
id.set("virtlink")
78+
name.set("Daniel A. A. Pelsmaeker")
79+
email.set("[email protected]")
80+
}
81+
}
82+
scm {
83+
connection.set("scm:[email protected]:Virtlink/disjoint-map.git")
84+
developerConnection.set("scm:[email protected]:Virtlink/disjoint-map.git")
85+
url.set("scm:[email protected]:Virtlink/disjoint-map.git")
86+
}
87+
}
88+
}
89+
}
90+
repositories {
91+
maven {
92+
name = "GitHubPackages"
93+
url = uri("https://maven.pkg.github.com/Virtlink/disjoint-map")
94+
credentials {
95+
username = project.findProperty("gpr.user") as String? ?: System.getenv("GITHUB_ACTOR")
96+
password = project.findProperty("gpr.publishKey") as String? ?: System.getenv("GITHUB_TOKEN")
97+
}
98+
}
5199
}
52100
}
53-
}
54101

55-
val dokkaJar by tasks.creating(Jar::class) {
56-
group = JavaBasePlugin.DOCUMENTATION_GROUP
57-
description = "Assembles Kotlin docs with Dokka"
58-
classifier = "javadoc"
59-
from(tasks.dokka)
60-
}
102+
signing {
103+
sign(publishing.publications["mavenJava"])
104+
if (!project.hasProperty("signing.secretKeyRingFile")) {
105+
// If no secretKeyRingFile was set, we assume an in-memory key in the SIGNING_KEY environment variable (used in CI)
106+
useInMemoryPgpKeys(
107+
project.findProperty("signing.keyId") as String? ?: System.getenv("SIGNING_KEY_ID"),
108+
System.getenv("SIGNING_KEY"),
109+
project.findProperty("signing.password") as String? ?: System.getenv("SIGNING_KEY_PASSWORD"),
110+
)
111+
}
112+
}
61113

62-
val sourcesJar by tasks.creating(Jar::class) {
63-
archiveClassifier.set("sources")
64-
from(sourceSets.getByName("main").allSource)
65-
}
114+
val checkNotDirty by tasks.registering {
115+
doLast {
116+
if (project.extra["isDirtyVersion"] as Boolean) {
117+
throw GradleException("Cannot publish a dirty version: ${project.version}")
118+
}
119+
}
120+
}
66121

67-
//val githubRepo: String by project
68-
//val githubReadme: String by project
69-
//
70-
//val pomUrl: String by project
71-
//val pomIssueUrl: String by project
72-
//val pomLicenseName: String by project
73-
//val pomLicenseUrl: String by project
74-
//val pomLicenseDist: String by project
75-
//val pomDeveloperId: String by project
76-
//val pomDeveloperName: String by project
77-
//val pomScmUrl: String by project
78-
//val pomScmConnection: String by project
79-
//val pomScmDevConnection: String by project
80-
81-
//publishing {
82-
// publications {
83-
// create<MavenPublication>("lib") {
84-
// from(components["java"])
85-
// artifact(dokkaJar)
86-
// artifact(sourcesJar)
87-
//
88-
// pom.withXml {
89-
// asNode().apply {
90-
// appendNode("name", rootProject.name)
91-
// appendNode("description", project.description)
92-
// appendNode("url", pomUrl)
93-
// appendNode("licenses").appendNode("license").apply {
94-
// appendNode("name", pomLicenseName)
95-
// appendNode("url", pomLicenseUrl)
96-
// appendNode("distribution", pomLicenseDist)
97-
// }
98-
// appendNode("developers").appendNode("developer").apply {
99-
// appendNode("id", pomDeveloperId)
100-
// appendNode("name", pomDeveloperName)
101-
// }
102-
// appendNode("scm").apply {
103-
// appendNode("url", pomScmUrl)
104-
// appendNode("connection", pomScmConnection)
105-
// appendNode("developerConnection", pomScmDevConnection)
106-
// }
107-
// }
108-
// }
109-
// }
110-
// }
111-
//
112-
// repositories {
113-
// maven {
114-
// name = "GitHubPackages"
115-
// url = uri("https://maven.pkg.github.com/virtlink/disjoint-map")
116-
// credentials {
117-
// username = System.getenv("GITHUB_ACTOR")
118-
// password = System.getenv("GITHUB_TOKEN")
122+
tasks.publish { dependsOn(checkNotDirty) }
123+
124+
// tasks.withType<DokkaTask>().configureEach {
125+
126+
// outputFormat = "html"
127+
// outputDirectory = "$buildDir/javadoc"
128+
// configuration {
129+
// sourceLink {
130+
// path = "src/main/kotlin"
131+
// url = "https://github.com/virtlink/disjoint-map/tree/master/src/main/kotlin"
132+
// lineSuffix = "#L"
119133
// }
120134
// }
121135
// }
122-
//}
123136

124-
//bintray {
125-
// user = project.findProperty("bintrayUser").toString()
126-
// key = project.findProperty("bintrayKey").toString()
127-
// setPublications("lib")
128-
// publish = true
129-
//
130-
// pkg.apply {
131-
// name = project.name
132-
// desc = project.description
133-
// websiteUrl = pomUrl
134-
// issueTrackerUrl = pomIssueUrl
135-
// vcsUrl = pomUrl + ".git"
136-
// githubRepo = githubRepo
137-
// setLicenses("Apache-2.0")
138-
// repo = project.findProperty("bintrayRepo").toString()
139-
// publicDownloadNumbers = true
140-
// setLabels("kotlin", "disjoint", "map", "set", "collection")
141-
//
142-
// githubReleaseNotesFile = githubReadme
137+
// val dokkaJar by tasks.creating(Jar::class) {
138+
// group = JavaBasePlugin.DOCUMENTATION_GROUP
139+
// description = "Assembles Kotlin docs with Dokka"
140+
// classifier = "javadoc"
141+
// from(tasks.dokka)
142+
// }
143143
//
144-
// version.apply {
145-
// name = project.version.toString()
146-
// desc = project.description
147-
// released = Date().toString()
148-
// vcsTag = project.version.toString()
149-
// gpg.apply {
150-
// sign = true
151-
// passphrase = project.findProperty("gpgPassphrase").toString()
152-
// }
153-
// mavenCentralSync.apply {
154-
// sync = true
155-
// user = project.findProperty("sonatypeUsername").toString()
156-
// password = project.findProperty("sonatypePassword").toString()
157-
// }
158-
// }
144+
// val sourcesJar by tasks.creating(Jar::class) {
145+
// archiveClassifier.set("sources")
146+
// from(sourceSets.getByName("main").allSource)
159147
// }
160-
//}
148+
}
149+
150+
151+
nexusPublishing {
152+
repositories {
153+
sonatype {
154+
nexusUrl.set(uri("https://oss.sonatype.org/service/local/"))
155+
snapshotRepositoryUrl.set(uri("https://oss.sonatype.org/content/repositories/snapshots/"))
156+
username.set(project.findProperty("ossrh.user") as String? ?: System.getenv("OSSRH_USERNAME"))
157+
password.set(project.findProperty("ossrh.token") as String? ?: System.getenv("OSSRH_TOKEN"))
158+
}
159+
}
160+
}

disjointmap/build.gradle.kts

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
plugins {
2+
`java-library`
3+
alias(libs.plugins.kotlin.jvm)
4+
}
5+
6+
val junitVersion = "5.8.1"
7+
8+
dependencies {
9+
implementation (libs.kotlinx.immutablecollections)
10+
11+
compileOnly (libs.jsr305)
12+
13+
testImplementation (libs.junit)
14+
}
File renamed without changes.

src/main/kotlin/com/virtlink/collections/DiffingMutableUnionFindMap.kt renamed to disjointmap/src/main/kotlin/com/virtlink/collections/DiffingMutableUnionFindMap.kt

File renamed without changes.

src/main/kotlin/com/virtlink/collections/DisjointMap.kt renamed to disjointmap/src/main/kotlin/com/virtlink/collections/DisjointMap.kt

File renamed without changes.

src/main/kotlin/com/virtlink/collections/DisjointMapImpl.kt renamed to disjointmap/src/main/kotlin/com/virtlink/collections/DisjointMapImpl.kt

File renamed without changes.

src/main/kotlin/com/virtlink/collections/DisjointMaps.kt renamed to disjointmap/src/main/kotlin/com/virtlink/collections/DisjointMaps.kt

File renamed without changes.

src/main/kotlin/com/virtlink/collections/ImmutableDisjointMap.kt renamed to disjointmap/src/main/kotlin/com/virtlink/collections/ImmutableDisjointMap.kt

File renamed without changes.

0 commit comments

Comments
 (0)