-
Notifications
You must be signed in to change notification settings - Fork 10
/
Copy pathcommon.gradle
115 lines (98 loc) · 4.37 KB
/
common.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
java {
withSourcesJar()
withJavadocJar()
sourceCompatibility(JavaVersion.VERSION_1_8)
targetCompatibility(JavaVersion.VERSION_1_8)
}
// We use both Maven Central and our own Artifactory instance, which contains module builds, extra libs, and so on
repositories {
// For development so you can publish binaries locally and have them grabbed from there
mavenLocal()
// External libs
mavenCentral()
// Used for gestalt 7 - Android annotations
google()
// Terasology Artifactory instance for libs not readily available elsewhere plus our own libs
maven {
def repoViaEnv = System.getenv()["RESOLUTION_REPO"]
if (rootProject.hasProperty("alternativeResolutionRepo")) {
// If the user supplies an alternative repo via gradle.properties then use that
name "from alternativeResolutionRepo property"
url alternativeResolutionRepo
} else if (repoViaEnv != null && repoViaEnv != "") {
name "from \$RESOLUTION_REPO"
url = repoViaEnv
} else {
// Our default is the main virtual repo containing everything except repos for testing Artifactory itself
name "Terasology Artifactory"
url "https://artifactory.terasology.io/artifactory/virtual-repo-live"
}
}
maven {
name "snowplow (pre-0.9)"
url "http://maven.snplow.com/releases"
allowInsecureProtocol true // 😱
}
}
// Extra details provided for unit tests
test {
useJUnitPlatform()
// ignoreFailures: Specifies whether the build should break when the verifications performed by this task fail.
ignoreFailures = true
// showStandardStreams: makes the standard streams (err and out) visible at console when running tests
testLogging.showStandardStreams = true
reports {
junitXml.required.set(true)
}
// Arguments to include while running tests
jvmArgs '-Xms512m', '-Xmx1024m'
}
// In theory all Javadoc should be good and fixed, but it might be a bit much to entirely fail a build over. For now at least ...
// Note: In IntelliJ 2020.1+ running a javadoc Gradle task may still *look* alarming in the UI, but errors should be ignored
javadoc {
failOnError = false
}
group = 'org.terasology.nui'
version = nuiVersion
publishing {
publications {
"$project.name"(MavenPublication) {
// Without this we get a .pom with no dependencies
from components.java
repositories {
maven {
name = 'TerasologyOrg'
if (rootProject.hasProperty("publishRepo")) {
// This first option is good for local testing, you can set a full explicit target repo in gradle.properties
url = "https://artifactory.terasology.io/artifactory/$publishRepo"
logger.info("Changing PUBLISH repoKey set via Gradle property to {}", publishRepo)
} else {
// Support override from the environment to use a different target publish org
String deducedPublishRepo = System.getenv()["PUBLISH_ORG"]
if (deducedPublishRepo == null || deducedPublishRepo == "") {
// If not then default
deducedPublishRepo = "libs"
}
// Base final publish repo on whether we're building a snapshot or a release
if (project.version.endsWith('SNAPSHOT')) {
deducedPublishRepo += "-snapshot-local"
} else {
deducedPublishRepo += "-release-local"
}
logger.info("The final deduced publish repo is {}", deducedPublishRepo)
url = "https://artifactory.terasology.io/artifactory/$deducedPublishRepo"
}
if (rootProject.hasProperty("mavenUser") && rootProject.hasProperty("mavenPass")) {
credentials {
username = "$mavenUser"
password = "$mavenPass"
}
authentication {
basic(BasicAuthentication)
}
}
}
}
}
}
}