Skip to content

Commit 989275d

Browse files
authored
Update AnyAttribute.currentWasModified (#181)
1 parent cf20006 commit 989275d

File tree

4 files changed

+72
-10
lines changed

4 files changed

+72
-10
lines changed

Package.resolved

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Scripts/bump_ag_pr.sh

Lines changed: 60 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,61 @@ filepath() {
77
[[ $1 = /* ]] && echo "$1" || echo "$PWD/${1#./}"
88
}
99

10-
# Accept optional branch argument, default to "main"
11-
TARGET_BRANCH="${1:-main}"
10+
# Capture script name for usage display
11+
SCRIPT_NAME="$(basename "$0")"
12+
13+
# Usage function
14+
show_usage() {
15+
cat << EOF
16+
Usage: $SCRIPT_NAME [branch] [--force] [--help]
17+
18+
Automated script to update DarwinPrivateFrameworks with AttributeGraph changes.
19+
20+
Arguments:
21+
branch Target branch to generate from (default: main)
22+
23+
Options:
24+
--force Force push the branch when creating PR
25+
--help Show this help message
26+
27+
Examples:
28+
$SCRIPT_NAME # Update from main branch
29+
$SCRIPT_NAME develop # Update from develop branch
30+
$SCRIPT_NAME main --force # Update from main with force push
31+
$SCRIPT_NAME --help # Show this help
32+
33+
Description:
34+
This script automates the process of updating DarwinPrivateFrameworks
35+
with the latest AttributeGraph changes by:
36+
1. Setting up a git worktree for the target branch
37+
2. Cloning DarwinPrivateFrameworks repository
38+
3. Generating AG template from OpenAttributeGraph
39+
4. Updating headers and Swift interface templates
40+
5. Creating and pushing a PR with the changes
41+
EOF
42+
}
43+
44+
# Parse command line arguments
45+
TARGET_BRANCH="main"
46+
FORCE_PUSH=""
47+
48+
# Parse arguments
49+
while [[ $# -gt 0 ]]; do
50+
case $1 in
51+
--help)
52+
show_usage
53+
exit 0
54+
;;
55+
--force)
56+
FORCE_PUSH="--force"
57+
shift
58+
;;
59+
*)
60+
TARGET_BRANCH="$1"
61+
shift
62+
;;
63+
esac
64+
done
1265

1366
SCRIPT_ROOT="$(dirname $(dirname $(filepath $0)))"
1467
OAG_REPO_DIR="$SCRIPT_ROOT/.og_repo"
@@ -17,6 +70,9 @@ AG_REPO_DIR="$SCRIPT_ROOT/.ag_repo"
1770

1871
echo "Starting DarwinPrivateFrameworks bump PR workflow..."
1972
echo "Target branch: $TARGET_BRANCH"
73+
if [[ -n "$FORCE_PUSH" ]]; then
74+
echo "Force push: enabled"
75+
fi
2076

2177
# Cleanup function
2278
cleanup() {
@@ -107,7 +163,7 @@ fi
107163

108164
# Step 8: Push branch and create PR
109165
echo "Pushing branch and creating PR..."
110-
git push origin "update-ag-$TARGET_BRANCH"
166+
git push origin "update-ag-$TARGET_BRANCH" $FORCE_PUSH
111167

112168
# Create PR
113169
PR_TITLE="Update AttributeGraph from OpenAttributeGraph $TARGET_BRANCH"
@@ -128,6 +184,4 @@ gh pr create \
128184
--base main
129185

130186
echo "✅ PR created successfully!"
131-
echo "Branch: update-ag-$TARGET_BRANCH"
132-
echo "✅ PR created successfully!"
133-
echo "Branch: update-ag-$CURRENT_BRANCH"
187+
echo "Branch: update-ag-$TARGET_BRANCH"

Sources/OpenAttributeGraphCxx/include/OpenAttributeGraph/OAGAttribute.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ OAGAttribute OAGGraphGetCurrentAttribute(void);
3131

3232
OAG_EXPORT
3333
OAG_REFINED_FOR_SWIFT
34-
bool OAGGraphCurrentAttributeWasModified(void);
34+
bool OAGGraphCurrentAttributeWasModified(void) OAG_SWIFT_NAME(getter:OAGAttribute.currentWasModified());
3535

3636
OAG_EXPORT
3737
OAG_REFINED_FOR_SWIFT

Tests/OpenAttributeGraphCompatibilityTests/Attribute/Attribute/AnyAttributeCompatibilityTests.swift

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ import Testing
88
// swift-testing framework will crash here on Linux
99
// Report to upstream for investigation when we bump to 5.10
1010
#if canImport(Darwin)
11-
//@Suite(.disabled(if: !compatibilityTestEnabled, "Attribute is not implemented"), .graphScope)
12-
@Suite(.disabled("Skip flaky CI tests after #154 temporary, See more info on #157"), .graphScope)
11+
@MainActor
12+
@Suite(.disabled(if: !compatibilityTestEnabled, "Attribute is not implemented"), .graphScope)
1313
struct AnyAttributeCompatibilityTests {
1414
@Test
1515
func constantValue() throws {
@@ -104,6 +104,14 @@ struct AnyAttributeCompatibilityTests {
104104
let identifier = Attribute(value: 0).identifier
105105
#expect(identifier.subgraph2 != nil)
106106
}
107+
108+
@Test
109+
func wasModified() {
110+
let value = Attribute(value: 0)
111+
value.value = 3
112+
#expect(AnyAttribute.currentWasModified == false)
113+
// TODO: currentWasModified true logic test case
114+
}
107115
#endif
108116
}
109117
#endif

0 commit comments

Comments
 (0)