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
46 changes: 0 additions & 46 deletions .github/actions/build-swift-project-macos/action.yml

This file was deleted.

43 changes: 43 additions & 0 deletions .github/actions/checkout-swift-headers/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
name: Checkout Swift Headers
description: |
This action checks-out certain header files from the swiftlang/swift
repository.

inputs:
path:
description: Relative path under $GITHUB_WORKSPACE to place the repository
required: true
swift-version-major:
description: The Swift toolchain major version.
required: true
swift-version-minor:
description: The Swift toolchain minor version.
required: true

runs:
using: "composite"
steps:
- uses: actions/checkout@v4
with:
repository: swiftlang/swift
path: ${{ inputs.path }}
ref: release/${{ inputs.swift-version-major }}.${{ inputs.swift-version-minor }}
sparse-checkout: |
include/swift
stdlib/include
stdlib/public/SwiftShims
stdlib/public/runtime/MetadataAllocatorTags.def
- name: Write CMakeConfig.h file
run: |
cat > include/swift/Runtime/CMakeConfig.h << EOF
#ifndef SWIFT_RUNTIME_CMAKECONFIG_H
#define SWIFT_RUNTIME_CMAKECONFIG_H
#define SWIFT_VERSION_MAJOR "${SWIFT_VERSION_MAJOR}"
#define SWIFT_VERSION_MINOR "${SWIFT_VERSION_MINOR}"
#endif
EOF
shell: bash
working-directory: ${{ inputs.path }}
env:
SWIFT_VERSION_MAJOR: ${{ inputs.swift-version-major }}
SWIFT_VERSION_MINOR: ${{ inputs.swift-version-minor }}
9 changes: 4 additions & 5 deletions .github/workflows/swift.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,10 @@ jobs:

steps:
- uses: actions/checkout@v4
- uses: ./.github/actions/checkout-swift-headers
with:
path: Compute
- uses: ./Compute/.github/actions/build-swift-project-macos
with:
checkout-scheme: release/6.2
path: Checkouts/swift
swift-version-major: 6
swift-version-minor: 2
- name: Build
run: swift build
working-directory: ./Compute
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,6 @@
# Swift
.build
.swiftpm

# Dependencies
Checkouts
42 changes: 42 additions & 0 deletions CompatibilityTesting/Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

68 changes: 68 additions & 0 deletions CompatibilityTesting/Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
// swift-tools-version: 6.2

import PackageDescription

let swiftCheckoutPath = "\(Context.packageDirectory)/Checkouts/swift"

var dependencies: [Package.Dependency] = [
.package(name: "Compute", path: ".."),
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0"),
.package(url: "https://github.com/groue/Semaphore", from: "0.1.0"),
]

if let useLocalDepsEnv = Context.environment["COMPUTE_USE_LOCAL_DEPS"], !useLocalDepsEnv.isEmpty {
let root: String
if useLocalDepsEnv == "1" {
root = ".."
} else {
root = useLocalDepsEnv
}
dependencies +=
[
.package(
name: "DarwinPrivateFrameworks",
path: "\(root)/DarwinPrivateFrameworks"
)
]
} else {
dependencies +=
[
.package(
url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks",
from: "0.0.4"
)
]
}

