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 new file mode 100644 index 00000000..70326703 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,76 @@ +buildscript { + repositories { + jcenter() + } +} + +plugins { + id("org.sonarqube") version "2.6.2" + jacoco +} + +jacoco { + toolVersion = ProjectProperties.Versions.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/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 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/base/build.gradle.kts b/compiler/base/build.gradle.kts new file mode 100644 index 00000000..ba751131 --- /dev/null +++ b/compiler/base/build.gradle.kts @@ -0,0 +1,28 @@ +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 ProjectProperties.Versions.KOTLIN_VERSION + id("com.vanniktech.maven.publish") version "0.7.0" +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + api(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + api(ProjectProperties.Dependencies.JAVAPOET) + api(files(Jvm.current().getToolsJar())) +} 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..352fbeae --- /dev/null +++ b/compiler/standard/build.gradle.kts @@ -0,0 +1,34 @@ +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 ProjectProperties.Versions.KOTLIN_VERSION + id("com.vanniktech.maven.publish") version "0.7.0" +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + + implementation(project(":library")) + implementation(project(":compiler:base")) + + 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 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..1bc64d0f --- /dev/null +++ b/compiler/testing/base/build.gradle.kts @@ -0,0 +1,15 @@ +plugins { + java + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +dependencies { + implementation(project(":compiler:base")) + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + implementation(ProjectProperties.Dependencies.JUNIT) +} 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..a5ec3e49 --- /dev/null +++ b/compiler/testing/integration/build.gradle.kts @@ -0,0 +1,26 @@ +plugins { + java + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION + jacoco +} + +jacoco { + toolVersion = ProjectProperties.Versions.JACOCO_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +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") + testImplementation(ProjectProperties.Dependencies.JUNIT) +} 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..f363f22f --- /dev/null +++ b/compiler/testing/unit/build.gradle.kts @@ -0,0 +1,24 @@ +plugins { + java + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION + jacoco +} + +jacoco { + toolVersion = ProjectProperties.Versions.JACOCO_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_7 + sourceCompatibility = JavaVersion.VERSION_1_7 +} + +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) +} 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..e13695e7 --- /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(ProjectProperties.Dependencies.GSON) +} 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..088b910c --- /dev/null +++ b/sample/build.gradle.kts @@ -0,0 +1,20 @@ +plugins { + java + kotlin("jvm") version ProjectProperties.Versions.KOTLIN_VERSION + kotlin("kapt") version ProjectProperties.Versions.KOTLIN_VERSION +} + +java { + targetCompatibility = JavaVersion.VERSION_1_8 + sourceCompatibility = JavaVersion.VERSION_1_8 +} + +dependencies { + implementation(ProjectProperties.Dependencies.KOTLIN_STD_LIB) + implementation(ProjectProperties.Dependencies.GSON) + + implementation(project(":library")) + kapt(project(":compiler:standard")) + + testImplementation(ProjectProperties.Dependencies.JUNIT) +} \ 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