-
Notifications
You must be signed in to change notification settings - Fork 2
/
build.gradle
111 lines (90 loc) · 2.55 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
plugins {
id "java-library"
id "maven-publish"
id "com.diffplug.spotless" version "6.25.0" apply false
id "de.undercouch.download" version "5.5.0" apply false
}
def ENV = System.getenv()
version = "0.2.1" + (ENV.GITHUB_ACTIONS ? "" : "+local")
allprojects {
apply plugin: 'com.diffplug.spotless'
}
repositories {
mavenCentral()
}
dependencies {
testImplementation "org.junit.jupiter:junit-jupiter:5.10.0"
testRuntimeOnly "org.junit.platform:junit-platform-launcher"
}
test {
useJUnitPlatform()
}
tasks.withType(JavaCompile).configureEach {
it.options.release = 17
}
java {
withSourcesJar()
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
spotless {
lineEndings = com.diffplug.spotless.LineEnding.UNIX
java {
licenseHeaderFile(rootProject.file("HEADER")).yearSeparator("-")
removeUnusedImports()
importOrder('java', 'javax', '', 'net.fabricmc')
indentWithTabs()
trimTrailingWhitespace()
}
}
def architectures = [
"X86",
"X86-64",
"Aarch64"
]
evaluationDependsOn(":windows")
def collectDlls = tasks.register("collectDlls", Sync) {
architectures.forEach { arch ->
from(project(":windows").tasks.named("linkRelease${arch}").get().linkedFile) {
into "fabric-loom-native/" + arch.toLowerCase()
}
}
rename { fileName ->
"fabric-loom-native.dll"
}
into layout.buildDirectory.dir("dlls")
}
sourceSets.main.resources.srcDir collectDlls
tasks.withType(GenerateModuleMetadata) {
enabled = false
}
publishing {
publications {
create("maven", MavenPublication) {
groupId "net.fabricmc"
artifactId "fabric-loom-native"
version project.version
from components.java
// Include the PDB files in case someone wants to debug
architectures.forEach { arch ->
def dll = project(":windows").tasks.named("linkRelease${arch}").get().linkedFile
def pdb = dll.getAsFile().map { file -> new File(file.absolutePath.replace(".dll", ".pdb")) }
artifact(pdb) {
classifier arch.toLowerCase()
extension "pdb"
}
}
}
}
repositories {
if (ENV.MAVEN_URL) {
maven {
url ENV.MAVEN_URL
credentials {
username ENV.MAVEN_USERNAME
password ENV.MAVEN_PASSWORD
}
}
}
}
}