Search in sources :

Example 16 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class WriteStringTemplateRule method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    buildableContext.recordArtifact(output);
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    steps.add(new MkdirStep(getProjectFilesystem(), output.getParent()));
    steps.add(new StringTemplateStep(context.getSourcePathResolver().getAbsolutePath(template), getProjectFilesystem(), output, st -> {
        for (Map.Entry<String, String> ent : values.entrySet()) {
            st = st.add(ent.getKey(), ent.getValue());
        }
        return st;
    }));
    if (executable) {
        steps.add(new AbstractExecutionStep("chmod +x") {

            @Override
            public StepExecutionResult execute(ExecutionContext context) throws IOException {
                MoreFiles.makeExecutable(getProjectFilesystem().resolve(output));
                return StepExecutionResult.of(0, Optional.empty());
            }
        });
    }
    return steps.build();
}
Also used : ImmutableSortedSet(com.google.common.collect.ImmutableSortedSet) Step(com.facebook.buck.step.Step) ImmutableMap(com.google.common.collect.ImmutableMap) IOException(java.io.IOException) BuildTarget(com.facebook.buck.model.BuildTarget) MkdirStep(com.facebook.buck.step.fs.MkdirStep) StringTemplateStep(com.facebook.buck.step.fs.StringTemplateStep) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) ExecutionContext(com.facebook.buck.step.ExecutionContext) ImmutableList(com.google.common.collect.ImmutableList) Map(java.util.Map) Suppliers(com.google.common.base.Suppliers) Optional(java.util.Optional) MoreFiles(com.facebook.buck.io.MoreFiles) StepExecutionResult(com.facebook.buck.step.StepExecutionResult) Path(java.nio.file.Path) ExecutionContext(com.facebook.buck.step.ExecutionContext) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) StepExecutionResult(com.facebook.buck.step.StepExecutionResult) ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) Step(com.facebook.buck.step.Step) MkdirStep(com.facebook.buck.step.fs.MkdirStep) StringTemplateStep(com.facebook.buck.step.fs.StringTemplateStep) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) IOException(java.io.IOException) StringTemplateStep(com.facebook.buck.step.fs.StringTemplateStep)

Example 17 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class PreDexMerge method addMetadataWriteStep.

private void addMetadataWriteStep(final PreDexedFilesSorter.Result result, final ImmutableList.Builder<Step> steps, final Path metadataFilePath) {
    StringBuilder nameBuilder = new StringBuilder(30);
    final boolean isRootModule = result.apkModule.equals(apkModuleGraph.getRootAPKModule());
    final String storeId = result.apkModule.getName();
    nameBuilder.append("write_");
    if (!isRootModule) {
        nameBuilder.append(storeId);
        nameBuilder.append("_");
    }
    nameBuilder.append("metadata_txt");
    steps.add(new AbstractExecutionStep(nameBuilder.toString()) {

        @Override
        public StepExecutionResult execute(ExecutionContext executionContext) {
            Map<Path, DexWithClasses> metadataTxtEntries = result.metadataTxtDexEntries;
            List<String> lines = Lists.newArrayListWithCapacity(metadataTxtEntries.size());
            lines.add(".id " + storeId);
            if (isRootModule) {
                if (dexSplitMode.getDexStore() == DexStore.RAW) {
                    lines.add(".root_relative");
                }
            } else {
                for (APKModule dependency : apkModuleGraph.getGraph().getOutgoingNodesFor(result.apkModule)) {
                    lines.add(".requires " + dependency.getName());
                }
            }
            try {
                for (Map.Entry<Path, DexWithClasses> entry : metadataTxtEntries.entrySet()) {
                    Path pathToSecondaryDex = entry.getKey();
                    String containedClass = Iterables.get(entry.getValue().getClassNames(), 0);
                    containedClass = containedClass.replace('/', '.');
                    Sha1HashCode hash = getProjectFilesystem().computeSha1(pathToSecondaryDex);
                    lines.add(String.format("%s %s %s", pathToSecondaryDex.getFileName(), hash, containedClass));
                }
                getProjectFilesystem().writeLinesToPath(lines, metadataFilePath);
            } catch (IOException e) {
                executionContext.logError(e, "Failed when writing metadata.txt multi-dex.");
                return StepExecutionResult.ERROR;
            }
            return StepExecutionResult.SUCCESS;
        }
    });
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) StepExecutionResult(com.facebook.buck.step.StepExecutionResult) IOException(java.io.IOException) ExecutionContext(com.facebook.buck.step.ExecutionContext) Sha1HashCode(com.facebook.buck.util.sha1.Sha1HashCode) ImmutableList(com.google.common.collect.ImmutableList) List(java.util.List) Map(java.util.Map) ImmutableMap(com.google.common.collect.ImmutableMap) AbstractMap(java.util.AbstractMap)

