|
1 | 1 | plugins { |
2 | 2 | id 'java-gradle-plugin' |
| 3 | + id 'idea' |
3 | 4 | id 'eclipse' |
4 | 5 | id 'maven-publish' |
5 | | - id 'net.minecraftforge.licenser' version '1.0.1' |
6 | | - id 'net.minecraftforge.gradleutils' version '[2.3,2.4)' |
7 | | - id 'com.github.ben-manes.versions' version '0.46.0' |
| 6 | + alias libs.plugins.gradleutils |
| 7 | + alias libs.plugins.gitversion |
| 8 | + alias libs.plugins.changelog |
| 9 | + alias libs.plugins.licenser |
8 | 10 | } |
9 | 11 |
|
10 | | -version = gradleutils.getTagOffsetBranchVersion('FG_6.0') |
11 | | -logger.lifecycle('Version: ' + version + ' Java: ' + System.getProperty('java.version') + ' JVM: ' + System.getProperty('java.vm.version') + '(' + System.getProperty('java.vendor') + ') Arch: ' + System.getProperty('os.arch')) |
| 12 | +gradleutils.displayName = 'ForgeGradle' |
| 13 | +description = "Forge's Gradle plugin for Mod development" |
| 14 | +group = 'net.minecraftforge.gradle' |
| 15 | +version = gitversion.tagOffset |
12 | 16 |
|
13 | | -changelog { |
14 | | - from '6.0' |
15 | | - publishAll = false |
16 | | -} |
17 | | -sourceSets { |
18 | | - common |
19 | | - mcp |
20 | | - patcher |
21 | | - userdev |
22 | | -} |
| 17 | +println "Version: $version" |
23 | 18 |
|
24 | 19 | java { |
25 | 20 | toolchain.languageVersion = JavaLanguageVersion.of(8) |
26 | 21 | withSourcesJar() |
27 | 22 | } |
28 | 23 |
|
29 | | -configurations { |
30 | | - configureEach { |
31 | | - exclude group: 'org.ow2.asm' |
| 24 | +sourceSets { |
| 25 | + register('common') |
| 26 | + |
| 27 | + register('mcp') { |
| 28 | + configurations.named(implementationConfigurationName) { |
| 29 | + extendsFrom configurations.getByName(common.implementationConfigurationName) |
| 30 | + } |
| 31 | + |
| 32 | + configurations.named(compileOnlyConfigurationName) { |
| 33 | + extendsFrom configurations.getByName(common.compileOnlyConfigurationName) |
| 34 | + } |
32 | 35 | } |
33 | | - mcpImplementation.extendsFrom commonImplementation |
34 | | - patcherImplementation.extendsFrom commonImplementation |
35 | | - userdevImplementation.extendsFrom mcpImplementation |
36 | | - implementation.extendsFrom mcpImplementation, patcherImplementation, userdevImplementation |
37 | | -} |
38 | 36 |
|
39 | | -tasks.named('jar', Jar).configure { |
40 | | - from sourceSets.common.output |
41 | | - from sourceSets.mcp.output |
42 | | - from sourceSets.patcher.output |
43 | | - from sourceSets.userdev.output |
44 | | -} |
| 37 | + register('patcher') { |
| 38 | + configurations.named(implementationConfigurationName) { |
| 39 | + extendsFrom configurations.getByName(common.implementationConfigurationName) |
| 40 | + } |
45 | 41 |
|
46 | | -tasks.named('sourcesJar', Jar).configure { |
47 | | - from sourceSets.common.allJava |
48 | | - from sourceSets.mcp.allJava |
49 | | - from sourceSets.patcher.allJava |
50 | | - from sourceSets.userdev.allJava |
51 | | -} |
| 42 | + configurations.named(compileOnlyConfigurationName) { |
| 43 | + extendsFrom configurations.getByName(common.compileOnlyConfigurationName) |
| 44 | + } |
| 45 | + } |
52 | 46 |
|
53 | | -repositories { |
54 | | - mavenLocal() |
55 | | - maven gradleutils.forgeMaven |
56 | | -} |
| 47 | + register('userdev') { |
| 48 | + configurations.named(implementationConfigurationName) { |
| 49 | + extendsFrom configurations.getByName(mcp.implementationConfigurationName) |
| 50 | + } |
57 | 51 |
|
58 | | -license { |
59 | | - header = file('HEADER') |
60 | | - exclude '**/*.properties' |
61 | | - exclude 'net/minecraftforge/gradle/common/diff/' |
62 | | - exclude 'net/minecraftforge/gradle/common/util/JavaVersionParser.java' |
63 | | -} |
| 52 | + configurations.named(compileOnlyConfigurationName) { |
| 53 | + extendsFrom configurations.getByName(mcp.compileOnlyConfigurationName) |
| 54 | + } |
| 55 | + } |
| 56 | + |
| 57 | + named('main') { |
| 58 | + configurations.named(implementationConfigurationName) { |
| 59 | + extendsFrom( |
| 60 | + configurations.getByName(mcp.implementationConfigurationName), |
| 61 | + configurations.getByName(patcher.implementationConfigurationName), |
| 62 | + configurations.getByName(userdev.implementationConfigurationName), |
| 63 | + ) |
| 64 | + } |
64 | 65 |
|
65 | | -tasks.named('wrapper', Wrapper).configure { |
66 | | - gradleVersion = '8.4' |
67 | | - distributionType = Wrapper.DistributionType.ALL |
| 66 | + configurations.named(compileOnlyConfigurationName) { |
| 67 | + extendsFrom( |
| 68 | + configurations.getByName(mcp.compileOnlyConfigurationName), |
| 69 | + configurations.getByName(patcher.compileOnlyConfigurationName), |
| 70 | + configurations.getByName(userdev.compileOnlyConfigurationName), |
| 71 | + ) |
| 72 | + } |
| 73 | + } |
68 | 74 | } |
69 | 75 |
|
70 | 76 | dependencies { |
71 | | - commonImplementation gradleApi() |
72 | | - commonImplementation 'commons-io:commons-io:2.11.0' |
73 | | - commonImplementation 'com.google.code.gson:gson:2.10.1' |
74 | | - commonImplementation 'com.google.guava:guava:31.1-jre' |
75 | | - commonImplementation 'de.siegmar:fastcsv:2.2.1' |
76 | | - commonImplementation('net.minecraftforge:artifactural:3.0.20') { |
| 77 | + commonCompileOnly libs.nulls |
| 78 | + |
| 79 | + commonCompileOnly libs.gradle |
| 80 | + |
| 81 | + commonImplementation libs.commons.io |
| 82 | + commonImplementation libs.gson |
| 83 | + commonImplementation libs.guava |
| 84 | + commonImplementation libs.fastcsv |
| 85 | + commonImplementation(libs.artifactural) { |
77 | 86 | transitive = false |
78 | 87 | } |
79 | | - commonImplementation('net.minecraftforge:unsafe:0.2.0') { |
| 88 | + commonImplementation(libs.unsafe) { |
80 | 89 | transitive = false |
81 | 90 | } |
82 | | - commonImplementation 'org.apache.maven:maven-artifact:3.9.1' |
83 | | - commonImplementation 'org.apache.httpcomponents:httpclient:4.5.14' |
84 | | - commonImplementation 'net.minecraftforge:srgutils:0.5.10' |
85 | | - commonImplementation 'net.minecraftforge:DiffPatch:2.0.12:all' |
| 91 | + commonImplementation libs.maven.artifact |
| 92 | + commonImplementation libs.httpclient |
| 93 | + commonImplementation libs.srgutils |
| 94 | + commonImplementation variantOf(libs.diffpatch) { classifier 'all' } |
86 | 95 |
|
87 | 96 | mcpImplementation sourceSets.common.output |
88 | 97 | patcherImplementation sourceSets.mcp.output |
89 | 98 | patcherImplementation sourceSets.common.output |
90 | 99 | userdevImplementation sourceSets.mcp.output |
91 | 100 | userdevImplementation sourceSets.common.output |
92 | 101 |
|
93 | | - userdevImplementation 'net.minecraftforge:JarJarMetadata:0.3.19' |
94 | | - userdevImplementation 'net.minecraftforge:JarJarSelector:0.3.19' |
| 102 | + userdevImplementation libs.jarjar.metadata |
| 103 | + userdevImplementation libs.jarjar.selector |
| 104 | +} |
| 105 | + |
| 106 | +license { |
| 107 | + header = rootProject.file('HEADER') |
| 108 | + exclude '**/*.properties' |
| 109 | + exclude 'net/minecraftforge/gradle/common/diff/' |
| 110 | + exclude 'net/minecraftforge/gradle/common/util/JavaVersionParser.java' |
| 111 | +} |
| 112 | + |
| 113 | +tasks.named('jar', Jar) { |
| 114 | + from sourceSets.common.output |
| 115 | + from sourceSets.mcp.output |
| 116 | + from sourceSets.patcher.output |
| 117 | + from sourceSets.userdev.output |
| 118 | +} |
| 119 | + |
| 120 | +tasks.named('sourcesJar', Jar) { |
| 121 | + from sourceSets.common.allJava |
| 122 | + from sourceSets.mcp.allJava |
| 123 | + from sourceSets.patcher.allJava |
| 124 | + from sourceSets.userdev.allJava |
| 125 | +} |
| 126 | + |
| 127 | +changelog { |
| 128 | + from '6.0' |
95 | 129 | } |
96 | 130 |
|
97 | 131 | gradlePlugin { |
| 132 | + website = gitversion.url |
| 133 | + vcsUrl = gitversion.url + '.git' |
| 134 | + |
98 | 135 | plugins { |
99 | | - mcp { |
| 136 | + register('mcp') { |
100 | 137 | id = 'net.minecraftforge.gradle.mcp' |
101 | 138 | implementationClass = 'net.minecraftforge.gradle.mcp.MCPPlugin' |
102 | 139 | } |
103 | | - patcher { |
| 140 | + |
| 141 | + register('patcher') { |
104 | 142 | id = 'net.minecraftforge.gradle.patcher' |
105 | 143 | implementationClass = 'net.minecraftforge.gradle.patcher.PatcherPlugin' |
106 | 144 | } |
107 | | - userdev { |
| 145 | + |
| 146 | + register('userdev') { |
108 | 147 | id = 'net.minecraftforge.gradle' |
109 | 148 | implementationClass = 'net.minecraftforge.gradle.userdev.UserDevPlugin' |
| 149 | + displayName = gradleutils.displayName.get() |
| 150 | + description = project.description |
| 151 | + tags = ['minecraftforge', 'minecraft'] |
110 | 152 | } |
111 | 153 | } |
112 | | - automatedPublishing = true |
113 | 154 | } |
114 | 155 |
|
115 | 156 | publishing { |
116 | | - publications { |
117 | | - pluginMaven(MavenPublication) { |
118 | | - // Automated publishing declares the java component for us |
| 157 | + repositories { |
| 158 | + maven gradleutils.publishingForgeMaven |
| 159 | + } |
119 | 160 |
|
120 | | - project.changelog.publish(it) |
| 161 | + publications.register('pluginMaven', MavenPublication) { |
| 162 | + changelog.publish(it) |
| 163 | + gradleutils.promote(it) |
| 164 | + |
| 165 | + pom { pom -> |
| 166 | + name = gradleutils.displayName |
| 167 | + description = project.description |
| 168 | + |
| 169 | + gradleutils.pom.addRemoteDetails(pom) |
121 | 170 | } |
122 | 171 | } |
123 | | - repositories { |
124 | | - maven gradleutils.getPublishingForgeMaven() |
125 | | - } |
126 | 172 | } |
0 commit comments