2424import net .minecraftforge .util .data .json .JsonData ;
2525import net .minecraftforge .util .hash .HashFunction ;
2626import net .minecraftforge .util .hash .HashStore ;
27- import net .minecraftforge .util .logging .Log ;
27+ import static net .minecraftforge .mcmaven .impl .Mavenizer .LOGGER ;
28+
29+ import net .minecraftforge .util .logging .Logger ;
2830import org .jetbrains .annotations .Nullable ;
2931
3032// TODO [Mavenizer][MCPTask] Cleanup. Works well but is a mess.
3133public class MCPTask {
3234 public static void run (String [] args ) throws Exception {
3335 // TODO [MCMavenizer] Make this into a --log [level] option
34- Log . enabled = Log .Level .INFO ;
36+ LOGGER . setEnabled ( Logger .Level .INFO ) ;
3537
3638 var parser = new OptionParser ();
3739 parser .allowsUnrecognizedOptions ();
@@ -100,8 +102,8 @@ public static void run(String[] args) throws Exception {
100102
101103 var options = parser .parse (args );
102104 if (options .has (helpO )) {
103- parser .printHelpOn (Log . INFO );
104- Log .release ();
105+ parser .printHelpOn (LOGGER . getInfo () );
106+ LOGGER .release ();
105107 return ;
106108 }
107109
@@ -122,24 +124,24 @@ public static void run(String[] args) throws Exception {
122124 var sas = options .has (sasO ) ? options .valueOf (sasO ) : null ;
123125
124126 if (artifact == null ) {
125- Log .error ("Missing mcp --version or --artifact" );
126- Log .release ();
127+ LOGGER .error ("Missing mcp --version or --artifact" );
128+ LOGGER .release ();
127129 return ;
128130 }
129131
130132 var repo = new MCPConfigRepo (new Cache (cacheRoot , jdkCacheRoot ));
131- Log .info (" Output: " + output .getAbsolutePath ());
132- Log .info (" Cache: " + cacheRoot .getAbsolutePath ());
133- Log .info (" JDK Cache: " + jdkCacheRoot .getAbsolutePath ());
134- Log .info (" Artifact: " + artifact );
135- Log .info (" Pipeline: " + pipeline );
133+ LOGGER .info (" Output: " + output .getAbsolutePath ());
134+ LOGGER .info (" Cache: " + cacheRoot .getAbsolutePath ());
135+ LOGGER .info (" JDK Cache: " + jdkCacheRoot .getAbsolutePath ());
136+ LOGGER .info (" Artifact: " + artifact );
137+ LOGGER .info (" Pipeline: " + pipeline );
136138 if (options .has (rawO )) {
137- Log .info (" Raw Names: " + (options .has (seargeO ) ? "Searge" : "Notch" ));
139+ LOGGER .info (" Raw Names: " + (options .has (seargeO ) ? "Searge" : "Notch" ));
138140 } else {
139- Log .info (" Access: " + (ats == null ? null : ats .getAbsolutePath ()));
140- Log .info (" SAS: " + (sas == null ? null : sas .getAbsolutePath ()));
141+ LOGGER .info (" Access: " + (ats == null ? null : ats .getAbsolutePath ()));
142+ LOGGER .info (" SAS: " + (sas == null ? null : sas .getAbsolutePath ()));
141143 }
142- Log .info ();
144+ LOGGER .info ();
143145
144146 var mcp = repo .get (artifact );
145147 var side = mcp .getSide (pipeline );
@@ -152,13 +154,13 @@ public static void run(String[] args) throws Exception {
152154 Task rawTask = searge ? side .getTasks ().getSrgJar () : side .getTasks ().getRawJar ();
153155 File raw ;
154156
155- Log .info ("Creating Raw Jar" );
156- var indent = Log .push ();
157+ LOGGER .info ("Creating Raw Jar" );
158+ var indent = LOGGER .push ();
157159 try {
158160 raw = rawTask .execute ();
159161 cache .add ("raw" , raw );
160162 } finally {
161- Log .pop (indent );
163+ LOGGER .pop (indent );
162164 }
163165
164166 if (!output .exists () || !cache .isSame ()) {
@@ -198,21 +200,21 @@ public static void run(String[] args) throws Exception {
198200
199201 File sources = null ;
200202 {
201- Log .info ("Creating MCP Source Jar" );
202- var indent = Log .push ();
203+ LOGGER .info ("Creating MCP Source Jar" );
204+ var indent = LOGGER .push ();
203205 try {
204206 sources = sourcesTask .execute ();
205207 } finally {
206- Log .pop (indent );
208+ LOGGER .pop (indent );
207209 }
208210 }
209211
210212 var cache = HashStore .fromFile (output )
211213 .add ("sources" , sources );
212214
213215 if (options .has (mappingsO )) {
214- Log .info ("Renaming MCP Source Jar" );
215- var indent = Log .push ();
216+ LOGGER .info ("Renaming MCP Source Jar" );
217+ var indent = LOGGER .push ();
216218 try {
217219 var mappings = options .has (parchmentO )
218220 ? new ParchmentMappings (options .valueOf (parchmentO ))
@@ -221,7 +223,7 @@ public static void run(String[] args) throws Exception {
221223 var renameTask = new RenameTask (side .getBuildFolder (), pipeline , side , sourcesTask , mappings , false );
222224 sources = renameTask .execute ();
223225 } finally {
224- Log .pop (indent );
226+ LOGGER .pop (indent );
225227 }
226228
227229 cache .add ("renamed" , sources );
@@ -242,14 +244,14 @@ public static void run(String[] args) throws Exception {
242244 // TODO [Mavenizer][Extra MCPTask Files] do this better
243245 private static void writeFiles (MCPTaskFactory mcpTaskFactory , File output ) {
244246 var files = new MCPSetupFiles ();
245- files .versionManifest = mcpTaskFactory .findStep ("downloadManifest" ).execute ();
246- files .versionJson = mcpTaskFactory .findStep ("downloadJson" ).execute ();
247- files .clientRaw = mcpTaskFactory .findStep ("downloadClient" ).execute ();
248- files .serverRaw = mcpTaskFactory .findStep ("downloadServer" ).execute ();
249- files .serverExtracted = mcpTaskFactory .findStep ("extractServer" ).execute ();
250- files .clientMappings = mcpTaskFactory .findStep ( " downloadClientMappings" ).execute ();
251- files .serverMappings = mcpTaskFactory .findStep ( " downloadServerMappings" ).execute ();
252- files .librariesList = mcpTaskFactory .findStep ("listLibraries" ).execute ();
247+ files .versionManifest = mcpTaskFactory .findStep ("downloadManifest" ).execute (). getAbsolutePath () ;
248+ files .versionJson = mcpTaskFactory .findStep ("downloadJson" ).execute (). getAbsolutePath () ;
249+ files .clientRaw = mcpTaskFactory .findStep ("downloadClient" ).execute (). getAbsolutePath () ;
250+ files .serverRaw = mcpTaskFactory .findStep ("downloadServer" ).execute (). getAbsolutePath () ;
251+ files .serverExtracted = mcpTaskFactory .findStep ("extractServer" ).execute (). getAbsolutePath () ;
252+ files .clientMappings = mcpTaskFactory .downloadClientMappings ( ).execute (). getAbsolutePath ();
253+ files .serverMappings = mcpTaskFactory .downloadServerMappings ( ).execute (). getAbsolutePath ();
254+ files .librariesList = mcpTaskFactory .findStep ("listLibraries" ).execute (). getAbsolutePath () ;
253255
254256 try {
255257 JsonData .toJson (files , output );
0 commit comments