summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFabian Mastenbroek <mail.fabianm@gmail.com>2019-04-25 15:06:29 +0200
committerFabian Mastenbroek <mail.fabianm@gmail.com>2019-05-13 20:26:46 +0200
commit38828ab3708a22bbd321c76d936648a2010f5c60 (patch)
tree31f5e2a8005d7cc8d2b19b3341fc6594b59b8ba9
parent164fa3764ef7b75f04a07aa1dbf8b36dd98d7fb9 (diff)
chore: Migrate to Kotlin DSL for Gradle
This change migrates the build configuration for Gradle in Groovy to Kotlin, where possible. The scripts in the `gradle/` directory have not been migrated to extensive use of dynamicism.
-rw-r--r--build.gradle.kts (renamed from build.gradle)29
-rw-r--r--gradle/dokka.gradle2
-rw-r--r--odcsim-core/build.gradle.kts (renamed from odcsim-core/build.gradle)19
-rw-r--r--odcsim-engine-omega/build.gradle.kts (renamed from odcsim-engine-omega/build.gradle)25
-rw-r--r--odcsim-engine-tests/build.gradle.kts (renamed from odcsim-engine-tests/build.gradle)14
-rw-r--r--settings.gradle.kts (renamed from settings.gradle)8
6 files changed, 56 insertions, 41 deletions
diff --git a/build.gradle b/build.gradle.kts
index 3d53b45c..01f95b26 100644
--- a/build.gradle
+++ b/build.gradle.kts
@@ -23,28 +23,29 @@
*/
plugins {
- id 'org.jetbrains.kotlin.jvm' version '1.3.30' apply false
- id 'org.jetbrains.dokka' version '0.9.18' apply false
- id 'org.jlleitschuh.gradle.ktlint' version '7.4.0' apply false
+ kotlin("jvm") version "1.3.30" apply false
+ id("org.jetbrains.dokka") version "0.9.18" apply false
+ id("org.jlleitschuh.gradle.ktlint") version "7.4.0" apply false
}
allprojects {
- group = 'com.atlarge.opendc'
- version = '2.0.0'
+ group = "com.atlarge.opendc"
+ version = "2.0.0"
- ext {
- junit_jupiter_version = '5.4.2'
- junit_platform_version = '1.4.2'
- github_url = "https://github.com/atlarge-research/${rootProject.name}"
- }
+
+ extra["junitJupiterVersion"] = "5.4.2"
+ extra["junitPlatformVersion"] = "1.4.2"
+ extra["githubUrl"] = "https://github.com/atlarge-research/${rootProject.name}"
}
-wrapper {
- gradleVersion = '5.1'
+tasks.wrapper {
+ gradleVersion = "5.1"
}
// Wait for children to evaluate so we can configure tasks that are dependant on children
project.evaluationDependsOnChildren()
-apply from: 'gradle/jacoco.gradle'
-apply from: 'gradle/dokka.gradle'
+apply {
+ from("gradle/jacoco.gradle")
+ from("gradle/dokka.gradle")
+}
diff --git a/gradle/dokka.gradle b/gradle/dokka.gradle
index e8e47d2d..576dbbeb 100644
--- a/gradle/dokka.gradle
+++ b/gradle/dokka.gradle
@@ -41,7 +41,7 @@ dokka {
linkMapping {
dir = rootProject.projectDir.absolutePath
- url = "$github_url/tree/master"
+ url = "$githubUrl/tree/master"
suffix = '#L'
}
}
diff --git a/odcsim-core/build.gradle b/odcsim-core/build.gradle.kts
index a0cd8450..1596f3c8 100644
--- a/odcsim-core/build.gradle
+++ b/odcsim-core/build.gradle.kts
@@ -23,19 +23,24 @@
*/
/* Build configuration */
-apply from: '../gradle/kotlin.gradle'
-apply plugin: 'java-library'
+apply(from = "../gradle/kotlin.gradle")
+plugins {
+ `java-library`
+}
/* Project configuration */
repositories {
jcenter()
}
+val junitJupiterVersion: String by extra
+val junitPlatformVersion: String by extra
+
dependencies {
- implementation "org.jetbrains.kotlin:kotlin-stdlib"
+ implementation(kotlin("stdlib"))
- 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"
- testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0"
+ testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
+ testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
+ testImplementation("org.junit.platform:junit-platform-launcher:$junitPlatformVersion")
+ testImplementation("com.nhaarman.mockitokotlin2:mockito-kotlin:2.0.0")
}
diff --git a/odcsim-engine-omega/build.gradle b/odcsim-engine-omega/build.gradle.kts
index cefd3e20..347e2bb4 100644
--- a/odcsim-engine-omega/build.gradle
+++ b/odcsim-engine-omega/build.gradle.kts
@@ -23,23 +23,28 @@
*/
/* Build configuration */
-apply from: '../gradle/kotlin.gradle'
-apply plugin: 'java-library'
+apply(from = "../gradle/kotlin.gradle")
+plugins {
+ `java-library`
+}
/* Project configuration */
repositories {
jcenter()
}
+val junitJupiterVersion: String by extra
+val junitPlatformVersion: String by extra
+
dependencies {
- api project(':odcsim-core')
+ api(project(":odcsim-core"))
- implementation "org.jetbrains.kotlin:kotlin-stdlib"
- implementation "io.github.microutils:kotlin-logging:1.6.20"
+ implementation(kotlin("stdlib"))
+ implementation("io.github.microutils:kotlin-logging:1.6.20")
- testApi project(':odcsim-engine-tests')
- 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"
+ testCompile(project(":odcsim-engine-tests"))
+ testImplementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
+ testRuntimeOnly("org.junit.jupiter:junit-jupiter-engine:$junitJupiterVersion")
+ testImplementation("org.junit.platform:junit-platform-launcher:$junitPlatformVersion")
+ testRuntimeOnly("org.slf4j:slf4j-simple:1.7.25")
}
diff --git a/odcsim-engine-tests/build.gradle b/odcsim-engine-tests/build.gradle.kts
index da568319..8b19019a 100644
--- a/odcsim-engine-tests/build.gradle
+++ b/odcsim-engine-tests/build.gradle.kts
@@ -23,17 +23,21 @@
*/
/* Build configuration */
-apply from: '../gradle/kotlin.gradle'
-apply plugin: 'java-library'
+apply(from = "../gradle/kotlin.gradle")
+plugins {
+ `java-library`
+}
/* Project configuration */
repositories {
jcenter()
}
+val junitJupiterVersion: String by extra
+
dependencies {
- api project(':odcsim-core')
+ api(project(":odcsim-core"))
- implementation "org.jetbrains.kotlin:kotlin-stdlib"
- implementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version"
+ implementation(kotlin("stdlib"))
+ implementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion")
}
diff --git a/settings.gradle b/settings.gradle.kts
index 9ae9a5ab..b7657f70 100644
--- a/settings.gradle
+++ b/settings.gradle.kts
@@ -21,8 +21,8 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
-rootProject.name = 'opendc-simulator'
+rootProject.name = "opendc-simulator"
-include 'odcsim-core'
-include 'odcsim-engine-tests'
-include 'odcsim-engine-omega'
+include(":odcsim-core")
+include(":odcsim-engine-tests")
+include(":odcsim-engine-omega")