-
Notifications
You must be signed in to change notification settings - Fork 122
/
build.gradle
152 lines (128 loc) · 5.66 KB
/
build.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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
// Git plugin details at https://github.com/ajoberstar/gradle-git
import org.ajoberstar.gradle.git.tasks.*
plugins {
id 'destination-sol-ide'
id 'destination-sol-repositories'
id 'terasology-metrics'
id 'org.ajoberstar.grgit' version '5.0.0' apply false
}
repositories {
// Good ole Maven central
mavenCentral()
// Repos for LibGDX
maven { url "https://oss.sonatype.org/content/repositories/snapshots/" }
maven { url "https://oss.sonatype.org/content/repositories/releases/" }
// Terasology Artifactory for any shared libs
maven {
url "https://artifactory.terasology.io/artifactory/virtual-repo-live"
}
maven { url "https://maven.google.com" }
}
// Helper that returns a list of all local Destination Sol module projects
def destinationSolModules() {
subprojects.findAll {it.parent.name == 'modules'}
}
destinationSolModules().forEach { destSolModule ->
destSolModule.configurations.configureEach {
resolutionStrategy.dependencySubstitution.all { dependency ->
if (dependency.requested instanceof ModuleComponentSelector && dependency.requested.group == "org.destinationsol.modules") {
destinationSolModules().forEach { otherModule ->
if (otherModule.name == dependency.requested.module) {
dependency.useTarget otherModule
}
}
}
}
}
}
tasks.eclipse.doLast {
delete ".project"
}
tasks.eclipse.dependsOn extractMetricsConfig
import org.jetbrains.gradle.ext.Application
idea {
project {
// Set JDK
jdkName = '1.8'
wildcards -= '!?*.groovy'
settings {
compiler {
enableAutomake = true
}
runConfigurations {
"Desktop"(Application) {
mainClass = 'org.destinationsol.desktop.SolDesktop'
moduleName 'DestinationSol.desktop.main'
workingDirectory = rootDir
jvmArgs = '-splash:engine/src/main/resources/assets/textures/mainMenu/mainMenuLogo.png -Xms256m -Xmx1024m -Dlog4j.configuration=log4j-debug.properties'
programParameters = '-noSplash -noCrashReport'
}
}
copyright {
useDefault = 'DestinationSolCopyright'
profiles {
DestinationSolCopyright {
notice = 'Copyright 2023 The Terasology Foundation\n\nLicensed under the Apache License, Version 2.0 (the "License");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n https://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an "AS IS" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.'
keyword = 'Copyright'
allowReplaceRegexp = ''
}
}
}
taskTriggers {
afterSync tasks.named('extractMetricsConfig')
}
generateImlFiles = true
withIDEAFileXml("compiler.xml", ideaPatchAnnotationProcessors)
withIDEAFileXml("misc.xml", ideaPatchEntryPoints)
withIDEAFileXml("checkstyle-idea.xml", ideaPatchCheckstyle)
}
ipr {
withXml { xmlProvider ->
// Apply a bunch of tweaks to IntelliJ config - all defined in ide.gradle
// Part reason for separate file was in case a module needs to define something it cannot do so in a project block
def iprNode = xmlProvider.asNode()
ideaActivateCheckstyle(iprNode)
ideaActivateCopyright(iprNode)
ideaActivateAnnotations(iprNode)
ideaActivateGit(iprNode)
ideaActivateGradle(iprNode)
}
// Sets sourceCompatibility within IntelliJ (without this root build having the Java plugin applied)
whenMerged { project ->
project.jdk.languageLevel = 'JDK_1_8'
}
}
}
// Tweaks to the .iws
workspace.iws.withXml { xmlProvider ->
def iwsNode = xmlProvider.asNode()
ideaMakeAutomatically(iwsNode)
ideaRunConfig(iwsNode)
}
}
cleanIdea.doLast {
new File('DestinationSol.iws').delete()
new File('config/metrics').deleteDir()
println "Cleaned root - don't forget to re-extract code metrics config! 'gradlew extractConfig' will do so, or 'gradlew idea' (or eclipse)"
}
import org.ajoberstar.grgit.Grgit
tasks.register('fetchAndroid') {
description = 'Git clones the Android facade source from GitHub'
// Repo name is the dynamic part of the task name
def repo = 'DestSolAndroid'
// Default GitHub account to use. Supply with -PgithubAccount="TargetAccountName" or via gradle.properties
def githubHome = 'MovingBlocks'
def destination = file('android')
// Don't clone this repo if we already have a directory by that name (also determines Gradle UP-TO-DATE)
enabled = !destination.exists()
//println "fetchAndroid requested for $repo from Github under $githubHome - exists already? " + !enabled
doLast {
Grgit.clone(
// Do the actual clone if we don't have the directory already
uri: "https://github.com/$githubHome/" + repo + ".git",
//println "Fetching $repo from $uri"
dir: destination,
bare: false
)
}
}