From 60f2eaadf51d9775b255f168f7c7ebb1d35b2688 Mon Sep 17 00:00:00 2001 From: Tom Robinson Date: Wed, 27 Jan 2010 22:36:28 -0800 Subject: [PATCH] Modify press to inspect cibs for dependent classes. --- Tools/press/main.j | 22 +++++++++++++++++++++- 1 file changed, 21 insertions(+), 1 deletion(-) diff --git a/Tools/press/main.j b/Tools/press/main.j index 0d723b839..87b02a791 100644 --- a/Tools/press/main.j +++ b/Tools/press/main.j @@ -1,13 +1,16 @@ require("narwhal").ensureEngine("rhino"); @import +@import @import "objj-analysis-tools.j" +@import "cib-analysis-tools.j" var ARGS = require("args"); var FILE = require("file"); var OS = require("os"); var DOM = require("browser/dom"); +var UTIL = require("util"); var INTERPRETER = require("interpreter"); var serializer = new DOM.XMLSerializer(); @@ -150,6 +153,10 @@ function pressEnvironment(rootPath, outputFiles, environment, options) { scope.OBJJ_INCLUDE_PATHS = frameworks; scope.OBJJ_ENVIRONMENTS = [environment, "ObjJ"]; + // build list of cibs to inspect for dependent classes + // FIXME: what's the best way to determine which cibs to look in? + var cibs = FILE.glob(rootPath.join("**", "*.cib")).filter(function(path) { return !(/Frameworks/).test(path); }); + // flattening bookkeeping. keep track of the bundles and evaled code (in the correct order!) var bundleArchiveResponses = []; var exectuableResponses = []; @@ -186,7 +193,7 @@ function pressEnvironment(rootPath, outputFiles, environment, options) { // coalesce the results var dependencies = coalesceGlobalDefines(globals); - // Log + // log identifer => files defining CPLog.trace("Global defines:"); Object.keys(dependencies).sort().forEach(function(identifier) { CPLog.trace(" " + identifier + " => " + rootPath.relative(dependencies[identifier])); @@ -219,8 +226,21 @@ function pressEnvironment(rootPath, outputFiles, environment, options) { requiredFiles[mainPath] = true; + // check the code traverseDependencies(context, scope.objj_files[mainPath]); + // check the cibs + cibs.forEach(function(cibPath) { + var cibClasses = findCibClassDependencies(cibPath); + CPLog.debug(cibPath + " => " + cibClasses); + + var referencedFiles = {}; + markFilesReferencedByTokens(cibClasses, context.dependencies, referencedFiles); + checkReferenced(context, null, referencedFiles); + + print(UTIL.repr(referencedFiles)); + }); + var count = 0, total = 0; for (var path in scope.objj_files)