-
-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathbuild.gradle
More file actions
130 lines (105 loc) · 3.58 KB
/
build.gradle
File metadata and controls
130 lines (105 loc) · 3.58 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
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar
plugins {
id 'java-gradle-plugin'
id 'groovy'
id 'idea'
id 'eclipse'
id 'maven-publish'
alias libs.plugins.versions
alias libs.plugins.licenser
alias libs.plugins.gradleutils
alias libs.plugins.gitversion
alias libs.plugins.changelog
alias libs.plugins.plugin.publish
alias libs.plugins.shadow
}
gradleutils.displayName = 'Forge Gradle Utilities'
description = "Small collection of utilities for standardizing Forge's buildscripts."
group = 'net.minecraftforge'
version = gitversion.tagOffset
println "Version: $version"
java {
toolchain.languageVersion = JavaLanguageVersion.of(17)
withSourcesJar()
withJavadocJar()
}
gradleutils.pluginDevDefaults(configurations, libs.versions.gradle)
// NOTE: If you are making a new Gradle plugin, do not copy this block!
configurations.configureEach {
resolutionStrategy.dependencySubstitution {
// NOTE: We build this in this repo, but enforce the module using a dependency substitution
// That way, new plugins can effectively copy this buildscript just without this section
// The "shadowed" attribute is declared here since project dependencies do not read the published module file
substitute module('net.minecraftforge:gradleutils-shared') using variant(project(':gradleutils-shared')) {
attributes {
attribute(Bundling.BUNDLING_ATTRIBUTE, named(Bundling, Bundling.SHADOWED))
}
} because 'Project dependencies do not read the published module file, so the shadowed attribute is manually declared.'
}
}
dependencies {
// Static Analysis
compileOnly libs.nulls
// Gradle API
compileOnly libs.gradle
// GradleUtils Shared Base
implementation libs.gradleutils.shared
// JavaDoc Links Plugin
compileOnly libs.gradle.javadoc.links
// Versions Plugin
compileOnly libs.gradle.versions
// GitHub Actions Workflows
implementation libs.yaml
}
license {
header = rootProject.file('LICENSE-header.txt')
newLine = false
exclude '**/*.properties'
}
tasks.named('jar', Jar) {
archiveClassifier = 'thin'
}
tasks.named('shadowJar', ShadowJar) {
enableAutoRelocation = true
archiveClassifier = null
relocationPrefix = 'net.minecraftforge.gradleutils.shadow'
}
tasks.withType(Javadoc).configureEach {
javadocTool = javaToolchains.javadocToolFor { languageVersion = JavaLanguageVersion.of(24) }
}
changelog {
from '3.0'
}
gradlePlugin {
website = gitversion.url
vcsUrl = gitversion.url + '.git'
plugins.register('gradleutils') {
id = 'net.minecraftforge.gradleutils'
implementationClass = 'net.minecraftforge.gradleutils.internal.GradleUtilsPlugin'
displayName = gradleutils.displayName
description = project.description
tags = ['minecraftforge']
}
}
publishing {
repositories {
maven gradleutils.publishingForgeMaven
}
publications.register('pluginMaven', MavenPublication) {
changelog.publish(it)
gradleutils.promote(it)
pom { pom ->
name = gradleutils.displayName
description = project.description
gradleutils.pom.addRemoteDetails(pom)
licenses {
license gradleutils.pom.licenses.LGPLv2_1
}
developers {
developer gradleutils.pom.developers.Jonathing
developer gradleutils.pom.developers.Paint_Ninja
developer gradleutils.pom.developers.LexManos
}
}
}
}