diff options
author | 2016-04-26 16:22:38 +0000 | |
---|---|---|
committer | 2016-04-27 11:47:20 +0000 | |
commit | e82713de767ea4f002f49ba75427698989c47edd (patch) | |
tree | 96ce693a26e062bda56e79435a655441569773fc /src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java | |
parent | 8b999982958d9b63321e6295f5a66d0d2ce7c925 (diff) |
Delete the interface NativeAspectFactory and make native aspects extend from NativeAspectClass.
This a large refactoring of the aspects, currently we have the following:
- AspectClasses: The interface AspectClass is a implemented by either
SkylarkAspectClass or NativeAspectClass<NativeAspectFactory>.
They are wrappers for the AspectFactories and they hold the information about
the Class<> of the factory.
- AspectFactories (FooAspect.java): Represented by the interfaces
ConfiguredAspectFactory and NativeAspectFactory, also by
the interface ConfiguredNativeAspectFactory which is the union of the two
aforementioned interfaces.
All aspects implement ConfiguredNativeAspectFactory except Skylark aspects
which implement only ConfiguredAspectFactory.
After this CL the distinction between NativeAspectFactories and NativeAspectClasses
dissappear, namely aspect that extends NativeAspectClass is considered native
and if it implements ConfiguredAspectFactory it is configured.
Therefore the interfaces NativeAspectFactory and ConfiguredNativeAspectFactory
both disappear.
With this refactoring the aspectFactoryMap in the ConfiguredRuleClassProvider
changes its type from (String -> Class<? extends NativeAspectClass>)
to (String -> NativeAspectClass) which means it is now able to have an instance
of the aspect instead of its Class only.
By doing this, it is now possible to pass parameters when creating an
aspect in the ConfiguredRuleClassProvider.
--
MOS_MIGRATED_REVID=120819647
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java')
-rw-r--r-- | src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java | 13 |
1 files changed, 6 insertions, 7 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java index 994ab41cd7..3376a21fb2 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewTestCase.java @@ -52,7 +52,6 @@ import com.google.devtools.build.lib.analysis.BlazeDirectories; import com.google.devtools.build.lib.analysis.BuildView; import com.google.devtools.build.lib.analysis.BuildView.AnalysisResult; import com.google.devtools.build.lib.analysis.CachingAnalysisEnvironment; -import com.google.devtools.build.lib.analysis.ConfiguredAspectFactory; import com.google.devtools.build.lib.analysis.ConfiguredAttributeMapper; import com.google.devtools.build.lib.analysis.ConfiguredRuleClassProvider; import com.google.devtools.build.lib.analysis.ConfiguredTarget; @@ -548,7 +547,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { return getGeneratingSpawnAction( Iterables.find(getFilesToBuild(target), artifactNamed(outputName))); } - + protected void simulateLoadingPhase() { try { ensureTargetsVisited(targetConfig.getAllLabels().values()); @@ -922,7 +921,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { * is creating an Artifact. */ protected Artifact getBinArtifact(String packageRelativePath, ConfiguredTarget owner, - Class<? extends ConfiguredAspectFactory> creatingAspectFactory) { + NativeAspectClass creatingAspectFactory) { return getPackageRelativeDerivedArtifact( packageRelativePath, owner.getConfiguration().getBinDirectory(), @@ -931,7 +930,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { owner.getLabel(), owner.getConfiguration(), owner.getConfiguration(), - new NativeAspectClass(creatingAspectFactory), + creatingAspectFactory, AspectParameters.EMPTY) .argument()); } @@ -988,7 +987,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { * is creating an Artifact. */ protected Artifact getGenfilesArtifact(String packageRelativePath, ConfiguredTarget owner, - Class<? extends ConfiguredAspectFactory> creatingAspectFactory) { + NativeAspectClass creatingAspectFactory) { return getGenfilesArtifact( packageRelativePath, owner, creatingAspectFactory, AspectParameters.EMPTY); } @@ -996,7 +995,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { protected Artifact getGenfilesArtifact( String packageRelativePath, ConfiguredTarget owner, - Class<? extends ConfiguredAspectFactory> creatingAspectFactory, + NativeAspectClass creatingAspectFactory, AspectParameters params) { return getPackageRelativeDerivedArtifact( packageRelativePath, @@ -1006,7 +1005,7 @@ public abstract class BuildViewTestCase extends FoundationTestCase { owner.getLabel(), owner.getConfiguration(), owner.getConfiguration(), - new NativeAspectClass(creatingAspectFactory), + creatingAspectFactory, params) .argument()); } |