mirror of
https://github.com/netbirdio/gvisor.git
synced 2026-05-22 17:12:49 -07:00
mark platforms as Linux-only
Related to #1270. PiperOrigin-RevId: 411648212
This commit is contained in:
committed by
gVisor bot
parent
0fd9b69d5c
commit
2bedb2dc39
@@ -1,15 +1,32 @@
|
||||
load("//tools:defs.bzl", "go_library")
|
||||
load("//tools:defs.bzl", "go_library", "select_system")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
# Don't rewrite the deps attribute of :platforms.
|
||||
# @unused
|
||||
glaze_ignore = [
|
||||
"platforms.go",
|
||||
"platforms_darwin.go",
|
||||
]
|
||||
|
||||
go_library(
|
||||
name = "platforms",
|
||||
srcs = ["platforms.go"],
|
||||
srcs = [
|
||||
"platforms.go",
|
||||
"platforms_darwin.go",
|
||||
],
|
||||
# Nothing needs to be stateified, and stateify has trouble when select is
|
||||
# used to choose deps.
|
||||
stateify = False,
|
||||
visibility = [
|
||||
"//runsc:__subpackages__",
|
||||
],
|
||||
deps = [
|
||||
"//pkg/sentry/platform/kvm",
|
||||
"//pkg/sentry/platform/ptrace",
|
||||
],
|
||||
deps = select_system(
|
||||
darwin = [],
|
||||
linux = [
|
||||
"//pkg/sentry/platform/kvm",
|
||||
"//pkg/sentry/platform/ptrace",
|
||||
"//runsc/boot/platforms/nonstandard",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
load("//tools:defs.bzl", "go_library")
|
||||
|
||||
package(licenses = ["notice"])
|
||||
|
||||
go_library(
|
||||
name = "nonstandard",
|
||||
srcs = ["nonstandard.go"],
|
||||
visibility = [
|
||||
"//runsc:__subpackages__",
|
||||
],
|
||||
)
|
||||
@@ -0,0 +1,16 @@
|
||||
// Copyright 2021 The gVisor Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
// Package nonstandard provides a place for nonstandard platforms.
|
||||
package nonstandard
|
||||
@@ -12,6 +12,9 @@
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build linux
|
||||
// +build linux
|
||||
|
||||
// Package platforms imports all available platform packages.
|
||||
package platforms
|
||||
|
||||
@@ -19,6 +22,7 @@ import (
|
||||
// Import platforms that runsc might use.
|
||||
_ "gvisor.dev/gvisor/pkg/sentry/platform/kvm"
|
||||
_ "gvisor.dev/gvisor/pkg/sentry/platform/ptrace"
|
||||
_ "gvisor.dev/gvisor/runsc/boot/platforms/nonstandard"
|
||||
)
|
||||
|
||||
const (
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
// Copyright 2021 The gVisor Authors.
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
// You may obtain a copy of the License at
|
||||
//
|
||||
// http://www.apache.org/licenses/LICENSE-2.0
|
||||
//
|
||||
// Unless required by applicable law or agreed to in writing, software
|
||||
// distributed under the License is distributed on an "AS IS" BASIS,
|
||||
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
// See the License for the specific language governing permissions and
|
||||
// limitations under the License.
|
||||
|
||||
//go:build darwin
|
||||
// +build darwin
|
||||
|
||||
package platforms
|
||||
|
||||
// This file makes the platforms package buildable on Darwin.
|
||||
@@ -27,8 +27,11 @@ def select_arch(amd64 = "amd64", arm64 = "arm64", default = None, **kwargs):
|
||||
values["//conditions:default"] = default
|
||||
return select(values, **kwargs)
|
||||
|
||||
def select_system(linux = ["__linux__"], **kwargs):
|
||||
return linux # Only Linux supported.
|
||||
def select_system(linux = ["__linux__"], darwin = [], **kwargs):
|
||||
return select({
|
||||
"@bazel_tools//src/conditions:darwin": darwin,
|
||||
"//conditions:default": linux,
|
||||
})
|
||||
|
||||
def default_installer():
|
||||
return None
|
||||
|
||||
@@ -156,4 +156,7 @@ def select_goarch():
|
||||
return select_arch(amd64 = "amd64", arm64 = "arm64")
|
||||
|
||||
def select_goos():
|
||||
return select_system(linux = "linux")
|
||||
return select_system(
|
||||
linux = "linux",
|
||||
darwin = "darwin",
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user