-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbuild.gradle.kts
99 lines (83 loc) · 2.59 KB
/
build.gradle.kts
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
@file:Suppress("UnstableApiUsage", "LocalVariableName")
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
import java.time.LocalDateTime.now
import java.time.format.DateTimeFormatter.ofPattern
plugins {
// plugins for the subprojects, no need to apply here
id( "org.jetbrains.kotlin.jvm" ) version "1.8.0" apply false
// root project plugins
id( "com.github.johnrengelman.shadow") version "7.1.2"
java
idea
}
val shade = configurations.create( "shade" )
allprojects {
apply( plugin = "xyz.wagyourtail.unimined" )
repositories {
mavenLocal()
mavenCentral()
maven( url = "https://libraries.minecraft.net" )
maven( url = "https://repsy.io/mvn/enderzombi102/mc" ) {
content { includeGroup( "com.enderzombi102" ) }
}
maven( url = "https://repo.sleeping.town" ) {
content { includeGroup( "com.unascribed" ) }
}
}
}
subprojects {
apply( plugin = "org.jetbrains.kotlin.jvm" )
group = "com.enderzombi102.loadercomplex"
configurations.create( "jarz" )
logger.lifecycle( "Found subproject: `$path`" )
tasks.withType<JavaCompile> {
sourceCompatibility = "8"
targetCompatibility = "8"
options.encoding = "UTF-8"
}
tasks.withType<KotlinCompile> {
compilerOptions.jvmTarget.set( JvmTarget.JVM_1_8 )
}
}
dependencies {
// depend on all "type subprojects"
rootProject.subprojects.stream()
.filter { it.parent == rootProject }
.map( Project::getName )
.forEach {
shade( project( path=it, configuration="jarz" ) ) {
isTransitive = false
}
}
shade( libs.bundles.shade )
}
val genIntellijRuns: Task by tasks.creating {
group = "unimined_runs"
description = "Generate IntelliJ run configurations for all subprojects and versions."
rootProject.subprojects.forEach {
try {
dependsOn( it.tasks.getByName( "genIntellijRun" ).path )
} catch ( _: UnknownTaskException ) { }
}
}
tasks.withType<com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar> {
configurations = listOf( shade )
archiveClassifier.set( "" )
from( "LICENSE" ) {
rename { "${it}_$archiveBaseName" }
}
val api = project( ":loadercomplex-api" )
manifest.attributes(
"Specification-Title" to "LoaderComplex",
"Specification-Vendor" to "Aurora Inhabitants",
"Specification-Version" to api.version, // bundled api version
"Implementation-Title" to project.name,
"Implementation-Version" to archiveVersion, // mod version
"Implementation-Vendor" to "Aurora Inhabitants",
"Implementation-Timestamp" to now().format( ofPattern( "dd-MM-yyyy'T'HH:mm:ss" ) ), // build date
)
}
artifacts {
archives( tasks["shadowJar"] )
}