Skip to content

Commit

Permalink
convert libs from groovy to kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
soloturn committed Nov 16, 2024
1 parent cf0f598 commit 60c9b04
Show file tree
Hide file tree
Showing 9 changed files with 174 additions and 127 deletions.
34 changes: 0 additions & 34 deletions gestalt-di/build.gradle

This file was deleted.

45 changes: 45 additions & 0 deletions gestalt-di/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

tasks.register<Copy>("gatherJarModules") {
dependsOn(
":testpack:moduleA:jar",
":testpack:moduleB:jar",
":testpack:moduleC:jar",
":testpack:moduleD:jar"
)

from("../testpack/moduleA/build/libs/")
from("../testpack/moduleB/build/libs/")
from("../testpack/moduleC/build/libs/")
from("../testpack/moduleD/build/libs/")
from("../testpack/moduleF/build/libs/")
into("test-modules")
include("*.jar")
}

// Primary dependencies definition
dependencies {
testAnnotationProcessor(project(":gestalt-inject-java"))

implementation(libs.slf4j.api)
implementation(libs.guava)
api(project(":gestalt-inject"))

testImplementation(libs.junit)
testImplementation(libs.logback)
testImplementation(libs.mockito)

testImplementation(project(":gestalt-module"))
testImplementation(project(":testpack:testpack-api"))
testImplementation(project(":gestalt-entity-system"))
}

tasks.named("test") {
dependsOn("gatherJarModules")
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from: "$rootDir/gradle/common.gradle.kts")
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

