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
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
|
/*
* This file is part of fabric-loom, licensed under the MIT License (MIT).
*
* Copyright (c) 2021 FabricMC
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package net.fabricmc.loom.api;
import java.io.File;
import java.util.List;
import java.util.function.Consumer;
import org.gradle.api.Action;
import org.gradle.api.NamedDomainObjectContainer;
import org.gradle.api.artifacts.Dependency;
import org.gradle.api.file.ConfigurableFileCollection;
import org.gradle.api.file.RegularFileProperty;
import org.gradle.api.provider.ListProperty;
import org.gradle.api.provider.Property;
import org.gradle.api.provider.Provider;
import org.gradle.api.publish.maven.MavenPublication;
import org.jetbrains.annotations.ApiStatus;
import net.fabricmc.loom.api.decompilers.LoomDecompiler;
import net.fabricmc.loom.api.mappings.layered.spec.LayeredMappingSpecBuilder;
import net.fabricmc.loom.configuration.ide.RunConfig;
import net.fabricmc.loom.configuration.ide.RunConfigSettings;
import net.fabricmc.loom.configuration.launch.LaunchProviderSettings;
import net.fabricmc.loom.configuration.processors.JarProcessor;
import net.fabricmc.loom.util.DeprecationHelper;
import net.fabricmc.loom.util.ModPlatform;
/**
* This is the public api available exposed to build scripts.
*/
public interface LoomGradleExtensionAPI {
@ApiStatus.Internal
DeprecationHelper getDeprecationHelper();
RegularFileProperty getAccessWidenerPath();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default File getAccessWidener() {
getDeprecationHelper().replaceWithInLoom0_11("accessWidener", "accessWidenerPath");
return getAccessWidenerPath().getAsFile().getOrNull();
}
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default void setAccessWidener(File file) {
getDeprecationHelper().replaceWithInLoom0_11("accessWidener", "accessWidenerPath");
getAccessWidenerPath().set(file);
}
Property<Boolean> getShareRemapCaches();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default void setShareCaches(boolean shareCaches) {
getDeprecationHelper().replaceWithInLoom0_11("shareCaches", "shareRemapCaches");
getShareRemapCaches().set(shareCaches);
}
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default boolean isShareCaches() {
getDeprecationHelper().replaceWithInLoom0_11("shareCaches", "shareRemapCaches");
return getShareRemapCaches().get();
}
default void shareCaches() {
getShareRemapCaches().set(true);
}
ListProperty<LoomDecompiler> getGameDecompilers();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default List<LoomDecompiler> getDecompilers() {
getDeprecationHelper().replaceWithInLoom0_11("decompilers", "gameDecompilers");
return getGameDecompilers().get();
}
default void addDecompiler(LoomDecompiler decompiler) {
getGameDecompilers().add(decompiler);
}
ListProperty<JarProcessor> getGameJarProcessors();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default List<JarProcessor> getJarProcessors() {
getDeprecationHelper().replaceWithInLoom0_11("jarProcessors", "gameJarProcessors");
return getGameJarProcessors().get();
}
default void addJarProcessor(JarProcessor processor) {
getGameJarProcessors().add(processor);
}
ConfigurableFileCollection getLog4jConfigs();
default Dependency officialMojangMappings() {
return layered(LayeredMappingSpecBuilder::officialMojangMappings);
}
Dependency layered(Action<LayeredMappingSpecBuilder> action);
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default String getRefmapName() {
getDeprecationHelper().replaceWithInLoom0_11("refmapName", "mixin.defaultRefmapName");
return getMixin().getDefaultRefmapName().get();
}
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default void setRefmapName(String refmapName) {
getDeprecationHelper().replaceWithInLoom0_11("refmapName", "mixin.defaultRefmapName");
getMixin().getDefaultRefmapName().set(refmapName);
}
Property<Boolean> getRemapArchives();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default boolean isRemapMod() {
getDeprecationHelper().replaceWithInLoom0_11("remapMod", "remapArchives");
return getRemapArchives().get();
}
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default void setRemapMod(boolean remapMod) {
getDeprecationHelper().replaceWithInLoom0_11("remapMod", "remapArchives");
getRemapArchives().set(remapMod);
}
void runs(Action<NamedDomainObjectContainer<RunConfigSettings>> action);
NamedDomainObjectContainer<RunConfigSettings> getRunConfigs();
void mixin(Action<MixinExtensionAPI> action);
@ApiStatus.Experimental
// TODO: move this from LoomGradleExtensionAPI to LoomGradleExtension once getRefmapName & setRefmapName is removed.
MixinExtensionAPI getMixin();
Property<String> getCustomMinecraftManifest();
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default void setCustomManifest(String customManifest) {
getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest");
getCustomMinecraftManifest().set(customManifest);
}
@Deprecated(forRemoval = true)
@ApiStatus.ScheduledForRemoval(inVersion = "0.11")
default String getCustomManifest() {
getDeprecationHelper().replaceWithInLoom0_11("customManifest", "customMinecraftManifest");
return getCustomMinecraftManifest().getOrNull();
}
/**
* If true, Loom will replace the {@code -dev} jars in the {@code *Elements} configurations
* with remapped outgoing variants.
*
* <p>Will only apply if {@link #getRemapArchives()} is also true.
*
* @return the property controlling the setup of remapped variants
*/
Property<Boolean> getSetupRemappedVariants();
/**
* Disables the deprecated POM generation for a publication.
* This is useful if you want to suppress deprecation warnings when you're not using software components.
*
* <p>Experimental API: Will be removed in Loom 0.12 together with the deprecated POM generation functionality.
*
* @param publication the maven publication
*/
@ApiStatus.Experimental
void disableDeprecatedPomGeneration(MavenPublication publication);
/**
* Reads the mod version from the fabric.mod.json file located in the main sourcesets resources.
* This is useful if you want to set the gradle version based of the version in the fabric.mod.json file.
*
* @return the version defined in the fabric.mod.json
*/
String getModVersion();
/**
* When true loom will apply transitive access wideners from compile dependencies.
*
* @return the property controlling the transitive access wideners
*/
Property<Boolean> getEnableTransitiveAccessWideners();
// ===================
// Architectury Loom
// ===================
void silentMojangMappingsLicense();
boolean isSilentMojangMappingsLicenseEnabled();
Provider<ModPlatform> getPlatform();
default boolean isForge() {
return getPlatform().get() == ModPlatform.FORGE;
}
void setGenerateSrgTiny(Boolean generateSrgTiny);
boolean shouldGenerateSrgTiny();
void launches(Action<NamedDomainObjectContainer<LaunchProviderSettings>> action);
NamedDomainObjectContainer<LaunchProviderSettings> getLaunchConfigs();
default void addTaskBeforeRun(String task) {
this.getTasksBeforeRun().add(task);
}
List<String> getTasksBeforeRun();
List<Consumer<RunConfig>> getSettingsPostEdit();
/**
* Gets the Forge extension used to configure Forge details.
*
* @return the Forge extension
* @throws UnsupportedOperationException if running on another platform
* @see #isForge()
*/
ForgeExtensionAPI getForge();
void forge(Action<ForgeExtensionAPI> action);
}
|