diff options
Diffstat (limited to 'src')
12 files changed, 115 insertions, 150 deletions
diff --git a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java index d3c2139207..c16e95dd29 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/RuleContext.java @@ -1087,7 +1087,7 @@ public final class RuleContext extends TargetContext if (getToolchainContext() == null) { return null; } - return getToolchainContext().getExecutionPlatform(); + return getToolchainContext().executionPlatform(); } private void checkAttribute(String attributeName, Mode mode) { diff --git a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java index a23dccdad5..dea39859a9 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/ToolchainContext.java @@ -34,20 +34,18 @@ import com.google.devtools.build.lib.packages.Attribute; import com.google.devtools.build.lib.skyframe.ConfiguredTargetAndData; import com.google.devtools.build.lib.skylarkbuildapi.ToolchainContextApi; import com.google.devtools.build.lib.skylarkinterface.SkylarkPrinter; -import com.google.devtools.build.lib.skylarkinterface.SkylarkValue; import com.google.devtools.build.lib.syntax.EvalException; import com.google.devtools.build.lib.syntax.EvalUtils; -import com.google.devtools.build.lib.syntax.SkylarkIndexable; import com.google.devtools.build.lib.util.OrderedSetMultimap; import java.util.Optional; import java.util.Set; import java.util.stream.StreamSupport; -import javax.annotation.Nullable; /** Contains toolchain-related information needed for a {@link RuleContext}. */ @Immutable @ThreadSafe public class ToolchainContext implements ToolchainContextApi { + public static ToolchainContext create( String targetDescription, PlatformInfo executionPlatform, @@ -78,7 +76,7 @@ public class ToolchainContext implements ToolchainContextApi { private final ResolvedToolchainLabels resolvedToolchainLabels; /** Stores the actual ToolchainInfo provider for each toolchain type. */ - private ResolvedToolchainProviders resolvedToolchainProviders; + private ImmutableMap<Label, ToolchainInfo> toolchainProviders; private ToolchainContext( String targetDescription, @@ -91,36 +89,29 @@ public class ToolchainContext implements ToolchainContextApi { this.targetPlatform = targetPlatform; this.requiredToolchains = ImmutableList.copyOf(requiredToolchains); this.resolvedToolchainLabels = resolvedToolchainLabels; - this.resolvedToolchainProviders = - new ResolvedToolchainProviders(ImmutableMap.<Label, ToolchainInfo>of()); + this.toolchainProviders = ImmutableMap.of(); } - public PlatformInfo getExecutionPlatform() { + public PlatformInfo executionPlatform() { return executionPlatform; } - public PlatformInfo getTargetPlatform() { + public PlatformInfo targetPlatform() { return targetPlatform; } - public ImmutableList<Label> getRequiredToolchains() { + public ImmutableList<Label> requiredToolchainTypes() { return requiredToolchains; } public void resolveToolchains( OrderedSetMultimap<Attribute, ConfiguredTargetAndData> prerequisiteMap) { if (!this.requiredToolchains.isEmpty()) { - this.resolvedToolchainProviders = - new ResolvedToolchainProviders(findToolchains(resolvedToolchainLabels, prerequisiteMap)); + this.toolchainProviders = findToolchains(resolvedToolchainLabels, prerequisiteMap); } } - @Nullable - public SkylarkIndexable getResolvedToolchainProviders() { - return resolvedToolchainProviders; - } - - public ImmutableSet<Label> getResolvedToolchainLabels() { + public ImmutableSet<Label> resolvedToolchainLabels() { return resolvedToolchainLabels.getToolchainLabels(); } @@ -133,6 +124,7 @@ public class ToolchainContext implements ToolchainContextApi { /** Tracks the mapping from toolchain type label to the label of the actual resolved toolchain. */ private static class ResolvedToolchainLabels { + private final ImmutableBiMap<Label, Label> toolchainLabels; private ResolvedToolchainLabels(ImmutableBiMap<Label, Label> toolchainLabels) { @@ -185,80 +177,71 @@ public class ToolchainContext implements ToolchainContextApi { return toolchains.build(); } - /** Tracks the mapping from toolchain type label to {@link ToolchainInfo} provider. */ - public class ResolvedToolchainProviders implements SkylarkValue, SkylarkIndexable { - - private final ImmutableMap<Label, ToolchainInfo> toolchains; + // Implement SkylarkValue and SkylarkIndexable. - private ResolvedToolchainProviders(ImmutableMap<Label, ToolchainInfo> toolchains) { - this.toolchains = toolchains; - } - - @Override - public boolean isImmutable() { - return true; - } + @Override + public boolean isImmutable() { + return true; + } - @Override - public void repr(SkylarkPrinter printer) { - printer.append("<toolchain_context.resolved_labels: "); - printer.append(toolchains.keySet().stream() - .map(key -> key.toString()) - .collect(joining(", "))); - printer.append(">"); - } + @Override + public void repr(SkylarkPrinter printer) { + printer.append("<toolchain_context.resolved_labels: "); + printer.append( + toolchainProviders.keySet().stream().map(key -> key.toString()).collect(joining(", "))); + printer.append(">"); + } - private Label transformKey(Object key, Location loc) throws EvalException { - if (key instanceof Label) { - Label toolchainType = (Label) key; - return toolchainType; - } else if (key instanceof String) { - Label toolchainType = null; - String rawLabel = (String) key; - try { - toolchainType = Label.parseAbsolute(rawLabel); - } catch (LabelSyntaxException e) { - throw new EvalException( - loc, String.format("Unable to parse toolchain %s: %s", rawLabel, e.getMessage()), e); - } - return toolchainType; - } else { + private Label transformKey(Object key, Location loc) throws EvalException { + if (key instanceof Label) { + Label toolchainType = (Label) key; + return toolchainType; + } else if (key instanceof String) { + Label toolchainType = null; + String rawLabel = (String) key; + try { + toolchainType = Label.parseAbsolute(rawLabel); + } catch (LabelSyntaxException e) { throw new EvalException( - loc, - String.format( - "Toolchains only supports indexing by toolchain type, got %s instead", - EvalUtils.getDataTypeName(key))); + loc, String.format("Unable to parse toolchain %s: %s", rawLabel, e.getMessage()), e); } + return toolchainType; + } else { + throw new EvalException( + loc, + String.format( + "Toolchains only supports indexing by toolchain type, got %s instead", + EvalUtils.getDataTypeName(key))); } + } - @Override - public ToolchainInfo getIndex(Object key, Location loc) throws EvalException { - Label toolchainType = transformKey(key, loc); - - if (!requiredToolchains.contains(toolchainType)) { - throw new EvalException( - loc, - String.format( - "In %s, toolchain type %s was requested but only types [%s] are configured", - targetDescription, - toolchainType, - requiredToolchains - .stream() - .map(toolchain -> toolchain.toString()) - .collect(joining()))); - } - return toolchains.get(toolchainType); + @Override + public ToolchainInfo getIndex(Object key, Location loc) throws EvalException { + Label toolchainType = transformKey(key, loc); + + if (!requiredToolchains.contains(toolchainType)) { + throw new EvalException( + loc, + String.format( + "In %s, toolchain type %s was requested but only types [%s] are configured", + targetDescription, + toolchainType, + requiredToolchains + .stream() + .map(toolchain -> toolchain.toString()) + .collect(joining()))); } + return toolchainProviders.get(toolchainType); + } - /** Returns the toolchain for the given type */ - public ToolchainInfo getForToolchainType(Label toolchainType) { - return toolchains.get(toolchainType); - } + /** Returns the toolchain for the given type */ + public ToolchainInfo forToolchainType(Label toolchainType) { + return toolchainProviders.get(toolchainType); + } - @Override - public boolean containsKey(Object key, Location loc) throws EvalException { - Label toolchainType = transformKey(key, loc); - return toolchains.containsKey(toolchainType); - } + @Override + public boolean containsKey(Object key, Location loc) throws EvalException { + Label toolchainType = transformKey(key, loc); + return toolchainProviders.containsKey(toolchainType); } } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/Util.java b/src/main/java/com/google/devtools/build/lib/analysis/Util.java index 47336c0d78..22e90583af 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/Util.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/Util.java @@ -101,13 +101,13 @@ public abstract class Util { ToolchainContext toolchainContext = ruleContext.getToolchainContext(); if (toolchainContext != null) { BuildConfiguration config = ruleContext.getConfiguration(); - for (Label toolchain : toolchainContext.getResolvedToolchainLabels()) { + for (Label toolchain : toolchainContext.resolvedToolchainLabels()) { maybeImplicitDeps.add(ConfiguredTargetKey.of(toolchain, config)); } maybeImplicitDeps.add( - ConfiguredTargetKey.of(toolchainContext.getExecutionPlatform().label(), config)); + ConfiguredTargetKey.of(toolchainContext.executionPlatform().label(), config)); maybeImplicitDeps.add( - ConfiguredTargetKey.of(toolchainContext.getTargetPlatform().label(), config)); + ConfiguredTargetKey.of(toolchainContext.targetPlatform().label(), config)); } return ImmutableSet.copyOf(Sets.difference(maybeImplicitDeps, explicitDeps)); } diff --git a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java index 2634773cdc..5dec1480bf 100644 --- a/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java +++ b/src/main/java/com/google/devtools/build/lib/analysis/skylark/SkylarkRuleContext.java @@ -656,7 +656,7 @@ public final class SkylarkRuleContext implements SkylarkRuleContextApi { @Override public SkylarkIndexable toolchains() throws EvalException { checkMutable("toolchains"); - return ruleContext.getToolchainContext().getResolvedToolchainProviders(); + return ruleContext.getToolchainContext(); } @Override diff --git a/src/main/java/com/google/devtools/build/lib/rules/ToolchainType.java b/src/main/java/com/google/devtools/build/lib/rules/ToolchainType.java index 0139ddfade..1d0c229d88 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/ToolchainType.java +++ b/src/main/java/com/google/devtools/build/lib/rules/ToolchainType.java @@ -25,7 +25,6 @@ import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.Runfiles; import com.google.devtools.build.lib.analysis.RunfilesProvider; import com.google.devtools.build.lib.analysis.TemplateVariableInfo; -import com.google.devtools.build.lib.analysis.ToolchainContext.ResolvedToolchainProviders; import com.google.devtools.build.lib.analysis.config.BuildConfiguration; import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Fragment; import com.google.devtools.build.lib.analysis.config.BuildConfiguration.Options; @@ -80,10 +79,8 @@ public class ToolchainType implements RuleConfiguredTargetFactory { && ruleContext .getFragment(PlatformConfiguration.class) .isToolchainTypeEnabled(ruleContext.getLabel())) { - ResolvedToolchainProviders providers = - (ResolvedToolchainProviders) - ruleContext.getToolchainContext().getResolvedToolchainProviders(); - ToolchainInfo toolchainInfo = providers.getForToolchainType(ruleContext.getLabel()); + ToolchainInfo toolchainInfo = + ruleContext.getToolchainContext().forToolchainType(ruleContext.getLabel()); if (toolchainInfo != null) { toolchainInfo.addGlobalMakeVariables(fragmentBuilder); } diff --git a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java index c1191850f8..63a94cf5f7 100644 --- a/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java +++ b/src/main/java/com/google/devtools/build/lib/rules/cpp/CppHelper.java @@ -38,7 +38,6 @@ import com.google.devtools.build.lib.analysis.PlatformConfiguration; import com.google.devtools.build.lib.analysis.RuleConfiguredTargetBuilder; import com.google.devtools.build.lib.analysis.RuleContext; import com.google.devtools.build.lib.analysis.StaticallyLinkedMarkerProvider; -import com.google.devtools.build.lib.analysis.ToolchainContext.ResolvedToolchainProviders; import com.google.devtools.build.lib.analysis.TransitiveInfoCollection; import com.google.devtools.build.lib.analysis.actions.CustomCommandLine; import com.google.devtools.build.lib.analysis.actions.SpawnAction; @@ -455,10 +454,7 @@ public class CppHelper { private static CcToolchainProvider getToolchainFromPlatformConstraints( RuleContext ruleContext, Label toolchainType) { - ResolvedToolchainProviders providers = - (ResolvedToolchainProviders) - ruleContext.getToolchainContext().getResolvedToolchainProviders(); - return (CcToolchainProvider) providers.getForToolchainType(toolchainType); + return (CcToolchainProvider) ruleContext.getToolchainContext().forToolchainType(toolchainType); } private static CcToolchainProvider getToolchainFromCrosstoolTop( diff --git a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java index 71e1be16bb..cbee20e43f 100644 --- a/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java +++ b/src/main/java/com/google/devtools/build/lib/skyframe/ConfiguredTargetFunction.java @@ -452,7 +452,7 @@ public final class ConfiguredTargetFunction implements SkyFunction { configConditions, toolchainContext == null ? ImmutableSet.of() - : toolchainContext.getResolvedToolchainLabels(), + : toolchainContext.resolvedToolchainLabels(), transitiveRootCauses, defaultBuildOptions, ((ConfiguredRuleClassProvider) ruleClassProvider).getTrimmingTransitionFactory()); diff --git a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/ToolchainContextApi.java b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/ToolchainContextApi.java index 3441c52044..3bc97fcd83 100644 --- a/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/ToolchainContextApi.java +++ b/src/main/java/com/google/devtools/build/lib/skylarkbuildapi/ToolchainContextApi.java @@ -16,14 +16,12 @@ package com.google.devtools.build.lib.skylarkbuildapi; import com.google.devtools.build.lib.skylarkinterface.SkylarkModule; import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory; +import com.google.devtools.build.lib.skylarkinterface.SkylarkValue; +import com.google.devtools.build.lib.syntax.SkylarkIndexable; -/** - * Stores toolchains available to a given rule. - */ +/** Stores toolchains available to a given rule. */ @SkylarkModule( name = "ToolchainContext", category = SkylarkModuleCategory.BUILTIN, - doc = "Stores toolchains available to a given rule." -) -public interface ToolchainContextApi { -} + doc = "Stores toolchains available to a given rule.") +public interface ToolchainContextApi extends SkylarkValue, SkylarkIndexable {} diff --git a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java index 5fcae537c2..14a3cc5386 100644 --- a/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java +++ b/src/test/java/com/google/devtools/build/lib/analysis/util/BuildViewForTesting.java @@ -352,9 +352,7 @@ public class BuildViewForTesting { configurations.getHostConfiguration(), /*aspect=*/ null, getConfigurableAttributeKeysForTesting(eventHandler, ctgNode), - toolchainContext == null - ? ImmutableSet.of() - : toolchainContext.getResolvedToolchainLabels(), + toolchainContext == null ? ImmutableSet.of() : toolchainContext.resolvedToolchainLabels(), skyframeExecutor.getDefaultBuildOptions(), ruleClassProvider.getTrimmingTransitionFactory()); } diff --git a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSelectionTest.java b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSelectionTest.java index d6938814fc..2f72860c2b 100644 --- a/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSelectionTest.java +++ b/src/test/java/com/google/devtools/build/lib/rules/cpp/CcToolchainSelectionTest.java @@ -19,7 +19,6 @@ import static com.google.common.truth.Truth.assertThat; import com.google.common.collect.ImmutableList; import com.google.common.collect.Iterables; import com.google.devtools.build.lib.analysis.ConfiguredTarget; -import com.google.devtools.build.lib.analysis.ToolchainContext.ResolvedToolchainProviders; import com.google.devtools.build.lib.analysis.util.BuildViewTestCase; import com.google.devtools.build.lib.analysis.util.ScratchAttributeWriter; import com.google.devtools.build.lib.cmdline.Label; @@ -64,12 +63,11 @@ public class CcToolchainSelectionTest extends BuildViewTestCase { ScratchAttributeWriter.fromLabelString(this, "cc_library", "//lib") .setList("srcs", "a.cc") .write(); - ResolvedToolchainProviders providers = - (ResolvedToolchainProviders) - getRuleContext(target).getToolchainContext().getResolvedToolchainProviders(); CcToolchainProvider toolchain = (CcToolchainProvider) - providers.getForToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); + getRuleContext(target) + .getToolchainContext() + .forToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); assertThat(Iterables.getOnlyElement(toolchain.getCompile()).getExecPathString()) .endsWith("piii"); } @@ -101,12 +99,11 @@ public class CcToolchainSelectionTest extends BuildViewTestCase { ScratchAttributeWriter.fromLabelString(this, "cc_library", "//lib") .setList("srcs", "a.cc") .write(); - ResolvedToolchainProviders providers = - (ResolvedToolchainProviders) - getRuleContext(target).getToolchainContext().getResolvedToolchainProviders(); CcToolchainProvider toolchain = (CcToolchainProvider) - providers.getForToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); + getRuleContext(target) + .getToolchainContext() + .forToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); assertThat(toolchain.getToolchainIdentifier()).endsWith("piii"); } @@ -163,12 +160,11 @@ public class CcToolchainSelectionTest extends BuildViewTestCase { ScratchAttributeWriter.fromLabelString(this, "cc_library", "//lib") .setList("srcs", "a.cc") .write(); - ResolvedToolchainProviders providers = - (ResolvedToolchainProviders) - getRuleContext(target).getToolchainContext().getResolvedToolchainProviders(); CcToolchainProvider toolchain = (CcToolchainProvider) - providers.getForToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); + getRuleContext(target) + .getToolchainContext() + .forToolchainType(Label.parseAbsolute(CPP_TOOLCHAIN_TYPE)); assertThat(toolchain.getToolPathFragment(CppConfiguration.Tool.LD).toString()) .contains("piii-ld"); } diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/RuleContextTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/RuleContextTest.java index 8f33c0b0e6..7423652698 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/RuleContextTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/RuleContextTest.java @@ -17,7 +17,6 @@ package com.google.devtools.build.lib.skyframe; import static com.google.common.truth.Truth.assertThat; import com.google.devtools.build.lib.analysis.RuleContext; -import com.google.devtools.build.lib.analysis.ToolchainContext.ResolvedToolchainProviders; import com.google.devtools.build.lib.analysis.platform.ToolchainInfo; import com.google.devtools.build.lib.cmdline.Label; import com.google.devtools.build.lib.rules.platform.ToolchainTestCase; @@ -36,15 +35,13 @@ public class RuleContextTest extends ToolchainTestCase { "--host_platform=//platforms:linux", "--platforms=//platforms:mac"); RuleContext ruleContext = getRuleContext(getConfiguredTarget("//x")); - assertThat(ruleContext.getToolchainContext().getResolvedToolchainLabels()) + assertThat(ruleContext.getToolchainContext().resolvedToolchainLabels()) .contains(Label.parseAbsolute("//toolchain:toolchain_1_impl")); - ResolvedToolchainProviders resolvedToolchainProviders = - (ResolvedToolchainProviders) - ruleContext.getToolchainContext().getResolvedToolchainProviders(); ToolchainInfo toolchain = - resolvedToolchainProviders.getForToolchainType( - Label.parseAbsolute("//toolchain:test_toolchain")); + ruleContext + .getToolchainContext() + .forToolchainType(Label.parseAbsolute("//toolchain:test_toolchain")); assertThat(toolchain.getValue("data")).isEqualTo("foo"); } } diff --git a/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainUtilTest.java b/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainUtilTest.java index b2175c640a..fa3af8e923 100644 --- a/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainUtilTest.java +++ b/src/test/java/com/google/devtools/build/lib/skyframe/ToolchainUtilTest.java @@ -104,16 +104,16 @@ public class ToolchainUtilTest extends ToolchainTestCase { ToolchainContext toolchainContext = result.get(key).toolchainContext(); assertThat(toolchainContext).isNotNull(); - assertThat(toolchainContext.getRequiredToolchains()).containsExactly(testToolchainType); - assertThat(toolchainContext.getResolvedToolchainLabels()) + assertThat(toolchainContext.requiredToolchainTypes()).containsExactly(testToolchainType); + assertThat(toolchainContext.resolvedToolchainLabels()) .containsExactly(Label.parseAbsoluteUnchecked("//extra:extra_toolchain_mac_impl")); - assertThat(toolchainContext.getExecutionPlatform()).isNotNull(); - assertThat(toolchainContext.getExecutionPlatform().label()) + assertThat(toolchainContext.executionPlatform()).isNotNull(); + assertThat(toolchainContext.executionPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:mac")); - assertThat(toolchainContext.getTargetPlatform()).isNotNull(); - assertThat(toolchainContext.getTargetPlatform().label()) + assertThat(toolchainContext.targetPlatform()).isNotNull(); + assertThat(toolchainContext.targetPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:linux")); } @@ -132,15 +132,15 @@ public class ToolchainUtilTest extends ToolchainTestCase { ToolchainContext toolchainContext = result.get(key).toolchainContext(); assertThat(toolchainContext).isNotNull(); - assertThat(toolchainContext.getRequiredToolchains()).isEmpty(); + assertThat(toolchainContext.requiredToolchainTypes()).isEmpty(); // With no toolchains requested, should fall back to the host platform. - assertThat(toolchainContext.getExecutionPlatform()).isNotNull(); - assertThat(toolchainContext.getExecutionPlatform().label()) + assertThat(toolchainContext.executionPlatform()).isNotNull(); + assertThat(toolchainContext.executionPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//host:host")); - assertThat(toolchainContext.getTargetPlatform()).isNotNull(); - assertThat(toolchainContext.getTargetPlatform().label()) + assertThat(toolchainContext.targetPlatform()).isNotNull(); + assertThat(toolchainContext.targetPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:linux")); } @@ -176,15 +176,15 @@ public class ToolchainUtilTest extends ToolchainTestCase { ToolchainContext toolchainContext = result.get(key).toolchainContext(); assertThat(toolchainContext).isNotNull(); - assertThat(toolchainContext.getRequiredToolchains()).isEmpty(); + assertThat(toolchainContext.requiredToolchainTypes()).isEmpty(); // With no toolchains requested, should fall back to the host platform. - assertThat(toolchainContext.getExecutionPlatform()).isNotNull(); - assertThat(toolchainContext.getExecutionPlatform().label()) + assertThat(toolchainContext.executionPlatform()).isNotNull(); + assertThat(toolchainContext.executionPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//sample:sample_b")); - assertThat(toolchainContext.getTargetPlatform()).isNotNull(); - assertThat(toolchainContext.getTargetPlatform().label()) + assertThat(toolchainContext.targetPlatform()).isNotNull(); + assertThat(toolchainContext.targetPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:linux")); } @@ -365,16 +365,16 @@ public class ToolchainUtilTest extends ToolchainTestCase { ToolchainContext toolchainContext = result.get(key).toolchainContext(); assertThat(toolchainContext).isNotNull(); - assertThat(toolchainContext.getRequiredToolchains()).containsExactly(testToolchainType); - assertThat(toolchainContext.getResolvedToolchainLabels()) + assertThat(toolchainContext.requiredToolchainTypes()).containsExactly(testToolchainType); + assertThat(toolchainContext.resolvedToolchainLabels()) .containsExactly(Label.parseAbsoluteUnchecked("//extra:extra_toolchain_linux_impl")); - assertThat(toolchainContext.getExecutionPlatform()).isNotNull(); - assertThat(toolchainContext.getExecutionPlatform().label()) + assertThat(toolchainContext.executionPlatform()).isNotNull(); + assertThat(toolchainContext.executionPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:linux")); - assertThat(toolchainContext.getTargetPlatform()).isNotNull(); - assertThat(toolchainContext.getTargetPlatform().label()) + assertThat(toolchainContext.targetPlatform()).isNotNull(); + assertThat(toolchainContext.targetPlatform().label()) .isEqualTo(Label.parseAbsoluteUnchecked("//platforms:linux")); } |