Example 18 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class UnzipAar method getBuildSteps.

@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
    ImmutableList.Builder<Step> steps = ImmutableList.builder();
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), unpackDirectory));
    steps.add(new UnzipStep(getProjectFilesystem(), context.getSourcePathResolver().getAbsolutePath(aarFile), unpackDirectory));
    steps.add(new TouchStep(getProjectFilesystem(), getProguardConfig()));
    steps.add(new MkdirStep(getProjectFilesystem(), context.getSourcePathResolver().getAbsolutePath(getAssetsDirectory())));
    steps.add(new MkdirStep(getProjectFilesystem(), getNativeLibsDirectory()));
    steps.add(new TouchStep(getProjectFilesystem(), getTextSymbolsFile()));
    // We take the classes.jar file that is required to exist in an .aar and merge it with any
    // .jar files under libs/ into an "uber" jar. We do this for simplicity because we do not know
    // how many entries there are in libs/ at graph enhancement time, but we need to make sure
    // that all of the .class files in the .aar get packaged. As it is implemented today, an
    // android_library that depends on an android_prebuilt_aar can compile against anything in the
    // .aar's classes.jar or libs/.
    steps.add(new MkdirStep(getProjectFilesystem(), uberClassesJar.getParent()));
    steps.add(new AbstractExecutionStep("create_uber_classes_jar") {

        @Override
        public StepExecutionResult execute(ExecutionContext context) {
            Path libsDirectory = unpackDirectory.resolve("libs");
            boolean dirDoesNotExistOrIsEmpty;
            if (!getProjectFilesystem().exists(libsDirectory)) {
                dirDoesNotExistOrIsEmpty = true;
            } else {
                try {
                    dirDoesNotExistOrIsEmpty = getProjectFilesystem().getDirectoryContents(libsDirectory).isEmpty();
                } catch (IOException e) {
                    context.logError(e, "Failed to get directory contents of %s", libsDirectory);
                    return StepExecutionResult.ERROR;
                }
            }
            Path classesJar = unpackDirectory.resolve("classes.jar");
            JavacEventSinkToBuckEventBusBridge eventSink = new JavacEventSinkToBuckEventBusBridge(context.getBuckEventBus());
            if (!getProjectFilesystem().exists(classesJar)) {
                try {
                    JarDirectoryStepHelper.createEmptyJarFile(getProjectFilesystem(), classesJar, eventSink, context.getStdErr());
                } catch (IOException e) {
                    context.logError(e, "Failed to create empty jar %s", classesJar);
                    return StepExecutionResult.ERROR;
                }
            }
            if (dirDoesNotExistOrIsEmpty) {
                try {
                    getProjectFilesystem().copy(classesJar, uberClassesJar, ProjectFilesystem.CopySourceMode.FILE);
                } catch (IOException e) {
                    context.logError(e, "Failed to copy from %s to %s", classesJar, uberClassesJar);
                    return StepExecutionResult.ERROR;
                }
            } else {
                // Glob all of the contents from classes.jar and the entries in libs/ into a single JAR.
                ImmutableSortedSet.Builder<Path> entriesToJarBuilder = ImmutableSortedSet.naturalOrder();
                entriesToJarBuilder.add(classesJar);
                try {
                    entriesToJarBuilder.addAll(getProjectFilesystem().getDirectoryContents(libsDirectory));
                } catch (IOException e) {
                    context.logError(e, "Failed to get directory contents of %s", libsDirectory);
                    return StepExecutionResult.ERROR;
                }
                ImmutableSortedSet<Path> entriesToJar = entriesToJarBuilder.build();
                try {
                    JarDirectoryStepHelper.createJarFile(getProjectFilesystem(), uberClassesJar, entriesToJar, /* mainClass */
                    Optional.empty(), /* manifestFile */
                    Optional.empty(), /* mergeManifests */
                    true, /* blacklist */
                    ImmutableSet.of(), eventSink, context.getStdErr());
                } catch (IOException e) {
                    context.logError(e, "Failed to jar %s into %s", entriesToJar, uberClassesJar);
                    return StepExecutionResult.ERROR;
                }
            }
            return StepExecutionResult.SUCCESS;
        }
    });
    steps.add(new MakeCleanDirectoryStep(getProjectFilesystem(), pathToTextSymbolsDir));
    steps.add(new ExtractFromAndroidManifestStep(getAndroidManifest(), getProjectFilesystem(), buildableContext, METADATA_KEY_FOR_R_DOT_JAVA_PACKAGE, pathToRDotJavaPackageFile));
    steps.add(CopyStep.forFile(getProjectFilesystem(), getTextSymbolsFile(), pathToTextSymbolsFile));
    buildableContext.recordArtifact(unpackDirectory);
    buildableContext.recordArtifact(uberClassesJar);
    buildableContext.recordArtifact(pathToTextSymbolsFile);
    buildableContext.recordArtifact(pathToRDotJavaPackageFile);
    return steps.build();
}
Also used : SourcePath(com.facebook.buck.rules.SourcePath) Path(java.nio.file.Path) ExplicitBuildTargetSourcePath(com.facebook.buck.rules.ExplicitBuildTargetSourcePath) UnzipStep(com.facebook.buck.zip.UnzipStep) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) StepExecutionResult(com.facebook.buck.step.StepExecutionResult) ImmutableList(com.google.common.collect.ImmutableList) MkdirStep(com.facebook.buck.step.fs.MkdirStep) Step(com.facebook.buck.step.Step) CopyStep(com.facebook.buck.step.fs.CopyStep) UnzipStep(com.facebook.buck.zip.UnzipStep) MkdirStep(com.facebook.buck.step.fs.MkdirStep) AbstractExecutionStep(com.facebook.buck.step.AbstractExecutionStep) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep) TouchStep(com.facebook.buck.step.fs.TouchStep) TouchStep(com.facebook.buck.step.fs.TouchStep) IOException(java.io.IOException) JavacEventSinkToBuckEventBusBridge(com.facebook.buck.jvm.java.JavacEventSinkToBuckEventBusBridge) ExecutionContext(com.facebook.buck.step.ExecutionContext) ImmutableSortedSet(com.google.common.collect.ImmutableSortedSet) MakeCleanDirectoryStep(com.facebook.buck.step.fs.MakeCleanDirectoryStep)

