Bug 1915288 - Include platform-specific Rust dependencies when copying deps from mozilla-central. r=rjl,thunderbird-reviewers,tobyp DONTBUILD
Bug 1914434 showed we need these dependencies to prevent build bustages. Differential Revision: https://phabricator.services.mozilla.com/D220384 --HG-- extra : moz-landing-system : lando
This commit is contained in:
Родитель
5e9b3fcf10
Коммит
f3ef1a5daf
|
@ -75,12 +75,15 @@ members = {members}
|
||||||
[workspace.dependencies]
|
[workspace.dependencies]
|
||||||
{dependencies}
|
{dependencies}
|
||||||
|
|
||||||
|
{target_dependencies}
|
||||||
|
|
||||||
{patches}
|
{patches}
|
||||||
"""
|
"""
|
||||||
|
|
||||||
CARGO_FILES = {
|
CARGO_FILES = {
|
||||||
"mc_workspace_toml": "Cargo.toml",
|
"mc_workspace_toml": "Cargo.toml",
|
||||||
"mc_gkrust_toml": "toolkit/library/rust/shared/Cargo.toml",
|
"mc_gkrust_toml": "toolkit/library/rust/shared/Cargo.toml",
|
||||||
|
"mc_hack_toml": "build/workspace-hack/Cargo.toml",
|
||||||
"mc_cargo_lock": "Cargo.lock",
|
"mc_cargo_lock": "Cargo.lock",
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -137,6 +140,7 @@ class CargoFile:
|
||||||
self.workspace_members = list()
|
self.workspace_members = list()
|
||||||
self.workspace_deps = dict()
|
self.workspace_deps = dict()
|
||||||
self.features = dict()
|
self.features = dict()
|
||||||
|
self.target_deps = dict()
|
||||||
|
|
||||||
data = TOMLFile(filename).read()
|
data = TOMLFile(filename).read()
|
||||||
|
|
||||||
|
@ -154,6 +158,19 @@ class CargoFile:
|
||||||
self._handle_workspace(data[section])
|
self._handle_workspace(data[section])
|
||||||
elif section == "features":
|
elif section == "features":
|
||||||
self.features = data["features"]
|
self.features = data["features"]
|
||||||
|
elif section == "target":
|
||||||
|
self.target_deps.update(self._handle_target_dependencies(data[section]))
|
||||||
|
|
||||||
|
def _handle_target_dependencies(self, data):
|
||||||
|
"""Store configuration-specific (e.g. platform-specific dependencies)"""
|
||||||
|
target_deps = dict()
|
||||||
|
for target in data:
|
||||||
|
deps = data[target].get("dependencies")
|
||||||
|
|
||||||
|
if deps:
|
||||||
|
target_deps[target] = deps
|
||||||
|
|
||||||
|
return target_deps
|
||||||
|
|
||||||
def _handle_dependencies(self, data):
|
def _handle_dependencies(self, data):
|
||||||
"""Store each dependency"""
|
"""Store each dependency"""
|
||||||
|
@ -292,9 +309,11 @@ def regen_toml_files(command_context, workspace):
|
||||||
"""
|
"""
|
||||||
mc_workspace_toml = os.path.join(command_context.topsrcdir, CARGO_FILES["mc_workspace_toml"])
|
mc_workspace_toml = os.path.join(command_context.topsrcdir, CARGO_FILES["mc_workspace_toml"])
|
||||||
mc_gkrust_toml = os.path.join(command_context.topsrcdir, CARGO_FILES["mc_gkrust_toml"])
|
mc_gkrust_toml = os.path.join(command_context.topsrcdir, CARGO_FILES["mc_gkrust_toml"])
|
||||||
|
mc_hack_toml = os.path.join(command_context.topsrcdir, CARGO_FILES["mc_hack_toml"])
|
||||||
|
|
||||||
mc_workspace = CargoFile(mc_workspace_toml)
|
mc_workspace = CargoFile(mc_workspace_toml)
|
||||||
mc_gkrust = CargoFile(mc_gkrust_toml)
|
mc_gkrust = CargoFile(mc_gkrust_toml)
|
||||||
|
mc_hack = CargoFile(mc_hack_toml)
|
||||||
|
|
||||||
comm_gkrust_toml = os.path.join(workspace, "gkrust", "Cargo.toml")
|
comm_gkrust_toml = os.path.join(workspace, "gkrust", "Cargo.toml")
|
||||||
comm_gkrust_dir = os.path.dirname(comm_gkrust_toml)
|
comm_gkrust_dir = os.path.dirname(comm_gkrust_toml)
|
||||||
|
@ -389,6 +408,19 @@ def regen_toml_files(command_context, workspace):
|
||||||
for dep in mc_workspace.workspace_deps:
|
for dep in mc_workspace.workspace_deps:
|
||||||
workspace_dependencies.append(inline_encoded_toml(dep, mc_workspace.workspace_deps[dep]))
|
workspace_dependencies.append(inline_encoded_toml(dep, mc_workspace.workspace_deps[dep]))
|
||||||
|
|
||||||
|
# Target-specific dependencies for the workspace
|
||||||
|
target_deps = ""
|
||||||
|
for target, deps in mc_hack.target_deps.items():
|
||||||
|
target_name = target.replace('"', '\\"')
|
||||||
|
|
||||||
|
for dep_name, dep in deps.items():
|
||||||
|
target_deps += f'[target."{target_name}".dependencies.{dep_name}]\n'
|
||||||
|
|
||||||
|
for key, value in dep.items():
|
||||||
|
target_deps += inline_encoded_toml(key, value) + "\n"
|
||||||
|
|
||||||
|
target_deps += "\n"
|
||||||
|
|
||||||
# Patch emission
|
# Patch emission
|
||||||
for section in patches:
|
for section in patches:
|
||||||
data = patches[section]
|
data = patches[section]
|
||||||
|
@ -410,6 +442,7 @@ def regen_toml_files(command_context, workspace):
|
||||||
cargo_toml = (
|
cargo_toml = (
|
||||||
workspace_template.format(
|
workspace_template.format(
|
||||||
dependencies="\n".join(workspace_dependencies),
|
dependencies="\n".join(workspace_dependencies),
|
||||||
|
target_dependencies=target_deps.strip(),
|
||||||
members=workspace_members,
|
members=workspace_members,
|
||||||
features=tomlkit.dumps(features),
|
features=tomlkit.dumps(features),
|
||||||
patches=workspace_patches,
|
patches=workspace_patches,
|
||||||
|
@ -443,20 +476,47 @@ def inline_encoded_toml(id, data):
|
||||||
"""
|
"""
|
||||||
if isinstance(data, str):
|
if isinstance(data, str):
|
||||||
return f'{id} = "{data}"'
|
return f'{id} = "{data}"'
|
||||||
ret = f"{id} = {{"
|
if isinstance(data, bool):
|
||||||
|
return f"{id} = {str(data).lower()}"
|
||||||
|
|
||||||
|
# Keep track of whether the data structure we're dealing with is a list or a
|
||||||
|
# dict, because lists need some extra formatting tweaks compared to dicts.
|
||||||
|
is_list = isinstance(data, list)
|
||||||
|
|
||||||
|
if is_list:
|
||||||
|
ret = f"{id} = [\n"
|
||||||
|
else:
|
||||||
|
ret = f"{id} = {{"
|
||||||
|
|
||||||
for idx, key in enumerate(data):
|
for idx, key in enumerate(data):
|
||||||
if isinstance(data[key], bool):
|
if is_list:
|
||||||
value = (str(data[key])).lower()
|
value = data[idx]
|
||||||
elif isinstance(data[key], list):
|
|
||||||
value = str(data[key])
|
|
||||||
else:
|
else:
|
||||||
value = '"' + data[key] + '"'
|
value = data[key]
|
||||||
|
|
||||||
|
if isinstance(value, bool):
|
||||||
|
value = (str(value)).lower()
|
||||||
|
elif isinstance(value, list):
|
||||||
|
value = str(value)
|
||||||
|
else:
|
||||||
|
value = '"' + value + '"'
|
||||||
if idx > 0:
|
if idx > 0:
|
||||||
ret += ", "
|
ret += ","
|
||||||
|
if is_list:
|
||||||
|
ret += "\n"
|
||||||
|
ret += " "
|
||||||
else:
|
else:
|
||||||
ret += " "
|
ret += " "
|
||||||
ret += f"{key} = {value}"
|
|
||||||
return ret + " }"
|
if is_list:
|
||||||
|
ret += f"{value}"
|
||||||
|
else:
|
||||||
|
ret += f"{key} = {value}"
|
||||||
|
|
||||||
|
if is_list:
|
||||||
|
return ret + "\n]"
|
||||||
|
else:
|
||||||
|
return ret + " }"
|
||||||
|
|
||||||
|
|
||||||
def verify_vendored_dependencies(topsrcdir):
|
def verify_vendored_dependencies(topsrcdir):
|
||||||
|
|
|
@ -3450,6 +3450,12 @@ dependencies = [
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozilla-central-workspace-hack"
|
name = "mozilla-central-workspace-hack"
|
||||||
version = "0.1.0"
|
version = "0.1.0"
|
||||||
|
dependencies = [
|
||||||
|
"core-foundation-sys",
|
||||||
|
"scopeguard",
|
||||||
|
"winapi",
|
||||||
|
"windows-sys",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "mozurl"
|
name = "mozurl"
|
||||||
|
|
135
rust/Cargo.toml
135
rust/Cargo.toml
|
@ -18,6 +18,141 @@ uniffi_bindgen = { version = "0.27.3" }
|
||||||
rusqlite = { version = "0.31.0" }
|
rusqlite = { version = "0.31.0" }
|
||||||
glean = { version = "=60.5.0" }
|
glean = { version = "=60.5.0" }
|
||||||
|
|
||||||
|
[target."cfg(windows)".dependencies.scopeguard]
|
||||||
|
version = "1"
|
||||||
|
optional = true
|
||||||
|
|
||||||
|
[target."cfg(windows)".dependencies.winapi]
|
||||||
|
version = "0.3.6"
|
||||||
|
features = [
|
||||||
|
"avrt",
|
||||||
|
"basetsd",
|
||||||
|
"bits",
|
||||||
|
"bits2_5",
|
||||||
|
"bitsmsg",
|
||||||
|
"cfg",
|
||||||
|
"combaseapi",
|
||||||
|
"consoleapi",
|
||||||
|
"d3d11",
|
||||||
|
"d3d11_1",
|
||||||
|
"d3d11_2",
|
||||||
|
"d3d11sdklayers",
|
||||||
|
"d3d12",
|
||||||
|
"d3d12sdklayers",
|
||||||
|
"d3d12shader",
|
||||||
|
"d3dcommon",
|
||||||
|
"d3dcompiler",
|
||||||
|
"dcomp",
|
||||||
|
"dwrite",
|
||||||
|
"dwrite_1",
|
||||||
|
"dwrite_3",
|
||||||
|
"dxgi1_2",
|
||||||
|
"dxgi1_3",
|
||||||
|
"dxgi1_4",
|
||||||
|
"dxgi1_5",
|
||||||
|
"dxgi1_6",
|
||||||
|
"dxgidebug",
|
||||||
|
"dxgiformat",
|
||||||
|
"errhandlingapi",
|
||||||
|
"evntrace",
|
||||||
|
"fileapi",
|
||||||
|
"guiddef",
|
||||||
|
"handleapi",
|
||||||
|
"hidclass",
|
||||||
|
"hidpi",
|
||||||
|
"hidusage",
|
||||||
|
"impl-debug",
|
||||||
|
"impl-default",
|
||||||
|
"in6addr",
|
||||||
|
"inaddr",
|
||||||
|
"ioapiset",
|
||||||
|
"knownfolders",
|
||||||
|
"libloaderapi",
|
||||||
|
"memoryapi",
|
||||||
|
"minwinbase",
|
||||||
|
"minwindef",
|
||||||
|
"mmeapi",
|
||||||
|
"mmsystem",
|
||||||
|
"mswsock",
|
||||||
|
"namedpipeapi",
|
||||||
|
"ntdef",
|
||||||
|
"ntsecapi",
|
||||||
|
"ntstatus",
|
||||||
|
"oaidl",
|
||||||
|
"objbase",
|
||||||
|
"oleauto",
|
||||||
|
"processenv",
|
||||||
|
"processthreadsapi",
|
||||||
|
"profileapi",
|
||||||
|
"psapi",
|
||||||
|
"rpcndr",
|
||||||
|
"setupapi",
|
||||||
|
"shlobj",
|
||||||
|
"std",
|
||||||
|
"synchapi",
|
||||||
|
"sysinfoapi",
|
||||||
|
"taskschd",
|
||||||
|
"timeapi",
|
||||||
|
"timezoneapi",
|
||||||
|
"unknwnbase",
|
||||||
|
"winbase",
|
||||||
|
"wincon",
|
||||||
|
"wincrypt",
|
||||||
|
"windef",
|
||||||
|
"winerror",
|
||||||
|
"wininet",
|
||||||
|
"winioctl",
|
||||||
|
"winnls",
|
||||||
|
"winnt",
|
||||||
|
"winreg",
|
||||||
|
"winsock2",
|
||||||
|
"winuser",
|
||||||
|
"ws2def",
|
||||||
|
"ws2ipdef",
|
||||||
|
"ws2tcpip",
|
||||||
|
"wtypes",
|
||||||
|
"wtypesbase"
|
||||||
|
]
|
||||||
|
|
||||||
|
[target."cfg(windows)".dependencies.windows-sys]
|
||||||
|
version = "0.52"
|
||||||
|
optional = true
|
||||||
|
features = [
|
||||||
|
"Wdk_Foundation",
|
||||||
|
"Wdk_Storage",
|
||||||
|
"Wdk_Storage_FileSystem",
|
||||||
|
"Wdk_System_IO",
|
||||||
|
"Wdk_System_Threading",
|
||||||
|
"Win32_Foundation",
|
||||||
|
"Win32_Globalization",
|
||||||
|
"Win32_Graphics_Gdi",
|
||||||
|
"Win32_Networking",
|
||||||
|
"Win32_Networking_WinSock",
|
||||||
|
"Win32_Security",
|
||||||
|
"Win32_Storage_FileSystem",
|
||||||
|
"Win32_System_Com",
|
||||||
|
"Win32_System_Diagnostics_Debug",
|
||||||
|
"Win32_System_ErrorReporting",
|
||||||
|
"Win32_System_IO",
|
||||||
|
"Win32_System_Kernel",
|
||||||
|
"Win32_System_LibraryLoader",
|
||||||
|
"Win32_System_Memory",
|
||||||
|
"Win32_System_Pipes",
|
||||||
|
"Win32_System_ProcessStatus",
|
||||||
|
"Win32_System_SystemInformation",
|
||||||
|
"Win32_System_SystemServices",
|
||||||
|
"Win32_System_Threading",
|
||||||
|
"Win32_System_WindowsProgramming",
|
||||||
|
"Win32_UI_Controls",
|
||||||
|
"Win32_UI_Input_KeyboardAndMouse",
|
||||||
|
"Win32_UI_Shell",
|
||||||
|
"Win32_UI_WindowsAndMessaging"
|
||||||
|
]
|
||||||
|
|
||||||
|
[target."cfg(any(target_os = \"macos\", target_os = \"ios\"))".dependencies.core-foundation-sys]
|
||||||
|
version = "0.8"
|
||||||
|
optional = true
|
||||||
|
|
||||||
[patch.crates-io]
|
[patch.crates-io]
|
||||||
mozilla-central-workspace-hack = { path = "." }
|
mozilla-central-workspace-hack = { path = "." }
|
||||||
cmake = { path = "../../build/rust/cmake" }
|
cmake = { path = "../../build/rust/cmake" }
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
{"mc_workspace_toml": "948ffb790b7c291e164071ecffb81aaf89d0956d12d36ff97634362396a45fac3e5a3bb98e7c2864873c1d18e2f854c292fcc736a5ab4d6589ea2947c44a3eca", "mc_gkrust_toml": "9e4671d426a453a7743cb0f3e0efff735e44b33d81f2ea514d652acb20cc032fe4b50073586cf81647571cda974a885afb2256223fcb0cd62c4141b71c2af0f2", "mc_cargo_lock": "7c08fbfcf7d9d15f11068b0582c4cb46c41ed4193497177dafc22b262e5557b260c39b23802751701fea1966713eee4d6adac4ac89c1d1ddf5a75dd07f733af6"}
|
{"mc_workspace_toml": "948ffb790b7c291e164071ecffb81aaf89d0956d12d36ff97634362396a45fac3e5a3bb98e7c2864873c1d18e2f854c292fcc736a5ab4d6589ea2947c44a3eca", "mc_gkrust_toml": "9e4671d426a453a7743cb0f3e0efff735e44b33d81f2ea514d652acb20cc032fe4b50073586cf81647571cda974a885afb2256223fcb0cd62c4141b71c2af0f2", "mc_hack_toml": "0be5955346b278ea0611209027bbee30ee54d0d8ed7ffb48b5705db70de2bdd285e16e22c297b5f65acb18427f7937567ed8fd6a7ff26b8579000faf00095f59", "mc_cargo_lock": "7c08fbfcf7d9d15f11068b0582c4cb46c41ed4193497177dafc22b262e5557b260c39b23802751701fea1966713eee4d6adac4ac89c1d1ddf5a75dd07f733af6"}
|
Загрузка…
Ссылка в новой задаче