This repository has been archived by the owner on Aug 11, 2020. It is now read-only.
forked from MinecraftForge/ForgeGradle
-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
127 lines (114 loc) · 4.28 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
plugins {
id 'net.minecrell.licenser' version '0.4.1'
id 'org.ajoberstar.grgit' version '3.0.0'
id 'com.github.ben-manes.versions' version '0.20.0'
//id 'com.github.johnrengelman.shadow' version '2.0.4'
}
apply plugin: 'java'
apply plugin: 'maven-publish'
apply plugin: 'eclipse'
sourceCompatibility = targetCompatibility = '1.8' // Need this here so eclipse task generates correctly.
compileJava {
sourceCompatibility = targetCompatibility = '1.8'
}
group = 'net.minecraftforge.gradle'
version = gitVersion()
def gitVersion() {
def raw = grgit.describe(longDescr: true, tags: true)
def desc = (raw == null ? 'unknown-unknown-unknown' : raw).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}"
}
sourceSets {
common
mcp
patcher
userdev
}
configurations {
mcpImplementation.extendsFrom commonImplementation
patcherImplementation.extendsFrom commonImplementation
userdevImplementation.extendsFrom mcpImplementation
implementation.extendsFrom mcpImplementation, patcherImplementation, userdevImplementation
}
jar {
from sourceSets.common.output
from sourceSets.mcp.output
from sourceSets.patcher.output
from sourceSets.userdev.output
}
repositories {
jcenter()
maven { url = 'https://files.minecraftforge.net/maven' }
}
license {
header = file('HEADER')
ext {
name = 'ForgeGradle'
year = 2018
fullname = 'Forge Development LLC'
}
exclude '**/*.properties'
exclude 'net/minecraftforge/gradle/common/diff/'
exclude 'net/minecraftforge/gradle/common/util/JavaVersionParser.java'
}
wrapper {
gradleVersion = '4.9'
distributionType = Wrapper.DistributionType.ALL
}
dependencies {
commonImplementation gradleApi()
commonImplementation 'com.cloudbees:diff4j:1.2'
commonImplementation 'commons-io:commons-io:2.4'
commonImplementation 'com.github.jponge:lzma-java:1.3' // replaces the LZMA binary
commonImplementation 'com.nothome:javaxdelta:2.0.1' // GDIFF implementation for BinPatches
commonImplementation 'com.google.code.gson:gson:2.8.5'
commonImplementation 'com.google.guava:guava:26.0-jre'
commonImplementation 'de.siegmar:fastcsv:1.0.2'
commonImplementation 'net.minecraftforge:artifactural:1.0.+'
commonImplementation 'org.ow2.asm:asm-commons:6.2.1' //TODO: Remove and make standalone external tools?
commonImplementation 'org.apache.maven:maven-artifact:3.6.0'
commonImplementation 'org.apache.httpcomponents:httpclient:4.3.3'
mcpImplementation sourceSets.common.output
patcherImplementation sourceSets.mcp.output
patcherImplementation sourceSets.common.output
userdevImplementation sourceSets.mcp.output
userdevImplementation sourceSets.common.output
}
//Gradle doesn't add it's own source when doing the API. So lets hack it in!
import org.gradle.plugins.ide.eclipse.model.*
import org.gradle.plugins.ide.eclipse.model.internal.*
project.extensions.eclipse.classpath.file.whenMerged { Classpath cp ->
def gradleSrc = gradle.gradleHomeDir.absolutePath.replace(File.separator, '/') + '/src/'
cp.entries.each { entry ->
if ((entry in AbstractLibrary) && entry.library.file.name.startsWith('gradle-')) {
def type = (entry.library.file.name =~ "^gradle(-(.*))?-(${gradle.gradleVersion})")[0][2]
if (type == 'api') type = 'core-api' //Gradle name is different for cores
if (type == '') type = 'core'
entry.sourcePath = new FileReferenceFactory().fromPath(gradleSrc + type)
}
}
}
publishing {
publications {
mavenJava(MavenPublication) {
from components.java
}
}
repositories {
maven {
if (project.hasProperty('forgeMavenPassword')) {
credentials {
username project.properties.forgeMavenUser
password project.properties.forgeMavenPassword
}
url 'https://files.minecraftforge.net/maven/manage/upload'
} else {
url 'file://' + rootProject.file('repo').getAbsolutePath()
}
}
}
}