Bug 1773509 - Add an in-tree windows crate that wraps a bootstrapped windows-rs. r=firefox-build-system-reviewers,supply-chain-reviewers,ahochheiden

Differential Revision: https://phabricator.services.mozilla.com/D200104
This commit is contained in:
Mike Hommey 2024-02-06 14:57:53 +00:00
parent 59cdc7f6f2
commit 85d4984e64
17 changed files with 935 additions and 5 deletions

11
Cargo.lock generated
View File

@ -2257,7 +2257,7 @@ dependencies = [
"webext_storage_bridge",
"webrender_bindings",
"wgpu_bindings",
"windows-core",
"windows",
"wpf-gpu-raster",
"xpcom",
]
@ -6580,6 +6580,15 @@ version = "0.4.0"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f"
[[package]]
name = "windows"
version = "0.52.0"
dependencies = [
"mozbuild",
"windows-core",
"windows-targets 0.52.999",
]
[[package]]
name = "windows-core"
version = "0.52.0"

View File

@ -108,6 +108,9 @@ windows-targets_0_48 = { package = "windows-targets", path = "build/rust/windows
# Patch windows-sys from 0.48.0 to 0.52.0
windows-sys = { path = "build/rust/windows-sys" }
# Patch windows to use a non-vendored local copy of the crate.
windows = { path = "build/rust/windows" }
# Dummy oslog replacement. It's only used by glean in code that is not actually used.
oslog = { path = "build/rust/oslog" }

View File

@ -65,6 +65,26 @@ def generate(output):
)
)
windows_rs_dir = buildconfig.substs.get("MOZ_WINDOWS_RS_DIR")
if windows_rs_dir:
output.write(
textwrap.dedent(
f"""
/// Macro used to name a path in the srcdir for use with macros like `include!`
#[macro_export]
macro_rules! windows_rs_path {{
($path:literal) => {{
concat!({escape_rust_string(windows_rs_dir + "/")}, $path)
}}
}}
/// The path to the windows-rs crate, for use in build scripts
pub const WINDOWS_RS_DIR: &str = {escape_rust_string(windows_rs_dir)};
"""
)
)
# Finally, write out some useful booleans from the buildconfig.
output.write(generate_bool("MOZ_FOLD_LIBS"))
output.write(generate_bool("NIGHTLY_BUILD"))

View File

