diff options
author | ulfjack <ulfjack@google.com> | 2017-07-19 14:54:42 +0200 |
---|---|---|
committer | Klaus Aehlig <aehlig@google.com> | 2017-07-19 16:49:52 +0200 |
commit | 9bdef4370fa952097509e413689597e8431fec4b (patch) | |
tree | 5f9ce7722aceb06ef761793e3bb53ee58370d4ad /src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java | |
parent | 286f1e9839f34efc910ce49f040bac23716f8520 (diff) |
Refactor TargetPatternPhaseFunction
- Make TargetPatternPhaseKey implement SkyKey
- Move the TargetParsingCompleteEvent posting into the function
- Split the time reporting out into TargetParsingPhaseTimeEvent
PiperOrigin-RevId: 162475743
Diffstat (limited to 'src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java')
-rw-r--r-- | src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java | 20 |
1 files changed, 15 insertions, 5 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java index 13b1556f22..d90db5018e 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/TargetPatternPhaseFunction.java @@ -27,10 +27,11 @@ import com.google.devtools.build.lib.pkgcache.CompileOneDependencyTransformer; import com.google.devtools.build.lib.pkgcache.FilteringPolicies; import com.google.devtools.build.lib.pkgcache.LoadingPhaseRunner; import com.google.devtools.build.lib.pkgcache.ParsingFailedEvent; +import com.google.devtools.build.lib.pkgcache.TargetParsingCompleteEvent; import com.google.devtools.build.lib.pkgcache.TargetProvider; import com.google.devtools.build.lib.pkgcache.TestFilter; import com.google.devtools.build.lib.skyframe.EnvironmentBackedRecursivePackageProvider.MissingDepException; -import com.google.devtools.build.lib.skyframe.TargetPatternPhaseValue.TargetPatternList; +import com.google.devtools.build.lib.skyframe.TargetPatternPhaseValue.TargetPatternPhaseKey; import com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternKey; import com.google.devtools.build.lib.skyframe.TargetPatternValue.TargetPatternSkyKeyOrException; import com.google.devtools.build.lib.util.Preconditions; @@ -54,7 +55,7 @@ final class TargetPatternPhaseFunction implements SkyFunction { @Override public TargetPatternPhaseValue compute(SkyKey key, Environment env) throws InterruptedException { - TargetPatternList options = (TargetPatternList) key.argument(); + TargetPatternPhaseKey options = (TargetPatternPhaseKey) key.argument(); PackageValue packageValue = null; boolean workspaceError = false; try { @@ -176,9 +177,18 @@ final class TargetPatternPhaseFunction implements SkyFunction { ResolvedTargets<Target> expandedTargets = expandedTargetsBuilder.build(); Set<Target> testSuiteTargets = Sets.difference(targets.getTargets(), expandedTargets.getTargets()); - return new TargetPatternPhaseValue(expandedTargets.getTargets(), testsToRun, preExpansionError, + TargetPatternPhaseValue result = new TargetPatternPhaseValue( + expandedTargets.getTargets(), testsToRun, preExpansionError, expandedTargets.hasError() || workspaceError, filteredTargets, testFilteredTargets, - targets.getTargets(), ImmutableSet.copyOf(testSuiteTargets), workspaceName); + ImmutableSet.copyOf(testSuiteTargets), workspaceName); + env.getListener().post( + new TargetParsingCompleteEvent( + targets.getTargets(), + result.getFilteredTargets(), + result.getTestFilteredTargets(), + options.getTargetPatterns(), + result.getTargets())); + return result; } /** @@ -187,7 +197,7 @@ final class TargetPatternPhaseFunction implements SkyFunction { * @param options the command-line arguments in structured form */ private static ResolvedTargets<Target> getTargetsToBuild( - Environment env, TargetPatternList options) throws InterruptedException { + Environment env, TargetPatternPhaseKey options) throws InterruptedException { List<TargetPatternKey> patternSkyKeys = new ArrayList<>(); for (TargetPatternSkyKeyOrException keyOrException : TargetPatternValue.keys( |