@Test public void analyze_iteratesOverRootProject() throws Exception { ProjectAnalyzer analyzer = new ProjectAnalyzer(testProjectSuggesters, testSuggesters); File rootProject = TestUtils.getTestDataFile(ROOT_PROJECT); GradleContext appContext = GradleContext.builder() .setMinSdkVersion(15) .setOnDemand(false) .setPluginType(GradleContext.PluginType.APPLICATION) .setProguardConfigs( ImmutableMap.of( "release", ProguardConfig.builder() .setMinifyEnabled(false) .setHasProguardRules(true) .build())) .setAndroidPluginVersion(AndroidPluginVersion.create("3.4.0")) .setLibraryDependencies( ImmutableSet.of( Library.newBuilder() .setMavenLibrary( MavenLibrary.newBuilder() .setGroupId("com.google.inject") .setArtifactId("guice") .setVersion("3.0") .build()) .build(), Library.newBuilder() .setMavenLibrary( MavenLibrary.newBuilder() .setGroupId("com.android.support.constraint") .setArtifactId("constraint-layout") .setVersion("1.1.3") .build()) .build(), Library.newBuilder() .setMavenLibrary( MavenLibrary.newBuilder() .setGroupId("com.android.support") .setArtifactId("appcompat-v7") .setVersion("28.0.0") .build()) .build())) .setBundleConfig( BundleConfig.builder() .setBundleConfigLocation(BundleConfigLocation.builder().build()) .build()) .build(); Suggestion stubSuggestion = Suggestion.create( Suggestion.IssueType.WEBP, Suggestion.Category.WEBP, Payload.getDefaultInstance(), "Stub Suggestion", null, null); suggester.setEntrySuggestions( ImmutableMultimap.of( ContextAndEntryPath.create(appContext, "app/src/main/AndroidManifest.xml"), stubSuggestion)); ImmutableList<Suggestion> suggestions = analyzer.analyze(rootProject); assertThat(suggestions).containsExactly(stubSuggestion); assertThat(suggester.getAnalyzedEntries()) .containsExactlyElementsIn(filesUnderDirectory(rootProject.toPath())); }
@Override @CheckReturnValue public ImmutableList<Suggestion> analyze(File projectDirectory) { File buildFile = new File(projectDirectory, Project.BUILD_GRADLE); Project project = buildFile.exists() ? Project.create(projectDirectory, null) : null; return analyzeProject( projectDirectory, project, projectDirectory, projectSuggesters, suggesters); }
ProjectAnalyzer implements ArtifactAnalyzer { @Override @CheckReturnValue public ImmutableList<Suggestion> analyze(File projectDirectory) { File buildFile = new File(projectDirectory, Project.BUILD_GRADLE); Project project = buildFile.exists() ? Project.create(projectDirectory, null) : null; return analyzeProject( projectDirectory, project, projectDirectory, projectSuggesters, suggesters); } }
ProjectAnalyzer implements ArtifactAnalyzer { @Override @CheckReturnValue public ImmutableList<Suggestion> analyze(File projectDirectory) { File buildFile = new File(projectDirectory, Project.BUILD_GRADLE); Project project = buildFile.exists() ? Project.create(projectDirectory, null) : null; return analyzeProject( projectDirectory, project, projectDirectory, projectSuggesters, suggesters); } ProjectAnalyzer(
      ImmutableList<ProjectSuggester> projectSuggesters,
      ImmutableList<ProjectTreeSuggester> suggesters); }
ProjectAnalyzer implements ArtifactAnalyzer { @Override @CheckReturnValue public ImmutableList<Suggestion> analyze(File projectDirectory) { File buildFile = new File(projectDirectory, Project.BUILD_GRADLE); Project project = buildFile.exists() ? Project.create(projectDirectory, null) : null; return analyzeProject( projectDirectory, project, projectDirectory, projectSuggesters, suggesters); } ProjectAnalyzer(
      ImmutableList<ProjectSuggester> projectSuggesters,
      ImmutableList<ProjectTreeSuggester> suggesters); @Override @CheckReturnValue ImmutableList<Suggestion> analyze(File projectDirectory); }
ProjectAnalyzer implements ArtifactAnalyzer { @Override @CheckReturnValue public ImmutableList<Suggestion> analyze(File projectDirectory) { File buildFile = new File(projectDirectory, Project.BUILD_GRADLE); Project project = buildFile.exists() ? Project.create(projectDirectory, null) : null; return analyzeProject( projectDirectory, project, projectDirectory, projectSuggesters, suggesters); } ProjectAnalyzer(
      ImmutableList<ProjectSuggester> projectSuggesters,
      ImmutableList<ProjectTreeSuggester> suggesters); @Override @CheckReturnValue ImmutableList<Suggestion> analyze(File projectDirectory);  }