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
2 changes: 1 addition & 1 deletion Package.resolved

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

66 changes: 60 additions & 6 deletions Scripts/bump_ag_pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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() {
Expand Down Expand Up @@ -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"
Expand All @@ -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"
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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