Exemplo n.º 1
0
 public static void main(String[] args) throws Exception {
   MukiGenerator generator = new MukiGenerator();
   ExecutionResult result = new ExecutionResult();
   result.setOk(true);
   generator.run(args, result);
   System.out.print("*** Muki v" + Version.id() + " Created by Gabriel Casarini ***");
   System.out.println(result.getLog());
 }
Exemplo n.º 2
0
 public void run(String[] args, ExecutionResult result) throws Exception {
   if (args != null && args.length == 1) {
     String value = args[0].trim().toLowerCase();
     if (value.equals("help") || value.equals("?")) {
       result.append("Usage: " + COMMAND_HELP);
       result.setOk(false);
       return;
     }
   }
   if (args == null || args.length != 3) {
     result.append("Usage: " + COMMAND_HELP);
     result.setOk(false);
     return;
   }
   String option = args[0];
   String projectFile = args[1];
   String outputDirectory = args[2];
   this.run(option, projectFile, outputDirectory, result);
 }
Exemplo n.º 3
0
 public void run(String option, String projectFile, String outputDirectory, ExecutionResult result)
     throws Exception {
   if (option == null
       || (!option.equals(GENERATE_JAVA)
           && !option.equals(GENERATE_OBJC)
           && !option.equals(GENERATE_SWIFT))) {
     result.append("-> Invalid option! The command line is:");
     result.append(COMMAND_HELP);
     result.setOk(false);
     return;
   }
   if (projectFile == null || !this.getIo().existsFile(projectFile)) {
     result.append("-> The project file doesn't exists: " + projectFile);
     result.setOk(false);
     return;
   }
   if (outputDirectory == null || !this.getIo().existsFile(outputDirectory)) {
     result.append("-> The output directory doesn't exists: " + outputDirectory);
     result.setOk(false);
     return;
   }
   ModelUtility modelUtility = new ModelUtility();
   Project newProject = modelUtility.openProject(projectFile);
   this.setProject(newProject);
   this.setOutputDirectory(outputDirectory);
   if (option.equals(GENERATE_JAVA)) {
     this.generateJava(result);
     return;
   }
   if (option.equals(GENERATE_OBJC)) {
     this.generateObjC(result);
     return;
   }
   if (option.equals(GENERATE_SWIFT)) {
     this.generateSwift(result);
     return;
   }
 }