@@ -102,12 +102,23 @@ public abstract class ShadowJar :
102
102
}
103
103
}
104
104
105
+ /* *
106
+ * [ResourceTransformer]s to be applied in the shadow steps.
107
+ */
105
108
@get:Nested
106
109
public open val transformers: SetProperty <ResourceTransformer > = objectFactory.setProperty()
107
110
111
+ /* *
112
+ * [Relocator]s to be applied in the shadow steps.
113
+ */
108
114
@get:Nested
109
115
public open val relocators: SetProperty <Relocator > = objectFactory.setProperty()
110
116
117
+ /* *
118
+ * The configurations to include dependencies from.
119
+ *
120
+ * Defaults to a set that contains `runtimeClasspath` or `runtime` configuration.
121
+ */
111
122
@get:Classpath
112
123
@get:Optional
113
124
public open val configurations: SetProperty <Configuration > = objectFactory.setProperty()
@@ -116,6 +127,9 @@ public abstract class ShadowJar :
116
127
public open val dependencyFilter: Property <DependencyFilter > =
117
128
objectFactory.property(DefaultDependencyFilter (project))
118
129
130
+ /* *
131
+ * Final dependencies to be shadowed.
132
+ */
119
133
@get:Classpath
120
134
public open val includedDependencies: ConfigurableFileCollection = objectFactory.fileCollection {
121
135
dependencyFilter.zip(configurations) { df, cs -> df.resolve(cs) }
@@ -132,7 +146,7 @@ public abstract class ShadowJar :
132
146
/* *
133
147
* Prefix to use for relocated packages.
134
148
*
135
- * Defaults to [ShadowBasePlugin.SHADOW] .
149
+ * Defaults to `shadow` .
136
150
*/
137
151
@get:Input
138
152
public open val relocationPrefix: Property <String > = objectFactory.property(ShadowBasePlugin .SHADOW )
@@ -146,33 +160,54 @@ public abstract class ShadowJar :
146
160
@Input // Trigger task executions after excludes changed.
147
161
override fun getExcludes (): MutableSet <String > = super .getExcludes()
148
162
163
+ /* *
164
+ * Enable [minimizeJar], this equals to `minimizeJar.set(true)`.
165
+ */
149
166
override fun minimize () {
150
167
minimizeJar.set(true )
151
168
}
152
169
170
+ /* *
171
+ * Enable [minimizeJar] and execute the [action] with the [DependencyFilter] for minimize.
172
+ */
153
173
override fun minimize (action : Action <DependencyFilter >? ) {
154
174
minimize()
155
175
action?.execute(dependencyFilterForMinimize)
156
176
}
157
177
178
+ /* *
179
+ * Extra dependency operations to be applied in the shadow steps.
180
+ */
158
181
override fun dependencies (action : Action <DependencyFilter >? ) {
159
182
action?.execute(dependencyFilter.get())
160
183
}
161
184
185
+ /* *
186
+ * Merge Java services files.
187
+ */
162
188
override fun mergeServiceFiles () {
163
189
transform(ServiceFileTransformer ::class .java, null )
164
190
}
165
191
192
+ /* *
193
+ * Merge Java services files with [rootPath].
194
+ */
166
195
override fun mergeServiceFiles (rootPath : String ) {
167
196
transform(ServiceFileTransformer ::class .java) {
168
197
it.path = rootPath
169
198
}
170
199
}
171
200
201
+ /* *
202
+ * Merge Java services files with [action].
203
+ */
172
204
override fun mergeServiceFiles (action : Action <ServiceFileTransformer >? ) {
173
205
transform(ServiceFileTransformer ::class .java, action)
174
206
}
175
207
208
+ /* *
209
+ * Merge Groovy extension modules (`META-INF/**/org.codehaus.groovy.runtime.ExtensionModule`).
210
+ */
176
211
override fun mergeGroovyExtensionModules () {
177
212
transform(GroovyExtensionModuleTransformer ::class .java, null )
178
213
}
@@ -193,6 +228,9 @@ public abstract class ShadowJar :
193
228
}
194
229
}
195
230
231
+ /* *
232
+ * Relocate classes matching [pattern] to [destination] using [SimpleRelocator].
233
+ */
196
234
override fun relocate (
197
235
pattern : String ,
198
236
destination : String ,
@@ -202,35 +240,67 @@ public abstract class ShadowJar :
202
240
addRelocator(relocator, action)
203
241
}
204
242
243
+ /* *
244
+ * Relocate classes using a [Relocator].
245
+ */
205
246
override fun <R : Relocator > relocate (clazz : Class <R >, action : Action <R >? ) {
206
247
val relocator = clazz.getDeclaredConstructor().newInstance()
207
248
addRelocator(relocator, action)
208
249
}
209
250
251
+ /* *
252
+ * Relocate classes using a [Relocator].
253
+ */
210
254
override fun <R : Relocator > relocate (relocator : R , action : Action <R >? ) {
211
255
addRelocator(relocator, action)
212
256
}
213
257
258
+ /* *
259
+ * Relocate classes using a [Relocator].
260
+ *
261
+ * This is a convenience method for [relocate] with a reified type parameter for Kotlin.
262
+ */
214
263
public inline fun <reified R : Relocator > relocate () {
215
264
relocate(R ::class .java, null )
216
265
}
217
266
267
+ /* *
268
+ * Relocate classes using a [Relocator].
269
+ *
270
+ * This is a convenience method for [relocate] with a reified type parameter for Kotlin.
271
+ */
218
272
public inline fun <reified R : Relocator > relocate (action : Action <R >? ) {
219
273
relocate(R ::class .java, action)
220
274
}
221
275
276
+ /* *
277
+ * Transform resources using a [ResourceTransformer].
278
+ */
222
279
override fun <T : ResourceTransformer > transform (clazz : Class <T >, action : Action <T >? ) {
223
280
addTransform(clazz.create(objectFactory), action)
224
281
}
225
282
283
+ /* *
284
+ * Transform resources using a [ResourceTransformer].
285
+ */
226
286
override fun <T : ResourceTransformer > transform (transformer : T , action : Action <T >? ) {
227
287
addTransform(transformer, action)
228
288
}
229
289
290
+ /* *
291
+ * Transform resources using a [ResourceTransformer].
292
+ *
293
+ * This is a convenience method for [transform] with a reified type parameter for Kotlin.
294
+ */
230
295
public inline fun <reified T : ResourceTransformer > transform () {
231
296
transform(T ::class .java, null )
232
297
}
233
298
299
+ /* *
300
+ * Transform resources using a [ResourceTransformer].
301
+ *
302
+ * This is a convenience method for [transform] with a reified type parameter for Kotlin.
303
+ */
234
304
public inline fun <reified T : ResourceTransformer > transform (action : Action <T >? ) {
235
305
transform(T ::class .java, action)
236
306
}
0 commit comments