-
Notifications
You must be signed in to change notification settings - Fork 0
/
build.gradle
106 lines (94 loc) · 3.08 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
plugins {
id 'java'
id 'idea'
id 'eclipse'
id 'java-library'
id 'maven-publish'
id "fabric-loom" version "0.8.9"
}
group = 'io.github.astrarre'
loom {
shareCaches = true
//runDir = "run"
}
apply from: 'scripts/allprojects.gradle'
static def fapi(Project proj, String... modules) {
fapi(true, proj, modules)
}
static def fapi(boolean addToMaven, Project proj, String... modules) {
proj.extensions.add("fapi_deps", modules)
proj.configure(proj) {
dependencies {
if(modules.length == 0) {
modImplementation("net.fabricmc.fabric-api:fabric-api:${fabric_version}") {
exclude module: 'fabric-loader'
}
} else {
modules.each {
include(modImplementation(fabricApi.module(it, fabric_version)) {
exclude module: 'fabric-loader'
})
}
}
}
if(addToMaven) {
modules.each {
def str = it
publishing {
publications {
mavenJava2(MavenPublication) {
pom.withXml {
def depsNode = getOrCreateNode(asNode(), "dependencies")
proj.each {
def depNode = depsNode.appendNode("dependency")
depNode.appendNode("groupId", "net.fabricmc.fabric-api")
depNode.appendNode("artifactId", str)
depNode.appendNode("version", fabricApi.moduleVersion(str, fabric_version))
depNode.appendNode("scope", "compile")
}
}
}
}
}
}
}
}
}
dependencies {
modImplementation("me.shedaniel:RoughlyEnoughItems:5.11.188") {
exclude module: 'fabric-api'
exclude module: 'fabric-loader'
}
}
fapi(project)
static def nanoevents(Project proj) {
proj.configure(proj) {
def nano_events_ver = "3.0.6"
def nano_events_ap = "1.0.4"
modImplementation("net.devtech:NanoEvents:$nano_events_ver") {
transitive = false
}
testmodImplementationOnly "net.devtech:nanoevents-ap:$nano_events_ap"
compileOnly "net.devtech:nanoevents-ap:$nano_events_ap"
annotationProcessor "net.devtech:nanoevents-ap:$nano_events_ap"
testmodAnnotationProcessor "net.devtech:nanoevents-ap:$nano_events_ap"
processResources {
from(sourceSets.main.output.classesDirs.singleFile) {
include "nanoevents/**"
}
}
}
}
static Node getOrCreateNode(Node node, String name) {
Node dependencies = null
for(Node n : node) {
if(name == n.name()) {
dependencies = n
break
}
}
if(dependencies == null) {
dependencies = node.appendNode(name)
}
return dependencies
}