CreateManifestKeepList extends DefaultAndroidTask { @TaskAction public void generateKeepListFromManifest() throws ParserConfigurationException, SAXException, IOException { generateKeepListFromManifest(getManifest(), getOutputFile(), filter); }  @InputFile File getManifest(); void setManifest(File manifest); @OutputFile File getOutputFile(); void setOutputFile(File outputFile); @Deprecated void setFilter(@NonNull Filter filter); @TaskAction void generateKeepListFromManifest();  }
@Test public void generateKeepListFromManifestWithFilter() throws Exception { File manifest = temporaryFolder.newFile("AndroidManifest.xml"); Files.write(MANIFEST, manifest, Charsets.UTF_8); File unfilteredOutput = new File(temporaryFolder.newFolder(), "manifest_keep.txt"); CreateManifestKeepList.generateKeepListFromManifest( manifest, unfilteredOutput, null ); assertThat(Files.toString(unfilteredOutput, Charsets.UTF_8)).isEqualTo(EXPECTED_KEEP); File filteredOutput = new File(temporaryFolder.newFolder(), "manifest_keep.txt"); CreateManifestKeepList.generateKeepListFromManifest( manifest, filteredOutput, removeActivity("com.android.tests.flavored.OtherActivity")); assertThat(Files.toString(filteredOutput, Charsets.UTF_8)) .isEqualTo(EXPECTED_KEEP_FILTERED); }