diff --git a/Objective-J/CommonJS/lib/objective-j.js b/Objective-J/CommonJS/lib/objective-j.js index 883e34e7f..1bce5a864 100644 --- a/Objective-J/CommonJS/lib/objective-j.js +++ b/Objective-J/CommonJS/lib/objective-j.js @@ -68,6 +68,8 @@ with (window) // runs the objj repl or file provided in args exports.run = function(args) { + var multipleFiles = false; + if (args) { // we expect args to be in the format: @@ -91,13 +93,24 @@ exports.run = function(args) print(" -v, --version print the current version of objj"); print(" -I, --objj-include-paths include a specific framework paths") print(" -h, --help print this help"); + print(" -m, --multifiles launch objj on several files") return; } - while (argv.length && argv[0] == "-I" || argv[0] == "--objj-include-paths") + while (argv.length && argv[0].indexOf('-') === 0) { - argv.shift(); - OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().split(":")); + switch (argv[0]) + { + case "-I": + argv.shift(); + OBJJ_INCLUDE_PATHS.unshift.apply(OBJJ_INCLUDE_PATHS, argv.shift().split(":")); + break; + + case "-m": + argv.shift(); + multipleFiles = true; + break + } } } @@ -112,12 +125,6 @@ exports.run = function(args) exports.make_narwhal_factory(mainFilePath)(require, { }, module, system, print); - if (argv[0] == "--") - { - endCommand = true; - argv.shift(); - } - if (typeof main === "function") { main([arg0].concat(argv)); @@ -126,7 +133,7 @@ exports.run = function(args) require("browser/timeout").serviceTimeouts(); - if (endCommand) + if (!multipleFiles || endCommand) break; ObjectiveJ.Executable.resetCachedFileExecutableSearchers(); diff --git a/Objective-J/CommonJS/objj-executable b/Objective-J/CommonJS/objj-executable index 9f2f05a02..919302c11 100755 --- a/Objective-J/CommonJS/objj-executable +++ b/Objective-J/CommonJS/objj-executable @@ -3,5 +3,5 @@ var execPath = require("file").path(module.path); var mainPath = execPath.dirname().dirname().join("lib", execPath.basename(), "main.j"); -var args = ["objj", String(mainPath), "--"].concat(system.args.slice(1)); +var args = ["objj", String(mainPath)].concat(system.args.slice(1)); require("objective-j").run(args); diff --git a/Tests/Tools/ToolsTest.j b/Tests/Tools/ToolsTest.j index b588f25c7..000a05aa8 100644 --- a/Tests/Tools/ToolsTest.j +++ b/Tests/Tools/ToolsTest.j @@ -33,7 +33,7 @@ function cleanup() { status = OS.system(["objj", "ToolsTestApp/AppController.j"]); [self assert:0 equals:status message:"objj failed"]; - status = OS.system(["objj", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]); + status = OS.system(["objj", "-m", "ToolsTestApp/AppController.j", "ToolsTestApp/AppController.j"]); [self assert:0 equals:status message:"objj failed with several files"]; status = OS.system(["objj", "-I", "ToolsTestApp/Frameworks", "ToolsTestApp/AppController.j"]); diff --git a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m index 8d95e03a8..7872f8887 100644 --- a/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m +++ b/Tools/XcodeCapp/XcodeCapp/ProcessSourceOperation.m @@ -44,7 +44,7 @@ return; NSNotificationCenter *center = [NSNotificationCenter defaultCenter]; - + NSDictionary *info = @{ @"projectId":self.projectId, @"path":self.sourcePath }; [center postNotificationName:XCCConversionDidStartNotification object:self userInfo:info]; @@ -72,7 +72,6 @@ launchPath = self.xcc.executablePaths[@"objj"]; arguments = @[ self.xcc.parserPath, - @"--", self.projectPath, self.sourcePath ]; @@ -85,21 +84,21 @@ return; [self.xcc performSelectorOnMainThread:@selector(computeIgnoredPaths) withObject:nil waitUntilDone:NO]; - + notificationTitle = @"Parsed .xcodecapp-ignore"; notificationMessage = @"Ignored paths updated"; } // Run the task and get the response if needed NSInteger status = 0; - + if (arguments) { if (self.isCancelled) return; DDLogVerbose(@"Running processing task: %@", launchPath); - + NSDictionary *taskResult = [self.xcc runTaskWithLaunchPath:launchPath arguments:arguments returnType:kTaskReturnTypeAny]; @@ -121,7 +120,7 @@ notificationTitle = @"Error converting xib"; NSString *message = [NSString stringWithFormat:@"%@\n%@", self.sourcePath.lastPathComponent, response]; - + NSDictionary *info = @{ @"projectId":self.projectId, @@ -132,7 +131,7 @@ if (self.isCancelled) return; - + [center postNotificationName:XCCConversionDidGenerateErrorNotification object:self userInfo:info]; } else @@ -153,14 +152,14 @@ [self postErrorNotificationForPath:self.sourcePath line:0 message:response status:status]; } } - + if ([self.xcc shouldShowErrorNotification]) [self notifyUserWithTitle:notificationTitle message:notificationMessage]; } else if (!self.xcc.isLoadingProject) { BOOL showFinalNotification = YES; - + if ([self.xcc shouldProcessWithCappLint]) { showFinalNotification = [self.xcc checkCappLintForPath:[NSArray arrayWithObject:self.sourcePath]]; @@ -168,7 +167,7 @@ if (!showFinalNotification) [self.xcc showCappLintErrors]; } - + if (showFinalNotification) [self notifyUserWithTitle:notificationTitle message:notificationMessage]; }