Skip to content

Commit

Permalink
Update OpenGraph dependency (#173)
Browse files Browse the repository at this point in the history
  • Loading branch information
Kyle-Ye authored Dec 13, 2024
1 parent b4addfb commit 370e6b1
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 21 deletions.
16 changes: 16 additions & 0 deletions .github/workflows/compatibility_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ jobs:
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
DARWIN_PRIVATE_FRAMEWORKS_TARGET_RELEASE: ${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -30,6 +35,9 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/darwin_setup_build.sh
shell: bash
- name: Run compatibility tests on OpenSwiftUI + macOS
run: |
swift test \
Expand Down Expand Up @@ -64,6 +72,11 @@ jobs:
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_SUPPORT_MULTI_PRODUCTS: 0
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
DARWIN_PRIVATE_FRAMEWORKS_TARGET_RELEASE: ${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
- name: Setup Xcode
Expand All @@ -72,6 +85,9 @@ jobs:
xcode-version: ${{ matrix.xcode-version }}
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/darwin_setup_build.sh
shell: bash
- name: Run compatibility tests on OpenSwiftUI + iOS
run: |
# FIXME: xcodebuild will run all test targets.
Expand Down
7 changes: 4 additions & 3 deletions .github/workflows/ios.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,11 @@ jobs:
OPENSWIFTUI_SWIFT_LOG: 0
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENSWIFTUI_SUPPORT_MULTI_PRODUCTS: 0
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE_${{ matrix.release }}
DARWIN_PRIVATE_FRAMEWORKS_TARGET_RELEASE: ${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
Expand All @@ -41,7 +42,7 @@ jobs:
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/macOS_setup_build.sh
run: Scripts/CI/darwin_setup_build.sh
shell: bash
- name: Build test target in debug mode
run: |
Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,9 @@ jobs:
OPENSWIFTUI_SWIFT_CRYPTO: 0
OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }}
OPENSWIFTUI_USE_LOCAL_DEPS: 1
OPENGRAPH_USE_LOCAL_DEPS: 1
OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }}
OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE_${{ matrix.release }}
DARWIN_PRIVATE_FRAMEWORKS_TARGET_RELEASE: ${{ matrix.release }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v4
Expand All @@ -36,7 +37,7 @@ jobs:
- name: Swift version
run: swift --version
- name: Set up build environment
run: Scripts/CI/macOS_setup_build.sh
run: Scripts/CI/darwin_setup_build.sh
shell: bash
- name: Build and run tests in debug mode with coverage
run: |
Expand Down
13 changes: 11 additions & 2 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -1,13 +1,22 @@
{
"originHash" : "5c37246fc3829f800b0ccd442988c364c2beeffc296cdc8b4f7ce1585eebc14a",
"originHash" : "0c4677673310eb1475283b96def29718c2f307825c2d136e0bfc40f4cd3d6920",
"pins" : [
{
"identity" : "darwinprivateframeworks",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git",
"state" : {
"branch" : "main",
"revision" : "fc757950da6df4b1e30a3236549a27f21f82ab8a"
}
},
{
"identity" : "opengraph",
"kind" : "remoteSourceControl",
"location" : "https://github.com/OpenSwiftUIProject/OpenGraph",
"state" : {
"branch" : "main",
"revision" : "074491f9950c7692142630b08b7c87b8cb682e28"
"revision" : "5eccfe5e3149b3deb4bf5b76511d2ea7f5b39b94"
}
},
{
Expand Down
35 changes: 22 additions & 13 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -241,7 +241,7 @@ extension Target {
func addAGSettings() {
// FIXME: Weird SwiftPM behavior for test Target. Otherwize we'll get the following error message
// "could not determine executable path for bundle 'AttributeGraph.framework'"
dependencies.append(.product(name: "AttributeGraph", package: "OpenGraph"))
dependencies.append(.product(name: "AttributeGraph", package: "DarwinPrivateFrameworks"))
var swiftSettings = swiftSettings ?? []
swiftSettings.append(.define("OPENGRAPH_ATTRIBUTEGRAPH"))
self.swiftSettings = swiftSettings
Expand Down Expand Up @@ -269,7 +269,17 @@ extension Target {
}
}

let useLocalDeps = envEnable("OPENSWIFTUI_USE_LOCAL_DEPS")

if attributeGraphCondition {
let privateFrameworkRepo: Package.Dependency
if useLocalDeps {
privateFrameworkRepo = Package.Dependency.package(path: "../DarwinPrivateFrameworks")
} else {
privateFrameworkRepo = Package.Dependency.package(url: "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", branch: "main")
}
package.dependencies.append(privateFrameworkRepo)

openSwiftUICoreTarget.addAGSettings()
openSwiftUITarget.addAGSettings()

Expand All @@ -280,6 +290,17 @@ if attributeGraphCondition {
openSwiftUIBridgeTestTarget.addAGSettings()
}

if useLocalDeps {
package.dependencies += [
.package(path: "../OpenGraph"),
]
} else {
package.dependencies += [
// FIXME: on Linux platform: OG contains unsafe build flags which prevents us using version dependency
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph", branch: "main"),
]
}

#if os(macOS)
let openCombineCondition = envEnable("OPENSWIFTUI_OPENCOMBINE")
#else
Expand Down Expand Up @@ -328,18 +349,6 @@ if compatibilityTestCondition {
openSwiftUICompatibilityTestTarget.dependencies.append("OpenSwiftUI")
}

let useLocalDeps = envEnable("OPENSWIFTUI_USE_LOCAL_DEPS")
if useLocalDeps {
package.dependencies += [
.package(path: "../OpenGraph"),
]
} else {
package.dependencies += [
// FIXME: on Linux platform: OG contains unsafe build flags which prevents us using version dependency
.package(url: "https://github.com/OpenSwiftUIProject/OpenGraph", branch: "main"),
]
}

extension [Platform] {
static var nonDarwinPlatforms: [Platform] {
[.linux, .android, .wasi, .openbsd, .windows]
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion Scripts/CI/og_setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ clone_checkout_og() {

update_og() {
cd $REPO_ROOT/../OpenGraph
./AG/update.sh
./Scripts/CI/darwin_setup_build.sh
}

clone_checkout_og
Expand Down

0 comments on commit 370e6b1

Please sign in to comment.