-
Notifications
You must be signed in to change notification settings - Fork 100
/
Copy pathbuild.gradle
158 lines (137 loc) · 4.74 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
153
154
155
156
157
158
import org.apache.tools.ant.filters.ReplaceTokens
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
maven {
url "https://plugins.gradle.org/m2/"
}
}
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.3-SNAPSHOT'
classpath "com.wynprice.cursemaven:CurseMaven:2.1.1"
}
}
plugins {
id "org.sonarqube" version "2.6.2"
id "maven-publish"
id "com.wynprice.cursemaven" version "2.1.1"
id "de.fuerstenau.buildconfig" version "1.1.8"
}
// We apply the 'forge' plugin, so ForgeGradle can do it's stuff.
apply plugin: 'net.minecraftforge.gradle.forge'
apply plugin: 'idea'
repositories {
maven {
name = "CoFH Maven"
url = "http://maven.covers1624.net"
}
maven {
name "LatvianModder Ivy"
url = "https://maven.latmod.com/"
}
maven {
url "http://dvs1.progwml6.com/files/maven"
}
}
minecraft{
version = minecraft_version + "-" + forge_version
mappings = mcp_mappings
runDir = "run"
replaceIn "automation/AncientWarfareAutomation.java"
replaceIn "core/AncientWarfareCore.java"
replaceIn "npc/AncientWarfareNPC.java"
replaceIn "structure/AncientWarfareStructure.java"
replaceIn "vehicle/AncientWarfareVehicles.java"
replace "@VERSION@", "${project.minecraft.version}-${project.major}.${project.minor}.${project.patch}." + getBuildNumber() + getStable()
replace "0.000.000.001", "$forge_version"
}
version = minecraft.version + "-" + project.major +"."+ project.minor +"."+ project.patch +"."+ getBuildNumber() + getStable()
group = "shadowmage"
archivesBaseName = "ancientwarfare"
sourceCompatibility = 1.8
targetCompatibility = 1.8
dependencies {
deobfCompile "cofh:RedstoneFlux:${rf_version}:universal"
deobfCompile "mezz.jei:jei_${minecraft_version}:${jei_version}"
deobfCompile "codechicken:CodeChickenLib:${ccl_version}:deobf"
deobfCompile "com.feed_the_beast.mods:FTBLib:${ftblib_version}"
compile "curse.maven:ElectroblobsWizardry:${eb_cf_fileid}"
compile "curse.maven:infinitylib:${infinitylib_cf_fileid}"
compile "curse.maven:agricraft:${agricraft_cf_fileid}"
}
buildConfig {
appName = project.name // sets value of NAME field
version = project.version // sets value of VERSION field,
clsName = 'BuildConfig' // sets the name of the BuildConfig class
packageName = 'net.shadowmage.ancientwarfare' // sets the package of the BuildConfig class,
charset = 'UTF-8' // sets charset of the generated class,
buildConfigField 'boolean', 'UNSTABLE', {isUnstable()}
}
processResources{
// replace stuff in mcmod.info, nothing else
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
// replace version and mcversion
expand 'version':project.version, 'mcversion':project.minecraft.version
}
// copy everything else, thats not the mcmod.info
from(sourceSets.main.resources.srcDirs) {
exclude 'mcmod.info'
}
rename '(.+_at.cfg)', 'META-INF/$1'
}
jar {
manifest {
attributes 'FMLAT': 'ancientwarfare_at.cfg'
}
}
static def getBuildNumber() {
if (System.getenv("GITHUB_RUN_NUMBER") != null) {
return Integer.valueOf(Integer.parseInt(System.getenv("GITHUB_RUN_NUMBER")) + 830).toString()
}
return ""
}
def getStable() {
if (isUnstable()) {
return "unstable"
}
return ""
}
def isUnstable() {
return (System.getenv("GITHUB_REF") == null || System.getenv("GITHUB_REF").endsWith("-dev"));
}
task minifyStructureTemplates(type: MinifyStructuresTask) {
templateFolder = "$projectDir/src/main/resources/assets/ancientwarfare/template/"
}
publishing {
repositories {
maven {
name = "GitHubPackages"
url = uri("https://maven.pkg.github.com/P3pp3rF1y/AncientWarfare2")
credentials {
username = project.findProperty("gpr.user") ?: System.getenv("GPR_USER")
password = project.findProperty("gpr.key") ?: System.getenv("GPR_API_KEY")
}
}
}
publications {
gpr(MavenPublication) {
artifactId 'ancientwarfare2'
from components.java
}
}
}
sonarqube {
properties {
property "sonar.projectName", "Ancient Warfare 2"
property "sonar.projectKey", "ancientwarfare"
}
}