public static void swcDependencies(String[] args) { try { CompilerAPI.useAS3(); // setup the path resolver CompilerAPI.usePathResolver(); // set up for localizing messages LocalizationManager l10n = new LocalizationManager(); l10n.addLocalizer(new XLRLocalizer()); l10n.addLocalizer(new ResourceBundleLocalizer()); ThreadLocalToolkit.setLocalizationManager(l10n); // setup the console logger. the configuration parser needs a logger. CompilerAPI.useConsoleLogger(); // process configuration ConfigurationBuffer cfgbuf = new ConfigurationBuffer(DependencyRootConfiguration.class, Configuration.getAliases()); DefaultsConfigurator.loadDefaults(cfgbuf); DependencyRootConfiguration configuration = (DependencyRootConfiguration) Mxmlc.processConfiguration( l10n, "swcdepends", args, cfgbuf, DependencyRootConfiguration.class, "no-default-arg"); // well, setup the logger again now that we know configuration.getWarnings()??? CompilerAPI.useConsoleLogger(true, true, configuration.getWarnings(), true); CompilerAPI.setupHeadless(configuration); CompilerConfiguration compilerConfig = configuration.getCompilerConfiguration(); VirtualFile[] virtualFiles = new VirtualFile[0]; VirtualFile[] moreFiles = compilerConfig.getLibraryPath(); if (moreFiles != null) virtualFiles = moreFiles; // first one, just assign reference moreFiles = Configuration.getAllExcludedLibraries(compilerConfig, configuration); if (moreFiles != null) virtualFiles = (VirtualFile[]) CompilerConfiguration.merge(virtualFiles, moreFiles, VirtualFile.class); moreFiles = compilerConfig.getThemeFiles(); if (moreFiles != null) { // remove the css files and keep the swcs List<VirtualFile> themeSwcs = new ArrayList<VirtualFile>(moreFiles.length); for (int i = 0; i < moreFiles.length; i++) { if (moreFiles[i].getName().endsWith(".swc")) themeSwcs.add(moreFiles[i]); } if (themeSwcs.size() > 0) virtualFiles = (VirtualFile[]) CompilerConfiguration.merge( virtualFiles, themeSwcs.toArray(new VirtualFile[themeSwcs.size()]), VirtualFile.class); } moreFiles = compilerConfig.getIncludeLibraries(); if (moreFiles != null) virtualFiles = (VirtualFile[]) CompilerConfiguration.merge(virtualFiles, moreFiles, VirtualFile.class); DependencyConfiguration dependencyConfig = configuration.getDependencyConfiguration(); List<String> types = dependencyConfig.getDesiredScriptDependencyTypes(); SwcDependencyInfo depInfo = SwcDependencyUtil.getSwcDependencyInfo( virtualFiles, types.size() == 0 ? null : types.toArray(new String[types.size()]), dependencyConfig.getMinimizeDependencySet()); List<String> depOrder = depInfo.getSwcDependencyOrder(); List<String> showSwcs = dependencyConfig.getShowSwcs(); // list the swc dependencies for (String swcLocation : depOrder) { // filter the swcs that are shown if (showSwcs.size() != 0) { boolean skip = true; for (String showSwc : showSwcs) { if (swcLocation.equals(showSwc) || swcLocation.endsWith(showSwc)) { skip = false; break; } } if (skip) continue; } System.out.println(swcLocation + ":"); // list of swc dependencies on swcLocation Set<String> depends = depInfo.getDependencies(swcLocation); for (String swcDepName : depends) { System.out.println("\t" + swcDepName); // list the external scripts that caused the dependencies between // swcLocation and swcDepName. if (dependencyConfig.getShowExterns()) { SwcExternalScriptInfo swcExternalScriptInfo = depInfo.getSwcExternalScriptInfo(swcLocation); for (String externalScriptName : swcExternalScriptInfo.getExternalScripts(swcDepName)) { if (dependencyConfig.getShowTypes()) { System.out.print("\t\t" + externalScriptName + "\t"); for (String type : swcExternalScriptInfo.getScriptDependencyTypes(externalScriptName)) { System.out.print(type + " "); } System.out.println(); } else System.out.println("\t\t" + externalScriptName); } } } } } catch (ConfigurationException ex) { Mxmlc.processConfigurationException(ex, "swcdepends"); } catch (SwcException ex) { assert ThreadLocalToolkit.errorCount() > 0; } catch (Throwable t) // IOException, Throwable { ThreadLocalToolkit.logError(t.getLocalizedMessage()); if (Trace.error) { t.printStackTrace(); } } finally { CompilerAPI.removePathResolver(); } }
static { // set up for localizing messages m_localizationManager = new LocalizationManager(); m_localizationManager.addLocalizer( new DebuggerLocalizer("flash.tools.debugger.concrete.djapi.")); // $NON-NLS-1$ }