Skip to content

Commit 81bdd0d

Browse files
authored
Merge pull request #150 from MovingBlocks/kotlin2
common.gradle now common.gradle.kts
2 parents 9158f87 + bf4b914 commit 81bdd0d

File tree

10 files changed

+89
-95
lines changed

10 files changed

+89
-95
lines changed

gestalt-asset-core/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-di/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
task gatherJarModules(dependsOn: [':testpack:moduleA:jar', ':testpack:moduleB:jar', ':testpack:moduleC:jar', ':testpack:moduleD:jar'], type: Copy)
66

gestalt-entity-system/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-es-perf/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-inject-java/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-inject/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-module/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gestalt-util/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// Copyright 2021 The Terasology Foundation
22
// SPDX-License-Identifier: Apache-2.0
3-
apply from: "$rootDir/gradle/common.gradle"
3+
apply(from: "$rootDir/gradle/common.gradle.kts")
44

55
// Primary dependencies definition
66
dependencies {

gradle/common.gradle

Lines changed: 0 additions & 87 deletions
This file was deleted.

gradle/common.gradle.kts

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
// Copyright 2021 The Terasology Foundation
2+
// SPDX-License-Identifier: Apache-2.0
3+
4+
// Most typical common config, but not quite global
5+
apply(plugin = "java-library")
6+
apply(plugin = "maven-publish")
7+
8+
extensions.configure<JavaPluginExtension> {
9+
withSourcesJar()
10+
withJavadocJar()
11+
12+
sourceCompatibility = JavaVersion.VERSION_1_8
13+
targetCompatibility = JavaVersion.VERSION_1_8
14+
}
15+
16+
// Extra details provided for unit tests
17+
tasks.withType<Test> {
18+
useJUnit()
19+
20+
// ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail.
21+
ignoreFailures = true
22+
23+
// showStandardStreams: makes the standard streams (err and out) visible at console when running tests
24+
testLogging.showStandardStreams = true
25+
26+
reports {
27+
junitXml.required.set(true)
28+
}
29+
30+
// Arguments to include while running tests
31+
jvmArgs = listOf("-Xms512m", "-Xmx1024m")
32+
}
33+
34+
// Javadoc configuration
35+
tasks.withType<Javadoc> {
36+
isFailOnError = false
37+
}
38+
39+
extensions.configure<PublishingExtension> {
40+
publications {
41+
create<MavenPublication>(project.name) {
42+
// Without this we get a .pom with no dependencies
43+
from(components["java"])
44+
45+
repositories {
46+
maven {
47+
name = "TerasologyOrg"
48+
url = uri(
49+
if (rootProject.hasProperty("publishRepo")) {
50+
// This first option is good for local testing, you can set a full explicit target repo in gradle.properties
51+
"https://artifactory.terasology.io/artifactory/${rootProject.property("publishRepo")}"
52+
} else {
53+
// Support override from the environment to use a different target publish org
54+
val deducedPublishRepo = System.getenv("PUBLISH_ORG").takeIf { it?.isNotEmpty() == true }
55+
?: "libs"
56+
57+
val suffix = if (project.version.toString().endsWith("SNAPSHOT")) {
58+
"-snapshot-local"
59+
} else {
60+
"-release-local"
61+
}
62+
63+
logger.info("The final deduced publish repo is {}", deducedPublishRepo + suffix)
64+
"https://artifactory.terasology.io/artifactory/$deducedPublishRepo$suffix"
65+
}
66+
)
67+
68+
if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) {
69+
credentials {
70+
username = rootProject.property("mavenUser").toString()
71+
password = rootProject.property("mavenPass").toString()
72+
}
73+
authentication {
74+
create<BasicAuthentication>("basic")
75+
}
76+
}
77+
}
78+
}
79+
}
80+
}
81+
}

0 commit comments

Comments
 (0)