@ -0,0 +1,736 @@
# THIS FILE IS AUTOMATICALLY GENERATED BY CARGO
#
# When uploading crates to the registry Cargo will automatically
# "normalize" Cargo.toml files for maximal compatibility
# with all versions of Cargo and also rewrite `path` dependencies
# to registry (e.g., crates.io) dependencies.
#
# If you are reading this file be aware that the original Cargo.toml
# will likely look very different (and much more reasonable).
# See Cargo.toml.orig for the original contents.
[package]
edition = "2021"
rust-version = "1.56"
name = "windows"
version = "0.52.0"
authors = ["Microsoft"]
description = "Rust for Windows"
documentation = "https://microsoft.github.io/windows-docs-rs/"
readme = "readme.md"
categories = ["os::windows-apis"]
license = "MIT OR Apache-2.0"
repository = "https://github.com/microsoft/windows-rs"
[package.metadata.docs.rs]
default-target = "x86_64-pc-windows-msvc"
rustdoc-args = [
"--cfg",
"docsrs",
]
targets = []
[dependencies.windows-core]
version = "0.52.0"
[dependencies.windows-implement]
version = "0.52.0"
optional = true
[dependencies.windows-interface]
version = "0.52.0"
optional = true
[dependencies.windows-targets]
version = "0.52.0"
[features]
AI = []
AI_MachineLearning = ["AI"]
ApplicationModel = []
ApplicationModel_Activation = ["ApplicationModel"]
ApplicationModel_AppExtensions = ["ApplicationModel"]
ApplicationModel_AppService = ["ApplicationModel"]
ApplicationModel_Appointments = ["ApplicationModel"]
ApplicationModel_Appointments_AppointmentsProvider = ["ApplicationModel_Appointments"]
ApplicationModel_Appointments_DataProvider = ["ApplicationModel_Appointments"]
ApplicationModel_Background = ["ApplicationModel"]
ApplicationModel_Calls = ["ApplicationModel"]
ApplicationModel_Calls_Background = ["ApplicationModel_Calls"]
ApplicationModel_Calls_Provider = ["ApplicationModel_Calls"]
ApplicationModel_Chat = ["ApplicationModel"]
ApplicationModel_CommunicationBlocking = ["ApplicationModel"]
ApplicationModel_Contacts = ["ApplicationModel"]
ApplicationModel_Contacts_DataProvider = ["ApplicationModel_Contacts"]
ApplicationModel_Contacts_Provider = ["ApplicationModel_Contacts"]
ApplicationModel_ConversationalAgent = ["ApplicationModel"]
ApplicationModel_Core = ["ApplicationModel"]
ApplicationModel_DataTransfer = ["ApplicationModel"]
ApplicationModel_DataTransfer_DragDrop = ["ApplicationModel_DataTransfer"]
ApplicationModel_DataTransfer_DragDrop_Core = ["ApplicationModel_DataTransfer_DragDrop"]
ApplicationModel_DataTransfer_ShareTarget = ["ApplicationModel_DataTransfer"]
ApplicationModel_Email = ["ApplicationModel"]
ApplicationModel_Email_DataProvider = ["ApplicationModel_Email"]
ApplicationModel_ExtendedExecution = ["ApplicationModel"]
ApplicationModel_ExtendedExecution_Foreground = ["ApplicationModel_ExtendedExecution"]
ApplicationModel_Holographic = ["ApplicationModel"]
ApplicationModel_LockScreen = ["ApplicationModel"]
ApplicationModel_Payments = ["ApplicationModel"]
ApplicationModel_Payments_Provider = ["ApplicationModel_Payments"]
ApplicationModel_Preview = ["ApplicationModel"]
ApplicationModel_Preview_Holographic = ["ApplicationModel_Preview"]
ApplicationModel_Preview_InkWorkspace = ["ApplicationModel_Preview"]
ApplicationModel_Preview_Notes = ["ApplicationModel_Preview"]
ApplicationModel_Resources = ["ApplicationModel"]
ApplicationModel_Resources_Core = ["ApplicationModel_Resources"]
ApplicationModel_Resources_Management = ["ApplicationModel_Resources"]
ApplicationModel_Search = ["ApplicationModel"]
ApplicationModel_Search_Core = ["ApplicationModel_Search"]
ApplicationModel_Store = ["ApplicationModel"]
ApplicationModel_Store_LicenseManagement = ["ApplicationModel_Store"]
ApplicationModel_Store_Preview = ["ApplicationModel_Store"]
ApplicationModel_Store_Preview_InstallControl = ["ApplicationModel_Store_Preview"]
ApplicationModel_UserActivities = ["ApplicationModel"]
ApplicationModel_UserActivities_Core = ["ApplicationModel_UserActivities"]
ApplicationModel_UserDataAccounts = ["ApplicationModel"]
ApplicationModel_UserDataAccounts_Provider = ["ApplicationModel_UserDataAccounts"]
ApplicationModel_UserDataAccounts_SystemAccess = ["ApplicationModel_UserDataAccounts"]
ApplicationModel_UserDataTasks = ["ApplicationModel"]
ApplicationModel_UserDataTasks_DataProvider = ["ApplicationModel_UserDataTasks"]
ApplicationModel_VoiceCommands = ["ApplicationModel"]
ApplicationModel_Wallet = ["ApplicationModel"]
ApplicationModel_Wallet_System = ["ApplicationModel_Wallet"]
Data = []
Data_Html = ["Data"]
Data_Json = ["Data"]
Data_Pdf = ["Data"]
Data_Text = ["Data"]
Data_Xml = ["Data"]
Data_Xml_Dom = ["Data_Xml"]
Data_Xml_Xsl = ["Data_Xml"]
Devices = []
Devices_Adc = ["Devices"]
Devices_Adc_Provider = ["Devices_Adc"]
Devices_Background = ["Devices"]
Devices_Bluetooth = ["Devices"]
Devices_Bluetooth_Advertisement = ["Devices_Bluetooth"]
Devices_Bluetooth_Background = ["Devices_Bluetooth"]
Devices_Bluetooth_GenericAttributeProfile = ["Devices_Bluetooth"]
Devices_Bluetooth_Rfcomm = ["Devices_Bluetooth"]
Devices_Custom = ["Devices"]
Devices_Display = ["Devices"]
Devices_Display_Core = ["Devices_Display"]
Devices_Enumeration = ["Devices"]
Devices_Enumeration_Pnp = ["Devices_Enumeration"]
Devices_Geolocation = ["Devices"]
Devices_Geolocation_Geofencing = ["Devices_Geolocation"]
Devices_Geolocation_Provider = ["Devices_Geolocation"]
Devices_Gpio = ["Devices"]
Devices_Gpio_Provider = ["Devices_Gpio"]
Devices_Haptics = ["Devices"]
Devices_HumanInterfaceDevice = ["Devices"]
Devices_I2c = ["Devices"]
Devices_I2c_Provider = ["Devices_I2c"]
Devices_Input = ["Devices"]
Devices_Input_Preview = ["Devices_Input"]
Devices_Lights = ["Devices"]
Devices_Lights_Effects = ["Devices_Lights"]
Devices_Midi = ["Devices"]
Devices_PointOfService = ["Devices"]
Devices_PointOfService_Provider = ["Devices_PointOfService"]
Devices_Portable = ["Devices"]
Devices_Power = ["Devices"]
Devices_Printers = ["Devices"]
Devices_Printers_Extensions = ["Devices_Printers"]
Devices_Pwm = ["Devices"]
Devices_Pwm_Provider = ["Devices_Pwm"]
Devices_Radios = ["Devices"]
Devices_Scanners = ["Devices"]
Devices_Sensors = ["Devices"]
Devices_Sensors_Custom = ["Devices_Sensors"]
Devices_SerialCommunication = ["Devices"]
Devices_SmartCards = ["Devices"]
Devices_Sms = ["Devices"]
Devices_Spi = ["Devices"]
Devices_Spi_Provider = ["Devices_Spi"]
Devices_Usb = ["Devices"]
Devices_WiFi = ["Devices"]
Devices_WiFiDirect = ["Devices"]
Devices_WiFiDirect_Services = ["Devices_WiFiDirect"]
Embedded = []
Embedded_DeviceLockdown = ["Embedded"]
Foundation = []
Foundation_Collections = ["Foundation"]
Foundation_Diagnostics = ["Foundation"]
Foundation_Metadata = ["Foundation"]
Foundation_Numerics = ["Foundation"]
Gaming = []
Gaming_Input = ["Gaming"]
Gaming_Input_Custom = ["Gaming_Input"]
Gaming_Input_ForceFeedback = ["Gaming_Input"]
Gaming_Input_Preview = ["Gaming_Input"]
Gaming_Preview = ["Gaming"]
Gaming_Preview_GamesEnumeration = ["Gaming_Preview"]
Gaming_UI = ["Gaming"]
Gaming_XboxLive = ["Gaming"]
Gaming_XboxLive_Storage = ["Gaming_XboxLive"]
Globalization = []
Globalization_Collation = ["Globalization"]
Globalization_DateTimeFormatting = ["Globalization"]
Globalization_Fonts = ["Globalization"]
Globalization_NumberFormatting = ["Globalization"]
Globalization_PhoneNumberFormatting = ["Globalization"]
Graphics = []
Graphics_Capture = ["Graphics"]
Graphics_DirectX = ["Graphics"]
Graphics_DirectX_Direct3D11 = ["Graphics_DirectX"]
Graphics_Display = ["Graphics"]
Graphics_Display_Core = ["Graphics_Display"]
Graphics_Effects = ["Graphics"]
Graphics_Holographic = ["Graphics"]
Graphics_Imaging = ["Graphics"]
Graphics_Printing = ["Graphics"]
Graphics_Printing3D = ["Graphics"]
Graphics_Printing_OptionDetails = ["Graphics_Printing"]
Graphics_Printing_PrintSupport = ["Graphics_Printing"]
Graphics_Printing_PrintTicket = ["Graphics_Printing"]
Graphics_Printing_Workflow = ["Graphics_Printing"]
Management = []
Management_Core = ["Management"]
Management_Deployment = ["Management"]
Management_Deployment_Preview = ["Management_Deployment"]
Management_Policies = ["Management"]
Management_Update = ["Management"]
Management_Workplace = ["Management"]
Media = []
Media_AppBroadcasting = ["Media"]
Media_AppRecording = ["Media"]
Media_Audio = ["Media"]
Media_Capture = ["Media"]
Media_Capture_Core = ["Media_Capture"]
Media_Capture_Frames = ["Media_Capture"]
Media_Casting = ["Media"]
Media_ClosedCaptioning = ["Media"]
Media_ContentRestrictions = ["Media"]
Media_Control = ["Media"]
Media_Core = ["Media"]
Media_Core_Preview = ["Media_Core"]
Media_Devices = ["Media"]
Media_Devices_Core = ["Media_Devices"]
Media_DialProtocol = ["Media"]
Media_Editing = ["Media"]
Media_Effects = ["Media"]
Media_FaceAnalysis = ["Media"]
Media_Import = ["Media"]
Media_MediaProperties = ["Media"]
Media_Miracast = ["Media"]
Media_Ocr = ["Media"]
Media_PlayTo = ["Media"]
Media_Playback = ["Media"]
Media_Playlists = ["Media"]
Media_Protection = ["Media"]
Media_Protection_PlayReady = ["Media_Protection"]
Media_Render = ["Media"]
Media_SpeechRecognition = ["Media"]
Media_SpeechSynthesis = ["Media"]
Media_Streaming = ["Media"]
Media_Streaming_Adaptive = ["Media_Streaming"]
Media_Transcoding = ["Media"]
Networking = []
Networking_BackgroundTransfer = ["Networking"]
Networking_Connectivity = ["Networking"]
Networking_NetworkOperators = ["Networking"]
Networking_Proximity = ["Networking"]
Networking_PushNotifications = ["Networking"]
Networking_ServiceDiscovery = ["Networking"]
Networking_ServiceDiscovery_Dnssd = ["Networking_ServiceDiscovery"]
Networking_Sockets = ["Networking"]
Networking_Vpn = ["Networking"]
Networking_XboxLive = ["Networking"]
Perception = []
Perception_Automation = ["Perception"]
Perception_Automation_Core = ["Perception_Automation"]
Perception_People = ["Perception"]
Perception_Spatial = ["Perception"]
Perception_Spatial_Preview = ["Perception_Spatial"]
Perception_Spatial_Surfaces = ["Perception_Spatial"]
Phone = []
Phone_ApplicationModel = ["Phone"]
Phone_Devices = ["Phone"]
Phone_Devices_Notification = ["Phone_Devices"]
Phone_Devices_Power = ["Phone_Devices"]
Phone_Management = ["Phone"]
Phone_Management_Deployment = ["Phone_Management"]
Phone_Media = ["Phone"]
Phone_Media_Devices = ["Phone_Media"]
Phone_Notification = ["Phone"]
Phone_Notification_Management = ["Phone_Notification"]
Phone_PersonalInformation = ["Phone"]
Phone_PersonalInformation_Provisioning = ["Phone_PersonalInformation"]
Phone_Speech = ["Phone"]
Phone_Speech_Recognition = ["Phone_Speech"]
Phone_StartScreen = ["Phone"]
Phone_System = ["Phone"]
Phone_System_Power = ["Phone_System"]
Phone_System_Profile = ["Phone_System"]
Phone_System_UserProfile = ["Phone_System"]
Phone_System_UserProfile_GameServices = ["Phone_System_UserProfile"]
Phone_System_UserProfile_GameServices_Core = ["Phone_System_UserProfile_GameServices"]
Phone_UI = ["Phone"]
Phone_UI_Input = ["Phone_UI"]
Security = []
Security_Authentication = ["Security"]
Security_Authentication_Identity = ["Security_Authentication"]
Security_Authentication_Identity_Core = ["Security_Authentication_Identity"]
Security_Authentication_OnlineId = ["Security_Authentication"]
Security_Authentication_Web = ["Security_Authentication"]
Security_Authentication_Web_Core = ["Security_Authentication_Web"]
Security_Authentication_Web_Provider = ["Security_Authentication_Web"]
Security_Authorization = ["Security"]
Security_Authorization_AppCapabilityAccess = ["Security_Authorization"]
Security_Credentials = ["Security"]
Security_Credentials_UI = ["Security_Credentials"]
Security_Cryptography = ["Security"]
Security_Cryptography_Certificates = ["Security_Cryptography"]
Security_Cryptography_Core = ["Security_Cryptography"]
Security_Cryptography_DataProtection = ["Security_Cryptography"]
Security_DataProtection = ["Security"]
Security_EnterpriseData = ["Security"]
Security_ExchangeActiveSyncProvisioning = ["Security"]
Security_Isolation = ["Security"]
Services = []
Services_Maps = ["Services"]
Services_Maps_Guidance = ["Services_Maps"]
Services_Maps_LocalSearch = ["Services_Maps"]
Services_Maps_OfflineMaps = ["Services_Maps"]
Services_Store = ["Services"]
Services_TargetedContent = ["Services"]
Storage = []
Storage_AccessCache = ["Storage"]
Storage_BulkAccess = ["Storage"]
Storage_Compression = ["Storage"]
Storage_FileProperties = ["Storage"]
Storage_Pickers = ["Storage"]
Storage_Pickers_Provider = ["Storage_Pickers"]
Storage_Provider = ["Storage"]
Storage_Search = ["Storage"]
Storage_Streams = ["Storage"]
System = []
System_Diagnostics = ["System"]
System_Diagnostics_DevicePortal = ["System_Diagnostics"]
System_Diagnostics_Telemetry = ["System_Diagnostics"]
System_Diagnostics_TraceReporting = ["System_Diagnostics"]
System_Display = ["System"]
System_Implementation = ["System"]
System_Implementation_FileExplorer = ["System_Implementation"]
System_Inventory = ["System"]
System_Power = ["System"]
System_Profile = ["System"]
System_Profile_SystemManufacturers = ["System_Profile"]
System_RemoteDesktop = ["System"]
System_RemoteDesktop_Input = ["System_RemoteDesktop"]
System_RemoteSystems = ["System"]
System_Threading = ["System"]
System_Threading_Core = ["System_Threading"]
System_Update = ["System"]
System_UserProfile = ["System"]
UI = []
UI_Accessibility = ["UI"]
UI_ApplicationSettings = ["UI"]
UI_Composition = ["UI"]
UI_Composition_Core = ["UI_Composition"]
UI_Composition_Desktop = ["UI_Composition"]
UI_Composition_Diagnostics = ["UI_Composition"]
UI_Composition_Effects = ["UI_Composition"]
UI_Composition_Interactions = ["UI_Composition"]
UI_Composition_Scenes = ["UI_Composition"]
UI_Core = ["UI"]
UI_Core_AnimationMetrics = ["UI_Core"]
UI_Core_Preview = ["UI_Core"]
UI_Input = ["UI"]
UI_Input_Core = ["UI_Input"]
UI_Input_Inking = ["UI_Input"]
UI_Input_Inking_Analysis = ["UI_Input_Inking"]
UI_Input_Inking_Core = ["UI_Input_Inking"]
UI_Input_Inking_Preview = ["UI_Input_Inking"]
UI_Input_Preview = ["UI_Input"]
UI_Input_Preview_Injection = ["UI_Input_Preview"]
UI_Input_Spatial = ["UI_Input"]
UI_Notifications = ["UI"]
UI_Notifications_Management = ["UI_Notifications"]
UI_Popups = ["UI"]
UI_Shell = ["UI"]
UI_StartScreen = ["UI"]
UI_Text = ["UI"]
UI_Text_Core = ["UI_Text"]
UI_UIAutomation = ["UI"]
UI_UIAutomation_Core = ["UI_UIAutomation"]
UI_ViewManagement = ["UI"]
UI_ViewManagement_Core = ["UI_ViewManagement"]
UI_WebUI = ["UI"]
UI_WebUI_Core = ["UI_WebUI"]
UI_WindowManagement = ["UI"]
UI_WindowManagement_Preview = ["UI_WindowManagement"]
Wdk = []
Wdk_Foundation = ["Wdk"]
Wdk_Graphics = ["Wdk"]
Wdk_Graphics_Direct3D = ["Wdk_Graphics"]
Wdk_Storage = ["Wdk"]
Wdk_Storage_FileSystem = ["Wdk_Storage"]
Wdk_Storage_FileSystem_Minifilters = ["Wdk_Storage_FileSystem"]
Wdk_System = ["Wdk"]
Wdk_System_IO = ["Wdk_System"]
Wdk_System_OfflineRegistry = ["Wdk_System"]
Wdk_System_Registry = ["Wdk_System"]
Wdk_System_SystemInformation = ["Wdk_System"]
Wdk_System_SystemServices = ["Wdk_System"]
Wdk_System_Threading = ["Wdk_System"]
Web = []
Web_AtomPub = ["Web"]
Web_Http = ["Web"]
Web_Http_Diagnostics = ["Web_Http"]
Web_Http_Filters = ["Web_Http"]
Web_Http_Headers = ["Web_Http"]
Web_Syndication = ["Web"]
Web_UI = ["Web"]
Web_UI_Interop = ["Web_UI"]
Win32 = []
Win32_AI = ["Win32"]
Win32_AI_MachineLearning = ["Win32_AI"]
Win32_AI_MachineLearning_DirectML = ["Win32_AI_MachineLearning"]
Win32_AI_MachineLearning_WinML = ["Win32_AI_MachineLearning"]
Win32_Data = ["Win32"]
Win32_Data_HtmlHelp = ["Win32_Data"]
Win32_Data_RightsManagement = ["Win32_Data"]
Win32_Data_Xml = ["Win32_Data"]
Win32_Data_Xml_MsXml = ["Win32_Data_Xml"]
Win32_Data_Xml_XmlLite = ["Win32_Data_Xml"]
Win32_Devices = ["Win32"]
Win32_Devices_AllJoyn = ["Win32_Devices"]
Win32_Devices_BiometricFramework = ["Win32_Devices"]
Win32_Devices_Bluetooth = ["Win32_Devices"]
Win32_Devices_Communication = ["Win32_Devices"]
Win32_Devices_DeviceAccess = ["Win32_Devices"]
Win32_Devices_DeviceAndDriverInstallation = ["Win32_Devices"]
Win32_Devices_DeviceQuery = ["Win32_Devices"]
Win32_Devices_Display = ["Win32_Devices"]
Win32_Devices_Enumeration = ["Win32_Devices"]
Win32_Devices_Enumeration_Pnp = ["Win32_Devices_Enumeration"]
Win32_Devices_Fax = ["Win32_Devices"]
Win32_Devices_FunctionDiscovery = ["Win32_Devices"]
Win32_Devices_Geolocation = ["Win32_Devices"]
Win32_Devices_HumanInterfaceDevice = ["Win32_Devices"]
Win32_Devices_ImageAcquisition = ["Win32_Devices"]
Win32_Devices_PortableDevices = ["Win32_Devices"]
Win32_Devices_Properties = ["Win32_Devices"]
Win32_Devices_Pwm = ["Win32_Devices"]
Win32_Devices_Sensors = ["Win32_Devices"]
Win32_Devices_SerialCommunication = ["Win32_Devices"]
Win32_Devices_Tapi = ["Win32_Devices"]
Win32_Devices_Usb = ["Win32_Devices"]
Win32_Devices_WebServicesOnDevices = ["Win32_Devices"]
Win32_Foundation = ["Win32"]
Win32_Gaming = ["Win32"]
Win32_Globalization = ["Win32"]
Win32_Graphics = ["Win32"]
Win32_Graphics_CompositionSwapchain = ["Win32_Graphics"]
Win32_Graphics_DXCore = ["Win32_Graphics"]
Win32_Graphics_Direct2D = ["Win32_Graphics"]
Win32_Graphics_Direct2D_Common = ["Win32_Graphics_Direct2D"]
Win32_Graphics_Direct3D = ["Win32_Graphics"]
Win32_Graphics_Direct3D10 = ["Win32_Graphics"]
Win32_Graphics_Direct3D11 = ["Win32_Graphics"]
Win32_Graphics_Direct3D11on12 = ["Win32_Graphics"]
Win32_Graphics_Direct3D12 = ["Win32_Graphics"]
Win32_Graphics_Direct3D9 = ["Win32_Graphics"]
Win32_Graphics_Direct3D9on12 = ["Win32_Graphics"]
Win32_Graphics_Direct3D_Dxc = ["Win32_Graphics_Direct3D"]
Win32_Graphics_Direct3D_Fxc = ["Win32_Graphics_Direct3D"]
Win32_Graphics_DirectComposition = ["Win32_Graphics"]
Win32_Graphics_DirectDraw = ["Win32_Graphics"]
Win32_Graphics_DirectManipulation = ["Win32_Graphics"]
Win32_Graphics_DirectWrite = ["Win32_Graphics"]
Win32_Graphics_Dwm = ["Win32_Graphics"]
Win32_Graphics_Dxgi = ["Win32_Graphics"]
Win32_Graphics_Dxgi_Common = ["Win32_Graphics_Dxgi"]
Win32_Graphics_Gdi = ["Win32_Graphics"]
Win32_Graphics_GdiPlus = ["Win32_Graphics"]
Win32_Graphics_Hlsl = ["Win32_Graphics"]
Win32_Graphics_Imaging = ["Win32_Graphics"]
Win32_Graphics_Imaging_D2D = ["Win32_Graphics_Imaging"]
Win32_Graphics_OpenGL = ["Win32_Graphics"]
Win32_Graphics_Printing = ["Win32_Graphics"]
Win32_Graphics_Printing_PrintTicket = ["Win32_Graphics_Printing"]
Win32_Management = ["Win32"]
Win32_Management_MobileDeviceManagementRegistration = ["Win32_Management"]
Win32_Media = ["Win32"]
Win32_Media_Audio = ["Win32_Media"]
Win32_Media_Audio_Apo = ["Win32_Media_Audio"]
Win32_Media_Audio_DirectMusic = ["Win32_Media_Audio"]
Win32_Media_Audio_DirectSound = ["Win32_Media_Audio"]
Win32_Media_Audio_Endpoints = ["Win32_Media_Audio"]
Win32_Media_Audio_XAudio2 = ["Win32_Media_Audio"]
Win32_Media_DeviceManager = ["Win32_Media"]
Win32_Media_DirectShow = ["Win32_Media"]
Win32_Media_DirectShow_Tv = ["Win32_Media_DirectShow"]
Win32_Media_DirectShow_Xml = ["Win32_Media_DirectShow"]
Win32_Media_DxMediaObjects = ["Win32_Media"]
Win32_Media_KernelStreaming = ["Win32_Media"]
Win32_Media_LibrarySharingServices = ["Win32_Media"]
Win32_Media_MediaFoundation = ["Win32_Media"]
Win32_Media_MediaPlayer = ["Win32_Media"]
Win32_Media_Multimedia = ["Win32_Media"]
Win32_Media_PictureAcquisition = ["Win32_Media"]
Win32_Media_Speech = ["Win32_Media"]
Win32_Media_Streaming = ["Win32_Media"]
Win32_Media_WindowsMediaFormat = ["Win32_Media"]
Win32_NetworkManagement = ["Win32"]
Win32_NetworkManagement_Dhcp = ["Win32_NetworkManagement"]
Win32_NetworkManagement_Dns = ["Win32_NetworkManagement"]
Win32_NetworkManagement_InternetConnectionWizard = ["Win32_NetworkManagement"]
Win32_NetworkManagement_IpHelper = ["Win32_NetworkManagement"]
Win32_NetworkManagement_MobileBroadband = ["Win32_NetworkManagement"]
Win32_NetworkManagement_Multicast = ["Win32_NetworkManagement"]
Win32_NetworkManagement_Ndis = ["Win32_NetworkManagement"]
Win32_NetworkManagement_NetBios = ["Win32_NetworkManagement"]
Win32_NetworkManagement_NetManagement = ["Win32_NetworkManagement"]
Win32_NetworkManagement_NetShell = ["Win32_NetworkManagement"]
Win32_NetworkManagement_NetworkDiagnosticsFramework = ["Win32_NetworkManagement"]
Win32_NetworkManagement_NetworkPolicyServer = ["Win32_NetworkManagement"]
Win32_NetworkManagement_P2P = ["Win32_NetworkManagement"]
Win32_NetworkManagement_QoS = ["Win32_NetworkManagement"]
Win32_NetworkManagement_Rras = ["Win32_NetworkManagement"]
Win32_NetworkManagement_Snmp = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WNet = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WebDav = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WiFi = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WindowsConnectNow = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WindowsConnectionManager = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WindowsFilteringPlatform = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WindowsFirewall = ["Win32_NetworkManagement"]
Win32_NetworkManagement_WindowsNetworkVirtualization = ["Win32_NetworkManagement"]
Win32_Networking = ["Win32"]
Win32_Networking_ActiveDirectory = ["Win32_Networking"]
Win32_Networking_BackgroundIntelligentTransferService = ["Win32_Networking"]
Win32_Networking_Clustering = ["Win32_Networking"]
Win32_Networking_HttpServer = ["Win32_Networking"]
Win32_Networking_Ldap = ["Win32_Networking"]
Win32_Networking_NetworkListManager = ["Win32_Networking"]
Win32_Networking_RemoteDifferentialCompression = ["Win32_Networking"]
Win32_Networking_WebSocket = ["Win32_Networking"]
Win32_Networking_WinHttp = ["Win32_Networking"]
Win32_Networking_WinInet = ["Win32_Networking"]
Win32_Networking_WinSock = ["Win32_Networking"]
Win32_Networking_WindowsWebServices = ["Win32_Networking"]
Win32_Security = ["Win32"]
Win32_Security_AppLocker = ["Win32_Security"]
Win32_Security_Authentication = ["Win32_Security"]
Win32_Security_Authentication_Identity = ["Win32_Security_Authentication"]
Win32_Security_Authentication_Identity_Provider = ["Win32_Security_Authentication_Identity"]
Win32_Security_Authorization = ["Win32_Security"]
Win32_Security_Authorization_UI = ["Win32_Security_Authorization"]
Win32_Security_ConfigurationSnapin = ["Win32_Security"]
Win32_Security_Credentials = ["Win32_Security"]
Win32_Security_Cryptography = ["Win32_Security"]
Win32_Security_Cryptography_Catalog = ["Win32_Security_Cryptography"]
Win32_Security_Cryptography_Certificates = ["Win32_Security_Cryptography"]
Win32_Security_Cryptography_Sip = ["Win32_Security_Cryptography"]
Win32_Security_Cryptography_UI = ["Win32_Security_Cryptography"]
Win32_Security_DiagnosticDataQuery = ["Win32_Security"]
Win32_Security_DirectoryServices = ["Win32_Security"]
Win32_Security_EnterpriseData = ["Win32_Security"]
Win32_Security_ExtensibleAuthenticationProtocol = ["Win32_Security"]
Win32_Security_Isolation = ["Win32_Security"]
Win32_Security_LicenseProtection = ["Win32_Security"]
Win32_Security_NetworkAccessProtection = ["Win32_Security"]
Win32_Security_Tpm = ["Win32_Security"]
Win32_Security_WinTrust = ["Win32_Security"]
Win32_Security_WinWlx = ["Win32_Security"]
Win32_Storage = ["Win32"]
Win32_Storage_Cabinets = ["Win32_Storage"]
Win32_Storage_CloudFilters = ["Win32_Storage"]
Win32_Storage_Compression = ["Win32_Storage"]
Win32_Storage_DataDeduplication = ["Win32_Storage"]
Win32_Storage_DistributedFileSystem = ["Win32_Storage"]
Win32_Storage_EnhancedStorage = ["Win32_Storage"]
Win32_Storage_FileHistory = ["Win32_Storage"]
Win32_Storage_FileServerResourceManager = ["Win32_Storage"]
Win32_Storage_FileSystem = ["Win32_Storage"]
Win32_Storage_Imapi = ["Win32_Storage"]
Win32_Storage_IndexServer = ["Win32_Storage"]
Win32_Storage_InstallableFileSystems = ["Win32_Storage"]
Win32_Storage_IscsiDisc = ["Win32_Storage"]
Win32_Storage_Jet = ["Win32_Storage"]
Win32_Storage_Nvme = ["Win32_Storage"]
Win32_Storage_OfflineFiles = ["Win32_Storage"]
Win32_Storage_OperationRecorder = ["Win32_Storage"]
Win32_Storage_Packaging = ["Win32_Storage"]
Win32_Storage_Packaging_Appx = ["Win32_Storage_Packaging"]
Win32_Storage_Packaging_Opc = ["Win32_Storage_Packaging"]
Win32_Storage_ProjectedFileSystem = ["Win32_Storage"]
Win32_Storage_StructuredStorage = ["Win32_Storage"]
Win32_Storage_Vhd = ["Win32_Storage"]
Win32_Storage_VirtualDiskService = ["Win32_Storage"]
Win32_Storage_Vss = ["Win32_Storage"]
Win32_Storage_Xps = ["Win32_Storage"]
Win32_Storage_Xps_Printing = ["Win32_Storage_Xps"]
Win32_System = ["Win32"]
Win32_System_AddressBook = ["Win32_System"]
Win32_System_Antimalware = ["Win32_System"]
Win32_System_ApplicationInstallationAndServicing = ["Win32_System"]
Win32_System_ApplicationVerifier = ["Win32_System"]
Win32_System_AssessmentTool = ["Win32_System"]
Win32_System_ClrHosting = ["Win32_System"]
Win32_System_Com = ["Win32_System"]
Win32_System_Com_CallObj = ["Win32_System_Com"]
Win32_System_Com_ChannelCredentials = ["Win32_System_Com"]
Win32_System_Com_Events = ["Win32_System_Com"]
Win32_System_Com_Marshal = ["Win32_System_Com"]
Win32_System_Com_StructuredStorage = ["Win32_System_Com"]
Win32_System_Com_UI = ["Win32_System_Com"]
Win32_System_Com_Urlmon = ["Win32_System_Com"]
Win32_System_ComponentServices = ["Win32_System"]
Win32_System_Console = ["Win32_System"]
Win32_System_Contacts = ["Win32_System"]
Win32_System_CorrelationVector = ["Win32_System"]
Win32_System_DataExchange = ["Win32_System"]
Win32_System_DeploymentServices = ["Win32_System"]
Win32_System_DesktopSharing = ["Win32_System"]
Win32_System_DeveloperLicensing = ["Win32_System"]
Win32_System_Diagnostics = ["Win32_System"]
Win32_System_Diagnostics_Ceip = ["Win32_System_Diagnostics"]
Win32_System_Diagnostics_ClrProfiling = ["Win32_System_Diagnostics"]
Win32_System_Diagnostics_Debug = ["Win32_System_Diagnostics"]
Win32_System_Diagnostics_Debug_ActiveScript = ["Win32_System_Diagnostics_Debug"]
Win32_System_Diagnostics_Debug_Extensions = ["Win32_System_Diagnostics_Debug"]
Win32_System_Diagnostics_Etw = ["Win32_System_Diagnostics"]
Win32_System_Diagnostics_ProcessSnapshotting = ["Win32_System_Diagnostics"]
Win32_System_Diagnostics_ToolHelp = ["Win32_System_Diagnostics"]
Win32_System_DistributedTransactionCoordinator = ["Win32_System"]
Win32_System_Environment = ["Win32_System"]
Win32_System_ErrorReporting = ["Win32_System"]
Win32_System_EventCollector = ["Win32_System"]
Win32_System_EventLog = ["Win32_System"]
Win32_System_EventNotificationService = ["Win32_System"]
Win32_System_GroupPolicy = ["Win32_System"]
Win32_System_HostCompute = ["Win32_System"]
Win32_System_HostComputeNetwork = ["Win32_System"]
Win32_System_HostComputeSystem = ["Win32_System"]
Win32_System_Hypervisor = ["Win32_System"]
Win32_System_IO = ["Win32_System"]
Win32_System_Iis = ["Win32_System"]
Win32_System_Ioctl = ["Win32_System"]
Win32_System_JobObjects = ["Win32_System"]
Win32_System_Js = ["Win32_System"]
Win32_System_Kernel = ["Win32_System"]
Win32_System_LibraryLoader = ["Win32_System"]
Win32_System_Mailslots = ["Win32_System"]
Win32_System_Mapi = ["Win32_System"]
Win32_System_Memory = ["Win32_System"]
Win32_System_Memory_NonVolatile = ["Win32_System_Memory"]
Win32_System_MessageQueuing = ["Win32_System"]
Win32_System_MixedReality = ["Win32_System"]
Win32_System_Mmc = ["Win32_System"]
Win32_System_Ole = ["Win32_System"]
Win32_System_ParentalControls = ["Win32_System"]
Win32_System_PasswordManagement = ["Win32_System"]
Win32_System_Performance = ["Win32_System"]
Win32_System_Performance_HardwareCounterProfiling = ["Win32_System_Performance"]
Win32_System_Pipes = ["Win32_System"]
Win32_System_Power = ["Win32_System"]
Win32_System_ProcessStatus = ["Win32_System"]
Win32_System_RealTimeCommunications = ["Win32_System"]
Win32_System_Recovery = ["Win32_System"]
Win32_System_Registry = ["Win32_System"]
Win32_System_RemoteAssistance = ["Win32_System"]
Win32_System_RemoteDesktop = ["Win32_System"]
Win32_System_RemoteManagement = ["Win32_System"]
Win32_System_RestartManager = ["Win32_System"]
Win32_System_Restore = ["Win32_System"]
Win32_System_Rpc = ["Win32_System"]
Win32_System_Search = ["Win32_System"]
Win32_System_Search_Common = ["Win32_System_Search"]
Win32_System_SecurityCenter = ["Win32_System"]
Win32_System_ServerBackup = ["Win32_System"]
Win32_System_Services = ["Win32_System"]
Win32_System_SettingsManagementInfrastructure = ["Win32_System"]
Win32_System_SetupAndMigration = ["Win32_System"]
Win32_System_Shutdown = ["Win32_System"]
Win32_System_SideShow = ["Win32_System"]
Win32_System_StationsAndDesktops = ["Win32_System"]
Win32_System_SubsystemForLinux = ["Win32_System"]
Win32_System_SystemInformation = ["Win32_System"]
Win32_System_SystemServices = ["Win32_System"]
Win32_System_TaskScheduler = ["Win32_System"]
Win32_System_Threading = ["Win32_System"]
Win32_System_Time = ["Win32_System"]
Win32_System_TpmBaseServices = ["Win32_System"]
Win32_System_TransactionServer = ["Win32_System"]
Win32_System_UpdateAgent = ["Win32_System"]
Win32_System_UpdateAssessment = ["Win32_System"]
Win32_System_UserAccessLogging = ["Win32_System"]
Win32_System_Variant = ["Win32_System"]
Win32_System_VirtualDosMachines = ["Win32_System"]
Win32_System_WinRT = ["Win32_System"]
Win32_System_WinRT_AllJoyn = ["Win32_System_WinRT"]
Win32_System_WinRT_Composition = ["Win32_System_WinRT"]
Win32_System_WinRT_CoreInputView = ["Win32_System_WinRT"]
Win32_System_WinRT_Direct3D11 = ["Win32_System_WinRT"]
Win32_System_WinRT_Display = ["Win32_System_WinRT"]
Win32_System_WinRT_Graphics = ["Win32_System_WinRT"]
Win32_System_WinRT_Graphics_Capture = ["Win32_System_WinRT_Graphics"]
Win32_System_WinRT_Graphics_Direct2D = ["Win32_System_WinRT_Graphics"]
Win32_System_WinRT_Graphics_Imaging = ["Win32_System_WinRT_Graphics"]
Win32_System_WinRT_Holographic = ["Win32_System_WinRT"]
Win32_System_WinRT_Isolation = ["Win32_System_WinRT"]
Win32_System_WinRT_ML = ["Win32_System_WinRT"]
Win32_System_WinRT_Media = ["Win32_System_WinRT"]
Win32_System_WinRT_Metadata = ["Win32_System_WinRT"]
Win32_System_WinRT_Pdf = ["Win32_System_WinRT"]
Win32_System_WinRT_Printing = ["Win32_System_WinRT"]
Win32_System_WinRT_Shell = ["Win32_System_WinRT"]
Win32_System_WinRT_Storage = ["Win32_System_WinRT"]
Win32_System_WindowsProgramming = ["Win32_System"]
Win32_System_WindowsSync = ["Win32_System"]
Win32_System_Wmi = ["Win32_System"]
Win32_UI = ["Win32"]
Win32_UI_Accessibility = ["Win32_UI"]
Win32_UI_Animation = ["Win32_UI"]
Win32_UI_ColorSystem = ["Win32_UI"]
Win32_UI_Controls = ["Win32_UI"]
Win32_UI_Controls_Dialogs = ["Win32_UI_Controls"]
Win32_UI_Controls_RichEdit = ["Win32_UI_Controls"]
Win32_UI_HiDpi = ["Win32_UI"]
Win32_UI_Input = ["Win32_UI"]
Win32_UI_Input_Ime = ["Win32_UI_Input"]
Win32_UI_Input_Ink = ["Win32_UI_Input"]
Win32_UI_Input_KeyboardAndMouse = ["Win32_UI_Input"]
Win32_UI_Input_Pointer = ["Win32_UI_Input"]
Win32_UI_Input_Radial = ["Win32_UI_Input"]
Win32_UI_Input_Touch = ["Win32_UI_Input"]
Win32_UI_Input_XboxController = ["Win32_UI_Input"]
Win32_UI_InteractionContext = ["Win32_UI"]
Win32_UI_LegacyWindowsEnvironmentFeatures = ["Win32_UI"]
Win32_UI_Magnification = ["Win32_UI"]
Win32_UI_Notifications = ["Win32_UI"]
Win32_UI_Ribbon = ["Win32_UI"]
Win32_UI_Shell = ["Win32_UI"]
Win32_UI_Shell_Common = ["Win32_UI_Shell"]
Win32_UI_Shell_PropertiesSystem = ["Win32_UI_Shell"]
Win32_UI_TabletPC = ["Win32_UI"]
Win32_UI_TextServices = ["Win32_UI"]
Win32_UI_WindowsAndMessaging = ["Win32_UI"]
Win32_UI_Wpf = ["Win32_UI"]
Win32_Web = ["Win32"]
Win32_Web_InternetExplorer = ["Win32_Web"]
default = []
deprecated = []
docs = []
implement = [
"windows-implement",
"windows-interface",
"windows-core/implement",
]
[dependencies.mozbuild]
version = "0.1"

