-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild.gradle
191 lines (169 loc) · 5.91 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
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
buildscript {
repositories {
jcenter()
maven {
name = "forge"
url = "http://files.minecraftforge.net/maven"
}
maven {
name = "sonatype"
url = "https://oss.sonatype.org/content/repositories/snapshots/"
}
}
//noinspection GroovyAssignabilityCheck
dependencies {
classpath 'net.minecraftforge.gradle:ForgeGradle:2.2-SNAPSHOT'
classpath group: 'com.github.rodionmoiseev.gradle.plugins', name: 'idea-utils', version: '0.2'
}
}
import groovy.json.*
//noinspection GroovyAssignabilityCheck
configurations {
compile
deployJars
}
apply plugin: "net.minecraftforge.gradle.forge"
apply plugin: "idea-utils"
apply plugin: "maven"
group = "net.doubledoordev.d3commands"
version = "1.3.1"
targetCompatibility = 1.7
sourceCompatibility = 1.7
archivesBaseName = 'D3Commands'
def githuborg = 'DoubleDoorDevelopment'
def description = 'Some useful command things'
minecraft {
version = "1.9.4-12.17.0.1976"
runDir = "jars"
mappings = "stable_26"
}
repositories {
maven {
name "DDD repo"
url "http://doubledoordev.net/maven/"
}
}
dependencies {
compile "net.doubledoordev.d3core:D3Core:" + project.minecraft.version + "-+:dev"
}
if (System.getenv().BUILD_NUMBER != null) version += "." + System.getenv().BUILD_NUMBER
//noinspection GroovyAssignabilityCheck
processResources {
from(sourceSets.main.resources.srcDirs) {
include 'mcmod.info'
expand 'version':project.version, 'mcversion':project.minecraft.version, 'modid':project.archivesBaseName, 'githuborg':githuborg, 'description':description, 'group':project.group, 'artifactId':project.archivesBaseName
}
doLast {
def updateFile = new File(project.archivesBaseName + '.json')
def json;
if (updateFile.exists()) {
json = new JsonSlurper().parseText(updateFile.getText())
}
else {
def builder = new JsonBuilder()
json = builder(
homepage: "http://doubledoordev.net/",
promos: new HashMap<>()
)
}
def outStream = new ByteArrayOutputStream()
def result = exec {
executable = 'git'
args = [ 'log', '-n', '1', "--format='%B'"]
standardOutput = outStream
}
def fullLog = outStream.toString().replaceAll("^\\s*'\\s*|\\s*'\\s*\$", "").replaceAll("[\\r\\n]+", "\n")
json['promos'][project.minecraft.version + '-latest'] = project.version
json['promos'][project.minecraft.version + '-recomended'] = project.version
if (!json.containsKey(project.minecraft.version)) json.put(project.minecraft.version, new HashMap<>())
def version = json[project.minecraft.version]
version.put(project.version, fullLog)
updateFile.write JsonOutput.prettyPrint(JsonOutput.toJson(json))
}
}
task deobfJar(type: Jar, dependsOn: 'jar') {
from sourceSets.main.output
from "LICENSE.txt"
classifier "dev"
appendix = project.minecraft.version
manifest {
}
}
sourceJar {
from "LICENSE.txt"
exclude("com/**")
classifier "src"
appendix = project.minecraft.version
manifest {
}
}
//noinspection GroovyAssignabilityCheck
jar {
from "LICENSE.txt"
exclude("com/**")
appendix = project.minecraft.version
manifest {
}
}
artifacts {
archives deobfJar
}
idea {
project {
copyright {
name = 'MIT License'
license = file('LICENSE.txt')
}
}
}
//noinspection GroovyAssignabilityCheck
uploadArchives {
if (project.hasProperty("dddUser") && project.hasProperty("dddUrl") && project.hasProperty("dddPass")) {
repositories {
mavenDeployer {
repository(url: dddUrl) {
authentication(userName: dddUser, password: dddPass)
}
pom {
groupId = project.group
version = project.minecraft.version + "-" + project.version
artifactId = project.archivesBaseName
project {
name project.archivesBaseName
packaging 'jar'
description = project.description
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName
scm {
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName
connection 'scm:git:git://github.com/' + githuborg + '/' + project.archivesBaseName + '.git'
developerConnection 'scm:git:[email protected]:' + githuborg + '/' + project.archivesBaseName + '.git'
}
issueManagement {
system 'github'
url 'https://github.com/' + githuborg + '/' + project.archivesBaseName + '/issues'
}
licenses {
license {
name 'MIT License'
url 'https://raw.github.com/' + githuborg + '/' + project.archivesBaseName + '/master/LICENCE.txt'
distribution 'repo'
}
}
developers {
developer {
id 'Dries007'
name 'Dries007'
roles { role 'developer' }
}
developer {
id 'Claycorp'
name 'Claycorp'
roles { role 'developer' }
}
}
}
}
}
}
}
}