Skip to content

Commit

Permalink
Updated EVERYTHING!! Standard publishing, testing, module name, kotli…
Browse files Browse the repository at this point in the history
…n version. No functionality changes, just build and publishing updates.
  • Loading branch information
bjsvedin committed Feb 13, 2024
1 parent f0409e1 commit 2b0b1d9
Show file tree
Hide file tree
Showing 63 changed files with 528 additions and 529 deletions.
10 changes: 5 additions & 5 deletions application/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
plugins {
kotlin("jvm")
id("org.jetbrains.kotlin.plugin.serialization") version "1.4.10"
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
}

val implementation by configurations

dependencies {
implementation(kotlin("stdlib-jdk8"))
implementation(project(":library"))
implementation(project(":kotlinx-serialization-csv"))
}

tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
kotlinOptions.jvmTarget = "1.8"
}
//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
// kotlinOptions.jvmTarget = "1.8"
//}
51 changes: 15 additions & 36 deletions build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,44 +1,23 @@
plugins {
base
kotlin("jvm") version "1.4.10" apply false
id("net.researchgate.release") version "2.8.1"
id("io.codearte.nexus-staging") version "0.22.0"
}

val serializationVersion = "1.0.0"

allprojects {
group = "com.lightningkite"

extra["serializationVersion"] = serializationVersion

buildscript {
val kotlinVersion:String by extra
repositories {
jcenter()
maven(url = "https://s01.oss.sonatype.org/content/repositories/releases/")
mavenCentral()
}
}

// Use `./gradlew release` to create a tagged release commit
release {
preTagCommitMessage = "[Gradle Release Plugin] Release version"
tagCommitMessage = "[Gradle Release Plugin] Release version"
newVersionCommitMessage = "[Gradle Release Plugin] New version"

git {
requireBranch = "main"
dependencies {
classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion")
classpath("org.jetbrains.dokka:dokka-gradle-plugin:1.9.10")
classpath("com.lightningkite:deploy-helpers:0.0.7")
}
}
allprojects {
group = "com.lightningkite"
repositories {
google()
mavenCentral()

val mavenCentralUsername: String? by project
val mavenCentralPassword: String? by project
nexusStaging {
packageGroup = "com.lightningkite"
username = mavenCentralUsername
password = mavenCentralPassword
numberOfRetries = 60
delayBetweenRetriesInMillis = 10_000
}

fun net.researchgate.release.ReleaseExtension.git(
configure: net.researchgate.release.GitAdapter.GitConfig.() -> Unit
) = (getProperty("git") as net.researchgate.release.GitAdapter.GitConfig).configure()
}
tasks.withType<Jar> { duplicatesStrategy = DuplicatesStrategy.EXCLUDE }
}
4 changes: 3 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
version=2.2.1-SNAPSHOT
#version=2.2.1
kotlin.code.style=official

# Disable generation of metadata sha256/sha512 checksum
# until https://issues.sonatype.org/browse/NEXUS-21802 is fixed
systemProp.org.gradle.internal.publish.checksums.insecure=true

kotlinVersion=1.9.22
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.6.1-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
185 changes: 185 additions & 0 deletions kotlinx-serialization-csv/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,185 @@
import com.lightningkite.deployhelpers.developer
import com.lightningkite.deployhelpers.github
import com.lightningkite.deployhelpers.standardPublishing

plugins {
kotlin("jvm")
id("org.jetbrains.kotlin.plugin.serialization") version "1.9.22"
id("org.jetbrains.dokka")
id("signing")
`maven-publish`
}

val serializationVersion = "1.0.0"

dependencies {
api(kotlin("stdlib-jdk8"))
api("org.jetbrains.kotlinx:kotlinx-serialization-core:$serializationVersion")

testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
testImplementation("org.jetbrains.kotlinx:kotlinx-serialization-json:$serializationVersion")
}

standardPublishing {
name.set("kotlinx-serialization-csv")
description.set("Library to easily use Kotlin Serialization to serialize to/from CSV.")
github("lightningkite", "kotlinx-serialization-csv")
licenses {
license {
name.set("Apache License, Version 2.0")
url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
}
}

developers {
developer(
id = "LightningKiteJoseph",
name = "Joseph Ivie",
email = "[email protected]",
)
developer(
id = "brudaswen",
name = "Sven Obser",
email = "[email protected]",
)
}
}

//java {
// withSourcesJar()
//
// sourceCompatibility = JavaVersion.VERSION_1_8
// targetCompatibility = JavaVersion.VERSION_1_8
//}
//
//tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile> {
// kotlinOptions.jvmTarget = "1.8"
// kotlinOptions.freeCompilerArgs = listOf(
// "-Xuse-experimental=kotlin.Experimental"
// )
//}
//
//tasks.named<Test>("test") {
// useJUnitPlatform()
//}
//
//tasks.withType<GenerateModuleMetadata> {
// enabled = !isSnapshot()
//}
//
//val dokkaJavadocJar by tasks.creating(Jar::class) {
// group = JavaBasePlugin.DOCUMENTATION_GROUP
// description = "Assembles Kotlin docs with Dokka"
// archiveClassifier.set("javadoc")
// from(tasks.dokkaJavadoc)
//}
//
//val publishRelease = tasks.create("publishRelease") {
// description = "Publish to Maven Central (iff this is a release version)."
//}
//
//val publishSnapshot = tasks.create("publishSnapshot") {
// description = "Publish to Maven Central (iff this is a snapshot version)."
//}
//
//tasks.whenTaskAdded {
// if (name == "publishToSonatype") {
// val publishToSonatype = this
// if (!isSnapshot()) {
// publishRelease.dependsOn(publishToSonatype)
//
// val closeAndReleaseRepository = rootProject.tasks.getByName("closeAndReleaseRepository")
// closeAndReleaseRepository.mustRunAfter(publishToSonatype)
// publishRelease.dependsOn(closeAndReleaseRepository)
// } else {
// publishSnapshot.dependsOn(publishToSonatype)
// }
// }
//}
//
//publishing {
// publications {
// create<MavenPublication>("library") {
// artifactId = "kotlinx-serialization-csv"
//
// pom {
// name.set("kotlinx-serialization-csv")
// description.set("Library to easily use Kotlin Serialization to serialize to/from CSV.")
// url.set("https://github.com/brudaswen/serialization-csv/")
//
// licenses {
// license {
// name.set("Apache License, Version 2.0")
// url.set("https://www.apache.org/licenses/LICENSE-2.0.txt")
// }
// }
// developers {
// developer {
// id.set("LightningKiteJoseph")
// name.set("Joseph Ivie")
// email.set("[email protected]")
// organization.set("Lightning Kite")
// organizationUrl.set("https://lightningkite.com")
// }
// developer {
// id.set("brudaswen")
// name.set("Sven Obser")
// email.set("[email protected]")
// }
// }
// scm {
// connection.set("scm:git:git://github.com/lightningkite/kotlinx-serialization-csv.git")
// developerConnection.set("scm:git:ssh://[email protected]:lightningkite/kotlinx-serialization-csv.git")
// url.set("https://github.com/lightningkite/kotlinx-serialization-csv/")
// }
// issueManagement {
// system.set("GitHub Issues")
// url.set("https://github.com/lightningkite/kotlinx-serialization-csv/issues/")
// }
// }
//
// from(components["java"])
// artifact(dokkaJavadocJar)
// }
// }
//}
//
//nexusPublishing {
// repositories {
// sonatype() {
// this.nexusUrl.set(URI("https://s01.oss.sonatype.org/content/repositories/releases/"))
// this.snapshotRepositoryUrl.set(URI("https://s01.oss.sonatype.org/content/repositories/snapshots"))
// }
// }
//
// clientTimeout.set(Duration.ofMinutes(30))
// val useSnapshot: String? by project
// if (useSnapshot != null) {
// useStaging.set(useSnapshot?.toBoolean()?.not())
// }
//}
//
//signing {
// setRequired { !isSnapshot() }
//
// val signingKey: String? by project
// val signingPassword: String? by project
// useInMemoryPgpKeys(signingKey, signingPassword)
//
// sign(publishing.publications["library"])
//}
//
//tasks.jacocoTestReport {
// reports {
// xml.isEnabled = true
// html.isEnabled = false
// }
//}
//
//tasks.check {
// dependsOn(tasks.jacocoTestReport)
//}
//
//fun isSnapshot() = version.toString().endsWith("-SNAPSHOT")
//
//fun url(path: String) = uri(path).toURL()
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
package kotlinx.serialization.csv.config

import org.junit.jupiter.api.assertThrows
import kotlin.test.Test
import kotlin.test.assertFailsWith

class CsvBuilderTest {

@Test
fun `should fail if delimiter equals quoteChar`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
delimiter = '!'
quoteChar = '!'
Expand All @@ -17,7 +17,7 @@ class CsvBuilderTest {

@Test
fun `should fail if delimiter equals escapeChar`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
delimiter = '!'
escapeChar = '!'
Expand All @@ -27,7 +27,7 @@ class CsvBuilderTest {

@Test
fun `should fail if escapeChar not set`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
quoteMode = QuoteMode.NONE
escapeChar = null
Expand All @@ -37,7 +37,7 @@ class CsvBuilderTest {

@Test
fun `should fail if recordSeparator is empty`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
recordSeparator = ""
}.build()
Expand All @@ -46,7 +46,7 @@ class CsvBuilderTest {

@Test
fun `should fail if recordSeparator is too long`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
recordSeparator = "\r\n\n"
}.build()
Expand All @@ -55,7 +55,7 @@ class CsvBuilderTest {

@Test
fun `should fail if recordSeparator is delimiter`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
delimiter = ','
recordSeparator = ","
Expand All @@ -65,7 +65,7 @@ class CsvBuilderTest {

@Test
fun `should fail if recordSeparator is quoteChar`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
quoteChar = '"'
recordSeparator = "\""
Expand All @@ -75,7 +75,7 @@ class CsvBuilderTest {

@Test
fun `should fail if recordSeparator is escapeChar`() {
assertThrows<IllegalArgumentException> {
assertFailsWith<IllegalArgumentException> {
CsvBuilder().apply {
escapeChar = '\\'
recordSeparator = "\\"
Expand Down
Loading

0 comments on commit 2b0b1d9

Please sign in to comment.