View File

@ -0,0 +1,24 @@
#![allow(warnings)]
#![cfg_attr(docsrs, doc = "This is a stub. The latest API documentation is here: <https://microsoft.github.io/windows-docs-rs/>")]
#![cfg_attr(docsrs, doc = "")]
/*!
Learn more about Rust for Windows here: <https://github.com/microsoft/windows-rs>
*/
#![doc(html_no_source)]
#![allow(non_snake_case, clashing_extern_declarations, non_upper_case_globals, non_camel_case_types, clippy::all)]
#![cfg_attr(not(feature = "docs"), doc(hidden))]
extern crate self as windows;
pub mod core {
pub use windows_core::*;
#[cfg(feature = "implement")]
pub use windows_implement::implement;
#[cfg(feature = "implement")]
pub use windows_interface::interface;
}
include!(mozbuild::windows_rs_path!("src/Windows/mod.rs"));

View File

@ -75,14 +75,13 @@ Cargo.lock to the HEAD version, run `git checkout -- Cargo.lock` or
"""
PACKAGES_WE_DONT_WANT = {
"windows": "The windows crate is too big to vendor.",
}
PACKAGES_WE_DONT_WANT = {}
PACKAGES_WE_ALWAYS_WANT_AN_OVERRIDE_OF = [
"autocfg",
"cmake",
"vcpkg",
"windows",
"windows-targets",
]

View File

@ -5064,6 +5064,12 @@ user-id = 189 # Andrew Gallant (BurntSushi)
start = "2020-01-11"
end = "2024-05-03"
[[trusted.windows]]
criteria = "safe-to-deploy"
user-id = 64539 # Kenny Kerr (kennykerr)
start = "2021-01-15"
end = "2025-01-30"
[[trusted.windows-core]]
criteria = "safe-to-deploy"
user-id = 64539 # Kenny Kerr (kennykerr)

View File

@ -227,6 +227,10 @@ notes = "Upstream project which we pin."
audit-as-crates-io = true
notes = "Upstream project which we pin."
[policy.windows]
audit-as-crates-io = true
notes = "Local override of the crates.io crate that uses a non-vendored local copy of the downloaded crate"
[policy.wr_malloc_size_of]
audit-as-crates-io = false

View File

@ -775,6 +775,13 @@ user-id = 189
user-login = "BurntSushi"
user-name = "Andrew Gallant"
[[publisher.windows]]
version = "0.52.0"
when = "2023-11-15"
user-id = 64539
user-login = "kennykerr"
user-name = "Kenny Kerr"
[[publisher.windows-core]]
version = "0.52.0"
when = "2023-11-15"

View File

@ -12,6 +12,9 @@ job-defaults:
script: mozharness/scripts/fx_desktop_build.py
optimization:
skip-unless-expanded: null
fetches:
toolchain:
- windows-rs
win32-mingwclang/opt:
description: "Win32 MinGW-Clang Opt"

View File

@ -5,6 +5,9 @@
job-defaults:
run:
using: mozharness
fetches:
toolchain:
- windows-rs
win32/debug:
description: "Win32 Debug"

View File

@ -367,6 +367,7 @@ jobs:
- sysroot-x86_64-linux-gnu
- sysroot-wasm32-wasi
- vs
- windows-rs
fetch:
- upx-3.95-win
@ -403,5 +404,6 @@ jobs:
- sysroot-x86_64-linux-gnu
- sysroot-wasm32-wasi
- vs
- windows-rs
fetch:
- upx-3.95-win

View File

@ -138,6 +138,7 @@ jobs:
- sysroot-x86_64-linux-gnu
- sysroot-wasm32-wasi
- vs
- windows-rs
fetch:
- upx-3.95-win

View File

@ -116,7 +116,7 @@ suggest = { version = "0.1" }
[target.'cfg(target_os = "windows")'.dependencies]
detect_win32k_conflicts = { path = "../../../xre/detect_win32k_conflicts" }
windows-core = "=0.52.0"
windows = "=0.52.0"
[features]
default = []

View File

@ -3573,3 +3573,112 @@ def perl_version_check(min_version):
with only_when(need_perl):
perl_version_check("5.006")
# windows-rs as bootstrappable toolchain
# ==============================================================
# The in-tree windows crate's purpose is to avoid vendoring the
# original windows crate, which is too large.
# The ideal solution would be for cargo to allow exceptions to
# vendoring, but it doesn't.
# The adopted solution is to somehow use the crate contents from
# a directory given via the mozbuild config, or bootstrapped.
#
# Unfortunately, doing `include!(mozbuild::windows_rs_path!("src/lib.rs"))`
# in the crate's lib.rs doesn't work because of
# https://github.com/rust-lang/rust/issues/66920.
#
# Previous versions of the windows crate had submodules declared
# directly in lib.rs. Annotating each of them with
# `#[path = concat!(mozbuild::windows_rs_path!("path/to/mod.rs"))]`
# unfortunately also didn't work, because of
# https://github.com/rust-lang/rust/issues/48250.
#
# Thankfully, newer versions of the windows crate now only have an
# `include!` at the end of lib.rs, so we can get away with simply
# replacing it with an `include!` that uses `mozbuild::windows_rs_path!`.
#
# We ensure that the in-tree contents match what we expect based on
# the original crate.
# The expectations are as such:
# - Cargo.toml is identical to the original one with the addition of the
# following two lines at the end (after an empty line):
# [dependencies.mozbuild]
# version = "0.1"
# - src/lib.rs is mostly identical to the original one, with two notable
# differences:
# - the addition of `#![allow(warnings)]` on the first line, because if
# the crate had been vendored normally, it would not be affected by
# `-D warnings`, and `#![allow(warnings)]` mimicks that.
# - the replacement of any
# `include!("path/file.rs")`
# with
# `include!(mozbuild::windows_rs_path!("src/path/file.rs"))`
with only_when(target_is_windows & compile_environment):
option(
env="MOZ_WINDOWS_RS_DIR",
nargs=1,
help="Path to the source of the 'windows' Rust crate",
)
@depends(
"MOZ_WINDOWS_RS_DIR",
bootstrap_path(
"windows-rs",
when=depends("MOZ_WINDOWS_RS_DIR")(lambda x: not x),
),
build_environment.topsrcdir,
)
@checking("for the windows rust crate source")
@imports(_from="__builtin__", _import="open")
@imports("re")
@imports("toml")
def windows_rs_dir(dir, bootstrapped, topsrcdir):
if bootstrapped:
dir = bootstrapped
elif dir:
dir = dir[0]
raw_cargo_toml = open(
os.path.join(topsrcdir, "build/rust/windows/Cargo.toml")
).read()
cargo_toml = toml.loads(raw_cargo_toml)
expected_version = cargo_toml["package"]["version"]
if not dir:
raise FatalCheckError(
"Cannot find the windows rust crate source.\n"
f"Try downloading it with `cargo download -x windows={expected_version}`\n"
"(you may need to `cargo install cargo-download` first)\n"
f"and set `MOZ_WINDOWS_RS_DIR` to location of the `windows-{expected_version}`"
" directory"
)
raw_cargo_toml_orig = open(os.path.join(dir, "Cargo.toml")).read()
cargo_toml = toml.loads(raw_cargo_toml_orig)
version = cargo_toml["package"]["version"]
if version != expected_version:
raise FatalCheckError(
f"The windows rust crate source in {dir} contains version "
f"{version}, but expected {expected_version}."
)
# Now that we've done the basic sanity check, let's go deeper.
DEPENDENCIES = '\n[dependencies.mozbuild]\nversion = "0.1"\n'
if not raw_cargo_toml.endswith(DEPENDENCIES):
configure_error("In-tree windows crate is missing dependency on mozbuild")
if raw_cargo_toml[: -len(DEPENDENCIES)] != raw_cargo_toml_orig:
configure_error("In-tree windows crate Cargo.toml doesn't match original")
lib_rs = open(os.path.join(topsrcdir, "build/rust/windows/src/lib.rs")).read()
lib_rs_orig = open(os.path.join(dir, "src/lib.rs")).read()
lib_rs_expected = "#![allow(warnings)]\n" + re.sub(
r'include!\("([^"]*)"\)',
r'include!(mozbuild::windows_rs_path!("src/\1"))',
lib_rs_orig,
)
if lib_rs != lib_rs_expected:
configure_error("In-tree windows crate lib.rs doesn't match original")
return dir
set_config("MOZ_WINDOWS_RS_DIR", windows_rs_dir)

View File

@ -14,6 +14,9 @@ license:
- toolkit/components/pdfjs/content/web/images/
# We probably want a specific license
- browser/extensions/webcompat/injections/
# Copied mostly verbatim from upstream. License is documented in
# Cargo.toml.
- build/rust/windows/src/lib.rs
# Different license
- build/pgo/blueprint/print.css
# Different license

View File

@ -5,6 +5,7 @@ rust:
include:
- '.'
exclude:
- build/rust/windows/src/lib.rs
- dom/webauthn/libudev-sys/
- gfx/wr/peek-poke/
- gfx/wr/webrender_build/