diff --git a/Objective-J/CommonJS/shrinksafe/js.jar b/Objective-J/CommonJS/shrinksafe/js.jar deleted file mode 100644 index c081d16b8..000000000 Binary files a/Objective-J/CommonJS/shrinksafe/js.jar and /dev/null differ diff --git a/Objective-J/CommonJS/shrinksafe/shrinksafe.jar b/Objective-J/CommonJS/shrinksafe/shrinksafe.jar deleted file mode 100644 index b0e736d13..000000000 Binary files a/Objective-J/CommonJS/shrinksafe/shrinksafe.jar and /dev/null differ diff --git a/Tools/ojdepcheck b/Tools/ojdepcheck new file mode 100755 index 000000000..2c38d8ecd --- /dev/null +++ b/Tools/ojdepcheck @@ -0,0 +1,59 @@ +#!/usr/bin/env objj + +require("narwhal").ensureEngine("rhino"); + +@import + +@import "press/objj-analysis-tools.j" + +var FILE = require("file"); + +var stream = require("term").stream +var parser = new (require("args").Parser)(); + +parser.usage("INPUT_PROJECT"); +parser.help("Checks a project for missing imports."); + +parser.helpful(); + +function main(args) +{ + var options = parser.parse(args); + + if (options.args.length < 1) { + parser.printUsage(options); + return; + } + + var rootPath = FILE.path(options.args[0]).join("").absolute(); + var mainPath = rootPath.join("main.j"); + + var analyzer = new ObjectiveJRuntimeAnalyzer(rootPath); + + analyzer.setIncludePaths([rootPath.join("Frameworks")]); + analyzer.setEnvironments(["Browser", "ObjJ"]); + + analyzer.initializeGlobalRecorder(); + + analyzer.load(mainPath); + analyzer.finishLoading(); + + var mainExecutable = analyzer.executableForImport(mainPath); + + var context = analyzer.traverseDependencies(mainExecutable, { + progressCallback : function(path) { stream.print("Analyzing \0purple(" + path + "\0)..."); } + }); + + for (var path in context.referencedFiles) { + var referencedFiles = context.referencedFiles[path]; + + for (var referenced in referencedFiles) { + if (!context.importedFiles[path] || !context.importedFiles[path][referenced]) { + stream.print("\0purple(" + rootPath.relative(path) + "\0) references but doesn't import \0purple(" + rootPath.relative(referenced) + "\0):") + Object.keys(referencedFiles[referenced]).forEach(function(token) { + stream.print(" \0cyan(" + token + "\0)"); + }); + } + } + } +} \ No newline at end of file