Example 19 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class JavaBuildGraphProcessor method run.

/**
   * Creates the appropriate target graph and other resources needed for the {@link Processor} and
   * runs it. This method will take responsibility for cleaning up the executor service after it
   * runs.
   */
static void run(final CommandRunnerParams params, final AbstractCommand command, final Processor processor) throws ExitCodeException, InterruptedException, IOException {
    final ConcurrencyLimit concurrencyLimit = command.getConcurrencyLimit(params.getBuckConfig());
    try (CommandThreadManager pool = new CommandThreadManager(command.getClass().getName(), concurrencyLimit)) {
        Cell cell = params.getCell();
        WeightedListeningExecutorService executorService = pool.getExecutor();
        // Ideally, we should be able to construct the TargetGraph quickly assuming most of it is
        // already in memory courtesy of buckd. Though we could make a performance optimization where
        // we pass an option to buck.py that tells it to ignore reading the BUCK.autodeps files when
        // parsing the BUCK files because we never need to consider the existing auto-generated deps
        // when creating the new auto-generated deps. If we did so, we would have to make sure to keep
        // the nodes for that version of the graph separate from the ones that are actually used for
        // building.
        TargetGraph graph;
        try {
            graph = params.getParser().buildTargetGraphForTargetNodeSpecs(params.getBuckEventBus(), cell, command.getEnableParserProfiling(), executorService, ImmutableList.of(TargetNodePredicateSpec.of(x -> true, BuildFileSpec.fromRecursivePath(Paths.get(""), cell.getRoot()))), /* ignoreBuckAutodepsFiles */
            true).getTargetGraph();
        } catch (BuildTargetException | BuildFileParseException e) {
            params.getBuckEventBus().post(ConsoleEvent.severe(MoreExceptions.getHumanReadableOrLocalizedMessage(e)));
            throw new ExitCodeException(1);
        }
        BuildRuleResolver buildRuleResolver = new BuildRuleResolver(graph, new DefaultTargetNodeToBuildRuleTransformer());
        CachingBuildEngineBuckConfig cachingBuildEngineBuckConfig = params.getBuckConfig().getView(CachingBuildEngineBuckConfig.class);
        LocalCachingBuildEngineDelegate cachingBuildEngineDelegate = new LocalCachingBuildEngineDelegate(params.getFileHashCache());
        BuildEngine buildEngine = new CachingBuildEngine(cachingBuildEngineDelegate, executorService, executorService, new DefaultStepRunner(), CachingBuildEngine.BuildMode.SHALLOW, cachingBuildEngineBuckConfig.getBuildDepFiles(), cachingBuildEngineBuckConfig.getBuildMaxDepFileCacheEntries(), cachingBuildEngineBuckConfig.getBuildArtifactCacheSizeLimit(), params.getObjectMapper(), buildRuleResolver, cachingBuildEngineBuckConfig.getResourceAwareSchedulingInfo(), new RuleKeyFactoryManager(params.getBuckConfig().getKeySeed(), fs -> cachingBuildEngineDelegate.getFileHashCache(), buildRuleResolver, cachingBuildEngineBuckConfig.getBuildInputRuleKeyFileSizeLimit(), new DefaultRuleKeyCache<>()));
        // Create a BuildEngine because we store symbol information as build artifacts.
        BuckEventBus eventBus = params.getBuckEventBus();
        ExecutionContext executionContext = ExecutionContext.builder().setConsole(params.getConsole()).setConcurrencyLimit(concurrencyLimit).setBuckEventBus(eventBus).setEnvironment(/* environment */
        ImmutableMap.of()).setExecutors(ImmutableMap.<ExecutorPool, ListeningExecutorService>of(ExecutorPool.CPU, executorService)).setJavaPackageFinder(params.getJavaPackageFinder()).setObjectMapper(params.getObjectMapper()).setPlatform(params.getPlatform()).setCellPathResolver(params.getCell().getCellPathResolver()).build();
        SourcePathResolver pathResolver = new SourcePathResolver(new SourcePathRuleFinder(buildRuleResolver));
        BuildEngineBuildContext buildContext = BuildEngineBuildContext.builder().setBuildContext(BuildContext.builder().setActionGraph(new ActionGraph(ImmutableList.of())).setSourcePathResolver(pathResolver).setJavaPackageFinder(executionContext.getJavaPackageFinder()).setEventBus(eventBus).build()).setClock(params.getClock()).setArtifactCache(params.getArtifactCacheFactory().newInstance()).setBuildId(eventBus.getBuildId()).setObjectMapper(params.getObjectMapper()).setEnvironment(executionContext.getEnvironment()).setKeepGoing(false).build();
        // Traverse the TargetGraph to find all of the auto-generated dependencies.
        JavaDepsFinder javaDepsFinder = JavaDepsFinder.createJavaDepsFinder(params.getBuckConfig(), params.getCell().getCellPathResolver(), params.getObjectMapper(), buildContext, executionContext, buildEngine);
        processor.process(graph, javaDepsFinder, executorService);
    }
}
Also used : BuckEventBus(com.facebook.buck.event.BuckEventBus) ActionGraph(com.facebook.buck.rules.ActionGraph) TargetNodePredicateSpec(com.facebook.buck.parser.TargetNodePredicateSpec) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) MoreExceptions(com.facebook.buck.util.MoreExceptions) ConsoleEvent(com.facebook.buck.event.ConsoleEvent) ExecutionContext(com.facebook.buck.step.ExecutionContext) ImmutableList(com.google.common.collect.ImmutableList) LocalCachingBuildEngineDelegate(com.facebook.buck.rules.LocalCachingBuildEngineDelegate) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) DefaultStepRunner(com.facebook.buck.step.DefaultStepRunner) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) ConcurrencyLimit(com.facebook.buck.util.concurrent.ConcurrencyLimit) CachingBuildEngineBuckConfig(com.facebook.buck.rules.CachingBuildEngineBuckConfig) BuildFileParseException(com.facebook.buck.json.BuildFileParseException) Cell(com.facebook.buck.rules.Cell) WeightedListeningExecutorService(com.facebook.buck.util.concurrent.WeightedListeningExecutorService) BuildFileSpec(com.facebook.buck.parser.BuildFileSpec) DefaultRuleKeyCache(com.facebook.buck.rules.keys.DefaultRuleKeyCache) ImmutableMap(com.google.common.collect.ImmutableMap) TargetGraph(com.facebook.buck.rules.TargetGraph) BuildTargetException(com.facebook.buck.model.BuildTargetException) IOException(java.io.IOException) CachingBuildEngine(com.facebook.buck.rules.CachingBuildEngine) JavaDepsFinder(com.facebook.buck.jvm.java.autodeps.JavaDepsFinder) BuildEngineBuildContext(com.facebook.buck.rules.BuildEngineBuildContext) Paths(java.nio.file.Paths) ExecutorPool(com.facebook.buck.step.ExecutorPool) BuildEngine(com.facebook.buck.rules.BuildEngine) BuildContext(com.facebook.buck.rules.BuildContext) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) RuleKeyFactoryManager(com.facebook.buck.rules.keys.RuleKeyFactoryManager) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) BuckEventBus(com.facebook.buck.event.BuckEventBus) JavaDepsFinder(com.facebook.buck.jvm.java.autodeps.JavaDepsFinder) DefaultRuleKeyCache(com.facebook.buck.rules.keys.DefaultRuleKeyCache) TargetGraph(com.facebook.buck.rules.TargetGraph) RuleKeyFactoryManager(com.facebook.buck.rules.keys.RuleKeyFactoryManager) WeightedListeningExecutorService(com.facebook.buck.util.concurrent.WeightedListeningExecutorService) BuildFileParseException(com.facebook.buck.json.BuildFileParseException) BuildRuleResolver(com.facebook.buck.rules.BuildRuleResolver) DefaultStepRunner(com.facebook.buck.step.DefaultStepRunner) BuildEngineBuildContext(com.facebook.buck.rules.BuildEngineBuildContext) DefaultTargetNodeToBuildRuleTransformer(com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer) Cell(com.facebook.buck.rules.Cell) BuildTargetException(com.facebook.buck.model.BuildTargetException) ConcurrencyLimit(com.facebook.buck.util.concurrent.ConcurrencyLimit) LocalCachingBuildEngineDelegate(com.facebook.buck.rules.LocalCachingBuildEngineDelegate) ActionGraph(com.facebook.buck.rules.ActionGraph) CachingBuildEngine(com.facebook.buck.rules.CachingBuildEngine) SourcePathResolver(com.facebook.buck.rules.SourcePathResolver) SourcePathRuleFinder(com.facebook.buck.rules.SourcePathRuleFinder) CachingBuildEngine(com.facebook.buck.rules.CachingBuildEngine) BuildEngine(com.facebook.buck.rules.BuildEngine) ExecutionContext(com.facebook.buck.step.ExecutionContext) ExecutorPool(com.facebook.buck.step.ExecutorPool) WeightedListeningExecutorService(com.facebook.buck.util.concurrent.WeightedListeningExecutorService) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) CachingBuildEngineBuckConfig(com.facebook.buck.rules.CachingBuildEngineBuckConfig)

