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 try-import %workspace%/local.bazelrc

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

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

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

@ -3,7 +3,11 @@
#include <filesystem> #include <filesystem>
#include <stdlib.h> #include <stdlib.h>
#include <optional> #include <optional>
#ifdef _WIN32
#include <process.h>
#else
#include <unistd.h> #include <unistd.h>
#endif
#include "absl/strings/str_cat.h" #include "absl/strings/str_cat.h"
#define LEVEL_REGEX_PATTERN "trace|debug|info|warning|error|critical|no_logs" #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 # temporary, before we do universal merging
"-universal_binaries", "-universal_binaries",
]) ])
_add_args(kwargs, "target_compatible_with", select({ if "target_compatible_with" not in kwargs:
"@platforms//os:linux": [], # Restrict to Linux or macOS by default, but allow overriding
"@platforms//os:macos": [], _add_args(kwargs, "target_compatible_with", select({
"//conditions:default": ["@platforms//:incompatible"], "@platforms//os:linux": [],
})) "@platforms//os:macos": [],
"//conditions:default": ["@platforms//:incompatible"],
}))
rule(**kwargs) rule(**kwargs)
def swift_cc_binary(**kwargs): def swift_cc_binary(**kwargs):

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

@ -19,8 +19,9 @@ sh_binary(
pkg_files( pkg_files(
name = "scripts", name = "scripts",
srcs = [ srcs = [
":identify-environment", "autobuild.cmd",
":autobuild", ":autobuild",
":identify-environment",
":qltest", ":qltest",
], ],
attributes = pkg_attributes(mode = "0755"), 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 if [[ "$OSTYPE" == "darwin"* ]]; then
exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/xcode-autobuilder" exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/xcode-autobuilder"
else else
exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/incompatible-os" exec "${CODEQL_EXTRACTOR_SWIFT_ROOT}/tools/${CODEQL_PLATFORM}/autobuilder-incompatible-os"
fi 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",
],
)