Merge pull request #13447 from github/sashabu/windows2

Swift: Bare-bones extractor pack for Windows.
This commit is contained in:
Alexandre Boulgakov 2023-06-19 15:39:54 +01:00 коммит произвёл GitHub
Родитель 21ad3e851a abc6d62b6f
Коммит 61a3f86f0f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 4AEE18F83AFDEB23
10 изменённых файлов: 54 добавлений и 31 удалений

Просмотреть файл

@ -1,3 +1,9 @@
build --repo_env=CC=clang --repo_env=CXX=clang++ --cxxopt="-std=c++20"
common --enable_platform_specific_config
build --repo_env=CC=clang --repo_env=CXX=clang++
build:linux --cxxopt=-std=c++20
build:macos --cxxopt=-std=c++20 --cpu=darwin_x86_64
build:windows --cxxopt=/std:c++20 --cxxopt=/Zc:preprocessor
try-import %workspace%/local.bazelrc

Просмотреть файл

@ -38,11 +38,15 @@ pkg_files(
pkg_filegroup(
name = "extractor-pack-generic",
srcs = [
":dbscheme_files",
":manifest",
"//swift/downgrades",
"//swift/tools",
],
] + select({
"@platforms//os:windows": [],
"//conditions:default": [
":dbscheme_files",
"//swift/downgrades",
],
}),
visibility = ["//visibility:public"],
)
@ -59,8 +63,8 @@ pkg_runfiles(
)
pkg_runfiles(
name = "incompatible-os",
srcs = ["//swift/tools/autobuilder-diagnostics:incompatible-os"],
name = "diagnostics",
srcs = ["//swift/tools/diagnostics:autobuilder-incompatible-os"],
prefix = "tools/" + codeql_platform,
)
@ -80,17 +84,20 @@ pkg_files(
pkg_filegroup(
name = "extractor-pack-arch",
srcs = [
":extractor",
":swift-test-sdk-arch",
":resource-dir-arch",
] + select({
"@platforms//os:linux": [
":incompatible-os",
srcs = select({
"@platforms//os:windows": [],
"//conditions:default": [
":extractor",
":resource-dir-arch",
":swift-test-sdk-arch",
],
}) + select({
"@platforms//os:macos": [
":xcode-autobuilder",
],
"//conditions:default": [
":diagnostics",
],
}),
visibility = ["//visibility:public"],
)
@ -122,7 +129,7 @@ generate_cmake(
"//swift/extractor:extractor.real",
"//swift/logging/tests/assertion-diagnostics:assert-false",
] + select({
"@platforms//os:linux": ["//swift/tools/autobuilder-diagnostics:incompatible-os"],
"@platforms//os:linux": ["//swift/tools/diagnostics:autobuilder-incompatible-os"],
"@platforms//os:macos": ["//swift/xcode-autobuilder"],
}),
visibility = ["//visibility:public"],

Просмотреть файл

@ -3,7 +3,11 @@
#include <filesystem>
#include <stdlib.h>
#include <optional>
#ifdef _WIN32
#include <process.h>
#else
#include <unistd.h>
#endif
#include "absl/strings/str_cat.h"
#define LEVEL_REGEX_PATTERN "trace|debug|info|warning|error|critical|no_logs"

Просмотреть файл

@ -10,11 +10,13 @@ def _wrap_cc(rule, kwargs):
# temporary, before we do universal merging
"-universal_binaries",
])
_add_args(kwargs, "target_compatible_with", select({
"@platforms//os:linux": [],
"@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}))
if "target_compatible_with" not in kwargs:
# Restrict to Linux or macOS by default, but allow overriding
_add_args(kwargs, "target_compatible_with", select({
"@platforms//os:linux": [],
"@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}))
rule(**kwargs)
def swift_cc_binary(**kwargs):

Просмотреть файл

@ -19,8 +19,9 @@ sh_binary(
pkg_files(
name = "scripts",
srcs = [
":identify-environment",
"autobuild.cmd",
":autobuild",
":identify-environment",
":qltest",
],
attributes = pkg_attributes(mode = "0755"),

Просмотреть файл

@ -0,0 +1 @@
"%CODEQL_EXTRACTOR_SWIFT_ROOT%/tools/%CODEQL_PLATFORM%/autobuilder-incompatible-os.exe"

Просмотреть файл

@ -3,5 +3,5 @@
if [[ "$OSTYPE" == "darwin"* ]]; then
exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/xcode-autobuilder"
else
exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/incompatible-os"
exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/autobuilder-incompatible-os"
fi

Просмотреть файл

@ -1,10 +0,0 @@
load("//swift:rules.bzl", "swift_cc_binary")
swift_cc_binary(
name = "incompatible-os",
srcs = ["IncompatibleOs.cpp"],
visibility = ["//swift:__subpackages__"],
deps = [
"//swift/logging",
],
)

Просмотреть файл

@ -0,0 +1,12 @@
load("//swift:rules.bzl", "swift_cc_binary")
swift_cc_binary(
name = "autobuilder-incompatible-os",
srcs = ["AutobuilderIncompatibleOs.cpp"],
# No restrictions (Windows allowed)
target_compatible_with = [],
visibility = ["//swift:__subpackages__"],
deps = [
"//swift/logging",
],
)