Search in sources :

Example 1 with IgnoredFileIndex

use of org.jetbrains.jps.indices.IgnoredFileIndex in project android by JetBrains.

the class AndroidResourcePackagingBuilder method doPackageResources.

private static boolean doPackageResources(@NotNull final CompileContext context, @NotNull File manifestFile, @NotNull IAndroidTarget target, @NotNull String[] resourceDirPaths, @NotNull String[] assetsDirPaths, @NotNull String outputPath, boolean releasePackage, @NotNull String moduleName, @NotNull BuildOutputConsumer outputConsumer, @Nullable String customManifestPackage, @Nullable String additionalParameters) {
    try {
        final IgnoredFileIndex ignoredFileIndex = context.getProjectDescriptor().getIgnoredFileIndex();
        final Map<AndroidCompilerMessageKind, List<String>> messages = AndroidApt.packageResources(target, -1, manifestFile.getPath(), resourceDirPaths, assetsDirPaths, outputPath, null, !releasePackage, 0, customManifestPackage, additionalParameters, new FileFilter() {

            @Override
            public boolean accept(File pathname) {
                return !ignoredFileIndex.isIgnored(PathUtilRt.getFileName(pathname.getPath()));
            }
        });
        AndroidJpsUtil.addMessages(context, messages, BUILDER_NAME, moduleName);
        final boolean success = messages.get(AndroidCompilerMessageKind.ERROR).size() == 0;
        if (success) {
            final List<String> srcFiles = new ArrayList<String>();
            srcFiles.add(manifestFile.getPath());
            fillRecursively(resourceDirPaths, srcFiles);
            fillRecursively(assetsDirPaths, srcFiles);
            outputConsumer.registerOutputFile(new File(outputPath), srcFiles);
        }
        return success;
    } catch (final IOException e) {
        AndroidJpsUtil.reportExceptionError(context, null, e, BUILDER_NAME);
        return false;
    }
}
Also used : IgnoredFileIndex(org.jetbrains.jps.indices.IgnoredFileIndex) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) AndroidCompilerMessageKind(org.jetbrains.android.util.AndroidCompilerMessageKind) IOException(java.io.IOException) FileFilter(java.io.FileFilter) File(java.io.File)

Aggregations

File (java.io.File)1 FileFilter (java.io.FileFilter)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 AndroidCompilerMessageKind (org.jetbrains.android.util.AndroidCompilerMessageKind)1 IgnoredFileIndex (org.jetbrains.jps.indices.IgnoredFileIndex)1