aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/test/java/com/google/devtools/build/lib/rules
diff options
context:
space:
mode:
authorGravatar John Cater <jcater@google.com>2017-07-13 19:18:50 +0200
committerGravatar László Csomor <laszlocsomor@google.com>2017-07-14 10:52:01 +0200
commit98375a24ab40bfe0ff124401ca2d95740f67e072 (patch)
tree4c6ceb24dbe0dd396286d04cd3ead7a705bcea89 /src/test/java/com/google/devtools/build/lib/rules
parent8002b6205e004721f771df20d1d8c1402c03964e (diff)
Add a SkyFunction to perform toolchain resolution.
Part of #2219. Change-Id: I339009c13639144ca756eb07c520df7d430a64e3 PiperOrigin-RevId: 161826487
Diffstat (limited to 'src/test/java/com/google/devtools/build/lib/rules')
-rw-r--r--src/test/java/com/google/devtools/build/lib/rules/platform/ToolchainTestCase.java17
1 files changed, 14 insertions, 3 deletions
diff --git a/src/test/java/com/google/devtools/build/lib/rules/platform/ToolchainTestCase.java b/src/test/java/com/google/devtools/build/lib/rules/platform/ToolchainTestCase.java
index 87bce409db..5d170baac0 100644
--- a/src/test/java/com/google/devtools/build/lib/rules/platform/ToolchainTestCase.java
+++ b/src/test/java/com/google/devtools/build/lib/rules/platform/ToolchainTestCase.java
@@ -16,6 +16,7 @@ package com.google.devtools.build.lib.rules.platform;
import com.google.devtools.build.lib.analysis.platform.ConstraintSettingInfo;
import com.google.devtools.build.lib.analysis.platform.ConstraintValueInfo;
+import com.google.devtools.build.lib.analysis.platform.PlatformInfo;
import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.skylark.util.SkylarkTestCase;
import org.junit.Before;
@@ -23,11 +24,15 @@ import org.junit.Before;
/** Utility methods for setting up platform and toolchain related tests. */
public abstract class ToolchainTestCase extends SkylarkTestCase {
- public Label testToolchainType;
+ public PlatformInfo targetPlatform;
+ public PlatformInfo hostPlatform;
+
public ConstraintSettingInfo setting;
public ConstraintValueInfo linuxConstraint;
public ConstraintValueInfo macConstraint;
+ public Label testToolchainType;
+
@Before
public void createConstraints() throws Exception {
scratch.file(
@@ -44,9 +49,15 @@ public abstract class ToolchainTestCase extends SkylarkTestCase {
}
@Before
+ public void createPlatforms() throws Exception {
+ targetPlatform =
+ PlatformInfo.builder().setLabel(makeLabel("//platforms:target_platform")).build();
+ hostPlatform = PlatformInfo.builder().setLabel(makeLabel("//platforms:host_platform")).build();
+ }
+
+ @Before
public void createToolchains() throws Exception {
- rewriteWorkspace(
- "register_toolchains(", " '//toolchain:toolchain_1',", " '//toolchain:toolchain_2')");
+ rewriteWorkspace("register_toolchains('//toolchain:toolchain_1', '//toolchain:toolchain_2')");
scratch.file(
"toolchain/BUILD",