Store data about aspect configurations on Dependencies.

Dependencies are the data structure which needs to propagate the configuration for each
aspect as created by trimConfigurations down to the point where it's actually used. We
need this to store different configurations for different aspects in a world where aspects
have their own configurations, which may have more fragments than the target they're
attached to.

That world is on its way.

Also in this CL:
* Refactor Dependency to be an abstract parent class with separate implementations for
  Attribute.Transitions and BuildConfigurations, as well as null configurations, to avoid
  having to check nullness in various places. Users of the API will not see this, but get
  factory methods instead of constructors. As a consequence of this, refactor Dependency
  to be its own top-level class instead of a nested class in DependencyResolver.

--
MOS_MIGRATED_REVID=113109615
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
index 64dd49d..d09f6fe0 100644
--- a/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
+++ b/src/test/java/com/google/devtools/build/lib/analysis/BuildViewTest.java
@@ -37,8 +37,6 @@
 import com.google.devtools.build.lib.actions.Artifact;
 import com.google.devtools.build.lib.actions.FailAction;
 import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult;
-import com.google.devtools.build.lib.analysis.DependencyResolver.Dependency;
-import com.google.devtools.build.lib.analysis.config.BuildConfiguration;
 import com.google.devtools.build.lib.analysis.config.InvalidConfigurationException;
 import com.google.devtools.build.lib.analysis.util.BuildViewTestBase;
 import com.google.devtools.build.lib.cmdline.Label;
@@ -330,26 +328,23 @@
     Dependency fileDependency;
     if (top.getConfiguration().useDynamicConfigurations()) {
       innerDependency =
-          new Dependency(
+          Dependency.withTransitionAndAspects(
               Label.parseAbsolute("//package:inner"),
               Attribute.ConfigurationTransition.NONE,
               ImmutableSet.<Aspect>of());
       fileDependency =
-          new Dependency(
+          Dependency.withTransitionAndAspects(
               Label.parseAbsolute("//package:file"),
               Attribute.ConfigurationTransition.NONE,
               ImmutableSet.<Aspect>of());
     } else {
       innerDependency =
-          new Dependency(
+          Dependency.withConfiguration(
               Label.parseAbsolute("//package:inner"),
-              getTargetConfiguration(),
-              ImmutableSet.<Aspect>of());
+              getTargetConfiguration());
       fileDependency =
-          new Dependency(
-              Label.parseAbsolute("//package:file"),
-              (BuildConfiguration) null,
-              ImmutableSet.<Aspect>of());
+          Dependency.withNullConfiguration(
+              Label.parseAbsolute("//package:file"));
     }
 
     assertThat(targets).containsExactly(innerDependency, fileDependency);