Search in sources :

Example 1 with BuildJobStateBuckConfig

use of com.facebook.buck.distributed.thrift.BuildJobStateBuckConfig in project buck by facebook.

the class DistBuildCellIndexer method dumpConfig.

private static BuildJobStateBuckConfig dumpConfig(BuckConfig buckConfig) {
    BuildJobStateBuckConfig jobState = new BuildJobStateBuckConfig();
    jobState.setUserEnvironment(buckConfig.getEnvironment());
    Map<String, List<OrderedStringMapEntry>> rawConfig = Maps.transformValues(buckConfig.getRawConfigForDistBuild(), input -> {
        List<OrderedStringMapEntry> result = new ArrayList<>();
        for (Map.Entry<String, String> entry : input.entrySet()) {
            result.add(new OrderedStringMapEntry(entry.getKey(), entry.getValue()));
        }
        return result;
    });
    jobState.setRawBuckConfig(rawConfig);
    jobState.setArchitecture(buckConfig.getArchitecture().name());
    jobState.setPlatform(buckConfig.getPlatform().name());
    return jobState;
}
Also used : OrderedStringMapEntry(com.facebook.buck.distributed.thrift.OrderedStringMapEntry) BuildJobStateBuckConfig(com.facebook.buck.distributed.thrift.BuildJobStateBuckConfig) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List) HashMap(java.util.HashMap) Map(java.util.Map)

Example 2 with BuildJobStateBuckConfig

use of com.facebook.buck.distributed.thrift.BuildJobStateBuckConfig in project buck by facebook.

the class DistBuildState method createBuckConfig.

private static BuckConfig createBuckConfig(Config config, ProjectFilesystem projectFilesystem, BuildJobStateBuckConfig remoteBuckConfig) {
    Architecture remoteArchitecture = Architecture.valueOf(remoteBuckConfig.getArchitecture());
    Architecture localArchitecture = Architecture.detect();
    Preconditions.checkState(remoteArchitecture.equals(localArchitecture), "Trying to load config with architecture %s on a machine that is %s. " + "This is not supported.", remoteArchitecture, localArchitecture);
    Platform remotePlatform = Platform.valueOf(remoteBuckConfig.getPlatform());
    Platform localPlatform = Platform.detect();
    Preconditions.checkState(remotePlatform.equals(localPlatform), "Trying to load config with platform %s on a machine that is %s. This is not supported.", remotePlatform, localPlatform);
    return new BuckConfig(config, projectFilesystem, remoteArchitecture, remotePlatform, ImmutableMap.copyOf(remoteBuckConfig.getUserEnvironment()), new DefaultCellPathResolver(projectFilesystem.getRootPath(), config));
}
Also used : DefaultCellPathResolver(com.facebook.buck.rules.DefaultCellPathResolver) Architecture(com.facebook.buck.util.environment.Architecture) Platform(com.facebook.buck.util.environment.Platform) BuckConfig(com.facebook.buck.cli.BuckConfig) BuildJobStateBuckConfig(com.facebook.buck.distributed.thrift.BuildJobStateBuckConfig)

Aggregations

BuildJobStateBuckConfig (com.facebook.buck.distributed.thrift.BuildJobStateBuckConfig)2 BuckConfig (com.facebook.buck.cli.BuckConfig)1 OrderedStringMapEntry (com.facebook.buck.distributed.thrift.OrderedStringMapEntry)1 DefaultCellPathResolver (com.facebook.buck.rules.DefaultCellPathResolver)1 Architecture (com.facebook.buck.util.environment.Architecture)1 Platform (com.facebook.buck.util.environment.Platform)1 ArrayList (java.util.ArrayList)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1