3737public abstract class ToolExecBase <P extends EnhancedProblems > extends JavaExec {
3838 private final P problems ;
3939 /// The default tool directory (usage is not required).
40- protected final DirectoryProperty defaultToolDir ;
40+ protected final DirectoryProperty defaultToolDir = this .getObjectFactory ().directoryProperty ();
41+ private final ListProperty <String > additionalArgs = this .getObjectFactory ().listProperty (String .class );
4142
4243 /// Additional arguments to use when invoking the tool. Use in configuration instead of [#args].
4344 ///
4445 /// @return The list property for the additional arguments
45- abstract @ Input @ Optional ListProperty <String > getAdditionalArgs ();
46+ public @ Input @ Optional ListProperty <String > getAdditionalArgs () {
47+ return this .additionalArgs ;
48+ }
4649
4750 /// The project layout provided by Gradle services.
4851 ///
@@ -66,7 +69,7 @@ protected ToolExecBase(Class<P> problemsType, Tool tool) {
6669 Tool .Resolved resolved ;
6770 if (this instanceof EnhancedTask ) {
6871 resolved = ((EnhancedTask ) this ).getTool (tool );
69- this .defaultToolDir = this . getObjectFactory (). directoryProperty () .value (
72+ this .defaultToolDir .value (
7073 ((EnhancedTask ) this ).globalCaches ().dir (tool .getName ().toLowerCase (Locale .ENGLISH )).map (this .ensureFileLocationInternal ())
7174 );
7275 } else {
@@ -76,15 +79,14 @@ protected ToolExecBase(Class<P> problemsType, Tool tool) {
7679 this .getObjectFactory ().newInstance (ToolsExtensionImpl .class )
7780 );
7881
79- this .defaultToolDir = this . getObjectFactory (). directoryProperty () .value (
82+ this .defaultToolDir .value (
8083 this .getProjectLayout ().getBuildDirectory ().dir (String .format ("minecraftforge/tools/%s/workDir" , tool .getName ().toLowerCase (Locale .ENGLISH ))).map (this .ensureFileLocationInternal ())
8184 );
8285 }
8386
8487 this .setClasspath (resolved .getClasspath ());
8588
86- this .defaultToolDir .disallowChanges ();
87- this .defaultToolDir .finalizeValueOnRead ();
89+ SharedUtil .finalizeProperty (this .defaultToolDir );
8890
8991 if (resolved .hasMainClass ())
9092 this .getMainClass ().set (resolved .getMainClass ());
@@ -109,7 +111,7 @@ private <T extends FileSystemLocation> Transformer<T, T> ensureFileLocationInter
109111 /// arguments added by superclasses, this method [must be invoked by overriders][MustBeInvokedByOverriders].
110112 @ MustBeInvokedByOverriders
111113 protected void addArguments () {
112- this .args (this .getAdditionalArgs ().getOrElse ( Collections . emptyList () ));
114+ this .args (this .getAdditionalArgs ().get ( ));
113115 }
114116
115117 /// @implNote Not invoking this method from an overriding method *will* result in the tool never being executed and
0 commit comments