/*
 * Copyright 2018 The Bazel Authors. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *    http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package com.google.idea.blaze.android.sync.importer;

import com.android.annotations.NonNull;
import com.google.idea.blaze.base.ideinfo.TargetMap;
import com.google.idea.blaze.base.model.BlazeProjectData;
import com.google.idea.blaze.base.model.primitives.WorkspaceRoot;
import com.google.idea.blaze.base.projectview.ProjectViewSet;
import com.google.idea.blaze.base.settings.Blaze;
import com.google.idea.blaze.base.settings.BuildSystemName;
import com.google.idea.blaze.base.sync.projectview.ProjectViewTargetImportFilter;
import com.google.idea.blaze.base.sync.workspace.ArtifactLocationDecoder;
import com.google.idea.blaze.java.sync.importer.JavaSourceFilter;
import com.intellij.openapi.project.Project;
import org.jetbrains.annotations.NotNull;

/** Inputs used for importing an Android project. */
public final class BlazeImportInput {

  public final @NonNull WorkspaceRoot workspaceRoot;
  public final @NonNull ProjectViewSet projectViewSet;
  public final @NonNull TargetMap targetMap;
  public final @NonNull ArtifactLocationDecoder artifactLocationDecoder;
  public final @NonNull BuildSystemName buildSystemName;

  public BlazeImportInput(
      @NonNull WorkspaceRoot workspaceRoot,
      @NonNull ProjectViewSet projectViewSet,
      @NonNull TargetMap targetMap,
      @NonNull ArtifactLocationDecoder artifactLocationDecoder,
      @NonNull BuildSystemName buildSystemName) {
    this.workspaceRoot = workspaceRoot;
    this.projectViewSet = projectViewSet;
    this.targetMap = targetMap;
    this.artifactLocationDecoder = artifactLocationDecoder;
    this.buildSystemName = buildSystemName;
  }

  public static BlazeImportInput forProject(
      @NonNull Project project,
      @NonNull WorkspaceRoot workspaceRoot,
      @NonNull ProjectViewSet projectViewSet,
      @NonNull BlazeProjectData projectData) {
    return forProject(
        project,
        workspaceRoot,
        projectViewSet,
        projectData.getTargetMap(),
        projectData.getArtifactLocationDecoder());
  }

  public static BlazeImportInput forProject(
      @NonNull Project project,
      @NonNull WorkspaceRoot workspaceRoot,
      @NonNull ProjectViewSet projectViewSet,
      @NonNull TargetMap targetMap,
      @NonNull ArtifactLocationDecoder artifactLocationDecoder) {
    return new BlazeImportInput(
        workspaceRoot,
        projectViewSet,
        targetMap,
        artifactLocationDecoder,
        Blaze.getBuildSystem(project));
  }

  @NotNull
  public JavaSourceFilter createSourceFilter() {
    return new JavaSourceFilter(buildSystemName, workspaceRoot, projectViewSet, targetMap);
  }

  @NotNull
  public ProjectViewTargetImportFilter createImportFilter() {
    return new ProjectViewTargetImportFilter(buildSystemName, workspaceRoot, projectViewSet);
  }
}

@@ -1458,24 +1458,33 @@
 tInput %7B%0A%0A  
+@NonNull 
 public final
@@ -1484,25 +1484,16 @@
 c final 
-@NonNull 
 Workspac
@@ -1511,24 +1511,33 @@
 paceRoot;%0A  
+@NonNull 
 public final
@@ -1537,25 +1537,16 @@
 c final 
-@NonNull 
 ProjectV
@@ -1566,24 +1566,33 @@
 tViewSet;%0A  
+@NonNull 
 public final
@@ -1592,25 +1592,16 @@
 c final 
-@NonNull 
 TargetMa
@@ -1611,24 +1611,33 @@
 argetMap;%0A  
+@NonNull 
 public final
@@ -1637,25 +1637,16 @@
 c final 
-@NonNull 
 Artifact
@@ -1688,16 +1688,25 @@
 oder;%0A  
+@NonNull 
 public f
@@ -1710,25 +1710,16 @@
 c final 
-@NonNull 
 BuildSys

Fix some java style warnings.