Skip to content

Commit

Permalink
SwiftWin32: silence warning on recent development compilers
Browse files Browse the repository at this point in the history
Use the newly minted support for access control on imports (SE-0409) to
clean up some newer warnings.
  • Loading branch information
compnerd committed Dec 2, 2023
1 parent 9275ac3 commit 778e896
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 1 deletion.
5 changes: 4 additions & 1 deletion Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.7
// swift-tools-version:5.9

import PackageDescription

Expand Down Expand Up @@ -38,6 +38,9 @@ let SwiftWin32: Package =
],
path: "Sources/SwiftWin32",
exclude: ["CoreAnimation", "CMakeLists.txt"],
swiftSettings: [
.enableExperimentalFeature("AccessLevelOnImport"),
],
linkerSettings: [
.linkedLibrary("User32"),
.linkedLibrary("ComCtl32"),
Expand Down
80 changes: 80 additions & 0 deletions [email protected]
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
// swift-tools-version:5.7

import PackageDescription

let SwiftWin32: Package =
Package(name: "SwiftWin32",
products: [
.library(name: "SwiftWin32",
type: .dynamic,
targets: ["SwiftWin32"]),
.library(name: "SwiftWin32UI",
type: .dynamic,
targets: ["SwiftWin32UI"]),
.executable(name: "UICatalog", targets: ["UICatalog"]),
.executable(name: "Calculator", targets: ["Calculator"]),
],
dependencies: [
.package(url: "https://github.com/apple/swift-log.git",
.upToNextMajor(from: "1.4.3")),
.package(url: "https://github.com/apple/swift-collections.git",
.upToNextMinor(from: "1.0.0")),
.package(url: "https://github.com/compnerd/cassowary.git",
branch: "main"),
.package(url: "https://github.com/compnerd/swift-com.git",
revision: "ebbc617d3b7ba3a2023988a74bebd118deea4cc5"),
],
targets: [
.target(name: "CoreAnimation",
path: "Sources/SwiftWin32/CoreAnimation"),
.target(name: "SwiftWin32",
dependencies: [
"CoreAnimation",
.product(name: "Logging", package: "swift-log"),
.product(name: "OrderedCollections",
package: "swift-collections"),
.product(name: "cassowary", package: "cassowary"),
.product(name: "SwiftCOM", package: "swift-com"),
],
path: "Sources/SwiftWin32",
exclude: ["CoreAnimation", "CMakeLists.txt"],
linkerSettings: [
.linkedLibrary("User32"),
.linkedLibrary("ComCtl32"),
]),
.target(name: "SwiftWin32UI",
dependencies: ["SwiftWin32"],
path: "Sources/SwiftWin32UI",
exclude: ["CMakeLists.txt"]),
.executableTarget(name: "Calculator",
dependencies: ["SwiftWin32"],
path: "Examples/Calculator",
exclude: [
"CMakeLists.txt",
"Calculator.exe.manifest",
"Info.plist",
],
swiftSettings: [
.unsafeFlags(["-parse-as-library"])
]),
.executableTarget(name: "UICatalog",
dependencies: ["SwiftWin32"],
path: "Examples/UICatalog",
exclude: [
"CMakeLists.txt",
"Info.plist",
"UICatalog.exe.manifest",
],
resources: [
.copy("Assets/CoffeeCup.jpg")
],
swiftSettings: [
.unsafeFlags(["-parse-as-library"])
]),
.target(name: "TestUtilities", path: "Tests/Utilities"),
.testTarget(name: "AutoLayoutTests", dependencies: ["SwiftWin32"]),
.testTarget(name: "CoreGraphicsTests", dependencies: ["SwiftWin32"]),
.testTarget(name: "SupportTests", dependencies: ["SwiftWin32"]),
.testTarget(name: "UICoreTests",
dependencies: ["SwiftWin32", "TestUtilities"])
])
1 change: 1 addition & 0 deletions [email protected]
4 changes: 4 additions & 0 deletions Sources/SwiftWin32/Platform/Win32+Menu.swift
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,12 @@

import WinSDK

#if swift(>=5.9)
internal import OrderedCollections
#else
@_implementationOnly
import OrderedCollections
#endif

internal final class _MenuBuilder: MenuSystem {
internal private(set) var hMenu: MenuHandle
Expand Down
4 changes: 4 additions & 0 deletions Sources/SwiftWin32/Support/Logging.swift
Original file line number Diff line number Diff line change
@@ -1,7 +1,11 @@
// Copyright © 2020 Saleem Abdulrasool <[email protected]>
// SPDX-License-Identifier: BSD-3-Clause

#if swift(>=5.9)
internal import Logging
#else
@_implementationOnly
import Logging
#endif

internal let log: Logger = Logger(label: "org.compnerd.swift-win32")

0 comments on commit 778e896

Please sign in to comment.