56 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Haxe
		
	
	
	
	
	
			
		
		
	
	
			56 lines
		
	
	
		
			1.7 KiB
		
	
	
	
		
			Haxe
		
	
	
	
	
	
| import lime.tools.HXProject;
 | |
| import lime.tools.Platform;
 | |
| import hxp.*;
 | |
| 
 | |
| class BuildTool extends Script{
 | |
|     public static function main() {
 | |
|         // Get command line arguments
 | |
|         var args = Sys.args();
 | |
|         var target = "linux"; // Default
 | |
|         
 | |
|         trace(args);
 | |
|         // Check if a platform was specified
 | |
|         if (args.length > 0) {
 | |
|             target = args[0].toLowerCase();
 | |
|         }
 | |
|         
 | |
|         // Create the project
 | |
|         var project = new Project();
 | |
|         
 | |
|         // Set target platform
 | |
|         switch (target) {
 | |
|             case "windows": project.target = Platform.WINDOWS;
 | |
|             case "mac": project.target = Platform.MAC;
 | |
|             case "linux": project.target = Platform.LINUX;
 | |
|             case "android": project.target = Platform.ANDROID;
 | |
|             case "ios": project.target = Platform.IOS;
 | |
|             case "html5": project.target = Platform.HTML5;
 | |
|             default: Sys.println('Unknown platform: $target, using linux'); 
 | |
|                     project.target = Platform.LINUX;
 | |
|         }
 | |
|         
 | |
|         // Create build configuration
 | |
|         var command = "build";
 | |
|         if (args.length > 1) {
 | |
|             command = args[1].toLowerCase();
 | |
|         }
 | |
|         
 | |
|         // Additional flags
 | |
|         var flags = [];
 | |
|         if (args.length > 2) {
 | |
|             flags = args.slice(2);
 | |
|         }
 | |
|         
 | |
|         // Use Lime's internal CommandLineTools
 | |
|         var commandLineArgs = [command, target].concat(flags);
 | |
|         // var lime = new CommandLineTools();
 | |
|         
 | |
|         // Pass the project directly to lime
 | |
|         // lime.project = project;
 | |
|         
 | |
|         HXProject.main();
 | |
| 
 | |
|         // Execute the command
 | |
|         // lime.process(commandLineArgs);
 | |
|     }
 | |
| } |