diff --git a/.github/workflows/ios.yml b/.github/workflows/ios.yml index 0eb2fab1d..152639f92 100644 --- a/.github/workflows/ios.yml +++ b/.github/workflows/ios.yml @@ -27,6 +27,10 @@ jobs: OPENSWIFTUI_SWIFT_LOG: 0 OPENSWIFTUI_SWIFT_CRYPTO: 0 OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }} + OPENSWIFTUI_USE_LOCAL_DEPS: 1 + OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }} + OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }} + GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 - name: Setup Xcode @@ -35,6 +39,9 @@ jobs: xcode-version: ${{ matrix.xcode-version }} - name: Swift version run: swift --version + - name: Set up build environment + run: Scripts/CI/macOS_setup_build.sh + shell: bash - name: Build test target in debug mode run: | xcodebuild build \ diff --git a/.github/workflows/macos.yml b/.github/workflows/macos.yml index 7072e21ef..16f882ab4 100644 --- a/.github/workflows/macos.yml +++ b/.github/workflows/macos.yml @@ -23,6 +23,10 @@ jobs: OPENSWIFTUI_SWIFT_LOG: 0 OPENSWIFTUI_SWIFT_CRYPTO: 0 OPENSWIFTUI_TARGET_RELEASE: ${{ matrix.release }} + OPENSWIFTUI_USE_LOCAL_DEPS: 1 + OPENGRAPH_TARGET_RELEASE: ${{ matrix.release }} + OPENGRAPH_ATTRIBUTEGRAPH_VERSION: RELEASE-${{ matrix.release }} + GH_TOKEN: ${{ github.token }} steps: - uses: actions/checkout@v4 - name: Setup Xcode @@ -31,6 +35,9 @@ jobs: xcode-version: ${{ matrix.xcode-version }} - name: Swift version run: swift --version + - name: Set up build environment + run: Scripts/CI/macOS_setup_build.sh + shell: bash - name: Build and run tests in debug mode with coverage run: | swift test \ diff --git a/Package.resolved b/Package.resolved index 9a01d3bd7..73f256555 100644 --- a/Package.resolved +++ b/Package.resolved @@ -7,7 +7,7 @@ "location" : "https://github.com/OpenSwiftUIProject/OpenGraph", "state" : { "branch" : "main", - "revision" : "f2b16a1145acadd47c708d528f7eb1047d412f78" + "revision" : "074491f9950c7692142630b08b7c87b8cb682e28" } }, { diff --git a/Scripts/CI/get_revision.sh b/Scripts/CI/get_revision.sh new file mode 100755 index 000000000..e1c99c239 --- /dev/null +++ b/Scripts/CI/get_revision.sh @@ -0,0 +1,43 @@ +#!/bin/bash + +# This script extracts the revision of a specific dependency from the Package.resolved file (Only support v3). +# Usage: ./get_revision.sh +# Output: revision of the dependency + +# A `realpath` alternative using the default C implementation. +filepath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))" +cd $REPO_ROOT + +# Ensure a dependency name is provided as an argument +if [[ $# -lt 1 ]]; then + echo "Usage: $0 " + exit 1 +fi + +DEPENDENCY_NAME="$1" +PACKAGE_RESOLVED_PATH="Package.resolved" + +# Check if the Package.resolved file exists +if [[ ! -f "$PACKAGE_RESOLVED_PATH" ]]; then + echo "Error: $PACKAGE_RESOLVED_PATH file not found!" + exit 1 +fi + +# Extract the revision using jq +REVISION=$(jq -r --arg name "$DEPENDENCY_NAME" ' + .pins[]? + | select(.identity == $name) + | .state.revision +' "$PACKAGE_RESOLVED_PATH") + +# Check if a revision was found +if [[ -z "$REVISION" ]]; then + echo "No revision found for dependency: $DEPENDENCY_NAME" + exit 1 +else + echo "$REVISION" +fi \ No newline at end of file diff --git a/Scripts/CI/macOS_setup_build.sh b/Scripts/CI/macOS_setup_build.sh new file mode 100755 index 000000000..58056187d --- /dev/null +++ b/Scripts/CI/macOS_setup_build.sh @@ -0,0 +1,11 @@ +#!/bin/bash + +# A `realpath` alternative using the default C implementation. +filepath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))" +cd $REPO_ROOT + +Scripts/CI/og_setup.sh \ No newline at end of file diff --git a/Scripts/CI/og_setup.sh b/Scripts/CI/og_setup.sh new file mode 100755 index 000000000..d4e7967d8 --- /dev/null +++ b/Scripts/CI/og_setup.sh @@ -0,0 +1,25 @@ +#!/bin/bash + +# A `realpath` alternative using the default C implementation. +filepath() { + [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" +} + +REPO_ROOT="$(dirname $(dirname $(dirname $(filepath $0))))" + +clone_checkout_og() { + cd $REPO_ROOT + revision=$(Scripts/CI/get_revision.sh opengraph) + cd .. + gh repo clone OpenSwiftUIProject/OpenGraph + cd OpenGraph + git checkout --quiet $revision +} + +update_og() { + cd $REPO_ROOT/../OpenGraph + ./AG/update.sh +} + +clone_checkout_og +update_og diff --git a/Scripts/demangle.sh b/Scripts/demangle.sh index 0e34b42bc..d38789277 100755 --- a/Scripts/demangle.sh +++ b/Scripts/demangle.sh @@ -5,7 +5,8 @@ filepath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } -OG_ROOT="$(dirname $(dirname $(filepath $0)))" +REPO_ROOT="$(dirname $(dirname $(filepath $0)))" +cd $REPO_ROOT # Get the language and input file path from the arguments language=${1:-"swift"} diff --git a/Sources/OpenSwiftUICore/View/InterfaceIdiom/InterfaceIdiomPredicate.swift b/Sources/OpenSwiftUICore/View/InterfaceIdiom/InterfaceIdiomPredicate.swift index f299b4c20..ec6c9381a 100644 --- a/Sources/OpenSwiftUICore/View/InterfaceIdiom/InterfaceIdiomPredicate.swift +++ b/Sources/OpenSwiftUICore/View/InterfaceIdiom/InterfaceIdiomPredicate.swift @@ -5,6 +5,7 @@ // Audited for iOS 18.0 // Status: Complete +#if OPENSWIFTUI_RELEASE_2024 package struct InterfaceIdiomPredicate: ViewInputPredicate where Idiom: InterfaceIdiom { package init() {} @@ -42,3 +43,4 @@ extension AnyInterfaceIdiom { value == AnyInterfaceIdiom(pattern) } } +#endif diff --git a/Tests/OpenSwiftUICoreTests/View/InterfaceIdiom/InterfaceIdiomTests.swift b/Tests/OpenSwiftUICoreTests/View/InterfaceIdiom/InterfaceIdiomTests.swift index a2fb24a09..f7d30ea31 100644 --- a/Tests/OpenSwiftUICoreTests/View/InterfaceIdiom/InterfaceIdiomTests.swift +++ b/Tests/OpenSwiftUICoreTests/View/InterfaceIdiom/InterfaceIdiomTests.swift @@ -5,6 +5,7 @@ @testable import OpenSwiftUICore import Testing +#if OPENSWIFTUI_RELEASE_2024 struct InterfaceIdiomTests { @Test func idiomEqual() { @@ -35,3 +36,4 @@ struct InterfaceIdiomTests { #expect((WidgetInterfaceIdiom() ~= AnyInterfaceIdiom(.complication)) == false) } } +#endif