let package = Package(
name: "CompatibilityTesting",
platforms: [.macOS(.v26)],
dependencies: dependencies,
targets: [
.target(name: "CompatibilityTesting"),
.testTarget(
name: "ComputeCompatibilityTests",
dependencies: [
.product(name: "_ComputeTestSupport", package: "Compute"),
.product(name: "AttributeGraph", package: "DarwinPrivateFrameworks"),
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "Semaphore", package: "Semaphore"),
],
swiftSettings: [
.interoperabilityMode(.Cxx),
.enableExperimentalFeature("Extern"),
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
.testTarget(
name: "ComputeLayoutDescriptorCompatibilityTests",
dependencies: [
.product(name: "AttributeGraph", package: "DarwinPrivateFrameworks")
],
swiftSettings: [
.enableExperimentalFeature("Extern")
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@

11 changes: 1 addition & 10 deletions Package.resolved

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

105 changes: 19 additions & 86 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,76 +2,22 @@

import PackageDescription

let swiftProjectPath = "\(Context.packageDirectory)/../swift-project"
let swiftCheckoutPath = "\(Context.packageDirectory)/Checkouts/swift"

var dependencies: [Package.Dependency] = [
.package(url: "https://github.com/apple/swift-algorithms", from: "1.2.0"),
.package(url: "https://github.com/groue/Semaphore", from: "0.1.0"),
]

if let useLocalDepsEnv = Context.environment["COMPUTE_USE_LOCAL_DEPS"], !useLocalDepsEnv.isEmpty {
let root: String
if useLocalDepsEnv == "1" {
root = ".."
} else {
root = useLocalDepsEnv
}
dependencies +=
[
.package(
name: "DarwinPrivateFrameworks",
path: "\(root)/DarwinPrivateFrameworks"
)
]
} else {
dependencies +=
[
.package(
url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks",
from: "0.0.4"
)
]
}

extension Target {
fileprivate static func swiftRuntimeTarget(
name: String,
dependencies: [Dependency] = [],
path: String? = nil,
sources: [String]? = nil,
cxxSettings: [CXXSetting] = []
) -> Target {
.target(
name: name,
dependencies: dependencies,
path: path ?? "Sources/\(name)",
sources: sources,
cxxSettings: [
.unsafeFlags([
"-static",
"-DCOMPILED_WITH_SWIFT",
"-DPURE_BRIDGING_MODE",
"-UIBOutlet", "-UIBAction", "-UIBInspectable",
"-isystem", "\(swiftProjectPath)/swift/include",
"-isystem", "\(swiftProjectPath)/swift/stdlib/public/SwiftShims",
"-isystem", "\(swiftProjectPath)/swift/stdlib/public/runtime",
"-isystem", "\(swiftProjectPath)/llvm-project/llvm/include",
"-isystem", "\(swiftProjectPath)/llvm-project/clang/include",
"-isystem", "\(swiftProjectPath)/build/Default/swift/include",
"-isystem", "\(swiftProjectPath)/build/Default/llvm/include",
"-isystem", "\(swiftProjectPath)/build/Default/llvm/tools/clang/include",
"-DLLVM_DISABLE_ABI_BREAKING_CHECKS_ENFORCING",
])
] + cxxSettings
)
}
}

let package = Package(
name: "Compute",
platforms: [.macOS(.v26)],
products: [
.library(name: "Compute", targets: ["Compute"])
.library(name: "Compute", targets: ["Compute"]),
.library(name: "_ComputeTestSupport", targets: ["_ComputeTestSupport"])
],
traits: [
.trait(name: "CompatibilityModeAttributeGraphV6")
],
dependencies: dependencies,
targets: [
Expand Down Expand Up @@ -109,20 +55,6 @@ let package = Package(
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
.testTarget(
name: "ComputeCompatibilityTests",
dependencies: [
"_ComputeTestSupport",
.product(name: "AttributeGraph", package: "DarwinPrivateFrameworks"),
.product(name: "Algorithms", package: "swift-algorithms"),
.product(name: "Semaphore", package: "Semaphore"),
],
swiftSettings: [
.interoperabilityMode(.Cxx),
.enableExperimentalFeature("Extern"),
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
.testTarget(
name: "ComputeLayoutDescriptorTests",
dependencies: [
Expand All @@ -133,20 +65,21 @@ let package = Package(
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
.testTarget(
name: "ComputeLayoutDescriptorCompatibilityTests",
dependencies: [
.product(name: "AttributeGraph", package: "DarwinPrivateFrameworks")
],
swiftSettings: [
.enableExperimentalFeature("Extern")
],
linkerSettings: [.linkedLibrary("swiftDemangle")]
),
.swiftRuntimeTarget(
.target(
name: "ComputeCxx",
dependencies: ["Utilities", "ComputeCxxSwiftSupport"],
cxxSettings: [.headerSearchPath(""), .unsafeFlags(["-Wno-elaborated-enum-base"])]
cxxSettings: [
.headerSearchPath(""),
.unsafeFlags([
"-Wno-elaborated-enum-base",
"-static",
"-DCOMPILED_WITH_SWIFT",
"-DPURE_BRIDGING_MODE",
"-isystem", "\(swiftCheckoutPath)/include",
"-isystem", "\(swiftCheckoutPath)/stdlib/include",
"-isystem", "\(swiftCheckoutPath)/stdlib/public/SwiftShims"
])
]
),
.target(name: "ComputeCxxSwiftSupport"),
.target(name: "_ComputeTestSupport"),
Expand Down
Loading