From 52437266445a31c55f7449fed6f47ec79cf272e8 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:29:34 +0900 Subject: [PATCH 01/20] Introduce multiplatform plugin --- build.gradle.kts | 45 ++++++++++++++++++++++++++++++++++++++------- 1 file changed, 38 insertions(+), 7 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ae37349..c715fec 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,5 +1,5 @@ plugins { - id("org.jetbrains.kotlin.jvm").version("1.3.41") + kotlin("multiplatform") version "1.3.50" id("org.jetbrains.dokka").version("0.9.18") jacoco `maven-publish` @@ -22,15 +22,46 @@ repositories { jcenter() } -val test by tasks.getting(Test::class) { - useJUnitPlatform { } -} +kotlin { + jvm { + val main by compilations.getting { + kotlinOptions { + jvmTarget = "1.8" + } +// compileKotlinTask // get the Kotlin task 'compileKotlinJvm' +// output // get the main compilation output + } +// compilations["test"].runtimeDependencyFiles // get the test runtime classpath + } + sourceSets { + val commonMain by getting { + dependencies { + implementation(kotlin("stdlib-common")) + } + } + val commonTest by getting { + dependencies { + implementation(kotlin("test-common")) + implementation(kotlin("test-annotations-common")) + } + } -dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") - testImplementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") + jvm().compilations["main"].defaultSourceSet { + dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") + } + } + jvm().compilations["test"].defaultSourceSet { + dependencies { + implementation("io.kotlintest:kotlintest-runner-junit5:3.3.2") + } + } + } } +val test by tasks.getting(Test::class) { + useJUnitPlatform { } +} //publishing settings //https://docs.gradle.org/current/userguide/publishing_maven.html From f505791ad0565de9752e474ebe30c57473723b92 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:37:09 +0900 Subject: [PATCH 02/20] rename sourceSetName --- .../github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt | 0 .../com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt | 0 .../com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt | 0 .../doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt | 0 .../doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt | 0 .../doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt | 0 .../github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt | 0 .../kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt | 0 .../com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt | 0 .../github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt | 0 .../doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt | 1 - .../github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt | 0 .../com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt | 1 - .../com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt | 0 .../com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt | 2 -- .../com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt | 2 -- .../com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt | 1 - .../resources/testdata/csv/backslash-escape.csv | 0 src/{test => jvmTest}/resources/testdata/csv/bom.csv | 0 src/{test => jvmTest}/resources/testdata/csv/empty-fields.csv | 0 src/{test => jvmTest}/resources/testdata/csv/empty.csv | 0 src/{test => jvmTest}/resources/testdata/csv/escape.csv | 0 .../resources/testdata/csv/hash-separated-dollar-quote.csv | 0 src/{test => jvmTest}/resources/testdata/csv/line-breaks.csv | 0 src/{test => jvmTest}/resources/testdata/csv/malformed.csv | 0 src/{test => jvmTest}/resources/testdata/csv/simple.csv | 0 src/{test => jvmTest}/resources/testdata/csv/simple.tsv | 0 src/{test => jvmTest}/resources/testdata/csv/unicode2028.csv | 0 src/{test => jvmTest}/resources/testdata/csv/with-header.csv | 0 34 files changed, 7 deletions(-) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt (100%) rename src/{main => jvmMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt (100%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt (98%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt (100%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt (99%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt (100%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt (90%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt (92%) rename src/{test => jvmTest}/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt (98%) rename src/{test => jvmTest}/resources/testdata/csv/backslash-escape.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/bom.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/empty-fields.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/empty.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/escape.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/hash-separated-dollar-quote.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/line-breaks.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/malformed.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/simple.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/simple.tsv (100%) rename src/{test => jvmTest}/resources/testdata/csv/unicode2028.csv (100%) rename src/{test => jvmTest}/resources/testdata/csv/with-header.csv (100%) diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReader.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileReader.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriter.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriter.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDsl.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDsl.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriteQuoteContext.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt diff --git a/src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt similarity index 100% rename from src/main/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt rename to src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt similarity index 98% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt index 73114ef..a7a4aea 100644 --- a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt @@ -1,6 +1,5 @@ package com.github.doyaaaaaken.kotlincsv.client -import io.kotlintest.shouldBe import io.kotlintest.specs.StringSpec /** diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt similarity index 100% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvFileWriterTest.kt diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt similarity index 99% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt index 712b313..852f8a4 100644 --- a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt @@ -1,6 +1,5 @@ package com.github.doyaaaaaken.kotlincsv.client -import io.kotlintest.shouldBe import io.kotlintest.specs.WordSpec import com.github.doyaaaaaken.kotlincsv.dsl.context.CsvReaderContext import com.github.doyaaaaaken.kotlincsv.dsl.csvReader diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt similarity index 100% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt similarity index 90% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt index 3709979..7c5054a 100644 --- a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt @@ -1,7 +1,5 @@ package com.github.doyaaaaaken.kotlincsv.dsl -import io.kotlintest.matchers.types.shouldBeTypeOf -import io.kotlintest.shouldBe import io.kotlintest.specs.StringSpec import com.github.doyaaaaaken.kotlincsv.client.CsvReader diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt similarity index 92% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt index 95ce2d9..05ae2d5 100644 --- a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt @@ -1,7 +1,5 @@ package com.github.doyaaaaaken.kotlincsv.dsl -import io.kotlintest.matchers.types.shouldBeTypeOf -import io.kotlintest.shouldBe import io.kotlintest.specs.StringSpec import com.github.doyaaaaaken.kotlincsv.client.CsvWriter import com.github.doyaaaaaken.kotlincsv.dsl.context.WriteQuoteMode diff --git a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt similarity index 98% rename from src/test/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt rename to src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt index d15c4c6..66a5a09 100644 --- a/src/test/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt @@ -1,7 +1,6 @@ package com.github.doyaaaaaken.kotlincsv.parser import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException -import io.kotlintest.shouldBe import io.kotlintest.shouldThrow import io.kotlintest.specs.WordSpec diff --git a/src/test/resources/testdata/csv/backslash-escape.csv b/src/jvmTest/resources/testdata/csv/backslash-escape.csv similarity index 100% rename from src/test/resources/testdata/csv/backslash-escape.csv rename to src/jvmTest/resources/testdata/csv/backslash-escape.csv diff --git a/src/test/resources/testdata/csv/bom.csv b/src/jvmTest/resources/testdata/csv/bom.csv similarity index 100% rename from src/test/resources/testdata/csv/bom.csv rename to src/jvmTest/resources/testdata/csv/bom.csv diff --git a/src/test/resources/testdata/csv/empty-fields.csv b/src/jvmTest/resources/testdata/csv/empty-fields.csv similarity index 100% rename from src/test/resources/testdata/csv/empty-fields.csv rename to src/jvmTest/resources/testdata/csv/empty-fields.csv diff --git a/src/test/resources/testdata/csv/empty.csv b/src/jvmTest/resources/testdata/csv/empty.csv similarity index 100% rename from src/test/resources/testdata/csv/empty.csv rename to src/jvmTest/resources/testdata/csv/empty.csv diff --git a/src/test/resources/testdata/csv/escape.csv b/src/jvmTest/resources/testdata/csv/escape.csv similarity index 100% rename from src/test/resources/testdata/csv/escape.csv rename to src/jvmTest/resources/testdata/csv/escape.csv diff --git a/src/test/resources/testdata/csv/hash-separated-dollar-quote.csv b/src/jvmTest/resources/testdata/csv/hash-separated-dollar-quote.csv similarity index 100% rename from src/test/resources/testdata/csv/hash-separated-dollar-quote.csv rename to src/jvmTest/resources/testdata/csv/hash-separated-dollar-quote.csv diff --git a/src/test/resources/testdata/csv/line-breaks.csv b/src/jvmTest/resources/testdata/csv/line-breaks.csv similarity index 100% rename from src/test/resources/testdata/csv/line-breaks.csv rename to src/jvmTest/resources/testdata/csv/line-breaks.csv diff --git a/src/test/resources/testdata/csv/malformed.csv b/src/jvmTest/resources/testdata/csv/malformed.csv similarity index 100% rename from src/test/resources/testdata/csv/malformed.csv rename to src/jvmTest/resources/testdata/csv/malformed.csv diff --git a/src/test/resources/testdata/csv/simple.csv b/src/jvmTest/resources/testdata/csv/simple.csv similarity index 100% rename from src/test/resources/testdata/csv/simple.csv rename to src/jvmTest/resources/testdata/csv/simple.csv diff --git a/src/test/resources/testdata/csv/simple.tsv b/src/jvmTest/resources/testdata/csv/simple.tsv similarity index 100% rename from src/test/resources/testdata/csv/simple.tsv rename to src/jvmTest/resources/testdata/csv/simple.tsv diff --git a/src/test/resources/testdata/csv/unicode2028.csv b/src/jvmTest/resources/testdata/csv/unicode2028.csv similarity index 100% rename from src/test/resources/testdata/csv/unicode2028.csv rename to src/jvmTest/resources/testdata/csv/unicode2028.csv diff --git a/src/test/resources/testdata/csv/with-header.csv b/src/jvmTest/resources/testdata/csv/with-header.csv similarity index 100% rename from src/test/resources/testdata/csv/with-header.csv rename to src/jvmTest/resources/testdata/csv/with-header.csv From 3df0d044ef2e8bed48db03b2364ad285da6ef3c5 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:42:46 +0900 Subject: [PATCH 03/20] Comment out all test --- build.gradle.kts | 158 +++++++++++++++++++++++------------------------ 1 file changed, 79 insertions(+), 79 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index c715fec..324dba6 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -59,82 +59,82 @@ kotlin { } } -val test by tasks.getting(Test::class) { - useJUnitPlatform { } -} - -//publishing settings -//https://docs.gradle.org/current/userguide/publishing_maven.html -val sourcesJar = task("sourcesJar") { - from(sourceSets.main.get().allSource) - archiveClassifier.set("sources") -} -val dokkaJar = task("dokkaJar") { - group = JavaBasePlugin.DOCUMENTATION_GROUP - archiveClassifier.set("javadoc") -} - -publishing { - publications { - create("mavenJava") { - artifactId = "kotlin-csv" - from(components["java"]) - artifacts { - artifact(sourcesJar) - artifact(dokkaJar) - } - pom { - name.set("kotlin-csv") - description.set("Kotlin CSV Reader/Writer") - url.set("https://github.com/doyaaaaaken/kotlin-csv") - - organization { - name.set("com.github.doyaaaaaken") - url.set("https://github.com/doyaaaaaken") - } - licenses { - license { - name.set("Apache License 2.0") - url.set("https://github.com/doyaaaaaken/kotlin-csv/blob/master/LICENSE") - } - } - scm { - url.set("https://github.com/doyaaaaaken/kotlin-csv") - connection.set("scm:git:git://github.com/doyaaaaaken/kotlin-csv.git") - developerConnection.set("https://github.com/doyaaaaaken/kotlin-csv") - } - developers { - developer { - name.set("doyaaaaaken") - } - } - } - } - } - repositories { - maven { - credentials { - val nexusUsername: String? by project - val nexusPassword: String? by project - username = nexusUsername - password = nexusPassword - } - - val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") - val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") - url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl - } - } -} - -signing { - sign(publishing.publications["mavenJava"]) -} - -tasks.withType { - reports { - xml.isEnabled = true - xml.destination = File("$buildDir/reports/jacoco/report.xml") - html.isEnabled = false - } -} +//val test by tasks.getting(Test::class) { +// useJUnitPlatform { } +//} +// +////publishing settings +////https://docs.gradle.org/current/userguide/publishing_maven.html +//val sourcesJar = task("sourcesJar") { +// from(sourceSets.main.get().allSource) +// archiveClassifier.set("sources") +//} +//val dokkaJar = task("dokkaJar") { +// group = JavaBasePlugin.DOCUMENTATION_GROUP +// archiveClassifier.set("javadoc") +//} +// +//publishing { +// publications { +// create("mavenJava") { +// artifactId = "kotlin-csv" +// from(components["java"]) +// artifacts { +// artifact(sourcesJar) +// artifact(dokkaJar) +// } +// pom { +// name.set("kotlin-csv") +// description.set("Kotlin CSV Reader/Writer") +// url.set("https://github.com/doyaaaaaken/kotlin-csv") +// +// organization { +// name.set("com.github.doyaaaaaken") +// url.set("https://github.com/doyaaaaaken") +// } +// licenses { +// license { +// name.set("Apache License 2.0") +// url.set("https://github.com/doyaaaaaken/kotlin-csv/blob/master/LICENSE") +// } +// } +// scm { +// url.set("https://github.com/doyaaaaaken/kotlin-csv") +// connection.set("scm:git:git://github.com/doyaaaaaken/kotlin-csv.git") +// developerConnection.set("https://github.com/doyaaaaaken/kotlin-csv") +// } +// developers { +// developer { +// name.set("doyaaaaaken") +// } +// } +// } +// } +// } +// repositories { +// maven { +// credentials { +// val nexusUsername: String? by project +// val nexusPassword: String? by project +// username = nexusUsername +// password = nexusPassword +// } +// +// val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") +// val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") +// url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl +// } +// } +//} +// +//signing { +// sign(publishing.publications["mavenJava"]) +//} +// +//tasks.withType { +// reports { +// xml.isEnabled = true +// xml.destination = File("$buildDir/reports/jacoco/report.xml") +// html.isEnabled = false +// } +//} From 157d219d7fef945e630217269318b005c8aab296 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:57:10 +0900 Subject: [PATCH 04/20] Fix test code --- build.gradle.kts | 9 +++++---- .../kotlincsv/client/BufferedLineReaderTest.kt | 1 + .../github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt | 5 +++-- .../github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt | 2 ++ .../github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt | 2 ++ .../github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt | 1 + 6 files changed, 14 insertions(+), 6 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 324dba6..ced2275 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,6 +31,7 @@ kotlin { // compileKotlinTask // get the Kotlin task 'compileKotlinJvm' // output // get the main compilation output } + // compilations["test"].runtimeDependencyFiles // get the test runtime classpath } sourceSets { @@ -59,10 +60,10 @@ kotlin { } } -//val test by tasks.getting(Test::class) { -// useJUnitPlatform { } -//} -// +val jvmTest by tasks.getting(Test::class) { + useJUnitPlatform { } +} + ////publishing settings ////https://docs.gradle.org/current/userguide/publishing_maven.html //val sourcesJar = task("sourcesJar") { diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt index a7a4aea..73114ef 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/BufferedLineReaderTest.kt @@ -1,5 +1,6 @@ package com.github.doyaaaaaken.kotlincsv.client +import io.kotlintest.shouldBe import io.kotlintest.specs.StringSpec /** diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt index 852f8a4..29e783d 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt @@ -5,6 +5,7 @@ import com.github.doyaaaaaken.kotlincsv.dsl.context.CsvReaderContext import com.github.doyaaaaaken.kotlincsv.dsl.csvReader import com.github.doyaaaaaken.kotlincsv.util.Const import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException +import io.kotlintest.shouldBe import io.kotlintest.shouldThrow import java.io.File @@ -157,7 +158,7 @@ class CsvReaderTest : WordSpec() { } "open method (with fileName argument)" should { - val rows = csvReader().open("src/test/resources/testdata/csv/simple.csv") { + val rows = csvReader().open("src/jvmTest/resources/testdata/csv/simple.csv") { readAll() } rows shouldBe listOf(listOf("a", "b", "c"), listOf("d", "e", "f")) @@ -174,5 +175,5 @@ class CsvReaderTest : WordSpec() { } private fun readTestDataFile(fileName: String): File { - return File("src/test/resources/testdata/csv/$fileName") + return File("src/jvmTest/resources/testdata/csv/$fileName") } diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt index 7c5054a..2fd226c 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt @@ -2,6 +2,8 @@ package com.github.doyaaaaaken.kotlincsv.dsl import io.kotlintest.specs.StringSpec import com.github.doyaaaaaken.kotlincsv.client.CsvReader +import io.kotlintest.matchers.types.shouldBeTypeOf +import io.kotlintest.shouldBe /** * @author doyaaaaaken diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt index 05ae2d5..e630820 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt @@ -3,6 +3,8 @@ package com.github.doyaaaaaken.kotlincsv.dsl import io.kotlintest.specs.StringSpec import com.github.doyaaaaaken.kotlincsv.client.CsvWriter import com.github.doyaaaaaken.kotlincsv.dsl.context.WriteQuoteMode +import io.kotlintest.matchers.types.shouldBeTypeOf +import io.kotlintest.shouldBe /** * @author doyaaaaaken diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt index 66a5a09..d15c4c6 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt @@ -1,6 +1,7 @@ package com.github.doyaaaaaken.kotlincsv.parser import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException +import io.kotlintest.shouldBe import io.kotlintest.shouldThrow import io.kotlintest.specs.WordSpec From 8f05442df293ab81e1de72a5247a0932e40182ae Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:59:24 +0900 Subject: [PATCH 05/20] comment out jacocoTestReport --- .circleci/config.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index ce63af1..0c8c18f 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,5 +25,6 @@ jobs: - run: command: | ./gradlew test - ./gradlew jacocoTestReport +# comment out temporarily +# ./gradlew jacocoTestReport bash <(curl -s https://codecov.io/bash) From ad3c430e4bcd9b18124da683504e6fdaa1fa73c6 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 06:59:50 +0900 Subject: [PATCH 06/20] remove command temporarily --- .circleci/config.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 0c8c18f..d9fd507 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,6 +25,4 @@ jobs: - run: command: | ./gradlew test -# comment out temporarily -# ./gradlew jacocoTestReport bash <(curl -s https://codecov.io/bash) From f9f4882f2a553be9e5423a22f37120b9b052015f Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Fri, 6 Sep 2019 07:03:40 +0900 Subject: [PATCH 07/20] fix test command --- .circleci/config.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index d9fd507..636e252 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -24,5 +24,5 @@ jobs: - run: command: | - ./gradlew test + ./gradlew check bash <(curl -s https://codecov.io/bash) From f6881d4b56d2a6f99237c21184ec493097c031ee Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 14:28:31 +0900 Subject: [PATCH 08/20] remove comment --- build.gradle.kts | 4 ---- 1 file changed, 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index ced2275..892ce6a 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -28,11 +28,7 @@ kotlin { kotlinOptions { jvmTarget = "1.8" } -// compileKotlinTask // get the Kotlin task 'compileKotlinJvm' -// output // get the main compilation output } - -// compilations["test"].runtimeDependencyFiles // get the test runtime classpath } sourceSets { val commonMain by getting { From af77a0d6b1cdfea5067d81f9d4bea05270a84086 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 14:55:25 +0900 Subject: [PATCH 09/20] commonMain project --- .../com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt | 0 .../github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt | 3 +-- .../com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt | 0 .../github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt | 2 -- 4 files changed, 1 insertion(+), 4 deletions(-) rename src/{jvmMain => commonMain}/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt (100%) rename src/{jvmMain => commonMain}/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt (98%) rename src/{jvmMain => commonMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt (100%) rename src/{jvmMain => commonMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt (81%) diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt similarity index 100% rename from src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt rename to src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParser.kt diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt similarity index 98% rename from src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt rename to src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt index 269c62b..06576f3 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt +++ b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/parser/ParseStateMachine.kt @@ -1,7 +1,6 @@ package com.github.doyaaaaaken.kotlincsv.parser import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException -import java.util.* /** * @author doyaaaaaaken @@ -16,7 +15,7 @@ internal class ParseStateMachine( private var state = ParseState.START - private val fields = Vector() + private val fields = ArrayList() private var field = StringBuilder() diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt similarity index 100% rename from src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt rename to src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/CsvDslMarker.kt diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt similarity index 81% rename from src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt rename to src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt index 74ac979..28eee6b 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt +++ b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/MalformedCSVException.kt @@ -1,7 +1,5 @@ package com.github.doyaaaaaken.kotlincsv.util -import java.lang.RuntimeException - /** * @author doyaaaaaken */ From 8282fdfe2e0a353ac1e162fb737482bfdd0b0003 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 15:01:02 +0900 Subject: [PATCH 10/20] setting for multiplatform library publishment --- settings.gradle.kts | 1 + 1 file changed, 1 insertion(+) diff --git a/settings.gradle.kts b/settings.gradle.kts index 651f61a..71315eb 100644 --- a/settings.gradle.kts +++ b/settings.gradle.kts @@ -1 +1,2 @@ rootProject.name = "kotlin-csv" +enableFeaturePreview("GRADLE_METADATA") \ No newline at end of file From 90275b42c4de94e5ac5750293cb561c1febf11c2 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 15:27:07 +0900 Subject: [PATCH 11/20] Convert Const.defaultCharset type into String --- .../doyaaaaaken/kotlincsv/client/CsvReader.kt | 19 +++++++++++-------- .../kotlincsv/dsl/context/CsvReaderContext.kt | 3 +-- .../kotlincsv/dsl/context/CsvWriterContext.kt | 3 +-- .../doyaaaaaken/kotlincsv/util/Const.kt | 2 +- .../kotlincsv/client/CsvReaderTest.kt | 4 ++-- .../kotlincsv/client/CsvWriterTest.kt | 9 ++++----- .../kotlincsv/dsl/CsvReaderDslTest.kt | 4 ++-- .../kotlincsv/dsl/CsvWriterDslTest.kt | 4 ++-- 8 files changed, 24 insertions(+), 24 deletions(-) diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt index dd76d39..f7090d4 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt +++ b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReader.kt @@ -5,6 +5,7 @@ import com.github.doyaaaaaken.kotlincsv.dsl.context.ICsvReaderContext import java.io.BufferedReader import java.io.File import java.io.InputStream +import java.nio.charset.Charset /** * CSV Reader class @@ -15,13 +16,15 @@ class CsvReader( private val ctx: CsvReaderContext = CsvReaderContext() ) : ICsvReaderContext by ctx { + private val charsetCode = Charset.forName(charset) + /** * read csv data as String, and convert into List> * * No need to close InputStream when calling this method. */ fun readAll(data: String): List> { - val br = data.byteInputStream(charset).bufferedReader(charset) + val br = data.byteInputStream(charsetCode).bufferedReader(charsetCode) return open(br) { readAll() } } @@ -31,7 +34,7 @@ class CsvReader( * No need to close InputStream when calling this method. */ fun readAll(file: File): List> { - val br = file.inputStream().bufferedReader(charset) + val br = file.inputStream().bufferedReader(charsetCode) return open(br) { readAll() } } @@ -41,7 +44,7 @@ class CsvReader( * No need to close InputStream when calling this method. */ fun readAll(ips: InputStream): List> { - val br = ips.bufferedReader(charset) + val br = ips.bufferedReader(charsetCode) return open(br) { readAll() } } @@ -51,7 +54,7 @@ class CsvReader( * No need to close InputStream when calling this method. */ fun readAllWithHeader(data: String): List> { - val br = data.byteInputStream(charset).bufferedReader(charset) + val br = data.byteInputStream(charsetCode).bufferedReader(charsetCode) return open(br) { readAllWithHeader() } } @@ -61,7 +64,7 @@ class CsvReader( * No need to close InputStream when calling this method. */ fun readAllWithHeader(file: File): List> { - val br = file.inputStream().bufferedReader(charset) + val br = file.inputStream().bufferedReader(charsetCode) return open(br) { readAllWithHeader() } } @@ -71,7 +74,7 @@ class CsvReader( * No need to close InputStream when calling this method. */ fun readAllWithHeader(ips: InputStream): List> { - val br = ips.bufferedReader(charset) + val br = ips.bufferedReader(charsetCode) return open(br) { readAllWithHeader() } } @@ -104,7 +107,7 @@ class CsvReader( * @see open method */ fun open(file: File, read: CsvFileReader.() -> T): T { - val br = file.inputStream().bufferedReader(charset) + val br = file.inputStream().bufferedReader(charsetCode) return open(br, read) } @@ -118,7 +121,7 @@ class CsvReader( * @see open method */ fun open(ips: InputStream, read: CsvFileReader.() -> T): T { - val br = ips.bufferedReader(charset) + val br = ips.bufferedReader(charsetCode) return open(br, read) } diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt index 4192334..a57c062 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt +++ b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvReaderContext.kt @@ -2,7 +2,6 @@ package com.github.doyaaaaaken.kotlincsv.dsl.context import com.github.doyaaaaaken.kotlincsv.util.Const import com.github.doyaaaaaken.kotlincsv.util.CsvDslMarker -import java.nio.charset.Charset /** * Interface for CSV Reader settings @@ -11,7 +10,7 @@ import java.nio.charset.Charset */ @CsvDslMarker interface ICsvReaderContext { - val charset: Charset + val charset: String val quoteChar: Char val delimiter: Char val escapeChar: Char diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt index b826a66..be04876 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt +++ b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/context/CsvWriterContext.kt @@ -2,7 +2,6 @@ package com.github.doyaaaaaken.kotlincsv.dsl.context import com.github.doyaaaaaken.kotlincsv.util.Const import com.github.doyaaaaaken.kotlincsv.util.CsvDslMarker -import java.nio.charset.Charset /** * Interface for CSV Writer settings @@ -11,7 +10,7 @@ import java.nio.charset.Charset */ @CsvDslMarker interface ICsvWriterContext { - val charset: Charset + val charset: String val delimiter: Char val nullCode: String val lineTerminator: String diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt index 8a4d59b..6e48a4e 100644 --- a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt +++ b/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt @@ -6,5 +6,5 @@ package com.github.doyaaaaaken.kotlincsv.util * @author doyaaaaaken */ internal object Const { - val defaultCharset = Charsets.UTF_8 + val defaultCharset = "UTF-8" } diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt index 29e783d..0628dc0 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvReaderTest.kt @@ -22,13 +22,13 @@ class CsvReaderTest : WordSpec() { } "be created with CsvReaderContext argument" { val context = CsvReaderContext().apply { - charset = Charsets.ISO_8859_1 + charset = Charsets.ISO_8859_1.name() quoteChar = '\'' delimiter = '\t' escapeChar = '"' } val reader = CsvReader(context) - reader.charset shouldBe Charsets.ISO_8859_1 + reader.charset shouldBe Charsets.ISO_8859_1.name() reader.quoteChar shouldBe '\'' reader.delimiter shouldBe '\t' reader.escapeChar shouldBe '"' diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt index 1bcd7aa..e6ff257 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/client/CsvWriterTest.kt @@ -35,7 +35,7 @@ class CsvWriterTest : WordSpec() { } "be created with CsvWriterContext argument" { val context = CsvWriterContext().apply { - charset = Charsets.ISO_8859_1 + charset = Charsets.ISO_8859_1.name() delimiter = '\t' nullCode = "NULL" lineTerminator = "\n" @@ -45,7 +45,7 @@ class CsvWriterTest : WordSpec() { } } val writer = CsvWriter(context) - writer.charset shouldBe Charsets.ISO_8859_1 + writer.charset shouldBe Charsets.ISO_8859_1.name() writer.delimiter shouldBe '\t' writer.nullCode shouldBe "NULL" writer.lineTerminator shouldBe "\n" @@ -101,13 +101,12 @@ class CsvWriterTest : WordSpec() { "Customized CsvWriter" should { "write csv with SJIS charset" { - val sjis = Charset.forName("SJIS") csvWriter{ - charset = sjis + charset = "SJIS" }.open(File(testFileName)) { writeAll(listOf(listOf("あ", "い"))) } - val actual = readTestFile(sjis) + val actual = readTestFile(Charset.forName("SJIS")) actual shouldBe "あ,い\r\n" } "write csv with '|' demimiter" { diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt index 2fd226c..5a52002 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvReaderDslTest.kt @@ -15,12 +15,12 @@ class CsvReaderDslTest : StringSpec({ } "csvReader method should work as dsl" { val reader = csvReader { - charset = Charsets.ISO_8859_1 + charset = Charsets.ISO_8859_1.name() quoteChar = '\'' delimiter = '\t' escapeChar = '"' } - reader.charset shouldBe Charsets.ISO_8859_1 + reader.charset shouldBe Charsets.ISO_8859_1.name() reader.quoteChar shouldBe '\'' reader.delimiter shouldBe '\t' reader.escapeChar shouldBe '"' diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt index e630820..144ddf5 100644 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/dsl/CsvWriterDslTest.kt @@ -16,7 +16,7 @@ class CsvWriterDslTest : StringSpec({ } "csvWriter method should work as dsl" { val writer = csvWriter { - charset = Charsets.ISO_8859_1 + charset = Charsets.ISO_8859_1.name() delimiter = '\t' nullCode = "NULL" lineTerminator = "\n" @@ -25,7 +25,7 @@ class CsvWriterDslTest : StringSpec({ mode = WriteQuoteMode.ALL } } - writer.charset shouldBe Charsets.ISO_8859_1 + writer.charset shouldBe Charsets.ISO_8859_1.name() writer.delimiter shouldBe '\t' writer.nullCode shouldBe "NULL" writer.lineTerminator shouldBe "\n" From 8b860625e3c97caaad6d2e0e929b456bef202a31 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 15:27:56 +0900 Subject: [PATCH 12/20] move file into other sourceSet --- .../kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename src/{jvmMain => commonMain}/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt (100%) diff --git a/src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt b/src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt similarity index 100% rename from src/jvmMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt rename to src/commonMain/kotlin/com/github/doyaaaaaken/kotlincsv/util/Const.kt From f225d3ee0a3c3da653b4027e8e105a8cee3493b9 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 16:28:17 +0900 Subject: [PATCH 13/20] Add test library for multiplatform --- build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.gradle.kts b/build.gradle.kts index 892ce6a..67a0fb4 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -45,6 +45,8 @@ kotlin { jvm().compilations["main"].defaultSourceSet { dependencies { + implementation(kotlin("test")) + implementation(kotlin("test-junit")) implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") } } From 4a8e2a529b98bf2307e27c4970e9c70c973eed07 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 16:45:53 +0900 Subject: [PATCH 14/20] Move test into commonTest --- .../kotlincsv/parser/CsvParserTest.kt | 76 +++++++++++++++++++ .../kotlincsv/parser/CsvParserTest.kt | 61 --------------- 2 files changed, 76 insertions(+), 61 deletions(-) create mode 100644 src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt delete mode 100644 src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt diff --git a/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt new file mode 100644 index 0000000..0f1462a --- /dev/null +++ b/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt @@ -0,0 +1,76 @@ +package com.github.doyaaaaaken.kotlincsv.parser + +import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException +import kotlin.test.Test +import kotlin.test.assertEquals +import kotlin.test.assertFailsWith +import kotlin.test.assertNull + +class CsvParserTest { + + private val parser = CsvParser('"', ',', '"') + + private val lineTerminators = listOf("\n", "\u2028", "\u2029", "\u0085", "\r", "\r\n") + + @Test + fun `parseRow method should parseEmptyRow`() { + assertEquals(parser.parseRow(""), emptyList()) + } + + @Test + fun `parseRow method should return null if line is on the way of csv row`() { + assertNull(parser.parseRow("a,\"b")) + } + + @Test + fun `ParseStateMachine logic should parse delimiter at the start of row`() { + assertEquals(parser.parseRow(",a"), listOf("", "a")) + } + + @Test + fun `ParseStateMachine logic should parse line terminator at the start of row`() { + lineTerminators.forEach { lt -> + assertEquals(parser.parseRow(lt), listOf("")) + } + } + + @Test + fun `ParseStateMachine logic should parse row with delimiter at the end`() { + assertEquals(parser.parseRow("a,"), listOf("a", "")) + } + + @Test + fun `ParseStateMachine logic should parse line terminator after quote end`() { + lineTerminators.forEach { lt -> + assertEquals(parser.parseRow("""a,"b"$lt"""), listOf("a", "b")) + } + } + + @Test + fun `ParseStateMachine logic should parse line terminator after delimiter`() { + lineTerminators.forEach { lt -> + assertEquals(parser.parseRow("a,$lt"), listOf("a", "")) + } + } + + @Test + fun `ParseStateMachine logic should parse line terminator after field`() { + lineTerminators.forEach { lt -> + assertEquals(parser.parseRow("a$lt"), listOf("a")) + } + } + + @Test + fun `ParseStateMachine logic should parse escape character after field`() { + assertEquals(parser.parseRow("a\"\""), listOf("a\"")) + } + + @Test + fun `ParseStateMachine logic should throw exception when parsing 2 rows`() { + lineTerminators.forEach { lt -> + assertFailsWith(MalformedCSVException::class) { + parser.parseRow("a${lt}b") + } + } + } +} diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt deleted file mode 100644 index d15c4c6..0000000 --- a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt +++ /dev/null @@ -1,61 +0,0 @@ -package com.github.doyaaaaaken.kotlincsv.parser - -import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException -import io.kotlintest.shouldBe -import io.kotlintest.shouldThrow -import io.kotlintest.specs.WordSpec - -class CsvParserTest : WordSpec() { - init { - val parser = CsvParser('"', ',', '"') - val lineTerminators = listOf("\n", "\u2028", "\u2029", "\u0085", "\r", "\r\n") - - "CsvParser.parseRow" should { - "parseEmptyRow" { - parser.parseRow("") shouldBe emptyList() - } - "return null if line is on the way of csv row" { - parser.parseRow("a,\"b") shouldBe null - } - } - - "ParseStateMachine logic" should { - "parse delimiter at the start of row" { - parser.parseRow(",a") shouldBe listOf("", "a") - } - "parse line terminator at the start of row" { - lineTerminators.forEach { lt -> - parser.parseRow(lt) shouldBe listOf("") - } - } - "parse row with delimiter at the end" { - parser.parseRow("a,") shouldBe listOf("a", "") - } - "parse line terminator after quote end" { - lineTerminators.forEach { lt -> - parser.parseRow("""a,"b"$lt""") shouldBe listOf("a", "b") - } - } - "parse line terminator after delimiter" { - lineTerminators.forEach { lt -> - parser.parseRow("a,$lt") shouldBe listOf("a", "") - } - } - "parse line terminator after field" { - lineTerminators.forEach { lt -> - parser.parseRow("a$lt") shouldBe listOf("a") - } - } - "parse escape character after field" { - parser.parseRow("a\"\"") shouldBe listOf("a\"") - } - "throw exception when parsing 2 rows" { - lineTerminators.forEach { lt -> - shouldThrow { - parser.parseRow("a${lt}b") - } - } - } - } - } -} From 2a76ed7dddfc36269dce10244b9126beeb904da1 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 16:59:17 +0900 Subject: [PATCH 15/20] Revert "Move test into commonTest" This reverts commit 4a8e2a529b98bf2307e27c4970e9c70c973eed07. --- .../kotlincsv/parser/CsvParserTest.kt | 76 ------------------- .../kotlincsv/parser/CsvParserTest.kt | 61 +++++++++++++++ 2 files changed, 61 insertions(+), 76 deletions(-) delete mode 100644 src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt create mode 100644 src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt diff --git a/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt deleted file mode 100644 index 0f1462a..0000000 --- a/src/commonTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt +++ /dev/null @@ -1,76 +0,0 @@ -package com.github.doyaaaaaken.kotlincsv.parser - -import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException -import kotlin.test.Test -import kotlin.test.assertEquals -import kotlin.test.assertFailsWith -import kotlin.test.assertNull - -class CsvParserTest { - - private val parser = CsvParser('"', ',', '"') - - private val lineTerminators = listOf("\n", "\u2028", "\u2029", "\u0085", "\r", "\r\n") - - @Test - fun `parseRow method should parseEmptyRow`() { - assertEquals(parser.parseRow(""), emptyList()) - } - - @Test - fun `parseRow method should return null if line is on the way of csv row`() { - assertNull(parser.parseRow("a,\"b")) - } - - @Test - fun `ParseStateMachine logic should parse delimiter at the start of row`() { - assertEquals(parser.parseRow(",a"), listOf("", "a")) - } - - @Test - fun `ParseStateMachine logic should parse line terminator at the start of row`() { - lineTerminators.forEach { lt -> - assertEquals(parser.parseRow(lt), listOf("")) - } - } - - @Test - fun `ParseStateMachine logic should parse row with delimiter at the end`() { - assertEquals(parser.parseRow("a,"), listOf("a", "")) - } - - @Test - fun `ParseStateMachine logic should parse line terminator after quote end`() { - lineTerminators.forEach { lt -> - assertEquals(parser.parseRow("""a,"b"$lt"""), listOf("a", "b")) - } - } - - @Test - fun `ParseStateMachine logic should parse line terminator after delimiter`() { - lineTerminators.forEach { lt -> - assertEquals(parser.parseRow("a,$lt"), listOf("a", "")) - } - } - - @Test - fun `ParseStateMachine logic should parse line terminator after field`() { - lineTerminators.forEach { lt -> - assertEquals(parser.parseRow("a$lt"), listOf("a")) - } - } - - @Test - fun `ParseStateMachine logic should parse escape character after field`() { - assertEquals(parser.parseRow("a\"\""), listOf("a\"")) - } - - @Test - fun `ParseStateMachine logic should throw exception when parsing 2 rows`() { - lineTerminators.forEach { lt -> - assertFailsWith(MalformedCSVException::class) { - parser.parseRow("a${lt}b") - } - } - } -} diff --git a/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt new file mode 100644 index 0000000..d15c4c6 --- /dev/null +++ b/src/jvmTest/kotlin/com/github/doyaaaaaken/kotlincsv/parser/CsvParserTest.kt @@ -0,0 +1,61 @@ +package com.github.doyaaaaaken.kotlincsv.parser + +import com.github.doyaaaaaken.kotlincsv.util.MalformedCSVException +import io.kotlintest.shouldBe +import io.kotlintest.shouldThrow +import io.kotlintest.specs.WordSpec + +class CsvParserTest : WordSpec() { + init { + val parser = CsvParser('"', ',', '"') + val lineTerminators = listOf("\n", "\u2028", "\u2029", "\u0085", "\r", "\r\n") + + "CsvParser.parseRow" should { + "parseEmptyRow" { + parser.parseRow("") shouldBe emptyList() + } + "return null if line is on the way of csv row" { + parser.parseRow("a,\"b") shouldBe null + } + } + + "ParseStateMachine logic" should { + "parse delimiter at the start of row" { + parser.parseRow(",a") shouldBe listOf("", "a") + } + "parse line terminator at the start of row" { + lineTerminators.forEach { lt -> + parser.parseRow(lt) shouldBe listOf("") + } + } + "parse row with delimiter at the end" { + parser.parseRow("a,") shouldBe listOf("a", "") + } + "parse line terminator after quote end" { + lineTerminators.forEach { lt -> + parser.parseRow("""a,"b"$lt""") shouldBe listOf("a", "b") + } + } + "parse line terminator after delimiter" { + lineTerminators.forEach { lt -> + parser.parseRow("a,$lt") shouldBe listOf("a", "") + } + } + "parse line terminator after field" { + lineTerminators.forEach { lt -> + parser.parseRow("a$lt") shouldBe listOf("a") + } + } + "parse escape character after field" { + parser.parseRow("a\"\"") shouldBe listOf("a\"") + } + "throw exception when parsing 2 rows" { + lineTerminators.forEach { lt -> + shouldThrow { + parser.parseRow("a${lt}b") + } + } + } + } + } +} From 710304b744df330021866ba0f0645df4ab91bfd2 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 19:40:34 +0900 Subject: [PATCH 16/20] enable to publishToMavenLocal --- build.gradle.kts | 54 +++++++++++++++++++++++++----------------------- 1 file changed, 28 insertions(+), 26 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 67a0fb4..55b2dfd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -72,9 +72,11 @@ val jvmTest by tasks.getting(Test::class) { // group = JavaBasePlugin.DOCUMENTATION_GROUP // archiveClassifier.set("javadoc") //} -// -//publishing { + + +publishing { // publications { + //TODO: いらない説あり // create("mavenJava") { // artifactId = "kotlin-csv" // from(components["java"]) @@ -110,30 +112,30 @@ val jvmTest by tasks.getting(Test::class) { // } // } // } -// repositories { -// maven { -// credentials { -// val nexusUsername: String? by project -// val nexusPassword: String? by project -// username = nexusUsername -// password = nexusPassword -// } -// -// val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") -// val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") -// url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl -// } -// } -//} -// + repositories { + maven { + credentials { + val nexusUsername: String? by project + val nexusPassword: String? by project + username = nexusUsername + password = nexusPassword + } + + val releasesRepoUrl = uri("https://oss.sonatype.org/service/local/staging/deploy/maven2/") + val snapshotsRepoUrl = uri("https://oss.sonatype.org/content/repositories/snapshots/") + url = if (version.toString().endsWith("SNAPSHOT")) snapshotsRepoUrl else releasesRepoUrl + } + } +} + //signing { // sign(publishing.publications["mavenJava"]) //} -// -//tasks.withType { -// reports { -// xml.isEnabled = true -// xml.destination = File("$buildDir/reports/jacoco/report.xml") -// html.isEnabled = false -// } -//} + +tasks.withType { + reports { + xml.isEnabled = true + xml.destination = File("$buildDir/reports/jacoco/report.xml") + html.isEnabled = false + } +} From bf841133a33bf0d1e541788b541b2bf825bc9cf7 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 20:24:07 +0900 Subject: [PATCH 17/20] sigining --- build.gradle.kts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 55b2dfd..09abc49 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -7,7 +7,7 @@ plugins { } group = "com.github.doyaaaaaken" -version = "0.6.1" +version = "0.7.0" buildscript { repositories { @@ -128,9 +128,9 @@ publishing { } } -//signing { -// sign(publishing.publications["mavenJava"]) -//} +signing { + sign(publishing.publications) +} tasks.withType { reports { From 032c490d3e579cd179c546d3cf29cc3328e4cb04 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 23:42:48 +0900 Subject: [PATCH 18/20] maven pom file --- build.gradle.kts | 65 ++++++++++++++++++++++++++++-------------------- 1 file changed, 38 insertions(+), 27 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index 09abc49..02241fd 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -75,8 +75,45 @@ val jvmTest by tasks.getting(Test::class) { publishing { + // publications["jvm"].apply { + // artifactId = "kotlin-csv" +// from(components["java"]) +// (this as MavenPublication).setArtifacts(dokkaJar) + +// artifacts { +// artifact(sourcesJar) +// artifact(dokkaJar) +// } +// } + publications.all { + (this as MavenPublication).pom { + name.set("kotlin-csv") + description.set("Kotlin CSV Reader/Writer") + url.set("https://github.com/doyaaaaaken/kotlin-csv") + + organization { + name.set("com.github.doyaaaaaken") + url.set("https://github.com/doyaaaaaken") + } + licenses { + license { + name.set("Apache License 2.0") + url.set("https://github.com/doyaaaaaken/kotlin-csv/blob/master/LICENSE") + } + } + scm { + url.set("https://github.com/doyaaaaaken/kotlin-csv") + connection.set("scm:git:git://github.com/doyaaaaaken/kotlin-csv.git") + developerConnection.set("https://github.com/doyaaaaaken/kotlin-csv") + } + developers { + developer { + name.set("doyaaaaaken") + } + } + } + } // publications { - //TODO: いらない説あり // create("mavenJava") { // artifactId = "kotlin-csv" // from(components["java"]) @@ -84,32 +121,6 @@ publishing { // artifact(sourcesJar) // artifact(dokkaJar) // } -// pom { -// name.set("kotlin-csv") -// description.set("Kotlin CSV Reader/Writer") -// url.set("https://github.com/doyaaaaaken/kotlin-csv") -// -// organization { -// name.set("com.github.doyaaaaaken") -// url.set("https://github.com/doyaaaaaken") -// } -// licenses { -// license { -// name.set("Apache License 2.0") -// url.set("https://github.com/doyaaaaaken/kotlin-csv/blob/master/LICENSE") -// } -// } -// scm { -// url.set("https://github.com/doyaaaaaken/kotlin-csv") -// connection.set("scm:git:git://github.com/doyaaaaaken/kotlin-csv.git") -// developerConnection.set("https://github.com/doyaaaaaken/kotlin-csv") -// } -// developers { -// developer { -// name.set("doyaaaaaken") -// } -// } -// } // } // } repositories { From 5ce3d54513fe8ea0a1c796c836ca0736630d002e Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 23:43:11 +0900 Subject: [PATCH 19/20] revert --- .circleci/config.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.circleci/config.yml b/.circleci/config.yml index 636e252..8581e6c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,4 +25,5 @@ jobs: - run: command: | ./gradlew check + ./gradlew jacocoTestReport bash <(curl -s https://codecov.io/bash) From dc325082cfc1613fa0e42c7799318777b5f034f6 Mon Sep 17 00:00:00 2001 From: doyaaaaaken Date: Sat, 7 Sep 2019 23:49:19 +0900 Subject: [PATCH 20/20] delete jacoco plugin --- .circleci/config.yml | 1 - build.gradle.kts | 9 --------- 2 files changed, 10 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index 8581e6c..636e252 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -25,5 +25,4 @@ jobs: - run: command: | ./gradlew check - ./gradlew jacocoTestReport bash <(curl -s https://codecov.io/bash) diff --git a/build.gradle.kts b/build.gradle.kts index 02241fd..f93f586 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -1,7 +1,6 @@ plugins { kotlin("multiplatform") version "1.3.50" id("org.jetbrains.dokka").version("0.9.18") - jacoco `maven-publish` signing } @@ -142,11 +141,3 @@ publishing { signing { sign(publishing.publications) } - -tasks.withType { - reports { - xml.isEnabled = true - xml.destination = File("$buildDir/reports/jacoco/report.xml") - html.isEnabled = false - } -}