From 38828ab3708a22bbd321c76d936648a2010f5c60 Mon Sep 17 00:00:00 2001 From: Fabian Mastenbroek Date: Thu, 25 Apr 2019 15:06:29 +0200 Subject: 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. --- build.gradle | 50 ----------------------------------- build.gradle.kts | 51 ++++++++++++++++++++++++++++++++++++ gradle/dokka.gradle | 2 +- odcsim-core/build.gradle | 41 ----------------------------- odcsim-core/build.gradle.kts | 46 ++++++++++++++++++++++++++++++++ odcsim-engine-omega/build.gradle | 45 ------------------------------- odcsim-engine-omega/build.gradle.kts | 50 +++++++++++++++++++++++++++++++++++ odcsim-engine-tests/build.gradle | 39 --------------------------- odcsim-engine-tests/build.gradle.kts | 43 ++++++++++++++++++++++++++++++ settings.gradle | 28 -------------------- settings.gradle.kts | 28 ++++++++++++++++++++ 11 files changed, 219 insertions(+), 204 deletions(-) delete mode 100644 build.gradle create mode 100644 build.gradle.kts delete mode 100644 odcsim-core/build.gradle create mode 100644 odcsim-core/build.gradle.kts delete mode 100644 odcsim-engine-omega/build.gradle create mode 100644 odcsim-engine-omega/build.gradle.kts delete mode 100644 odcsim-engine-tests/build.gradle create mode 100644 odcsim-engine-tests/build.gradle.kts delete mode 100644 settings.gradle create mode 100644 settings.gradle.kts diff --git a/build.gradle b/build.gradle deleted file mode 100644 index 3d53b45c..00000000 --- a/build.gradle +++ /dev/null @@ -1,50 +0,0 @@ -/* - * 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. - */ - -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 -} - -allprojects { - 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}" - } -} - -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' diff --git a/build.gradle.kts b/build.gradle.kts new file mode 100644 index 00000000..01f95b26 --- /dev/null +++ b/build.gradle.kts @@ -0,0 +1,51 @@ +/* + * 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. + */ + +plugins { + 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" + + + extra["junitJupiterVersion"] = "5.4.2" + extra["junitPlatformVersion"] = "1.4.2" + extra["githubUrl"] = "https://github.com/atlarge-research/${rootProject.name}" +} + +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") + 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 deleted file mode 100644 index a0cd8450..00000000 --- a/odcsim-core/build.gradle +++ /dev/null @@ -1,41 +0,0 @@ -/* - * 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. - */ - -/* Build configuration */ -apply from: '../gradle/kotlin.gradle' -apply plugin: 'java-library' - -/* Project configuration */ -repositories { - jcenter() -} - -dependencies { - implementation "org.jetbrains.kotlin: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" -} diff --git a/odcsim-core/build.gradle.kts b/odcsim-core/build.gradle.kts new file mode 100644 index 00000000..1596f3c8 --- /dev/null +++ b/odcsim-core/build.gradle.kts @@ -0,0 +1,46 @@ +/* + * 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. + */ + +/* Build configuration */ +apply(from = "../gradle/kotlin.gradle") +plugins { + `java-library` +} + +/* Project configuration */ +repositories { + jcenter() +} + +val junitJupiterVersion: String by extra +val junitPlatformVersion: String by extra + +dependencies { + implementation(kotlin("stdlib")) + + 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 deleted file mode 100644 index cefd3e20..00000000 --- a/odcsim-engine-omega/build.gradle +++ /dev/null @@ -1,45 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2018 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. - */ - -/* Build configuration */ -apply from: '../gradle/kotlin.gradle' -apply plugin: 'java-library' - -/* Project configuration */ -repositories { - jcenter() -} - -dependencies { - api project(':odcsim-core') - - implementation "org.jetbrains.kotlin: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" -} diff --git a/odcsim-engine-omega/build.gradle.kts b/odcsim-engine-omega/build.gradle.kts new file mode 100644 index 00000000..347e2bb4 --- /dev/null +++ b/odcsim-engine-omega/build.gradle.kts @@ -0,0 +1,50 @@ +/* + * MIT License + * + * Copyright (c) 2018 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. + */ + +/* Build configuration */ +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")) + + implementation(kotlin("stdlib")) + implementation("io.github.microutils:kotlin-logging:1.6.20") + + 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 deleted file mode 100644 index da568319..00000000 --- a/odcsim-engine-tests/build.gradle +++ /dev/null @@ -1,39 +0,0 @@ -/* - * MIT License - * - * Copyright (c) 2019 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. - */ - -/* Build configuration */ -apply from: '../gradle/kotlin.gradle' -apply plugin: 'java-library' - -/* Project configuration */ -repositories { - jcenter() -} - -dependencies { - api project(':odcsim-core') - - implementation "org.jetbrains.kotlin:kotlin-stdlib" - implementation "org.junit.jupiter:junit-jupiter-api:$junit_jupiter_version" -} diff --git a/odcsim-engine-tests/build.gradle.kts b/odcsim-engine-tests/build.gradle.kts new file mode 100644 index 00000000..8b19019a --- /dev/null +++ b/odcsim-engine-tests/build.gradle.kts @@ -0,0 +1,43 @@ +/* + * MIT License + * + * Copyright (c) 2019 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. + */ + +/* Build configuration */ +apply(from = "../gradle/kotlin.gradle") +plugins { + `java-library` +} + +/* Project configuration */ +repositories { + jcenter() +} + +val junitJupiterVersion: String by extra + +dependencies { + api(project(":odcsim-core")) + + implementation(kotlin("stdlib")) + implementation("org.junit.jupiter:junit-jupiter-api:$junitJupiterVersion") +} diff --git a/settings.gradle b/settings.gradle deleted file mode 100644 index 9ae9a5ab..00000000 --- a/settings.gradle +++ /dev/null @@ -1,28 +0,0 @@ -/* - * 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. - */ -rootProject.name = 'opendc-simulator' - -include 'odcsim-core' -include 'odcsim-engine-tests' -include 'odcsim-engine-omega' diff --git a/settings.gradle.kts b/settings.gradle.kts new file mode 100644 index 00000000..b7657f70 --- /dev/null +++ b/settings.gradle.kts @@ -0,0 +1,28 @@ +/* + * 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. + */ +rootProject.name = "opendc-simulator" + +include(":odcsim-core") +include(":odcsim-engine-tests") +include(":odcsim-engine-omega") -- cgit v1.2.3