diff --git a/Package.resolved b/Package.resolved index 2b2ce3d8..abab70e4 100644 --- a/Package.resolved +++ b/Package.resolved @@ -7,7 +7,7 @@ "location" : "https://github.com/OpenSwiftUIProject/DarwinPrivateFrameworks.git", "state" : { "branch" : "main", - "revision" : "0490c29426c9d69a14f84d2020f263abe568c127" + "revision" : "082d0abd12876636df553723e22a395a881f5491" } }, { diff --git a/Scripts/bump_ag_pr.sh b/Scripts/bump_ag_pr.sh index 3ca7a151..0f6229c0 100755 --- a/Scripts/bump_ag_pr.sh +++ b/Scripts/bump_ag_pr.sh @@ -7,8 +7,61 @@ filepath() { [[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}" } -# Accept optional branch argument, default to "main" -TARGET_BRANCH="${1:-main}" +# Capture script name for usage display +SCRIPT_NAME="$(basename "$0")" + +# Usage function +show_usage() { + cat << EOF +Usage: $SCRIPT_NAME [branch] [--force] [--help] + +Automated script to update DarwinPrivateFrameworks with AttributeGraph changes. + +Arguments: + branch Target branch to generate from (default: main) + +Options: + --force Force push the branch when creating PR + --help Show this help message + +Examples: + $SCRIPT_NAME # Update from main branch + $SCRIPT_NAME develop # Update from develop branch + $SCRIPT_NAME main --force # Update from main with force push + $SCRIPT_NAME --help # Show this help + +Description: + This script automates the process of updating DarwinPrivateFrameworks + with the latest AttributeGraph changes by: + 1. Setting up a git worktree for the target branch + 2. Cloning DarwinPrivateFrameworks repository + 3. Generating AG template from OpenAttributeGraph + 4. Updating headers and Swift interface templates + 5. Creating and pushing a PR with the changes +EOF +} + +# Parse command line arguments +TARGET_BRANCH="main" +FORCE_PUSH="" + +# Parse arguments +while [[ $# -gt 0 ]]; do + case $1 in + --help) + show_usage + exit 0 + ;; + --force) + FORCE_PUSH="--force" + shift + ;; + *) + TARGET_BRANCH="$1" + shift + ;; + esac +done SCRIPT_ROOT="$(dirname $(dirname $(filepath $0)))" OAG_REPO_DIR="$SCRIPT_ROOT/.og_repo" @@ -17,6 +70,9 @@ AG_REPO_DIR="$SCRIPT_ROOT/.ag_repo" echo "Starting DarwinPrivateFrameworks bump PR workflow..." echo "Target branch: $TARGET_BRANCH" +if [[ -n "$FORCE_PUSH" ]]; then + echo "Force push: enabled" +fi # Cleanup function cleanup() { @@ -107,7 +163,7 @@ fi # Step 8: Push branch and create PR echo "Pushing branch and creating PR..." -git push origin "update-ag-$TARGET_BRANCH" +git push origin "update-ag-$TARGET_BRANCH" $FORCE_PUSH # Create PR PR_TITLE="Update AttributeGraph from OpenAttributeGraph $TARGET_BRANCH" @@ -128,6 +184,4 @@ gh pr create \ --base main echo "✅ PR created successfully!" -echo "Branch: update-ag-$TARGET_BRANCH" -echo "✅ PR created successfully!" -echo "Branch: update-ag-$CURRENT_BRANCH" +echo "Branch: update-ag-$TARGET_BRANCH" \ No newline at end of file diff --git a/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h b/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h index 0ad158d7..44312958 100644 --- a/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h +++ b/Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h @@ -31,7 +31,7 @@ OAGAttribute OAGGraphGetCurrentAttribute(void); OAG_EXPORT OAG_REFINED_FOR_SWIFT -bool OAGGraphCurrentAttributeWasModified(void); +bool OAGGraphCurrentAttributeWasModified(void) OAG_SWIFT_NAME(getter:OAGAttribute.currentWasModified()); OAG_EXPORT OAG_REFINED_FOR_SWIFT diff --git a/Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift b/Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift index 036c4cf6..ec5b24af 100644 --- a/Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift +++ b/Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift @@ -8,8 +8,8 @@ import Testing // swift-testing framework will crash here on Linux // Report to upstream for investigation when we bump to 5.10 #if canImport(Darwin) -//@Suite(.disabled(if: !compatibilityTestEnabled, "Attribute is not implemented"), .graphScope) -@Suite(.disabled("Skip flaky CI tests after #154 temporary, See more info on #157"), .graphScope) +@MainActor +@Suite(.disabled(if: !compatibilityTestEnabled, "Attribute is not implemented"), .graphScope) struct AnyAttributeCompatibilityTests { @Test func constantValue() throws { @@ -104,6 +104,14 @@ struct AnyAttributeCompatibilityTests { let identifier = Attribute(value: 0).identifier #expect(identifier.subgraph2 != nil) } + + @Test + func wasModified() { + let value = Attribute(value: 0) + value.value = 3 + #expect(AnyAttribute.currentWasModified == false) + // TODO: currentWasModified true logic test case + } #endif } #endif