@@ -196,13 +196,6 @@ internal object PatchCommand : Runnable {
196
196
logger.warning(" Unknown input of patches:\n ${unknownPatches.joinToString(" \n " )} " )
197
197
}
198
198
199
- logger.info(" Setting patch options" )
200
-
201
- optionsFile.let {
202
- if (it.exists()) patches.setOptions(it)
203
- else Options .serialize(patches, prettyPrint = true ).let (it::writeText)
204
- }
205
-
206
199
// endregion
207
200
208
201
Patcher (
@@ -213,11 +206,18 @@ internal object PatchCommand : Runnable {
213
206
resourceCachePath.absolutePath,
214
207
)
215
208
).use { patcher ->
209
+ val filteredPatches = patcher.filterPatchSelection(patches).also { patches ->
210
+ logger.info(" Setting patch options" )
211
+
212
+ if (optionsFile.exists()) patches.setOptions(optionsFile)
213
+ else Options .serialize(patches, prettyPrint = true ).let (optionsFile::writeText)
214
+ }
215
+
216
216
// region Patch
217
217
218
218
val patcherResult = patcher.apply {
219
219
acceptIntegrations(integrations)
220
- acceptPatches(filterPatchSelection(patches ))
220
+ acceptPatches(filteredPatches.toList( ))
221
221
222
222
// Execute patches.
223
223
runBlocking {
@@ -277,7 +277,7 @@ internal object PatchCommand : Runnable {
277
277
* @param patches The patches to filter.
278
278
* @return The filtered patches.
279
279
*/
280
- private fun Patcher.filterPatchSelection (patches : PatchSet ) = buildList {
280
+ private fun Patcher.filterPatchSelection (patches : PatchSet ): PatchSet = buildSet {
281
281
val packageName = context.packageMetadata.packageName
282
282
val packageVersion = context.packageMetadata.packageVersion
283
283
0 commit comments