forked from MinecraftForge/ForgeGradle
-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
146 lines (130 loc) · 4.61 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
plugins {
id 'java-gradle-plugin'
id 'eclipse'
id 'maven-publish'
id 'org.cadixdev.licenser' version '0.6.1'
id 'net.minecraftforge.gradleutils' version '[2.0.10,)'
id 'com.github.ben-manes.versions' version '0.39.0'
}
version = gradleutils.getTagOffsetBranchVersion('FG_5.0')
logger.lifecycle('Version: ' + version + ' Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch'))
changelog {
fromTag '3.0'
disableAutomaticPublicationRegistration()
}
sourceSets {
common
mcp
patcher
userdev
}
java {
toolchain.languageVersion = JavaLanguageVersion.of(8)
withSourcesJar()
}
configurations {
all {
exclude group: 'org.ow2.asm'
}
mcpImplementation.extendsFrom commonImplementation
patcherImplementation.extendsFrom commonImplementation
userdevImplementation.extendsFrom mcpImplementation
implementation.extendsFrom mcpImplementation, patcherImplementation, userdevImplementation
}
tasks.named('jar', Jar).configure {
from sourceSets.common.output
from sourceSets.mcp.output
from sourceSets.patcher.output
from sourceSets.userdev.output
}
tasks.named('sourcesJar', Jar).configure {
from sourceSets.common.allJava
from sourceSets.mcp.allJava
from sourceSets.patcher.allJava
from sourceSets.userdev.allJava
}
repositories {
mavenLocal()
maven { url = 'https://maven.minecraftforge.net/' }
}
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'
}
tasks.named('wrapper', Wrapper).configure {
gradleVersion = '7.4.2'
distributionType = Wrapper.DistributionType.ALL
}
dependencies {
commonImplementation gradleApi()
commonImplementation 'commons-io:commons-io:2.8.0'
commonImplementation 'com.google.code.gson:gson:2.8.6'
commonImplementation 'com.google.guava:guava:30.1-jre'
commonImplementation 'de.siegmar:fastcsv:2.0.0'
commonImplementation('net.minecraftforge:artifactural:3.0.8') {
transitive = false
}
commonImplementation('net.minecraftforge:unsafe:0.2.0') {
transitive = false
}
commonImplementation 'org.apache.maven:maven-artifact:3.6.3'
commonImplementation 'org.apache.httpcomponents:httpclient:4.5.13'
commonImplementation 'net.minecraftforge:srgutils:0.4.13'
commonImplementation 'net.minecraftforge:DiffPatch:2.0.7:all'
mcpImplementation sourceSets.common.output
patcherImplementation sourceSets.mcp.output
patcherImplementation sourceSets.common.output
userdevImplementation sourceSets.mcp.output
userdevImplementation sourceSets.common.output
userdevImplementation 'net.minecraftforge:JarJarMetadata:0.3.17'
userdevImplementation 'net.minecraftforge:JarJarSelector:0.3.17'
}
//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)
}
}
}
gradlePlugin {
plugins {
mcp {
id = 'net.minecraftforge.gradle.mcp'
implementationClass = 'net.minecraftforge.gradle.mcp.MCPPlugin'
}
patcher {
id = 'net.minecraftforge.gradle.patcher'
implementationClass = 'net.minecraftforge.gradle.patcher.PatcherPlugin'
}
userdev {
id = 'net.minecraftforge.gradle'
implementationClass = 'net.minecraftforge.gradle.userdev.UserDevPlugin'
}
}
automatedPublishing = true
}
publishing {
publications {
pluginMaven(MavenPublication) {
// Automated publishing declares the java component for us
project.changelog.publish(it)
}
}
repositories {
maven gradleutils.getPublishingForgeMaven()
}
}