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'
95}
106
11- apply plugin : ' com.github.johnrengelman.shadow'
127apply plugin : ' java'
138apply plugin : ' eclipse'
149apply plugin : ' maven'
10+ apply plugin : ' maven-publish'
1511
1612group = ' 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" )
2118}
2219
2320repositories {
2421 mavenCentral()
2522}
2623
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+
2733jar {
2834 manifest. attributes(' Main-Class' : ' de.oceanlabs.mcp.mcinjector.MCInjector' )
2935 manifest. attributes(' Implementation-Version' : project. version)
@@ -38,83 +44,81 @@ artifacts {
3844 archives jar
3945 archives shadowJar
4046}
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+ }
4153
4254dependencies {
4355 compile ' org.ow2.asm:asm:6.1-beta2'
4456 compile ' org.ow2.asm:asm-tree:6.1-beta2'
4557 compile ' net.sf.jopt-simple:jopt-simple:4.9'
4658 compile ' com.google.code.gson:gson:2.2.4'
4759}
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'
7660
77- scm {
78- url ' https://github.com/ModCoderPack/MCInjector'
79- connection ' scm:git:git://github.com/ModCoderPack/MCInjector.git'
80- developerConnection ' scm:git:git@github.com: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:git@github.com:ModCoderPack/MCInjector.git'
9376 }
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'
10180 }
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+ }
10699 }
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+ }
111107 }
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
116117 }
118+ url ' http://files.minecraftforge.net/maven/manage/upload'
119+ } else {
120+ url ' file://' + project. file(' repo' ). getAbsolutePath()
117121 }
118122 }
119123 }
120- }
124+ }
0 commit comments