1
- buildscript {
2
- repositories {
3
- mavenCentral()
4
- jcenter()
5
- }
6
- dependencies {
7
- classpath ' com.github.jengelman.gradle.plugins:shadow:2.0.1'
8
- }
1
+ plugins {
2
+ id ' net.minecrell.licenser' version ' 0.3'
3
+ id ' org.ajoberstar.grgit' version ' 2.3.0'
4
+ id ' com.github.johnrengelman.shadow' version ' 2.0.4'
9
5
}
10
6
11
- apply plugin : ' com.github.johnrengelman.shadow'
12
7
apply plugin : ' java'
13
8
apply plugin : ' eclipse'
14
9
apply plugin : ' maven'
10
+ apply plugin : ' maven-publish'
15
11
16
12
group = ' de.oceanlabs.mcp'
17
- version = ' 3.7-SNAPSHOT'
18
- targetCompatibility = sourceCompatibility = ' 1.8'
19
- compileJava {
20
- sourceCompatibility = targetCompatibility = ' 1.8'
13
+ version = gitVersion()
14
+ targetCompatibility = sourceCompatibility = compileJava. targetCompatibility = compileJava. sourceCompatibility = ' 1.8'
15
+
16
+ ext {
17
+ CHANGELOG = file(" build/${ project.name} -${ project.version} -changelog.txt" )
21
18
}
22
19
23
20
repositories {
24
21
mavenCentral()
25
22
}
26
23
24
+ def gitVersion () {
25
+ def desc = grgit. describe(longDescr : true ). split(' -' ) as List
26
+ def hash = desc. remove(desc. size() - 1 )
27
+ def offset = desc. remove(desc. size() - 1 )
28
+ def tag = desc. join(' -' )
29
+ def branch = grgit. branch. current(). name
30
+ return " ${ tag} .${ offset}${ t -> if (branch != 'master') t << '-' + branch} "
31
+ }
32
+
27
33
jar {
28
34
manifest. attributes(' Main-Class' : ' de.oceanlabs.mcp.mcinjector.MCInjector' )
29
35
manifest. attributes(' Implementation-Version' : project. version)
@@ -38,83 +44,81 @@ artifacts {
38
44
archives jar
39
45
archives shadowJar
40
46
}
47
+ def changelog = file(' build/changelog.txt' )
48
+ def changelog_named = CHANGELOG
49
+ if (changelog. exists()) {
50
+ CHANGELOG . write(changelog. text)
51
+ artifacts. archives CHANGELOG
52
+ }
41
53
42
54
dependencies {
43
55
compile ' org.ow2.asm:asm:6.1-beta2'
44
56
compile ' org.ow2.asm:asm-tree:6.1-beta2'
45
57
compile ' net.sf.jopt-simple:jopt-simple:4.9'
46
58
compile ' com.google.code.gson:gson:2.2.4'
47
59
}
48
- configurations { deployJars }
49
- uploadArchives {
50
- repositories {
51
- add project. repositories. mavenLocal()
52
- }
53
- repositories. mavenDeployer {
54
- configuration = configurations. deployJars
55
-
56
- if (project. hasProperty(' mavenPass' )) {
57
- logger. info(' Publishing to files server' )
58
- repository(url : ' http://files.minecraftforge.net/maven/manage/upload' ) {
59
- authentication(userName : ' mcp' , password : project. getProperty(' mavenPass' ))
60
- }
61
- } else {
62
- logger. info(' Publishing to repo folder' )
63
- repository(url : ' file://localhost/' + project. file(' repo' ). getAbsolutePath())
64
- }
65
-
66
- pom {
67
- groupId = project. group
68
- version = project. version
69
- artifactId = project. archivesBaseName
70
- }
71
- pom. project {
72
- name project. archivesBaseName
73
- packaging ' jar'
74
- description ' Java class metadata injector'
75
- url ' https://github.com/ModCoderPack/MCInjector'
76
60
77
- scm {
78
- url ' https://github.com/ModCoderPack/MCInjector'
79
- connection ' scm:git:git://github.com/ModCoderPack/MCInjector.git'
80
- developerConnection
' scm:git:[email protected] :ModCoderPack/MCInjector.git'
81
- }
82
-
83
- issueManagement {
84
- system ' github'
85
- url ' https://github.com/ModCoderPack/MCInjector/issues'
86
- }
87
-
88
- licenses {
89
- license {
90
- name ' '
91
- url ' '
92
- distribution ' repo'
61
+ publishing {
62
+ publications {
63
+ mavenJava(MavenPublication ) {
64
+ from components. java
65
+ artifact shadowJar
66
+ if (CHANGELOG . exists())
67
+ artifact source : CHANGELOG , classifier : ' changelog'
68
+ pom {
69
+ name = ' MCInjector'
70
+ description = ' Utility for cleaning up Minecraft jar files for decompolation'
71
+ url = ' https://github.com/ModCoderPack/MCInjector'
72
+ scm {
73
+ url = ' https://github.com/ModCoderPack/MCInjector'
74
+ connection = ' scm:git:git://github.com/ModCoderPack/MCInjector.git'
75
+ developerConnection
= ' scm:git:[email protected] :ModCoderPack/MCInjector.git'
93
76
}
94
- }
95
-
96
- developers {
97
- developer {
98
- id ' Fesh0r'
99
- name ' Fesh0r'
100
- roles { role ' developer' }
77
+ issueManagement {
78
+ system = ' github'
79
+ url = ' https://github.com/ModCoderPack/MCInjector/issues'
101
80
}
102
- developer {
103
- id ' Searge'
104
- name ' Searge'
105
- roles { role ' developer' }
81
+
82
+ developers {
83
+ developer {
84
+ id = ' Fesh0r'
85
+ name = ' Fesh0r'
86
+ }
87
+ developer {
88
+ id = ' Searge'
89
+ name = ' Searge'
90
+ }
91
+ developer {
92
+ id = ' cpw'
93
+ name = ' cpw'
94
+ }
95
+ developer {
96
+ id = ' LexManos'
97
+ name = ' Lex Manos'
98
+ }
106
99
}
107
- developer {
108
- id ' cpw'
109
- name ' cpw'
110
- roles { role ' developer' }
100
+
101
+ licenses { // TODO: Ask the guys if I can license LGPL2.1 like everything else.
102
+ license {
103
+ name = ' '
104
+ url = ' '
105
+ distribution = ' repo'
106
+ }
111
107
}
112
- developer {
113
- id ' LexManos'
114
- name ' Lex Manos'
115
- roles { role ' developer' }
108
+ }
109
+ }
110
+ }
111
+ repositories {
112
+ maven {
113
+ if (project. hasProperty(' mavenPassword' )) {
114
+ credentials {
115
+ username = project. properties. mavenUser
116
+ password = project. properties. mavenPassword
116
117
}
118
+ url ' http://files.minecraftforge.net/maven/manage/upload'
119
+ } else {
120
+ url ' file://' + project. file(' repo' ). getAbsolutePath()
117
121
}
118
122
}
119
123
}
120
- }
124
+ }
0 commit comments