-
Notifications
You must be signed in to change notification settings - Fork 23
/
Copy pathbuild.gradle
132 lines (119 loc) · 3.96 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
plugins {
//id 'net.minecrell.licenser' version '0.3'
id 'org.ajoberstar.grgit' version '2.3.0'
id 'com.github.johnrengelman.shadow' version '2.0.4'
}
apply plugin: 'java'
apply plugin: 'eclipse'
apply plugin: 'maven'
apply plugin: 'maven-publish'
group = 'de.oceanlabs.mcp'
version = gitVersion()
targetCompatibility = sourceCompatibility = compileJava.targetCompatibility = compileJava.sourceCompatibility = '1.8'
ext {
CHANGELOG = file("build/${project.name}-${project.version}-changelog.txt")
}
repositories {
mavenCentral()
}
def gitVersion() {
def desc = grgit.describe(longDescr: true).split('-') as List
def hash = desc.remove(desc.size() - 1)
def offset = desc.remove(desc.size() - 1)
def tag = desc.join('-')
def branch = grgit.branch.current().name
return "${tag}.${offset}${t -> if (branch != 'master') t << '-' + branch}"
}
jar {
manifest.attributes('Main-Class': 'de.oceanlabs.mcp.mcinjector.MCInjector')
manifest.attributes('Implementation-Version': project.version)
}
shadowJar {
classifier 'fatjar'
manifest.attributes('Main-Class': 'de.oceanlabs.mcp.mcinjector.MCInjector')
manifest.attributes('Implementation-Version': project.version)
}
task sourceJar(type: Jar) {
classifier 'sources'
from sourceSets.main.allJava
}
artifacts {
archives jar
archives shadowJar
archives sourceJar
}
def changelog = file('build/changelog.txt')
def changelog_named = CHANGELOG
if (changelog.exists()) {
CHANGELOG.write(changelog.text)
artifacts.archives CHANGELOG
}
dependencies {
compile 'org.ow2.asm:asm:6.1-beta2'
compile 'org.ow2.asm:asm-tree:6.1-beta2'
compile 'net.sf.jopt-simple:jopt-simple:4.9'
compile 'com.google.code.gson:gson:2.2.4'
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
artifact shadowJar
artifact tasks.sourceJar
if (CHANGELOG.exists())
artifact source: CHANGELOG, classifier: 'changelog'
pom {
name = 'MCInjector'
description = 'Utility for cleaning up Minecraft jar files for decompolation'
url = 'https://github.com/ModCoderPack/MCInjector'
scm {
url = 'https://github.com/ModCoderPack/MCInjector'
connection = 'scm:git:git://github.com/ModCoderPack/MCInjector.git'
developerConnection = 'scm:git:[email protected]:ModCoderPack/MCInjector.git'
}
issueManagement {
system = 'github'
url = 'https://github.com/ModCoderPack/MCInjector/issues'
}
developers {
developer {
id = 'Fesh0r'
name = 'Fesh0r'
}
developer {
id = 'Searge'
name = 'Searge'
}
developer {
id = 'cpw'
name = 'cpw'
}
developer {
id = 'LexManos'
name = 'Lex Manos'
}
}
licenses { //TODO: Ask the guys if I can license LGPL2.1 like everything else.
license {
name = ''
url = ''
distribution = 'repo'
}
}
}
}
}
repositories {
maven {
if (project.hasProperty('mavenPassword')) {
credentials {
username = project.properties.mavenUser
password = project.properties.mavenPassword
}
url 'http://files.minecraftforge.net/maven/manage/upload'
} else {
url 'file://' + project.file('repo').getAbsolutePath()
}
}
}
}