Example 20 with ExecutionContext

use of com.facebook.buck.step.ExecutionContext in project buck by facebook.

the class CachingBuildEngine method processBuildRule.

private ListenableFuture<BuildResult> processBuildRule(final BuildRule rule, final BuildEngineBuildContext buildContext, final ExecutionContext executionContext, final OnDiskBuildInfo onDiskBuildInfo, final BuildInfoRecorder buildInfoRecorder, final BuildableContext buildableContext, final ConcurrentLinkedQueue<ListenableFuture<Void>> asyncCallbacks) {
    // If we've already seen a failure, exit early.
    if (!buildContext.isKeepGoing() && firstFailure != null) {
        return Futures.immediateFuture(BuildResult.canceled(rule, firstFailure));
    }
    final RuleKeyFactories ruleKeyFactory = ruleKeyFactories.apply(rule.getProjectFilesystem());
    try (BuildRuleEvent.Scope scope = BuildRuleEvent.resumeSuspendScope(buildContext.getEventBus(), rule, buildRuleDurationTracker, ruleKeyFactory.getDefaultRuleKeyFactory())) {
        // 1. Check if it's already built.
        Optional<RuleKey> cachedRuleKey = onDiskBuildInfo.getRuleKey(BuildInfo.MetadataKey.RULE_KEY);
        final RuleKey defaultRuleKey = ruleKeyFactory.getDefaultRuleKeyFactory().build(rule);
        if (defaultRuleKey.equals(cachedRuleKey.orElse(null))) {
            return Futures.transform(markRuleAsUsed(rule, buildContext.getEventBus()), Functions.constant(BuildResult.success(rule, BuildRuleSuccessType.MATCHING_RULE_KEY, CacheResult.localKeyUnchangedHit())));
        }
        // 2. Rule key cache lookup.
        ListenableFuture<CacheResult> rulekeyCacheResult = cacheActivityService.submit(() -> {
            CacheResult cacheResult = tryToFetchArtifactFromBuildCacheAndOverlayOnTopOfProjectFilesystem(rule, defaultRuleKey, buildContext.getArtifactCache(), // TODO(shs96c): This should be a shared between all tests, not one per cell
            rule.getProjectFilesystem(), buildContext);
            if (cacheResult.getType().isSuccess()) {
                fillMissingBuildMetadataFromCache(cacheResult, buildInfoRecorder, BuildInfo.MetadataKey.INPUT_BASED_RULE_KEY, BuildInfo.MetadataKey.DEP_FILE_RULE_KEY, BuildInfo.MetadataKey.DEP_FILE);
            }
            return cacheResult;
        }, CACHE_CHECK_RESOURCE_AMOUNTS);
        return Futures.transformAsync(rulekeyCacheResult, ruleAsyncFunction(rule, buildContext.getEventBus(), (cacheResult) -> handleRuleKeyCacheResult(rule, buildContext, executionContext, onDiskBuildInfo, buildInfoRecorder, buildableContext, asyncCallbacks, ruleKeyFactory, cacheResult)), serviceByAdjustingDefaultWeightsTo(SCHEDULING_MORE_WORK_RESOURCE_AMOUNTS));
    }
}
Also used : OptionalCompat(com.facebook.buck.util.OptionalCompat) NoSuchFileException(java.nio.file.NoSuchFileException) GZIPInputStream(java.util.zip.GZIPInputStream) ArtifactCache(com.facebook.buck.artifact_cache.ArtifactCache) BufferedInputStream(java.io.BufferedInputStream) StepRunner(com.facebook.buck.step.StepRunner) BuckEvent(com.facebook.buck.event.BuckEvent) RuleKeyCalculationEvent(com.facebook.buck.event.RuleKeyCalculationEvent) ObjectMappers(com.facebook.buck.util.ObjectMappers) MoreFutures(com.facebook.buck.util.concurrent.MoreFutures) SettableFuture(com.google.common.util.concurrent.SettableFuture) ArtifactCompressionEvent(com.facebook.buck.event.ArtifactCompressionEvent) ProjectFilesystem(com.facebook.buck.io.ProjectFilesystem) RuleKeyAndInputs(com.facebook.buck.rules.keys.RuleKeyAndInputs) Map(java.util.Map) RuleKeyFactories(com.facebook.buck.rules.keys.RuleKeyFactories) TypeReference(com.fasterxml.jackson.core.type.TypeReference) ArtifactInfo(com.facebook.buck.artifact_cache.ArtifactInfo) Path(java.nio.file.Path) WeightedListeningExecutorService(com.facebook.buck.util.concurrent.WeightedListeningExecutorService) Function(com.google.common.base.Function) ImmutableSet(com.google.common.collect.ImmutableSet) ImmutableMap(com.google.common.collect.ImmutableMap) Set(java.util.Set) SizeLimiter(com.facebook.buck.rules.keys.SizeLimiter) DefaultFileHashCache(com.facebook.buck.util.cache.DefaultFileHashCache) BuildTarget(com.facebook.buck.model.BuildTarget) Sets(com.google.common.collect.Sets) List(java.util.List) Stream(java.util.stream.Stream) StepFailedException(com.facebook.buck.step.StepFailedException) LazyPath(com.facebook.buck.io.LazyPath) ByteStreams(com.google.common.io.ByteStreams) DependencyFileEntry(com.facebook.buck.rules.keys.DependencyFileEntry) Optional(java.util.Optional) GZIPOutputStream(java.util.zip.GZIPOutputStream) MoreFunctions(com.facebook.buck.util.MoreFunctions) RuleKeyFactoryManager(com.facebook.buck.rules.keys.RuleKeyFactoryManager) ListeningExecutorService(com.google.common.util.concurrent.ListeningExecutorService) ConcurrentLinkedQueue(java.util.concurrent.ConcurrentLinkedQueue) BuckEventBus(com.facebook.buck.event.BuckEventBus) ProjectFileHashCache(com.facebook.buck.util.cache.ProjectFileHashCache) MoreExecutors(com.google.common.util.concurrent.MoreExecutors) Step(com.facebook.buck.step.Step) ListenableFuture(com.google.common.util.concurrent.ListenableFuture) AtomicReference(java.util.concurrent.atomic.AtomicReference) ConsoleEvent(com.facebook.buck.event.ConsoleEvent) BufferedOutputStream(java.io.BufferedOutputStream) ArrayList(java.util.ArrayList) ConcurrentMap(java.util.concurrent.ConcurrentMap) ExecutionContext(com.facebook.buck.step.ExecutionContext) Lists(com.google.common.collect.Lists) ImmutableList(com.google.common.collect.ImmutableList) ThrowableConsoleEvent(com.facebook.buck.event.ThrowableConsoleEvent) ResourceAmounts(com.facebook.buck.util.concurrent.ResourceAmounts) Atomics(com.google.common.util.concurrent.Atomics) Nonnull(javax.annotation.Nonnull) ImmutableSortedMap(com.google.common.collect.ImmutableSortedMap) Nullable(javax.annotation.Nullable) SupportsInputBasedRuleKey(com.facebook.buck.rules.keys.SupportsInputBasedRuleKey) MoreCollectors(com.facebook.buck.util.MoreCollectors) OutputStream(java.io.OutputStream) Logger(com.facebook.buck.log.Logger) Functions(com.google.common.base.Functions) CacheResultType(com.facebook.buck.artifact_cache.CacheResultType) Files(java.nio.file.Files) HashCode(com.google.common.hash.HashCode) ObjectMapper(com.fasterxml.jackson.databind.ObjectMapper) Throwables(com.google.common.base.Throwables) IOException(java.io.IOException) HumanReadableException(com.facebook.buck.util.HumanReadableException) Maps(com.google.common.collect.Maps) FutureCallback(com.google.common.util.concurrent.FutureCallback) ExecutionException(java.util.concurrent.ExecutionException) ContextualProcessExecutor(com.facebook.buck.util.ContextualProcessExecutor) Futures(com.google.common.util.concurrent.Futures) BorrowablePath(com.facebook.buck.io.BorrowablePath) Paths(java.nio.file.Paths) CacheResult(com.facebook.buck.artifact_cache.CacheResult) FileHashCache(com.facebook.buck.util.cache.FileHashCache) Unzip(com.facebook.buck.zip.Unzip) Preconditions(com.google.common.base.Preconditions) AsyncFunction(com.google.common.util.concurrent.AsyncFunction) VisibleForTesting(com.google.common.annotations.VisibleForTesting) MoreFiles(com.facebook.buck.io.MoreFiles) SupportsDependencyFileRuleKey(com.facebook.buck.rules.keys.SupportsDependencyFileRuleKey) Collections(java.util.Collections) InputStream(java.io.InputStream) RuleKeyFactories(com.facebook.buck.rules.keys.RuleKeyFactories) SupportsInputBasedRuleKey(com.facebook.buck.rules.keys.SupportsInputBasedRuleKey) SupportsDependencyFileRuleKey(com.facebook.buck.rules.keys.SupportsDependencyFileRuleKey) CacheResult(com.facebook.buck.artifact_cache.CacheResult)

