Skip to content
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions qt/private/cells.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Qualified Qt cells as target compatibility and consumer archive settings."""

load("//qt/private/toolchain:pins.bzl", "CELLS", "IDENTITIES")
load("//qt/private/toolchain:repos.bzl", "PLATFORM_SUPPORT", "qualified_cells")
load("//qt/private/toolchain:repos.bzl", "qualified_cells")

def qt_consumer_identity(cell):
"""Returns the consumer_archive arch, os and min_runtime of one qualified Qt cell."""
Expand All @@ -19,7 +19,7 @@ _INCOMPATIBLE = Label("@platforms//:incompatible")
_UNSUPPORTED = Label("//qt/private:unsupported")

QT_COMPATIBLE_WITH = select(
{setting: [] for setting in PLATFORM_SUPPORT.settings} |
{setting: [] for setting in [_cell_setting(cell) for cell in sorted(CELLS)]} |
{"//conditions:default": [_INCOMPATIBLE, _UNSUPPORTED]},
)

Expand Down
2 changes: 2 additions & 0 deletions qt/private/toolchain/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ exports_files([
"needs.bzl",
"pins.bzl",
"repos.bzl",
"seven_zip.bzl",
"tool.bzl",
"unsupported.bzl",
"windows_arm64.bzl",
Expand Down Expand Up @@ -56,6 +57,7 @@ real_source_target(
"needs.bzl",
"pins.bzl",
"repos.bzl",
"seven_zip.bzl",
"tool.bzl",
"unsupported.bzl",
"windows_arm64.bzl",
Expand Down
2 changes: 1 addition & 1 deletion qt/private/toolchain/pins.bzl
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""Pinned Qt SDK, runtime closure and extractor identities; versions, mirrors and license texts are in pins.json."""

load("@dx_pins_data//:pins.bzl", "DATA")
load("//core:seven_zip.bzl", "SEVEN_ZIP_EXTRACTORS")
load(":seven_zip.bzl", "SEVEN_ZIP_EXTRACTORS")
load(":layout_linux.bzl", LINUX_LAYOUT = "LAYOUT")
load(":layout_macos.bzl", MACOS_LAYOUT = "LAYOUT")
load(":layout_windows.bzl", WINDOWS_LAYOUT = "LAYOUT")
Expand Down
6 changes: 1 addition & 5 deletions qt/private/toolchain/repos.bzl
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
"""Opt-in hermetic Qt SDK acquisition."""

