diff options
Diffstat (limited to 'src/main/java/com/google/devtools/build')
3 files changed, 2 insertions, 80 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/packages/PackageLoadedEvent.java b/src/main/java/com/google/devtools/build/lib/packages/PackageLoadedEvent.java deleted file mode 100644 index 3dbf3c2677..0000000000 --- a/src/main/java/com/google/devtools/build/lib/packages/PackageLoadedEvent.java +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright 2014 Google Inc. 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.devtools.build.lib.packages; - -/** - * An event that is fired after a package is loaded. - */ -public final class PackageLoadedEvent { - private final String packageName; - private final long timeInMillis; - private final boolean reloading; - private final boolean successful; - - public PackageLoadedEvent(String packageName, long timeInMillis, boolean reloading, - boolean successful) { - this.packageName = packageName; - this.timeInMillis = timeInMillis; - this.reloading = reloading; - this.successful = successful; - } - - /** - * Returns the package name. - */ - public String getPackageName() { - return packageName; - } - - /** - * Returns time which was spent to load a package. - */ - public long getTimeInMillis() { - return timeInMillis; - } - - /** - * Returns true if package had been loaded before. - */ - public boolean isReloading() { - return reloading; - } - - /** - * Returns true if package was loaded successfully. - */ - public boolean isSuccessful() { - return successful; - } -} diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java index 8b354cdfa2..7a473f99b0 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/PackageFunction.java @@ -21,7 +21,6 @@ import com.google.common.collect.ImmutableSet; import com.google.common.collect.Iterables; import com.google.common.collect.Lists; import com.google.common.collect.Sets; -import com.google.common.eventbus.EventBus; import com.google.devtools.build.lib.Constants; import com.google.devtools.build.lib.events.Event; import com.google.devtools.build.lib.events.EventHandler; @@ -38,7 +37,6 @@ import com.google.devtools.build.lib.packages.PackageFactory; import com.google.devtools.build.lib.packages.PackageFactory.Globber; import com.google.devtools.build.lib.packages.PackageIdentifier; import com.google.devtools.build.lib.packages.PackageIdentifier.RepositoryName; -import com.google.devtools.build.lib.packages.PackageLoadedEvent; import com.google.devtools.build.lib.packages.Preprocessor; import com.google.devtools.build.lib.packages.RuleVisibility; import com.google.devtools.build.lib.packages.Target; @@ -53,8 +51,6 @@ import com.google.devtools.build.lib.syntax.Label; import com.google.devtools.build.lib.syntax.ParserInputSource; import com.google.devtools.build.lib.syntax.SkylarkEnvironment; import com.google.devtools.build.lib.syntax.Statement; -import com.google.devtools.build.lib.util.Clock; -import com.google.devtools.build.lib.util.JavaClock; import com.google.devtools.build.lib.util.Pair; import com.google.devtools.build.lib.vfs.Path; import com.google.devtools.build.lib.vfs.PathFragment; @@ -77,7 +73,6 @@ import java.util.Set; import java.util.concurrent.ConcurrentMap; import java.util.concurrent.atomic.AtomicBoolean; import java.util.concurrent.atomic.AtomicInteger; -import java.util.concurrent.atomic.AtomicReference; import javax.annotation.Nullable; @@ -91,7 +86,6 @@ public class PackageFunction implements SkyFunction { private final CachingPackageLocator packageLocator; private final ConcurrentMap<PackageIdentifier, Package.LegacyBuilder> packageFunctionCache; private final AtomicBoolean showLoadingProgress; - private final AtomicReference<EventBus> eventBus; private final AtomicInteger numPackagesLoaded; private final Profiler profiler = Profiler.instance(); @@ -108,14 +102,13 @@ public class PackageFunction implements SkyFunction { public PackageFunction(Reporter reporter, PackageFactory packageFactory, CachingPackageLocator pkgLocator, AtomicBoolean showLoadingProgress, ConcurrentMap<PackageIdentifier, Package.LegacyBuilder> packageFunctionCache, - AtomicReference<EventBus> eventBus, AtomicInteger numPackagesLoaded) { + AtomicInteger numPackagesLoaded) { this.reporter = reporter; this.packageFactory = packageFactory; this.packageLocator = pkgLocator; this.showLoadingProgress = showLoadingProgress; this.packageFunctionCache = packageFunctionCache; - this.eventBus = eventBus; this.numPackagesLoaded = numPackagesLoaded; } @@ -722,8 +715,6 @@ public class PackageFunction implements SkyFunction { : ParserInputSource.create(replacementContents, buildFilePath); Package.LegacyBuilder pkgBuilder = packageFunctionCache.get(packageId); if (pkgBuilder == null) { - Clock clock = new JavaClock(); - long startTime = clock.nanoTime(); profiler.startTask(ProfilerTask.CREATE_PACKAGE, packageId.toString()); try { Globber globber = packageFactory.createLegacyGlobber(buildFilePath.getParentDirectory(), @@ -737,15 +728,6 @@ public class PackageFunction implements SkyFunction { buildFilePath, preprocessingResult, localReporter.getEvents(), preludeStatements, importResult.importMap, importResult.fileDependencies, packageLocator, defaultVisibility, globber); - if (eventBus.get() != null) { - eventBus.get().post(new PackageLoadedEvent(packageId.toString(), - (clock.nanoTime() - startTime) / (1000 * 1000), - // It's impossible to tell if the package was loaded before, so we always pass false. - /*reloading=*/false, - // This isn't completely correct since we may encounter errors later (e.g. filesystem - // inconsistencies) - !pkgBuilder.containsErrors())); - } numPackagesLoaded.incrementAndGet(); packageFunctionCache.put(packageId, pkgBuilder); } finally { diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java index 49d702f1f7..f2ad498afd 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/SkyframeExecutor.java @@ -305,7 +305,7 @@ public abstract class SkyframeExecutor implements WalkableGraphFactory { map.put(SkyFunctions.RECURSIVE_PKG, new RecursivePkgFunction()); map.put(SkyFunctions.PACKAGE, new PackageFunction( reporter, pkgFactory, packageManager, showLoadingProgress, packageFunctionCache, - eventBus, numPackagesLoaded)); + numPackagesLoaded)); map.put(SkyFunctions.TARGET_MARKER, new TargetMarkerFunction()); map.put(SkyFunctions.TRANSITIVE_TARGET, new TransitiveTargetFunction()); map.put(SkyFunctions.CONFIGURED_TARGET, |