Aggregations

ExecutionContext (com.facebook.buck.step.ExecutionContext)176 TestExecutionContext (com.facebook.buck.step.TestExecutionContext)140 Test (org.junit.Test)128 Path (java.nio.file.Path)79 FakeProjectFilesystem (com.facebook.buck.testutil.FakeProjectFilesystem)67 ProjectFilesystem (com.facebook.buck.io.ProjectFilesystem)66 SourcePathResolver (com.facebook.buck.rules.SourcePathResolver)55 SourcePathRuleFinder (com.facebook.buck.rules.SourcePathRuleFinder)50 BuildRuleResolver (com.facebook.buck.rules.BuildRuleResolver)45 DefaultTargetNodeToBuildRuleTransformer (com.facebook.buck.rules.DefaultTargetNodeToBuildRuleTransformer)44 Step (com.facebook.buck.step.Step)34 ImmutableList (com.google.common.collect.ImmutableList)32 BuildTarget (com.facebook.buck.model.BuildTarget)31 SourcePath (com.facebook.buck.rules.SourcePath)26 TestConsole (com.facebook.buck.testutil.TestConsole)25 FakeProcess (com.facebook.buck.util.FakeProcess)21 ProcessExecutorParams (com.facebook.buck.util.ProcessExecutorParams)20 ImmutableMap (com.google.common.collect.ImmutableMap)20 MakeCleanDirectoryStep (com.facebook.buck.step.fs.MakeCleanDirectoryStep)19 FakeProcessExecutor (com.facebook.buck.util.FakeProcessExecutor)19