From f9e4ebede7c1dbf81a7a77cc45e08c60fcb811e3 Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sat, 12 Jan 2019 16:20:26 +0000 Subject: [PATCH 1/7] Migrated to kotlin gradle dsl --- build.gradle.kts | 97 +++++++++++++++++++ buildSrc/build.gradle.kts | 6 ++ buildSrc/src/main/java/Dependencies.kt | 12 +++ compiler/base/build.gradle.kts | 30 ++++++ compiler/standard/build.gradle | 28 ------ compiler/standard/build.gradle.kts | 31 ++++++ compiler/testing/base/build.gradle | 23 ----- compiler/testing/base/build.gradle.kts | 15 +++ compiler/testing/integration/build.gradle | 29 ------ compiler/testing/integration/build.gradle.kts | 21 ++++ compiler/testing/unit/build.gradle | 27 ------ compiler/testing/unit/build.gradle.kts | 19 ++++ library/build.gradle | 20 ---- library/build.gradle.kts | 24 +++++ sample/build.gradle | 28 ------ sample/build.gradle.kts | 20 ++++ settings.gradle | 14 +-- 17 files changed, 282 insertions(+), 162 deletions(-) create mode 100644 build.gradle.kts create mode 100644 buildSrc/build.gradle.kts create mode 100644 buildSrc/src/main/java/Dependencies.kt create mode 100644 compiler/base/build.gradle.kts delete mode 100644 compiler/standard/build.gradle create mode 100644 compiler/standard/build.gradle.kts delete mode 100644 compiler/testing/base/build.gradle create mode 100644 compiler/testing/base/build.gradle.kts delete mode 100644 compiler/testing/integration/build.gradle create mode 100644 compiler/testing/integration/build.gradle.kts delete mode 100644 compiler/testing/unit/build.gradle create mode 100644 compiler/testing/unit/build.gradle.kts delete mode 100644 library/build.gradle create mode 100644 library/build.gradle.kts delete mode 100644 sample/build.gradle create mode 100644 sample/build.gradle.kts diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..002679ea --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,97 @@ +buildscript { + repositories { + jcenter() + } +} + +ext { + var kotlin_version: String by extra + var javapoet_version: String by extra + var gson_version: String by extra + var junit_version: String by extra + var project_group: String by extra + var core_version: String by extra + var compiler_base_version: String by extra + var extensions_version: String by extra + + kotlin_version = "1.3.11" + javapoet_version = "1.11.1" + gson_version = "2.8.1" + junit_version = "4.12" + + project_group = "net.lachlanmckee" + core_version = "3.1.0" + compiler_base_version = "1.3.0" + extensions_version = "1.2.0" +} + +plugins { + id("org.sonarqube") version "2.6.2" + jacoco +} + +jacoco { + toolVersion = Dependencies.JACOCO_VERSION +} + +allprojects { + repositories { + jcenter() + maven("https://oss.sonatype.org/content/repositories/snapshots/") + } +} + +sonarqube { + properties { + property("sonar.projectName", "Gsonpath") + property("sonar.projectKey", "gsonpath") + } +} + +task("integrationCodeCoverageReport") { + executionData.setFrom(fileTree("compiler/testing/integration").include("**/build/jacoco/*.exec")) + + // Ignore extension code + val excludes = "gsonpath/compiler/ExtensionFieldMetadata.class" + + classDirectories.setFrom(fileTree("compiler/standard/build/classes/java/main") + + fileTree("compiler/standard/build/classes/kotlin/main") + + fileTree("compiler/base/build/classes/java/main").exclude(excludes) + + fileTree("compiler/base/build/classes/kotlin/main").exclude(excludes)) + + sourceDirectories.setFrom(files("compiler/standard/src/main/java", + "compiler/base/src/main/java")) + + reports { + xml.isEnabled = true + xml.destination = File("$buildDir/reports/jacoco/report.xml") + html.isEnabled = false + csv.isEnabled = false + } + + dependsOn(":compiler:testing:integration:test") +} + +task("unitCodeCoverageReport") { + executionData.setFrom(fileTree("compiler/testing/unit").include("**/build/jacoco/*.exec")) + + // Ignore extension code + val excludes = "gsonpath/compiler/ExtensionFieldMetadata.class" + + classDirectories.setFrom(fileTree("compiler/standard/build/classes/java/main") + + fileTree("compiler/standard/build/classes/kotlin/main") + + fileTree("compiler/base/build/classes/java/main").exclude(excludes) + + fileTree("compiler/base/build/classes/kotlin/main").exclude(excludes)) + + sourceDirectories.setFrom(files("compiler/standard/src/main/java", + "compiler/base/src/main/java")) + + reports { + xml.isEnabled = true + xml.destination = File("$buildDir/reports/jacoco/report.xml") + html.isEnabled = false + csv.isEnabled = false + } + + dependsOn(":compiler:testing:unit:test") +} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts new file mode 100644 index 00000000..15b61a20 --- /dev/null +++ b/buildSrc/build.gradle.kts @@ -0,0 +1,6 @@ +plugins { + `kotlin-dsl` +} +repositories { + jcenter() +} \ No newline at end of file diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt new file mode 100644 index 00000000..a6d16c98 --- /dev/null +++ b/buildSrc/src/main/java/Dependencies.kt @@ -0,0 +1,12 @@ +object Dependencies { + const val KOTLIN_VERSION = "1.3.11" + const val JAVAPOET_VERSION = "1.11.1" + const val GSON_VERSION = "2.8.1" + const val JUNIT_VERSION = "4.12" + const val JACOCO_VERSION = "0.8.2" + + const val PROJECT_GROUP = "net.lachlanmckee" + const val CORE_VERSION = "3.1.0" + const val COMPILER_BASE_VERSION = "1.3.0" + const val EXTENSIONS_VERSION = "1.2.0" +} \ No newline at end of file diff --git a/compiler/base/build.gradle.kts b/compiler/base/build.gradle.kts new file mode 100644 index 00000000..5a264d97 --- /dev/null +++ b/compiler/base/build.gradle.kts @@ -0,0 +1,30 @@ +import org.gradle.internal.jvm.Jvm + +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("com.vanniktech:gradle-maven-publish-plugin:0.7.0") + } +} + +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION + id("com.vanniktech.maven.publish") version "0.7.0" +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + implementation("com.squareup:javapoet:${Dependencies.JAVAPOET_VERSION}") + implementation(files(Jvm.current().getToolsJar())) + + testImplementation("junit:junit:${Dependencies.JUNIT_VERSION}") +} diff --git a/compiler/standard/build.gradle b/compiler/standard/build.gradle deleted file mode 100644 index ee158996..00000000 --- a/compiler/standard/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: 'java' -apply plugin: "kotlin" - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.7.0' - } -} - -apply plugin: "com.vanniktech.maven.publish" - -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - - compile project(":library") - compile project(":compiler:base") - - compile "com.squareup:javapoet:$javapoet_version" - compile "com.google.auto:auto-common:0.6" - compile "com.google.code.gson:gson:$gson_version" -} diff --git a/compiler/standard/build.gradle.kts b/compiler/standard/build.gradle.kts new file mode 100644 index 00000000..2b4025f5 --- /dev/null +++ b/compiler/standard/build.gradle.kts @@ -0,0 +1,31 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("com.vanniktech:gradle-maven-publish-plugin:0.7.0") + } +} + +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION + id("com.vanniktech.maven.publish") version "0.7.0" +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + + implementation(project(":library")) + implementation(project(":compiler:base")) + + implementation("com.squareup:javapoet:${Dependencies.JAVAPOET_VERSION}") + implementation("com.google.auto:auto-common:0.6") + implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") +} diff --git a/compiler/testing/base/build.gradle b/compiler/testing/base/build.gradle deleted file mode 100644 index ad10782e..00000000 --- a/compiler/testing/base/build.gradle +++ /dev/null @@ -1,23 +0,0 @@ -apply plugin: 'java' -apply plugin: 'kotlin' - -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 - -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile project(":compiler:standard") - compile "junit:junit:$junit_version" -} diff --git a/compiler/testing/base/build.gradle.kts b/compiler/testing/base/build.gradle.kts new file mode 100644 index 00000000..c1ebd315 --- /dev/null +++ b/compiler/testing/base/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + api("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + api(project(":compiler:standard")) + api("junit:junit:${Dependencies.JUNIT_VERSION}") +} diff --git a/compiler/testing/integration/build.gradle b/compiler/testing/integration/build.gradle deleted file mode 100644 index 78b7575b..00000000 --- a/compiler/testing/integration/build.gradle +++ /dev/null @@ -1,29 +0,0 @@ -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'jacoco' - -jacoco { - toolVersion = "0.8.2" -} - -targetCompatibility = JavaVersion.VERSION_1_8 -sourceCompatibility = JavaVersion.VERSION_1_8 - -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -dependencies { - compile project(":compiler:testing:base") - compile "com.google.truth:truth:0.34" - compile "com.google.testing.compile:compile-testing:0.11" - compile files(org.gradle.internal.jvm.Jvm.current().getToolsJar()) -} diff --git a/compiler/testing/integration/build.gradle.kts b/compiler/testing/integration/build.gradle.kts new file mode 100644 index 00000000..f659da55 --- /dev/null +++ b/compiler/testing/integration/build.gradle.kts @@ -0,0 +1,21 @@ +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION + jacoco +} + +jacoco { + toolVersion = Dependencies.JACOCO_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +dependencies { + implementation(project(":compiler:testing:base")) + implementation("com.google.truth:truth:0.34") + implementation("com.google.testing.compile:compile-testing:0.11") + implementation(files(org.gradle.internal.jvm.Jvm.current().getToolsJar())) +} diff --git a/compiler/testing/unit/build.gradle b/compiler/testing/unit/build.gradle deleted file mode 100644 index 34b5595a..00000000 --- a/compiler/testing/unit/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'jacoco' - -jacoco { - toolVersion = "0.8.2" -} - -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 - -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -dependencies { - testCompile project(":compiler:testing:base") - testCompile 'com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0' -} diff --git a/compiler/testing/unit/build.gradle.kts b/compiler/testing/unit/build.gradle.kts new file mode 100644 index 00000000..fa1771ab --- /dev/null +++ b/compiler/testing/unit/build.gradle.kts @@ -0,0 +1,19 @@ +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION + jacoco +} + +jacoco { + toolVersion = Dependencies.JACOCO_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + testImplementation(project(":compiler:testing:base")) + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0") +} diff --git a/library/build.gradle b/library/build.gradle deleted file mode 100644 index 7e107acc..00000000 --- a/library/build.gradle +++ /dev/null @@ -1,20 +0,0 @@ -apply plugin: 'java' - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.7.0' - } -} - -apply plugin: "com.vanniktech.maven.publish" - -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 - -dependencies { - compile fileTree(dir: 'libs', include: ['*.jar']) - compile "com.google.code.gson:gson:$gson_version" -} diff --git a/library/build.gradle.kts b/library/build.gradle.kts new file mode 100644 index 00000000..3a41cd98 --- /dev/null +++ b/library/build.gradle.kts @@ -0,0 +1,24 @@ +buildscript { + repositories { + mavenCentral() + } + + dependencies { + classpath("com.vanniktech:gradle-maven-publish-plugin:0.7.0") + } +} + +plugins { + java + id("com.vanniktech.maven.publish") version "0.7.0" +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation(fileTree("libs").include("*.jar")) + implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") +} diff --git a/sample/build.gradle b/sample/build.gradle deleted file mode 100644 index 85aeba52..00000000 --- a/sample/build.gradle +++ /dev/null @@ -1,28 +0,0 @@ -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'kotlin-kapt' - -targetCompatibility = JavaVersion.VERSION_1_8 -sourceCompatibility = JavaVersion.VERSION_1_8 - -buildscript { - repositories { - maven { - url "https://plugins.gradle.org/m2/" - } - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - } -} - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "com.google.code.gson:gson:$gson_version" - - compile project(":library") - kapt project(":compiler:standard") - - testCompile "junit:junit:$junit_version" -} \ No newline at end of file diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts new file mode 100644 index 00000000..d4b47c77 --- /dev/null +++ b/sample/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + java + kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("kapt") version Dependencies.KOTLIN_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +dependencies { + implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") + + implementation(project(":library")) + kapt(project(":compiler:standard")) + + testImplementation("junit:junit:${Dependencies.JUNIT_VERSION}") +} \ No newline at end of file diff --git a/settings.gradle b/settings.gradle index 11fb694f..d49a6b3c 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,7 +1,7 @@ -include ':library' -include ':compiler:base' -include ':compiler:standard' -include ':compiler:testing:base' -include ':compiler:testing:unit' -include ':compiler:testing:integration' -include ':sample' \ No newline at end of file +include ":library" +include ":compiler:base" +include ":compiler:standard" +include ":compiler:testing:base" +include ":compiler:testing:unit" +include ":compiler:testing:integration" +include ":sample" \ No newline at end of file From 3d1f369f941acd6b92bb09dcb5746b913f3f39f9 Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 13 Jan 2019 17:57:50 +0000 Subject: [PATCH 2/7] Fixed building issues --- build.gradle.kts | 2 +- buildSrc/src/main/java/Dependencies.kt | 12 --------- buildSrc/src/main/java/ProjectProperties.kt | 27 +++++++++++++++++++ compiler/base/build.gradle.kts | 8 +++--- compiler/standard/build.gradle.kts | 8 +++--- compiler/testing/base/build.gradle.kts | 8 +++--- compiler/testing/integration/build.gradle.kts | 4 +-- compiler/testing/unit/build.gradle.kts | 4 +-- library/build.gradle.kts | 2 +- sample/build.gradle.kts | 10 +++---- 10 files changed, 52 insertions(+), 33 deletions(-) delete mode 100644 buildSrc/src/main/java/Dependencies.kt create mode 100644 buildSrc/src/main/java/ProjectProperties.kt diff --git a/build.gradle.kts b/build.gradle.kts index 002679ea..04766a03 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -31,7 +31,7 @@ plugins { } jacoco { - toolVersion = Dependencies.JACOCO_VERSION + toolVersion = ProjectProperties.Versions.JACOCO_VERSION } allprojects { diff --git a/buildSrc/src/main/java/Dependencies.kt b/buildSrc/src/main/java/Dependencies.kt deleted file mode 100644 index a6d16c98..00000000 --- a/buildSrc/src/main/java/Dependencies.kt +++ /dev/null @@ -1,12 +0,0 @@ -object Dependencies { - const val KOTLIN_VERSION = "1.3.11" - const val JAVAPOET_VERSION = "1.11.1" - const val GSON_VERSION = "2.8.1" - const val JUNIT_VERSION = "4.12" - const val JACOCO_VERSION = "0.8.2" - - const val PROJECT_GROUP = "net.lachlanmckee" - const val CORE_VERSION = "3.1.0" - const val COMPILER_BASE_VERSION = "1.3.0" - const val EXTENSIONS_VERSION = "1.2.0" -} \ No newline at end of file diff --git a/buildSrc/src/main/java/ProjectProperties.kt b/buildSrc/src/main/java/ProjectProperties.kt new file mode 100644 index 00000000..c652fbe4 --- /dev/null +++ b/buildSrc/src/main/java/ProjectProperties.kt @@ -0,0 +1,27 @@ +import ProjectProperties.Versions.GSON_VERSION +import ProjectProperties.Versions.JAVAPOET_VERSION +import ProjectProperties.Versions.JUNIT_VERSION +import ProjectProperties.Versions.KOTLIN_VERSION + +object ProjectProperties { + object Versions { + const val KOTLIN_VERSION = "1.3.11" + const val JAVAPOET_VERSION = "1.11.1" + const val GSON_VERSION = "2.8.1" + const val JUNIT_VERSION = "4.12" + const val JACOCO_VERSION = "0.8.2" + } + + object Dependencies { + const val KOTLIN_STD_LIB = "org.jetbrains.kotlin:kotlin-stdlib:$KOTLIN_VERSION" + const val JAVAPOET = "com.squareup:javapoet:$JAVAPOET_VERSION" + const val JUNIT = "junit:junit:$JUNIT_VERSION" + const val GSON = "com.google.code.gson:gson:$GSON_VERSION" + } + + + const val PROJECT_GROUP = "net.lachlanmckee" + const val CORE_VERSION = "3.1.0" + const val COMPILER_BASE_VERSION = "1.3.0" + const val EXTENSIONS_VERSION = "1.2.0" +} \ No newline at end of file diff --git a/compiler/base/build.gradle.kts b/compiler/base/build.gradle.kts index 5a264d97..1c87a820 100644 --- a/compiler/base/build.gradle.kts +++ b/compiler/base/build.gradle.kts @@ -12,7 +12,7 @@ buildscript { plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION id("com.vanniktech.maven.publish") version "0.7.0" } @@ -22,9 +22,9 @@ java { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") - implementation("com.squareup:javapoet:${Dependencies.JAVAPOET_VERSION}") + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + implementation(ProjectProperties.Dependencies.JAVAPOET) implementation(files(Jvm.current().getToolsJar())) - testImplementation("junit:junit:${Dependencies.JUNIT_VERSION}") + testImplementation(ProjectProperties.Dependencies.JUNIT) } diff --git a/compiler/standard/build.gradle.kts b/compiler/standard/build.gradle.kts index 2b4025f5..c4d6b8cd 100644 --- a/compiler/standard/build.gradle.kts +++ b/compiler/standard/build.gradle.kts @@ -10,7 +10,7 @@ buildscript { plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION id("com.vanniktech.maven.publish") version "0.7.0" } @@ -20,12 +20,14 @@ java { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) implementation(project(":library")) implementation(project(":compiler:base")) + implementation(ProjectProperties.Dependencies.JAVAPOET) + implementation("com.google.auto.service:auto-service:1.0-rc2") implementation("com.squareup:javapoet:${Dependencies.JAVAPOET_VERSION}") implementation("com.google.auto:auto-common:0.6") - implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") + implementation(ProjectProperties.Dependencies.GSON) } diff --git a/compiler/testing/base/build.gradle.kts b/compiler/testing/base/build.gradle.kts index c1ebd315..71db35e5 100644 --- a/compiler/testing/base/build.gradle.kts +++ b/compiler/testing/base/build.gradle.kts @@ -1,6 +1,6 @@ plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION } java { @@ -9,7 +9,9 @@ java { } dependencies { - api("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") + api(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + api(project(":library")) + api(project(":compiler:base")) api(project(":compiler:standard")) - api("junit:junit:${Dependencies.JUNIT_VERSION}") + api(ProjectProperties.Dependencies.JUNIT) } diff --git a/compiler/testing/integration/build.gradle.kts b/compiler/testing/integration/build.gradle.kts index f659da55..bb4429b3 100644 --- a/compiler/testing/integration/build.gradle.kts +++ b/compiler/testing/integration/build.gradle.kts @@ -1,11 +1,11 @@ plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION jacoco } jacoco { - toolVersion = Dependencies.JACOCO_VERSION + toolVersion = ProjectProperties.Versions.JACOCO_VERSION } java { diff --git a/compiler/testing/unit/build.gradle.kts b/compiler/testing/unit/build.gradle.kts index fa1771ab..1e253b4a 100644 --- a/compiler/testing/unit/build.gradle.kts +++ b/compiler/testing/unit/build.gradle.kts @@ -1,11 +1,11 @@ plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION jacoco } jacoco { - toolVersion = Dependencies.JACOCO_VERSION + toolVersion = ProjectProperties.Versions.JACOCO_VERSION } java { diff --git a/library/build.gradle.kts b/library/build.gradle.kts index 3a41cd98..e13695e7 100644 --- a/library/build.gradle.kts +++ b/library/build.gradle.kts @@ -20,5 +20,5 @@ java { dependencies { implementation(fileTree("libs").include("*.jar")) - implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") + implementation(ProjectProperties.Dependencies.GSON) } diff --git a/sample/build.gradle.kts b/sample/build.gradle.kts index d4b47c77..088b910c 100644 --- a/sample/build.gradle.kts +++ b/sample/build.gradle.kts @@ -1,7 +1,7 @@ plugins { java - kotlin("jvm") version Dependencies.KOTLIN_VERSION - kotlin("kapt") version Dependencies.KOTLIN_VERSION + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION + kotlin("kapt") version ProjectProperties.Versions.KOTLIN_VERSION } java { @@ -10,11 +10,11 @@ java { } dependencies { - implementation("org.jetbrains.kotlin:kotlin-stdlib:${Dependencies.KOTLIN_VERSION}") - implementation("com.google.code.gson:gson:${Dependencies.GSON_VERSION}") + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + implementation(ProjectProperties.Dependencies.GSON) implementation(project(":library")) kapt(project(":compiler:standard")) - testImplementation("junit:junit:${Dependencies.JUNIT_VERSION}") + testImplementation(ProjectProperties.Dependencies.JUNIT) } \ No newline at end of file From 1c0fcd1a921a7e2529358e0c9f7d6aa568b4a31c Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 31 Mar 2019 21:44:01 +0100 Subject: [PATCH 3/7] Further fixes --- compiler/base/build.gradle | 27 --------------------------- compiler/standard/build.gradle.kts | 3 --- 2 files changed, 30 deletions(-) delete mode 100644 compiler/base/build.gradle diff --git a/compiler/base/build.gradle b/compiler/base/build.gradle deleted file mode 100644 index 04442499..00000000 --- a/compiler/base/build.gradle +++ /dev/null @@ -1,27 +0,0 @@ -import org.gradle.internal.jvm.Jvm - -apply plugin: 'java' -apply plugin: "kotlin" - -buildscript { - repositories { - mavenCentral() - } - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath 'com.vanniktech:gradle-maven-publish-plugin:0.7.0' - } -} - -apply plugin: "com.vanniktech.maven.publish" - -targetCompatibility = JavaVersion.VERSION_1_7 -sourceCompatibility = JavaVersion.VERSION_1_7 - -dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "com.squareup:javapoet:$javapoet_version" - compile files(Jvm.current().getToolsJar()) - - testCompile "junit:junit:$junit_version" -} diff --git a/compiler/standard/build.gradle.kts b/compiler/standard/build.gradle.kts index c4d6b8cd..170e3694 100644 --- a/compiler/standard/build.gradle.kts +++ b/compiler/standard/build.gradle.kts @@ -26,8 +26,5 @@ dependencies { implementation(project(":compiler:base")) implementation(ProjectProperties.Dependencies.JAVAPOET) - implementation("com.google.auto.service:auto-service:1.0-rc2") - implementation("com.squareup:javapoet:${Dependencies.JAVAPOET_VERSION}") - implementation("com.google.auto:auto-common:0.6") implementation(ProjectProperties.Dependencies.GSON) } From 4feae568fce5ce40ca083f50a9ff9a18ef51ff80 Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 31 Mar 2019 21:51:36 +0100 Subject: [PATCH 4/7] Further fixes --- compiler/base/build.gradle.kts | 8 +++----- compiler/standard/build.gradle.kts | 1 + 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/compiler/base/build.gradle.kts b/compiler/base/build.gradle.kts index 1c87a820..ba751131 100644 --- a/compiler/base/build.gradle.kts +++ b/compiler/base/build.gradle.kts @@ -22,9 +22,7 @@ java { } dependencies { - implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) - implementation(ProjectProperties.Dependencies.JAVAPOET) - implementation(files(Jvm.current().getToolsJar())) - - testImplementation(ProjectProperties.Dependencies.JUNIT) + api(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + api(ProjectProperties.Dependencies.JAVAPOET) + api(files(Jvm.current().getToolsJar())) } diff --git a/compiler/standard/build.gradle.kts b/compiler/standard/build.gradle.kts index 170e3694..6a481002 100644 --- a/compiler/standard/build.gradle.kts +++ b/compiler/standard/build.gradle.kts @@ -26,5 +26,6 @@ dependencies { implementation(project(":compiler:base")) implementation(ProjectProperties.Dependencies.JAVAPOET) + implementation("com.google.auto:auto-common:0.6") implementation(ProjectProperties.Dependencies.GSON) } From 13b8f783b7f2f118c6516cdb843ad918958cf0c9 Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 31 Mar 2019 22:28:33 +0100 Subject: [PATCH 5/7] Further fixes --- compiler/standard/build.gradle.kts | 3 +++ compiler/testing/base/build.gradle.kts | 6 +----- compiler/testing/integration/build.gradle.kts | 7 ++++++- compiler/testing/unit/build.gradle.kts | 5 +++++ 4 files changed, 15 insertions(+), 6 deletions(-) diff --git a/compiler/standard/build.gradle.kts b/compiler/standard/build.gradle.kts index 6a481002..352fbeae 100644 --- a/compiler/standard/build.gradle.kts +++ b/compiler/standard/build.gradle.kts @@ -1,3 +1,5 @@ +import org.gradle.internal.jvm.Jvm + buildscript { repositories { mavenCentral() @@ -28,4 +30,5 @@ dependencies { implementation(ProjectProperties.Dependencies.JAVAPOET) implementation("com.google.auto:auto-common:0.6") implementation(ProjectProperties.Dependencies.GSON) + implementation(files(Jvm.current().getToolsJar())) } diff --git a/compiler/testing/base/build.gradle.kts b/compiler/testing/base/build.gradle.kts index 71db35e5..d172e8ad 100644 --- a/compiler/testing/base/build.gradle.kts +++ b/compiler/testing/base/build.gradle.kts @@ -9,9 +9,5 @@ java { } dependencies { - api(ProjectProperties.Dependencies.KOTLIN_STD_LIB) - api(project(":library")) - api(project(":compiler:base")) - api(project(":compiler:standard")) - api(ProjectProperties.Dependencies.JUNIT) + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) } diff --git a/compiler/testing/integration/build.gradle.kts b/compiler/testing/integration/build.gradle.kts index bb4429b3..a5ec3e49 100644 --- a/compiler/testing/integration/build.gradle.kts +++ b/compiler/testing/integration/build.gradle.kts @@ -14,8 +14,13 @@ java { } dependencies { + implementation(project(":library")) + implementation(project(":compiler:base")) + implementation(project(":compiler:standard")) implementation(project(":compiler:testing:base")) + + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) implementation("com.google.truth:truth:0.34") implementation("com.google.testing.compile:compile-testing:0.11") - implementation(files(org.gradle.internal.jvm.Jvm.current().getToolsJar())) + testImplementation(ProjectProperties.Dependencies.JUNIT) } diff --git a/compiler/testing/unit/build.gradle.kts b/compiler/testing/unit/build.gradle.kts index 1e253b4a..f363f22f 100644 --- a/compiler/testing/unit/build.gradle.kts +++ b/compiler/testing/unit/build.gradle.kts @@ -14,6 +14,11 @@ java { } dependencies { + testImplementation(project(":library")) + testImplementation(project(":compiler:base")) + testImplementation(project(":compiler:standard")) testImplementation(project(":compiler:testing:base")) + testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0") + testImplementation(ProjectProperties.Dependencies.JUNIT) } From 68ca5a2fe64d1ebce540d918d34d263b5c7a6491 Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 7 Apr 2019 14:35:41 +0100 Subject: [PATCH 6/7] Further changes --- build.gradle | 84 ------------------------------------------------ build.gradle.kts | 21 ------------ 2 files changed, 105 deletions(-) delete mode 100644 build.gradle diff --git a/build.gradle b/build.gradle deleted file mode 100644 index eb3b3686..00000000 --- a/build.gradle +++ /dev/null @@ -1,84 +0,0 @@ -buildscript { - ext.kotlin_version = '1.3.21' - ext.javapoet_version = '1.11.1' - ext.gson_version = '2.8.1' - ext.junit_version = '4.12' - - repositories { - jcenter() - } -} - -plugins { - id "org.sonarqube" version "2.6.2" -} - -apply plugin: 'jacoco' - -jacoco { - toolVersion = "0.8.2" -} - -allprojects { - repositories { - jcenter() - maven { - url "https://oss.sonatype.org/content/repositories/snapshots/" - } - } -} - -sonarqube { - properties { - property "sonar.projectName", "Gsonpath" - property "sonar.projectKey", "gsonpath" - } -} - -task integrationCodeCoverageReport(type: JacocoReport) { - executionData fileTree(dir: "compiler/testing/integration").include("**/build/jacoco/*.exec") - - // Ignore extension code - def excludes = ['gsonpath/compiler/ExtensionFieldMetadata.class'] - - classDirectories = fileTree(dir: "compiler/standard/build/classes/java/main") + - fileTree(dir: "compiler/standard/build/classes/kotlin/main") + - fileTree(dir: "compiler/base/build/classes/java/main", excludes: excludes) + - fileTree(dir: "compiler/base/build/classes/kotlin/main", excludes: excludes) - - sourceDirectories = files('compiler/standard/src/main/java', - 'compiler/base/src/main/java') - - reports { - xml.setEnabled(true) - xml.destination new File("${buildDir}/reports/jacoco/report.xml") - html.setEnabled(false) - csv.setEnabled(false) - } - - dependsOn(':compiler:testing:integration:test') -} - -task unitCodeCoverageReport(type: JacocoReport) { - executionData fileTree(dir: "compiler/testing/unit").include("**/build/jacoco/*.exec") - - // Ignore extension code - def excludes = ['gsonpath/compiler/ExtensionFieldMetadata.class'] - - classDirectories = fileTree(dir: "compiler/standard/build/classes/java/main") + - fileTree(dir: "compiler/standard/build/classes/kotlin/main") + - fileTree(dir: "compiler/base/build/classes/java/main", excludes: excludes) + - fileTree(dir: "compiler/base/build/classes/kotlin/main", excludes: excludes) - - sourceDirectories = files('compiler/standard/src/main/java', - 'compiler/base/src/main/java') - - reports { - xml.setEnabled(true) - xml.destination new File("${buildDir}/reports/jacoco/report.xml") - html.setEnabled(false) - csv.setEnabled(false) - } - - dependsOn(':compiler:testing:unit:test') -} diff --git a/build.gradle.kts b/build.gradle.kts index 04766a03..70326703 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -4,27 +4,6 @@ buildscript { } } -ext { - var kotlin_version: String by extra - var javapoet_version: String by extra - var gson_version: String by extra - var junit_version: String by extra - var project_group: String by extra - var core_version: String by extra - var compiler_base_version: String by extra - var extensions_version: String by extra - - kotlin_version = "1.3.11" - javapoet_version = "1.11.1" - gson_version = "2.8.1" - junit_version = "4.12" - - project_group = "net.lachlanmckee" - core_version = "3.1.0" - compiler_base_version = "1.3.0" - extensions_version = "1.2.0" -} - plugins { id("org.sonarqube") version "2.6.2" jacoco From 6e018f813bea9d17f40e3de834a781214e1e90ed Mon Sep 17 00:00:00 2001 From: Lachlan McKee Date: Sun, 7 Apr 2019 14:45:19 +0100 Subject: [PATCH 7/7] Further changes --- compiler/testing/base/build.gradle.kts | 2 ++ 1 file changed, 2 insertions(+) diff --git a/compiler/testing/base/build.gradle.kts b/compiler/testing/base/build.gradle.kts index d172e8ad..1bc64d0f 100644 --- a/compiler/testing/base/build.gradle.kts +++ b/compiler/testing/base/build.gradle.kts @@ -9,5 +9,7 @@ java { } dependencies { + implementation(project(":compiler:base")) implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + implementation(ProjectProperties.Dependencies.JUNIT) }