private void addFilesIncludedInSwc(final Element rootElement) { final JpsCompilerExcludes excludes = JpsJavaExtensionService.getInstance() .getOrCreateCompilerConfiguration(myModule.getProject()) .getCompilerExcludes(); final Map<String, String> filePathToPathInSwc = new THashMap<String, String>(); for (String path : myBC.getCompilerOptions().getFilesToIncludeInSWC()) { final File fileOrDir = new File(path); if (excludes.isExcluded(fileOrDir)) continue; if (myProjectDescriptor.getIgnoredFileIndex().isIgnored(fileOrDir.getName())) continue; final String baseRelativePath = StringUtil.notNullize( FlexCommonUtils.getPathRelativeToSourceRoot(myModule, fileOrDir.getPath()), fileOrDir.getName()); if (fileOrDir.isDirectory()) { processFilesRecursively( fileOrDir, new Processor<File>() { public boolean process(final File file) { if (myProjectDescriptor.getIgnoredFileIndex().isIgnored(file.getName())) return false; if (!file.isDirectory() && !FlexCommonUtils.isSourceFile(file.getName()) && !excludes.isExcluded(file)) { final String relativePath = FileUtil.getRelativePath(fileOrDir, file); assert relativePath != null; final String pathInSwc = baseRelativePath.isEmpty() ? relativePath : baseRelativePath + "/" + relativePath; filePathToPathInSwc.put(file.getPath(), pathInSwc); } return true; } }); } else if (fileOrDir.isFile()) { filePathToPathInSwc.put(fileOrDir.getPath(), baseRelativePath); } } for (Map.Entry<String, String> entry : filePathToPathInSwc.entrySet()) { final String value = FileUtil.toSystemIndependentName(entry.getValue()) + CompilerOptionInfo.LIST_ENTRY_PARTS_SEPARATOR + FileUtil.toSystemIndependentName(entry.getKey()); addOption(rootElement, CompilerOptionInfo.INCLUDE_FILE_INFO, value); } }
private void addOtherOptions(final Element rootElement) { final Map<String, String> options = new THashMap<String, String>(myProjectLevelCompilerOptions.getAllOptions()); options.putAll(myModuleLevelCompilerOptions.getAllOptions()); options.putAll(myBC.getCompilerOptions().getAllOptions()); final String addOptions = myProjectLevelCompilerOptions.getAdditionalOptions() + " " + myModuleLevelCompilerOptions.getAdditionalOptions() + " " + myBC.getCompilerOptions().getAdditionalOptions(); final List<String> contextRootInAddOptions = FlexCommonUtils.getOptionValues(addOptions, "context-root", "compiler.context-root"); if (options.get("compiler.context-root") == null && contextRootInAddOptions.isEmpty()) { final List<String> servicesInAddOptions = FlexCommonUtils.getOptionValues(addOptions, "services", "compiler.services"); if (options.get("compiler.services") != null || !servicesInAddOptions.isEmpty()) { options.put("compiler.context-root", ""); } } for (final Map.Entry<String, String> entry : options.entrySet()) { addOption(rootElement, CompilerOptionInfo.getOptionInfo(entry.getKey()), entry.getValue()); } final String namespacesRaw = options.get("compiler.namespaces.namespace"); if (namespacesRaw != null && myBC.getOutputType() == OutputType.Library) { final String namespaces = FlexCommonUtils.replacePathMacros( namespacesRaw, myModule, myFlexmojos ? "" : mySdk.getHomePath()); final StringBuilder buf = new StringBuilder(); for (final String listEntry : StringUtil.split(namespaces, CompilerOptionInfo.LIST_ENTRIES_SEPARATOR)) { final int tabIndex = listEntry.indexOf(CompilerOptionInfo.LIST_ENTRY_PARTS_SEPARATOR); assert tabIndex != -1 : namespaces; final String namespace = listEntry.substring(0, tabIndex); if (buf.length() > 0) buf.append(CompilerOptionInfo.LIST_ENTRIES_SEPARATOR); buf.append(namespace); } if (buf.length() > 0) { addOption(rootElement, CompilerOptionInfo.INCLUDE_NAMESPACES_INFO, buf.toString()); } } }