// Primary dependencies definition
dependencies {
implementation(project(":gestalt-util"))
implementation(project(":gestalt-module"))
Expand All @@ -23,11 +26,12 @@ dependencies {
testImplementation(libs.mockito)
}

compileJava {
inputs.files sourceSets.main.resources.srcDirs
options.compilerArgs = ["-Aresource=${sourceSets.main.resources.srcDirs.join(File.pathSeparator)}"]
tasks.named<JavaCompile>("compileJava") {
inputs.files(sourceSets.main.get().resources.srcDirs)
options.compilerArgs.add("-Aresource=${sourceSets.main.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}
compileTestJava {
inputs.files sourceSets.test.resources.srcDirs
options.compilerArgs = ["-Aresource=${sourceSets.test.resources.srcDirs.join(File.pathSeparator)}"]

tasks.named<JavaCompile>("compileTestJava") {
inputs.files(sourceSets.test.get().resources.srcDirs)
options.compilerArgs.add("-Aresource=${sourceSets.test.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}
28 changes: 19 additions & 9 deletions gestalt-es-perf/build.gradle → gestalt-es-perf/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from: "$rootDir/gradle/common.gradle.kts")
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

// Primary dependencies definition
dependencies {
implementation(project(":gestalt-util"))
implementation(project(":gestalt-module"))
Expand All @@ -25,13 +28,20 @@ description = "High performance access methods to replace the use of reflections
* Testpack inclusion
*/

task gatherJarModules(dependsOn: [':testpack:moduleF:jar'], type: Copy)
task gatherModules(dependsOn: [':gestalt-es-perf:gatherJarModules'])
// Register the gatherJarModules task
val gatherJarModules by tasks.registering(Copy::class) {
dependsOn(":testpack:moduleF:jar")
from("../testpack/moduleF/build/libs/")
into("test-modules")
include("*.jar")
}

gatherJarModules {
from '../testpack/moduleF/build/libs/'
into 'test-modules'
include('*.jar')
// Register the gatherModules task
val gatherModules by tasks.registering {
dependsOn(":gestalt-es-perf:gatherJarModules")
}

test.dependsOn gatherModules
// Make the test task depend on gatherModules
tasks.named("test") {
dependsOn(gatherModules)
}
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from: "$rootDir/gradle/common.gradle.kts")
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

// Primary dependencies definition
dependencies {
implementation(project(":gestalt-util"))
implementation(libs.guava)
Expand All @@ -18,6 +21,6 @@ dependencies {
testImplementation(libs.mockito)

implementation("com.squareup:javapoet:1.12.0")
implementation(group: "javax.inject", name: "javax.inject", version: "1")
implementation("javax.inject:javax.inject:1")
implementation(project(":gestalt-inject"))
}
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from: "$rootDir/gradle/common.gradle.kts")
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

// Primary dependencies definition
dependencies {
api(group: 'javax.inject', name: 'javax.inject', version: '1')
api("javax.inject:javax.inject:1")
implementation(libs.slf4j.api)
implementation(libs.guava)
}
69 changes: 0 additions & 69 deletions gestalt-module/build.gradle

This file was deleted.

81 changes: 81 additions & 0 deletions gestalt-module/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

dependencies {
implementation("org.javassist:javassist:3.27.0-GA") // TODO: REMOVE this. Replace with gestalt's DI generator (used by ByteCodeInjector)

api(project(":gestalt-di"))

implementation(project(":gestalt-util"))
annotationProcessor(project(":gestalt-inject-java"))

implementation(libs.guava)
implementation(libs.gson)
implementation("org.apache.commons:commons-vfs2:2.2")
implementation(libs.slf4j.api)
implementation(libs.android.annotation)
implementation("com.github.zafarkhaja:java-semver:0.10.2")

testImplementation(project(":testpack:testpack-api"))
testAnnotationProcessor(project(":gestalt-inject-java"))
testImplementation(libs.junit)
testImplementation(libs.logback)
testImplementation(libs.mockito)
}

// Configure Java compilation options
tasks.named<JavaCompile>("compileJava") {
inputs.files(sourceSets.main.get().resources.srcDirs)
options.compilerArgs.add("-Aresource=${sourceSets.main.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}

tasks.named<JavaCompile>("compileTestJava") {
inputs.files(sourceSets.test.get().resources.srcDirs)
options.compilerArgs.add("-Aresource=${sourceSets.test.get().resources.srcDirs.joinToString(File.pathSeparator)}")
}

// Library and distribution config
description = "Provides support for modules - java libraries that can be activated at runtime and run in a sandboxed environment"

// Task registrations
val gatherJarModules by tasks.registering(Copy::class) {
dependsOn(":testpack:moduleA:jar", ":testpack:moduleB:jar", ":testpack:moduleC:jar", ":testpack:moduleD:jar")
from("../testpack/moduleA/build/libs/")
from("../testpack/moduleB/build/libs/")
from("../testpack/moduleC/build/libs/")
from("../testpack/moduleD/build/libs/")
into("test-modules")
include("*.jar")
}

val copyModuleELibs by tasks.registering(Copy::class) {
dependsOn(":testpack:moduleA:jar", ":testpack:moduleD:jar")
from("../testpack/moduleA/build/libs")
from("../testpack/moduleD/build/libs")
into("test-modules/moduleE/libs")
include("*.jar")
}

val copyModuleEInfo by tasks.registering(Copy::class) {
from("../testpack/moduleE")
into("test-modules/moduleE")
include("*.json")
}

val createModuleE by tasks.registering {
dependsOn(":gestalt-module:copyModuleEInfo", ":gestalt-module:copyModuleELibs")
}

val gatherModules by tasks.registering {
dependsOn(":gestalt-module:gatherJarModules", ":gestalt-module:createModuleE")
}

// Make the test task depend on gatherModules
tasks.named("test") {
dependsOn(gatherModules)
}
6 changes: 5 additions & 1 deletion gestalt-util/build.gradle → gestalt-util/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
// Copyright 2021 The Terasology Foundation
// SPDX-License-Identifier: Apache-2.0
apply(from: "$rootDir/gradle/common.gradle.kts")
apply(from = "$rootDir/gradle/common.gradle.kts")

plugins {
`java-library`
}

// Primary dependencies definition
dependencies {
Expand Down

0 comments on commit 60c9b04

Please sign in to comment.