use of org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList in project buck by facebook.
the class CsharpLibrary method resolveReferences.
private ImmutableList<Either<Path, String>> resolveReferences(SourcePathResolver pathResolver, ImmutableList<Either<BuildRule, String>> refs) {
ImmutableList.Builder<Either<Path, String>> resolved = ImmutableList.builder();
for (Either<BuildRule, String> ref : refs) {
if (ref.isLeft()) {
// TODO(shs96c): Do this in the constructor? Or the Description?
BuildRule rule = ref.getLeft();
Preconditions.checkArgument(rule instanceof CsharpLibrary || rule instanceof PrebuiltDotnetLibrary);
SourcePath outputPath = Preconditions.checkNotNull(rule.getSourcePathToOutput());
resolved.add(Either.ofLeft(pathResolver.getAbsolutePath(outputPath)));
} else {
resolved.add(Either.ofRight(ref.getRight()));
}
}
return resolved.build();
}
use of org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList 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 org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList in project buck by facebook.
the class PrebuiltDotnetLibrary method getBuildSteps.
@Override
public ImmutableList<Step> getBuildSteps(BuildContext context, BuildableContext buildableContext) {
ImmutableList.Builder<Step> steps = ImmutableList.builder();
steps.add(new RmStep(getProjectFilesystem(), output));
steps.add(new MkdirStep(getProjectFilesystem(), output.getParent()));
steps.add(CopyStep.forFile(getProjectFilesystem(), getResolver().getAbsolutePath(assembly), output));
return steps.build();
}
use of org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList in project buck by facebook.
the class PublicAnnouncementManager method getAndPostAnnouncements.
public void getAndPostAnnouncements() {
final ListenableFuture<ImmutableList<Announcement>> message = service.submit(() -> {
Optional<ClientSideSlb> slb = logConfig.getFrontendConfig().tryCreatingClientSideSlb(clock, eventBus, new CommandThreadFactory("PublicAnnouncement"));
if (slb.isPresent()) {
try (FrontendService frontendService = new FrontendService(ThriftOverHttpServiceConfig.of(new LoadBalancedService(slb.get(), logConfig.createOkHttpClient(), eventBus)))) {
AnnouncementRequest announcementRequest = new AnnouncementRequest();
announcementRequest.setBuckVersion(getBuckVersion());
announcementRequest.setRepository(repository);
FrontendRequest request = new FrontendRequest();
request.setType(FrontendRequestType.ANNOUNCEMENT);
request.setAnnouncementRequest(announcementRequest);
FrontendResponse response = frontendService.makeRequest(request);
return ImmutableList.copyOf(response.announcementResponse.announcements);
} catch (IOException e) {
throw new HumanReadableException("Failed to perform request", e);
}
} else {
throw new HumanReadableException("Failed to establish connection to server.");
}
});
Futures.addCallback(message, new FutureCallback<ImmutableList<Announcement>>() {
@Override
public void onSuccess(ImmutableList<Announcement> announcements) {
LOG.info("Public announcements fetched successfully.");
if (!announcements.isEmpty()) {
String announcement = HEADER_MSG;
for (Announcement entry : announcements) {
announcement = announcement.concat(String.format(ANNOUNCEMENT_TEMPLATE, entry.getErrorMessage(), entry.getSolutionMessage()));
}
consoleEventBusListener.setPublicAnnouncements(eventBus, Optional.of(announcement));
}
}
@Override
public void onFailure(Throwable t) {
LOG.warn("Failed to get public announcements. Reason: %s", t.getMessage());
}
});
}
use of org.apache.flink.shaded.guava30.com.google.common.collect.ImmutableList in project buck by facebook.
the class GoAssembleStep method getShellCommandInternal.
@Override
protected ImmutableList<String> getShellCommandInternal(ExecutionContext context) {
ImmutableList.Builder<String> commandBuilder = ImmutableList.<String>builder().addAll(asmCommandPrefix).add("-trimpath", workingDirectory.toString()).addAll(flags).add("-D", "GOOS_" + platform.getGoOs()).add("-D", "GOARCH_" + platform.getGoArch()).add("-o", output.toString());
for (Path dir : includeDirectories) {
commandBuilder.add("-I", dir.toString());
}
commandBuilder.add(src.toString());
return commandBuilder.build();
}
Aggregations