@@ -65,12 +65,21 @@ public abstract class GeneratePatcherConfigV2 extends DefaultTask implements For
6565 public abstract @ Input Property <String > getBinpatcherVersion ();
6666 public abstract @ Input ListProperty <String > getBinpatcherArguments ();
6767
68+ public abstract @ Input @ Optional ListProperty <String > getExtraRuntimeDeps ();
69+ public abstract @ Input @ Optional ListProperty <String > getExtraCompileDeps ();
70+ public abstract @ Input @ Optional ListProperty <String > getExtraAnnotationProcessorDeps ();
71+
6872 protected abstract @ Inject ObjectFactory getObjects ();
6973
7074 @ Inject
7175 public GeneratePatcherConfigV2 () {
72- this .getSourceFileEncoding ().convention (StandardCharsets .UTF_8 .name ());
7376 this .getOutput ().convention (this .getDefaultOutputFile ("json" ));
77+
78+ this .getPatchesOriginalPrefix ().convention ("a/" );
79+ this .getPatchesModifiedPrefix ().convention ("b/" );
80+ this .getSourceFileEncoding ().convention (StandardCharsets .UTF_8 .name ());
81+ this .getInject ().convention ("inject/" );
82+ this .getPatches ().convention ("patches/" );
7483 }
7584
7685 @ TaskAction
@@ -85,9 +94,12 @@ protected void exec() throws IOException {
8594 config .inject = this .getInject ().filter (Util .IS_NOT_BLANK ).getOrNull ();
8695 config .libraries = this .getLibraries ().get ();
8796 config .ats = DefaultGroovyMethods .collect (this .getATs (), Closures .<File , String >function (f -> "ats/" + f .getName ()));
97+ if (config .ats .isEmpty ()) config .ats = null ;
8898 config .sass = DefaultGroovyMethods .collect (this .getSASs (), Closures .<File , String >function (f -> "sas/" + f .getName ()));
99+ if (config .sass .isEmpty ()) config .sass = null ;
89100 config .srgs = DefaultGroovyMethods .collect (this .getSRGs (), Closures .<File , String >function (f -> "srgs/" + f .getName ()));
90101 config .srgs .addAll (this .getSRGLines ().get ());
102+ if (config .srgs .isEmpty ()) config .srgs = null ;
91103 config .mcp = this .getMCPConfig ().filter (Util .IS_NOT_BLANK ).get ();
92104
93105 config .runs = this .getRuns ().get ();
@@ -100,12 +112,18 @@ protected void exec() throws IOException {
100112 var v2 = (PatcherConfig .V2 ) (config = new PatcherConfig .V2 (config ));
101113 v2 .spec = 2 ;
102114 v2 .modules = this .getModules ().get ();
115+ if (v2 .modules .isEmpty ()) v2 .modules = null ;
103116 v2 .processor = this .getProcessor ().getOrNull ();
104117 v2 .patchesOriginalPrefix = this .getPatchesOriginalPrefix ().filter (Util .IS_NOT_BLANK ).getOrNull ();
105118 v2 .patchesModifiedPrefix = this .getPatchesModifiedPrefix ().filter (Util .IS_NOT_BLANK ).getOrNull ();
106119 v2 .notchObf = this .getNotchObf ().filter (b -> b ).getOrNull ();
107120 v2 .sourceFileCharset = this .getSourceFileEncoding ().filter (Util .IS_NOT_BLANK ).getOrNull ();
108121 v2 .universalFilters = this .getUniversalFilters ().get ();
122+ if (v2 .universalFilters .isEmpty ()) v2 .universalFilters = null ;
123+ v2 .extraDependencies = new PatcherConfig .V2 .ScopedDependencies ();
124+ v2 .extraDependencies .compileOnly = new ArrayList <>(getExtraCompileDeps ().get ());
125+ v2 .extraDependencies .runtimeOnly = new ArrayList <>(getExtraRuntimeDeps ().get ());
126+ v2 .extraDependencies .annotationProcessor = new ArrayList <>(getExtraAnnotationProcessorDeps ().get ());
109127 }
110128
111129 JsonData .toJson (config , this .getOutput ().getAsFile ().get ());
0 commit comments