load("//cc/private/toolchain:pins.bzl", "VC_REDIST_VERSION")
load("//core:host.bzl", "host_cell_of")
load("//core:platform_support.bzl", "cells_support", "lang_cells")
load("//core:seven_zip.bzl", "seven_zip_fetch")
load(
":pins.bzl",
"CELLS",
Expand All @@ -17,6 +14,7 @@ load(
"RUNTIME_MIRROR",
"RUNTIME_REPOSITORIES",
)
load(":seven_zip.bzl", "host_cell_of", "seven_zip_fetch")

HUB_NAME = "dx_qt"

Expand Down Expand Up @@ -140,8 +138,6 @@ def qualified_cells(cells = CELLS):
"""Returns the cells with pinned archives and probe evidence."""
return [cell for cell in sorted(cells.keys()) if cells[cell].blocker == ""]

PLATFORM_SUPPORT = cells_support("//qt:defs.bzl", "QT_COMPATIBLE_WITH", CELLS, lang_cells("qt"), "//qt/private", "constraints", settings = {cell: Label("//qt/private/platforms:cell_" + cell) for cell in CELLS})

def hub_targets():
"""Returns every target name the hub repository exposes."""
names = list(SHARED_TARGETS)
Expand Down
73 changes: 73 additions & 0 deletions qt/private/toolchain/seven_zip.bzl
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
"""Pinned 7-Zip extractors that unpack the Qt SDK .7z archives."""

_OSES = {"linux": "linux", "mac os x": "macos"}

_ARCHES = {"aarch64": "arm64", "amd64": "x86_64", "arm64": "arm64", "x86_64": "x86_64"}

_RELEASE = "https://github.com/ip7z/7zip/releases/download/26.06/"

_WINDOWS = struct(
archive = None,
binary = "7zr.exe",
sha256 = "e80db2dad715a6c5adabe292d31ed54e11f4e9b99ca349827b50573b175891bc",
url = _RELEASE + "7zr.exe",
)

SEVEN_ZIP_EXTRACTORS = {
"linux_arm64": struct(
archive = "7z2606-linux-arm64.tar.xz",
binary = "7zzs",
sha256 = "edcc408aacce77da5223728f2eceb5e9f6dc713b8a9df934ad21e2a7f7560627",
url = _RELEASE + "7z2606-linux-arm64.tar.xz",
),
"linux_x86_64": struct(
archive = "7z2606-linux-x64.tar.xz",
binary = "7zzs",
sha256 = "2b539cf067b2ad48e1baa5093dbaa8818b73542d1222a0ffde9dc5f2922ea62e",
url = _RELEASE + "7z2606-linux-x64.tar.xz",
),
"macos_arm64": struct(
archive = "7z2606-mac.tar.xz",
binary = "7zz",
sha256 = "b6f17920b4240940461dac8ef4009891881ac44d2a5ead625ede2ec8472185dd",
url = _RELEASE + "7z2606-mac.tar.xz",
),
"windows_arm64": _WINDOWS,
"windows_x86_64": _WINDOWS,
}

def host_cell_of(os_name, arch):
"""Returns `linux|macos|windows` + `_` + `x86_64|arm64` from Bazel's os name and arch."""
name = os_name.lower()
name = "windows" if name.startswith("windows") else _OSES.get(name, name)
return name + "_" + _ARCHES.get(arch, arch)

def seven_zip_fetch(rctx, output):
"""Downloads the pinned extractor of the repository host into output and returns its path."""
host = host_cell_of(rctx.os.name, rctx.os.arch)
if host not in SEVEN_ZIP_EXTRACTORS:
fail("the pinned 7-Zip extractor runs on " + ", ".join(sorted(SEVEN_ZIP_EXTRACTORS.keys())) + " hosts only, not " + rctx.os.name + " " + rctx.os.arch)
extractor = SEVEN_ZIP_EXTRACTORS[host]
canonical_id = "dx-7zip:" + extractor.url
if extractor.archive == None:
rctx.download(
url = extractor.url,
output = output + "/" + extractor.binary,
sha256 = extractor.sha256,
executable = True,
canonical_id = canonical_id,
)
else:
rctx.download_and_extract(
url = extractor.url,
output = output,
sha256 = extractor.sha256,
canonical_id = canonical_id,
)
return str(rctx.path(output + "/" + extractor.binary))

def seven_zip_extract(rctx, binary, archive, output, args = []):
"""Extracts one .7z archive into output with the fetched extractor, failing with its output."""
result = rctx.execute([binary, "x", "-y", "-bd", "-o" + output] + args + [str(archive)])
if result.return_code != 0:
fail("cannot extract '" + str(archive) + "': " + result.stdout + result.stderr)
4 changes: 2 additions & 2 deletions tools/ci/rule_set_loads_allowlist.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,6 @@ qt/private/platforms/BUILD.bazel foreign-load 1
qt/private/rust/BUILD.bazel foreign-load 1
qt/private/toolchain/BUILD.bazel foreign-load 2
qt/private/toolchain/cell_json.bzl foreign-load 2
qt/private/toolchain/pins.bzl foreign-load 2
qt/private/toolchain/repos.bzl foreign-load 4
qt/private/toolchain/pins.bzl foreign-load 1
qt/private/toolchain/repos.bzl foreign-load 1
qt/private/toolchain/tool.bzl foreign-load 2
Loading