Improve error handling around dep remapping.
This commit is contained in:
		
							parent
							
								
									80ad300b97
								
							
						
					
					
						commit
						f33637aa3c
					
				
					 1 changed files with 16 additions and 14 deletions
				
			
		|  | @ -28,6 +28,7 @@ import java.io.File; | ||||||
| import java.io.IOException; | import java.io.IOException; | ||||||
| import java.io.InputStream; | import java.io.InputStream; | ||||||
| import java.nio.charset.StandardCharsets; | import java.nio.charset.StandardCharsets; | ||||||
|  | import java.nio.file.Files; | ||||||
| import java.nio.file.Path; | import java.nio.file.Path; | ||||||
| import java.util.ArrayList; | import java.util.ArrayList; | ||||||
| import java.util.HashMap; | import java.util.HashMap; | ||||||
|  | @ -170,13 +171,8 @@ public class ModProcessor { | ||||||
| 
 | 
 | ||||||
| 		// Apply this in a second loop as we need to ensure all the inputs are on the classpath before remapping. | 		// Apply this in a second loop as we need to ensure all the inputs are on the classpath before remapping. | ||||||
| 		for (ModDependencyInfo info : remapList) { | 		for (ModDependencyInfo info : remapList) { | ||||||
| 			OutputConsumerPath outputConsumer; |  | ||||||
| 
 |  | ||||||
| 			try { | 			try { | ||||||
| 				outputConsumer = new OutputConsumerPath.Builder(info.getRemappedOutput().toPath()).build(); | 				OutputConsumerPath outputConsumer = new OutputConsumerPath.Builder(info.getRemappedOutput().toPath()).build(); | ||||||
| 			} catch (Exception e) { |  | ||||||
| 				throw new IOException("Could not create output consumer for " + info.getRemappedOutput().getAbsolutePath()); |  | ||||||
| 			} |  | ||||||
| 
 | 
 | ||||||
| 				outputConsumer.addNonClassFiles(info.getInputFile().toPath()); | 				outputConsumer.addNonClassFiles(info.getInputFile().toPath()); | ||||||
| 				outputConsumerMap.put(info, outputConsumer); | 				outputConsumerMap.put(info, outputConsumer); | ||||||
|  | @ -187,6 +183,12 @@ public class ModProcessor { | ||||||
| 				} | 				} | ||||||
| 
 | 
 | ||||||
| 				remapper.apply(outputConsumer, tagMap.get(info)); | 				remapper.apply(outputConsumer, tagMap.get(info)); | ||||||
|  | 			} catch (Exception e) { | ||||||
|  | 				remapper.finish(); | ||||||
|  | 				Files.deleteIfExists(info.getRemappedOutput().toPath()); | ||||||
|  | 
 | ||||||
|  | 				throw new RuntimeException("Failed to remap: " + info.getRemappedNotation(), e); | ||||||
|  | 			} | ||||||
| 		} | 		} | ||||||
| 
 | 
 | ||||||
| 		remapper.finish(); | 		remapper.finish(); | ||||||
|  |  | ||||||
		Loading…
	
		Reference in a new issue