blob: 5f859c184ca547995f9dedf6091522f0d92b8b37 (
plain)
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
|
plugins {
id("com.github.johnrengelman.shadow") version "7.1.2"
}
repositories {
maven { url = uri("https://maven.quiltmc.org/repository/release/") }
mavenCentral()
}
architectury {
platformSetupLoomIde()
loader("quilt")
}
loom {
accessWidenerPath.set(project(":common").loom.accessWidenerPath)
}
/**
* @see: https://docs.gradle.org/current/userguide/migrating_from_groovy_to_kotlin_dsl.html
* */
val common: Configuration by configurations.creating
val shadowCommon: Configuration by configurations.creating // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
val developmentQuilt: Configuration = configurations.getByName("developmentQuilt")
configurations {
compileClasspath.get().extendsFrom(configurations["common"])
runtimeClasspath.get().extendsFrom(configurations["common"])
developmentQuilt.extendsFrom(configurations["common"])
}
dependencies {
modImplementation("org.quiltmc:quilt-loader:${rootProject.property("quilt_loader_version")}")
modApi("org.quiltmc.quilted-fabric-api:quilted-fabric-api:${rootProject.property("quilt_fabric_api_version")}")
// Remove the next few lines if you don't want to depend on the API
modApi("dev.architectury:architectury-fabric:${rootProject.property("architectury_version")}") {
// We must not pull Fabric Loader from Architectury Fabric
exclude(group = "net.fabricmc")
exclude(group = "net.fabricmc.fabric-api")
}
common(project(":common", configuration = "namedElements")) { isTransitive = false }
shadowCommon(project(":common", configuration = "transformProductionQuilt")) { isTransitive = false }
common(kotlin("stdlib-jdk8"))
}
val javaComponent = components.getByName("java", AdhocComponentWithVariants::class)
javaComponent.withVariantsFromConfiguration(configurations["sourcesElements"]) {
skip()
}
tasks {
processResources {
inputs.property("group", rootProject.property("maven_group"))
inputs.property("version", project.version)
filesMatching("quilt.mod.json") {
expand(
"group" to rootProject.property("maven_group"),
"version" to project.version
)
}
}
shadowJar {
exclude("architectury.common.json")
/**
* magic!
* groovy -> kotlin dsl
* [project.configurations.shadowCommon] -> listOf(project.configurations["shadowCommon"])
* */
configurations = listOf(project.configurations["shadowCommon"])
archiveClassifier.set("dev-shadow")
}
remapJar {
injectAccessWidener.set(true)
/**
* magic!
* groovy -> kotlin dsl
* shadowJar.archiveFile -> shadowJar.flatMap { it.archiveFile }
* */
inputFile.set(shadowJar.flatMap { it.archiveFile })
dependsOn(shadowJar)
/**
* affect suffix of build jar name
* if { archiveClassifier.set("quilt") }
* name will be examplemod-1.0.0-quilt.jar
*/
archiveClassifier.set("quilt")
}
jar {
archiveClassifier.set("dev")
}
sourcesJar {
val commonSources = project(":common").tasks.getByName("sourcesJar", Jar::class)
dependsOn(commonSources)
from(commonSources.archiveFile.map { zipTree(it) })
}
publishing {
publications {
create<MavenPublication>("mavenQuilt") {
artifactId = "${rootProject.property("archives_base_name")}-${project.name}"
from(javaComponent)
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}
}
|