@Test public void textNonExclusion() throws IOException { setExcludes(ImmutableSet.of( FileUtils.join("foo", "text.properties"), FileUtils.join("bar", "other.properties"))); mFileFilter = new FileFilter( mPackagedJarExpansionSubStreams, mPackagingOptions); mFileFilter.handleChanged(mMergedFolder, createFile(mExpandedJar1, "foo/text.properties")); mFileFilter.handleChanged(mMergedFolder, createFile(mExpandedJar2, "bar/other.properties")); mFileFilter.handleChanged(mMergedFolder, createFile(mExpandedJar2, "bar/foo.properties")); assertMergedFilesCount(1); assertTrue(new File(mMergedFolder, "bar/foo.properties").exists()); }
void handleChanged(@NonNull File outputDir, @NonNull File changedFile) throws IOException { String archivePath = getArchivePath(changedFile); PackagingFileAction action = getPackagingAction(archivePath); switch (action) { case EXCLUDE: return; case MERGE: mergeAll(outputDir, archivePath); return; case PICK_FIRST: copy(changedFile, outputDir, archivePath); return; case NONE: copy(changedFile, outputDir, archivePath); } }
FileFilter implements ZipEntryFilter { void handleChanged(@NonNull File outputDir, @NonNull File changedFile) throws IOException { String archivePath = getArchivePath(changedFile); PackagingFileAction action = getPackagingAction(archivePath); switch (action) { case EXCLUDE: return; case MERGE: mergeAll(outputDir, archivePath); return; case PICK_FIRST: copy(changedFile, outputDir, archivePath); return; case NONE: copy(changedFile, outputDir, archivePath); } } }
FileFilter implements ZipEntryFilter { void handleChanged(@NonNull File outputDir, @NonNull File changedFile) throws IOException { String archivePath = getArchivePath(changedFile); PackagingFileAction action = getPackagingAction(archivePath); switch (action) { case EXCLUDE: return; case MERGE: mergeAll(outputDir, archivePath); return; case PICK_FIRST: copy(changedFile, outputDir, archivePath); return; case NONE: copy(changedFile, outputDir, archivePath); } } FileFilter(
            @NonNull List<SubStream> expandedFolders,
            @Nullable PackagingOptions packagingOptions); }
FileFilter implements ZipEntryFilter { void handleChanged(@NonNull File outputDir, @NonNull File changedFile) throws IOException { String archivePath = getArchivePath(changedFile); PackagingFileAction action = getPackagingAction(archivePath); switch (action) { case EXCLUDE: return; case MERGE: mergeAll(outputDir, archivePath); return; case PICK_FIRST: copy(changedFile, outputDir, archivePath); return; case NONE: copy(changedFile, outputDir, archivePath); } } FileFilter(
            @NonNull List<SubStream> expandedFolders,
            @Nullable PackagingOptions packagingOptions); @Override boolean checkEntry(@NonNull String archivePath); void handleRemoved(@NonNull File outputDir, @NonNull String removedFilePath); }
FileFilter implements ZipEntryFilter { void handleChanged(@NonNull File outputDir, @NonNull File changedFile) throws IOException { String archivePath = getArchivePath(changedFile); PackagingFileAction action = getPackagingAction(archivePath); switch (action) { case EXCLUDE: return; case MERGE: mergeAll(outputDir, archivePath); return; case PICK_FIRST: copy(changedFile, outputDir, archivePath); return; case NONE: copy(changedFile, outputDir, archivePath); } } FileFilter(
            @NonNull List<SubStream> expandedFolders,
            @Nullable PackagingOptions packagingOptions); @Override boolean checkEntry(@NonNull String archivePath); void handleRemoved(@NonNull File outputDir, @NonNull String removedFilePath);  }