From f682ea3c1a4791f8515f4924acbc1213d17dce29 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 11 Jul 2018 16:19:30 +0200 Subject: chore: Update Gradle wrapper version This change updates the Gradle wrapper version included in the repository to version 4.8 which includes native JUnit 5 integration. --- build.gradle | 27 +++++++++++++++++++++++++++ gradle/wrapper/gradle-wrapper.jar | Bin 54788 -> 54413 bytes gradle/wrapper/gradle-wrapper.properties | 11 +++++------ gradlew | 6 +++--- 4 files changed, 35 insertions(+), 9 deletions(-) create mode 100644 build.gradle diff --git a/build.gradle b/build.gradle new file mode 100644 index 00000000..b6046080 --- /dev/null +++ b/build.gradle @@ -0,0 +1,27 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +wrapper { + gradleVersion = '4.8' +} diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 24dcc970..1948b907 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 5c2e2870..d2c45a4b 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,6 +1,5 @@ -#Tue Aug 29 14:12:50 CEST 2017 -distributionBase=GRADLE_USER_HOME -distributionPath=wrapper/dists -zipStoreBase=GRADLE_USER_HOME -zipStorePath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-3.5-rc-2-all.zip +distributionBase=GRADLE_USER_HOME +distributionPath=wrapper/dists +distributionUrl=https\://services.gradle.org/distributions/gradle-4.8-bin.zip +zipStoreBase=GRADLE_USER_HOME +zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index 4453ccea..cccdd3d5 100755 --- a/gradlew +++ b/gradlew @@ -33,11 +33,11 @@ DEFAULT_JVM_OPTS="" # Use the maximum available, or set MAX_FD != -1 to use that value. MAX_FD="maximum" -warn ( ) { +warn () { echo "$*" } -die ( ) { +die () { echo echo "$*" echo @@ -155,7 +155,7 @@ if $cygwin ; then fi # Escape application args -save ( ) { +save () { for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done echo " " } -- cgit v1.2.3 From c5f88cc28f9d27f867247a713605368c558795a0 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 11 Jul 2018 16:42:26 +0200 Subject: chore: Update Gradle build configuration This change updates the Gradle build configuration in order to make use of the native JUnit 5 integration and the newest Kotlin and Dokka plugins. --- build.gradle | 18 ++++++++++ gradle/kotlin.gradle | 64 +++++++++++++++++++++++++++++++++++ opendc-core/build.gradle | 58 ++++---------------------------- opendc-kernel-omega/build.gradle | 64 ++++++----------------------------- opendc-model-odc/core/build.gradle | 64 ++++++----------------------------- opendc-model-odc/jpa/build.gradle | 66 +++++++------------------------------ opendc-model-odc/setup/build.gradle | 53 +++-------------------------- opendc-stdlib/build.gradle | 65 ++++++------------------------------ 8 files changed, 135 insertions(+), 317 deletions(-) create mode 100644 gradle/kotlin.gradle diff --git a/build.gradle b/build.gradle index b6046080..8ce1956a 100644 --- a/build.gradle +++ b/build.gradle @@ -22,6 +22,24 @@ * SOFTWARE. */ +plugins { + id 'org.jetbrains.kotlin.jvm' version '1.2.51' apply false + id 'org.jetbrains.kotlin.plugin.jpa' version '1.2.51' apply false + id 'org.jetbrains.dokka' version '0.9.17' apply false +} + +allprojects { + group = 'com.atlarge.opendc' + version = '1.2' + + ext { + kotlinx_coroutines_version = '0.23.4' + junit_jupiter_version = '5.2.0' + junit_platform_version = '1.2.0' + jacoco_version = '0.8.2-SNAPSHOT' + } +} + wrapper { gradleVersion = '4.8' } diff --git a/gradle/kotlin.gradle b/gradle/kotlin.gradle new file mode 100644 index 00000000..7fd45326 --- /dev/null +++ b/gradle/kotlin.gradle @@ -0,0 +1,64 @@ +/* + * MIT License + * + * Copyright (c) 2017 atlarge-research + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +/* Default configuration for Kotlin projects */ +apply plugin: 'kotlin' +apply plugin: 'org.jetbrains.dokka' + +sourceCompatibility = 1.8 + +compileKotlin { + kotlinOptions { + jvmTarget = "1.8" + } +} + +compileTestKotlin { + kotlinOptions { + jvmTarget = "1.8" + } +} + +kotlin { + experimental { + coroutines "enable" + } +} + +/* Configure test setup */ +test { + useJUnitPlatform {} + + testLogging { + events 'passed', 'skipped', 'failed' + } + + reports { + html.enabled = true + } +} + +/* Documentation generation */ +dokka {} + diff --git a/opendc-core/build.gradle b/opendc-core/build.gradle index 210b8820..e6c7076b 100644 --- a/opendc-core/build.gradle +++ b/opendc-core/build.gradle @@ -23,63 +23,19 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3' - } -} - -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'org.junit.platform.gradle.plugin' - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} +apply from: '../gradle/kotlin.gradle' +apply plugin: 'java-library' /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.2" + implementation "org.jetbrains.kotlin:kotlin-stdlib" + api "org.jetbrains.kotlinx:kotlinx-coroutines-core:$kotlinx_coroutines_version" - testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-RC3" - testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-RC3" - testCompile "org.junit.platform:junit-platform-launcher:1.0.0-RC3" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" + testImplementation "org.junit.platform:junit-platform-launcher:$junit_platform_version" } diff --git a/opendc-kernel-omega/build.gradle b/opendc-kernel-omega/build.gradle index e02da931..9170e73d 100644 --- a/opendc-kernel-omega/build.gradle +++ b/opendc-kernel-omega/build.gradle @@ -23,66 +23,22 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3' - } -} - -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'org.junit.platform.gradle.plugin' - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} +apply from: '../gradle/kotlin.gradle' +apply plugin: 'java-library' /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.2" - compile project(':opendc-core') - compile "io.github.microutils:kotlin-logging:1.4.6" + implementation "org.jetbrains.kotlin:kotlin-stdlib" + + api project(':opendc-core') + implementation "io.github.microutils:kotlin-logging:1.4.6" - testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-RC3" - testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-RC3" - testCompile "org.junit.platform:junit-platform-launcher:1.0.0-RC3" - testCompile "org.slf4j:slf4j-simple:1.7.25" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" + testImplementation "org.junit.platform:junit-platform-launcher:$junit_platform_version" + testRuntimeOnly "org.slf4j:slf4j-simple:1.7.25" } diff --git a/opendc-model-odc/core/build.gradle b/opendc-model-odc/core/build.gradle index e423da50..091dcbe4 100644 --- a/opendc-model-odc/core/build.gradle +++ b/opendc-model-odc/core/build.gradle @@ -23,67 +23,23 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3' - } -} - -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'org.junit.platform.gradle.plugin' - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} +apply from: '../../gradle/kotlin.gradle' +apply plugin: 'java-library' /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib" - compile project(':opendc-core') - compile project(':opendc-stdlib') - compile "io.github.microutils:kotlin-logging:1.4.6" + api project(':opendc-core') + api project(':opendc-stdlib') + implementation "io.github.microutils:kotlin-logging:1.4.6" - testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-RC3" - testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-RC3" - testCompile "org.junit.platform:junit-platform-launcher:1.0.0-RC3" - testCompile "org.slf4j:slf4j-simple:1.7.25" + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" + testImplementation "org.junit.platform:junit-platform-launcher:$junit_platform_version" + testRuntimeOnly "org.slf4j:slf4j-simple:1.7.25" } diff --git a/opendc-model-odc/jpa/build.gradle b/opendc-model-odc/jpa/build.gradle index 191ca787..33b50d39 100644 --- a/opendc-model-odc/jpa/build.gradle +++ b/opendc-model-odc/jpa/build.gradle @@ -23,69 +23,25 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.0-RC3' - } -} - -apply plugin: 'java' -apply plugin: 'kotlin' +apply from: '../../gradle/kotlin.gradle' +apply plugin: 'java-library' apply plugin: 'kotlin-jpa' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'org.junit.platform.gradle.plugin' - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" + implementation "org.jetbrains.kotlin:kotlin-stdlib" - compile project(':opendc-core') - compile project(':opendc-stdlib') - compile project(':opendc-model-odc:core') - compile 'org.hibernate.javax.persistence:hibernate-jpa-2.1-api:1.0.0.Final' + api project(':opendc-core') + api project(':opendc-stdlib') + api project(':opendc-model-odc:core') + api "javax.persistence:javax.persistence-api:2.2" + implementation "io.github.microutils:kotlin-logging:1.4.6" - testCompile 'org.junit.jupiter:junit-jupiter-api:5.0.0-RC3' - testRuntime 'org.junit.jupiter:junit-jupiter-engine:5.0.0-RC3' - testCompile 'org.junit.platform:junit-platform-launcher:1.0.0-RC3' + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" + testImplementation "org.junit.platform:junit-platform-launcher:$junit_platform_version" } diff --git a/opendc-model-odc/setup/build.gradle b/opendc-model-odc/setup/build.gradle index 1cca2a6e..c3976986 100644 --- a/opendc-model-odc/setup/build.gradle +++ b/opendc-model-odc/setup/build.gradle @@ -23,56 +23,12 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.kotlin:kotlin-noarg:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - } -} - -apply plugin: 'java' +apply from: '../../gradle/kotlin.gradle' apply plugin: 'application' -apply plugin: 'kotlin' -apply plugin: 'org.jetbrains.dokka' mainClassName = "com.atlarge.opendc.model.odc.platform.JpaPlatformRunnerKt" -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} - /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } @@ -80,8 +36,9 @@ repositories { dependencies { compile project(':opendc-model-odc:jpa') compile project(':opendc-kernel-omega') + compile "io.github.microutils:kotlin-logging:1.4.6" - runtime 'org.slf4j:slf4j-simple:1.7.25' - runtime 'org.hibernate:hibernate-core:5.2.5.Final' - runtime 'mysql:mysql-connector-java:5.1.13' + runtimeOnly "org.slf4j:slf4j-simple:1.7.25" + runtimeOnly "org.hibernate:hibernate-core:5.2.5.Final" + runtimeOnly "mysql:mysql-connector-java:5.1.13" } diff --git a/opendc-stdlib/build.gradle b/opendc-stdlib/build.gradle index e02da931..e1ed74ec 100644 --- a/opendc-stdlib/build.gradle +++ b/opendc-stdlib/build.gradle @@ -23,66 +23,21 @@ */ /* Build configuration */ -buildscript { - ext.kotlin_version = '1.2.21' - ext.dokka_version = '0.9.15' - - repositories { - mavenCentral() - jcenter() - } - - dependencies { - classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" - classpath "org.jetbrains.dokka:dokka-gradle-plugin:$dokka_version" - classpath 'org.junit.platform:junit-platform-gradle-plugin:1.0.3' - } -} - -apply plugin: 'java' -apply plugin: 'kotlin' -apply plugin: 'org.jetbrains.dokka' -apply plugin: 'org.junit.platform.gradle.plugin' - -compileKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -compileTestKotlin { - kotlinOptions { - jvmTarget = "1.8" - } -} - -kotlin { - experimental { - coroutines 'enable' - } -} - -dokka { - outputFormat = 'html' - outputDirectory = "$buildDir/javadoc" -} +apply plugin: 'java-library' +apply from: '../gradle/kotlin.gradle' /* Project configuration */ -group 'com.atlarge.opendc' -version '1.1' - repositories { jcenter() } dependencies { - compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" - compile "org.jetbrains.kotlinx:kotlinx-coroutines-core:0.22.2" - compile project(':opendc-core') - compile "io.github.microutils:kotlin-logging:1.4.6" - - testCompile "org.junit.jupiter:junit-jupiter-api:5.0.0-RC3" - testRuntime "org.junit.jupiter:junit-jupiter-engine:5.0.0-RC3" - testCompile "org.junit.platform:junit-platform-launcher:1.0.0-RC3" - testCompile "org.slf4j:slf4j-simple:1.7.25" + implementation "org.jetbrains.kotlin:kotlin-stdlib" + api project(':opendc-core') + implementation "io.github.microutils:kotlin-logging:1.4.6" + + testImplementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" + testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junit_jupiter_version" + testImplementation "org.junit.platform:junit-platform-launcher:$junit_platform_version" + testRuntimeOnly "org.slf4j:slf4j-simple:1.7.25" } -- cgit v1.2.3 From 8c7e208233c86614ac29157efba24e3a57d7f21c Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Wed, 11 Jul 2018 17:15:44 +0200 Subject: chore: Add support for Jacoco This change adds support for Jacoco in the build toolchain. --- gradle/kotlin.gradle | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/gradle/kotlin.gradle b/gradle/kotlin.gradle index 7fd45326..04f67ae8 100644 --- a/gradle/kotlin.gradle +++ b/gradle/kotlin.gradle @@ -25,6 +25,7 @@ /* Default configuration for Kotlin projects */ apply plugin: 'kotlin' apply plugin: 'org.jetbrains.dokka' +apply plugin: 'jacoco' sourceCompatibility = 1.8 @@ -57,6 +58,26 @@ test { reports { html.enabled = true } + + finalizedBy jacocoTestReport +} + +/* Coverage */ +repositories { + // This repository is needed to get the latest snapshot of Jacoco + maven { url = "https://oss.sonatype.org/content/repositories/snapshots" } +} + +jacoco { + // We use the latest snapshot of Jacoco in order to get it to ignore Kotlin-generated code + toolVersion = jacoco_version +} + +jacocoTestReport { + reports { + html.enabled = true + xml.enabled = true + } } /* Documentation generation */ -- cgit v1.2.3