-
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathbuild.gradle
More file actions
136 lines (111 loc) · 3.7 KB
/
build.gradle
File metadata and controls
136 lines (111 loc) · 3.7 KB
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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
import com.github.jengelman.gradle.plugins.shadow.transformers.PropertiesFileTransformer
plugins {
id 'java-library'
id 'idea'
id 'eclipse'
id 'maven-publish'
alias libs.plugins.licenser
alias libs.plugins.gradleutils
alias libs.plugins.shadow
}
final projectDisplayName = 'Java Provisioner'
final projectVendor = 'Forge Development LLC'
description = 'A tool that locates, and if nessasary, downloads a Java distribution using Disco'
group = 'net.minecraftforge'
version = gitversion.tagOffset
println "Version: $version"
java {
// Currently JOpt is the limiting, requiring java 8
// But also toolchains don't support building for anything lower then 8
toolchain.languageVersion = JavaLanguageVersion.of(8)
withSourcesJar()
}
tasks.register('createJavaProbeClass', buildsrc.ClassGeneratorTask)
tasks.register('javaProbeJar', Jar) {
destinationDirectory = layout.buildDirectory.dir('libs')
archiveBaseName = project.name
archiveClassifier = 'probe'
manifest {
attributes([
'Main-Class' : 'JavaProbe',
'Specification-Title' : 'Java Probe',
'Specification-Vendor' : projectVendor,
'Specification-Version' : gitversion.info.tag,
'Implementation-Title' : 'javaprobe',
'Implementation-Vendor' : projectVendor,
'Implementation-Version': project.version
])
}
from createJavaProbeClass.outputs.files
}
dependencies {
compileOnly libs.nulls
implementation libs.jopt
implementation libs.gson
implementation libs.jtar
implementation libs.bundles.utils
implementation javaProbeJar.outputs.files
}
license {
header rootProject.file('LICENSE-header.txt')
newLine false
}
tasks.named('jar', Jar) {
manifest {
attributes([
'Main-Class' : 'net.minecraftforge.java_provisioner.Main',
'Automatic-Module-Name': 'net.minecraftforge.java_provisioner',
'Sealed' : true
])
attributes([
'Specification-Title' : projectDisplayName,
'Specification-Vendor' : projectVendor,
'Specification-Version' : gitversion.info.tag,
'Implementation-Title' : projectDisplayName,
'Implementation-Vendor' : projectVendor,
'Implementation-Version': project.version
], 'net/minecraftforge/java_provisioner/')
}
from createJavaProbeClass.outputs.files
}
tasks.named('shadowJar', ShadowJar) {
enableRelocation = true
relocationPrefix = 'net.minecraftforge.java_provisioner.shadow'
// Rewrite JOpt's message files, so that help text is displayed nicely.
transform(PropertiesFileTransformer) {
paths = [ 'Messages.properties$' ]
keyTransformer = { key -> relocationPrefix.get() + '.' + key }
}
}
tasks.withType(JavaCompile).configureEach {
options.encoding = 'UTF-8'
}
changelog {
from '1.0'
}
publishing {
publications.register('mavenJava', MavenPublication) {
from components.java
artifactId = project.name
artifact javaProbeJar
pom { pom ->
name = projectDisplayName
description = project.description
gradleutils.pom.setGitHubDetails pom
licenses {
license gradleutils.pom.licenses.LGPLv2_1
}
developers {
developer gradleutils.pom.developers.LexManos
}
}
}
repositories {
maven gradleutils.publishingForgeMaven
}
}
eclipse {
synchronizationTasks javaProbeJar
}
idea.module { downloadJavadoc = downloadSources = true }