use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class CsharpLibrary method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ProjectFilesystem filesystem = getProjectFilesystem();
ImmutableSortedSet<Path> sourceFiles = context.getSourcePathResolver().getAllAbsolutePaths(srcs);
ImmutableListMultimap.Builder<Path, String> resolvedResources = ImmutableListMultimap.builder();
for (Map.Entry<String, SourcePath> resource : resources.entrySet()) {
resolvedResources.put(context.getSourcePathResolver().getAbsolutePath(resource.getValue()), resource.getKey());
}
ImmutableList<Either<Path, String>> references = resolveReferences(context.getSourcePathResolver(), refs);
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new MakeCleanDirectoryStep(filesystem, output.getParent()));
steps.add(new CsharpLibraryCompile(filesystem.resolve(output), sourceFiles, references, resolvedResources.build(), version));
return steps.build();
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class WriteFile method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
buildableContext.recordArtifact(output);
ProjectFilesystem projectFilesystem = getProjectFilesystem();
return ImmutableList.of(new MkdirStep(projectFilesystem, output.getParent()), new WriteFileStep(projectFilesystem, ByteSource.wrap(fileContents), output, executable));
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class JsonConcatenate method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
buildableContext.recordArtifact(output);
ProjectFilesystem projectFilesystem = getProjectFilesystem();
return ImmutableList.<Step>builder().add(new MkdirStep(projectFilesystem, outputDirectory)).add(new JsonConcatenateStep(projectFilesystem, inputs, output, stepShortName, stepDescription)).build();
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class MiniAapt method verifyReferences.
@VisibleForTesting
ImmutableSet<RDotTxtEntry> verifyReferences(ProjectFilesystem filesystem, ImmutableSet<RDotTxtEntry> references) throws IOException {
ImmutableSet.Builder<RDotTxtEntry> unresolved = ImmutableSet.builder();
ImmutableSet.Builder<RDotTxtEntry> definitionsBuilder = ImmutableSet.builder();
definitionsBuilder.addAll(resourceCollector.getResources());
for (Path depRTxt : pathsToSymbolsOfDeps) {
Iterable<String> lines = FluentIterable.from(filesystem.readLines(depRTxt)).filter(input -> !Strings.isNullOrEmpty(input)).toList();
for (String line : lines) {
Optional<RDotTxtEntry> entry = RDotTxtEntry.parse(line);
Preconditions.checkState(entry.isPresent());
definitionsBuilder.add(entry.get());
}
}
Set<RDotTxtEntry> definitions = definitionsBuilder.build();
for (RDotTxtEntry reference : references) {
if (!definitions.contains(reference)) {
unresolved.add(reference);
}
}
return unresolved.build();
}
use of com.facebook.buck.io.ProjectFilesystem in project buck by facebook.
the class DoctorCommand method runWithoutHelp.
@Override
public int runWithoutHelp(CommandRunnerParams params) throws IOException, InterruptedException {
ProjectFilesystem filesystem = params.getCell().getFilesystem();
BuildLogHelper buildLogHelper = new BuildLogHelper(filesystem, params.getObjectMapper());
UserInput userInput = new UserInput(params.getConsole().getStdOut(), new BufferedReader(new InputStreamReader(params.getStdIn())));
DoctorReportHelper helper = new DoctorReportHelper(params.getCell().getFilesystem(), userInput, params.getConsole(), params.getObjectMapper(), params.getBuckConfig().getView(DoctorConfig.class));
Optional<BuildLogEntry> entry = helper.promptForBuild(new ArrayList<>(buildLogHelper.getBuildLogs()));
if (!entry.isPresent()) {
params.getConsole().getStdOut().println("No interesting commands found in buck-out/log.");
return 0;
}
Optional<DefectSubmitResult> rageResult = generateRageReport(params, userInput, entry.get());
if (!rageResult.isPresent()) {
params.getConsole().printErrorText("Failed to generate report to send.");
return 1;
}
DoctorEndpointRequest request = helper.generateEndpointRequest(entry.get(), rageResult.get());
DoctorEndpointResponse response = helper.uploadRequest(request);
helper.presentResponse(response);
helper.presentRageResult(rageResult);
return 0;
}
Aggregations