public void write(final BufferedWriter w) { RW.writeln(w, "Module:" + myName); RW.writeln(w, "SourceProperties:"); mySource.write(w); RW.writeln(w, "TestProperties:"); myTest.write(w); RW.writeln(w, "Excludes:"); RW.writeln(w, myExcludes, RW.fromString); RW.writeln(w, "Libraries:"); RW.writeln(w, myLibraries); RW.writeln(w, "Dependencies:"); final List<ClasspathItemWrapper> weakened = new ArrayList<ClasspathItemWrapper>(); for (ClasspathItemWrapper cpiw : dependsOn(false)) { weakened.add(weaken(cpiw)); } RW.writeln(w, weakened); weakened.clear(); for (ClasspathItemWrapper cpiw : dependsOn(true)) { weakened.add(weaken(cpiw)); } RW.writeln(w, weakened); }
public List<ClasspathItemWrapper> dependsOn(final boolean tests) { if (tests) { if (myTestDependsOn != null) { return myTestDependsOn; } } else if (myDependsOn != null) { return myDependsOn; } final List<ClasspathItemWrapper> result = new ArrayList<ClasspathItemWrapper>(); for (ClasspathItem cpi : myModule.getClasspath(ClasspathKind.compile(tests))) { if (cpi instanceof Module) { result.add(getModule(((Module) cpi).getName())); } else if (cpi instanceof Library) { result.add(new LibraryWrapper((Library) cpi)); } else { result.add(new GenericClasspathItemWrapper(cpi)); } } if (tests) { myTestDependsOn = result; } else { myDependsOn = result; } return result; }
@SuppressWarnings("unchecked") private static AndroidFileSetState buildCurrentApkBuilderState( @NotNull Project project, @NotNull String resPackagePath, @NotNull String classesDexFilePath, @NotNull String[] nativeLibDirs, @NotNull String[] sourceRoots, @NotNull String[] externalJars, boolean release) { final List<String> roots = new ArrayList<String>(); roots.add(resPackagePath); roots.add(classesDexFilePath); roots.addAll(Arrays.asList(externalJars)); for (String sourceRootPath : sourceRoots) { final List<File> files = new ArrayList<File>(); AndroidApkBuilder.collectStandardSourceFolderResources( new File(sourceRootPath), files, new MyExcludedSourcesFilter(project)); roots.addAll(AndroidJpsUtil.toPaths(files)); } for (String nativeLibDir : nativeLibDirs) { final List<File> files = new ArrayList<File>(); AndroidApkBuilder.collectNativeLibraries(new File(nativeLibDir), files, !release); roots.addAll(AndroidJpsUtil.toPaths(files)); } return new AndroidFileSetState(roots, Condition.TRUE, false); }
public List<String> getClassPath(final ClasspathKind kind) { final List<String> result = new ArrayList<String>(); result.add(getOutputPath()); if (kind.isTestsIncluded()) { result.add(getTestOutputPath()); } return result; }
public void logFilePaths(PrintStream stream, Collection<String> paths) { List<String> strings = new ArrayList<String>(paths.size()); for (String path : paths) { strings.add(FileUtil.toSystemIndependentName(getRelativePath(path))); } logMany(stream, strings); }
private static void collectAssetDirs(@NotNull AndroidFacet facet, @NotNull List<String> result) throws IOException { final File assetsDir = facet.getAssetsDir(); if (assetsDir != null) { result.add(assetsDir.getPath()); } for (AndroidFacet depFacet : AndroidJpsUtil.getAllAndroidDependencies(facet.getModule(), true)) { final File depAssetsDir = depFacet.getAssetsDir(); if (depAssetsDir != null) { result.add(depAssetsDir.getPath()); } } }
@NotNull private static String[] collectNativeLibsFolders(@NotNull AndroidFacet facet) throws IOException { final List<String> result = new ArrayList<String>(); final File libsDir = facet.getNativeLibsDir(); if (libsDir != null) { result.add(libsDir.getPath()); } for (AndroidFacet depFacet : AndroidJpsUtil.getAllAndroidDependencies(facet.getModule(), true)) { final File depLibsDir = depFacet.getNativeLibsDir(); if (depLibsDir != null) { result.add(depLibsDir.getPath()); } } return ArrayUtil.toStringArray(result); }
public void makeModule(final String modName, final Flags flags) { if (modName == null) { makeModules(myProject.getModules().values(), flags); } else { final Module module = myProject.getModules().get(modName); final List<Module> list = new ArrayList<Module>(); if (module == null) { System.err.println("Module \"" + modName + "\" not found in project \"" + myRoot + "\""); return; } list.add(module); makeModules(list, flags); } }
private boolean updateDependencies( CompileContext context, ModuleChunk chunk, List<File> toCompile, String moduleOutputPath, List<GroovycOSProcessHandler.OutputItem> successfullyCompiled) throws IOException { final Mappings delta = context.createDelta(); final List<File> successfullyCompiledFiles = new ArrayList<File>(); if (!successfullyCompiled.isEmpty()) { final Callbacks.Backend callback = delta.getCallback(); final FileGeneratedEvent generatedEvent = new FileGeneratedEvent(); for (GroovycOSProcessHandler.OutputItem item : successfullyCompiled) { final String sourcePath = FileUtil.toSystemIndependentName(item.sourcePath); final String outputPath = FileUtil.toSystemIndependentName(item.outputPath); final RootDescriptor moduleAndRoot = context.getModuleAndRoot(new File(sourcePath)); if (moduleAndRoot != null) { final String moduleName = moduleAndRoot.module.getName().toLowerCase(Locale.US); context .getDataManager() .getSourceToOutputMap(moduleName, moduleAndRoot.isTestRoot) .appendData(sourcePath, outputPath); } callback.associate( outputPath, Callbacks.getDefaultLookup(sourcePath), new ClassReader(FileUtil.loadFileBytes(new File(outputPath)))); successfullyCompiledFiles.add(new File(sourcePath)); generatedEvent.add( moduleOutputPath, FileUtil.getRelativePath(moduleOutputPath, outputPath, '/')); } context.processMessage(generatedEvent); } return updateMappings(context, delta, chunk, toCompile, successfullyCompiledFiles); }