Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

import com.google.devtools.build.lib.cmdline.Label;
import com.google.devtools.build.lib.testutil.TestConstants;
import com.google.devtools.build.lib.util.OS;
import java.io.IOException;

/** Mocking support for platforms and toolchains. */
Expand Down Expand Up @@ -184,16 +185,12 @@ public static void setup(
")");
mockToolsConfig.create(
constraintsPath + "/host/BUILD",
"load(':constraints.bzl', 'HOST_CONSTRAINTS')",
"package(default_visibility=['//visibility:public'])",
"licenses(['notice'])",
"platform(",
" name = 'host',",
" constraint_values = [",
// Regardless of the actual machine the tests are run on, hardcode everything to a single
// default value for simplicity.
" '" + constraintsPackageRoot + "cpu:x86_64',",
" '" + constraintsPackageRoot + "os:linux',",
" ],",
" constraint_values = HOST_CONSTRAINTS,",
")",
"platform(",
" name = 'piii',",
Expand All @@ -208,7 +205,18 @@ public static void setup(
// Regardless of the actual machine the tests are run on, hardcode everything to a single
// default value for simplicity.
" '" + constraintsPackageRoot + "cpu:x86_64',",
" '" + constraintsPackageRoot + "os:linux',",
" '"
+ constraintsPackageRoot
+ "os:%s',"
.formatted(
switch (OS.getCurrent()) {
case DARWIN -> "darwin";
case FREEBSD -> "freebsd";
case OPENBSD -> "openbsd";
case LINUX -> "linux";
case WINDOWS -> "windows";
case UNKNOWN -> "none";
}),
" ]");
mockToolsConfig.create(
constraintsPath + "/host/extension.bzl", "def host_platform_repo(**kwargs):", " pass");
Expand Down
Loading