Sync Swift source files from OpenAttributeGraph repository to the _AttributeGraphDeviceSwiftShims target.
Usage
This command will:
- Copy all Swift files from OpenAttributeGraph's
Sources/OpenAttributeGraphdirectory - Replace
OAGwithAGin function names and symbols - Replace
OpenAttributeGraphwithAttributeGraphin imports and comments - Remove documentation (.docc) folders
Parameters
When using this command, provide:
- Location: Path to the OpenAttributeGraph repository (local path or GitHub URL)
Examples
Local path
/sync-ag-swift-shims
Location: /Users/kyle/Workspace/OP/OpenAttributeGraph
GitHub URL
/sync-ag-swift-shims
Location: https://github.com/OpenSwiftUIProject/OpenAttributeGraph
Implementation
The command will:
Resolve the source location:
- If a local path is provided, use it directly
- If a GitHub URL is provided, clone it to a temporary directory
Clean the target directory:
- Remove existing files in
AG/DeviceSwiftShims/(except any non-Swift configuration files)
- Remove existing files in
Copy Swift files:
- Source:
{repo}/Sources/OpenAttributeGraph/ - Target:
AG/DeviceSwiftShims/ - Preserve directory structure (Attribute/, Debug/, Graph/, Runtime/, etc.)
- Source:
Perform replacements in all copied files:
- Replace
OAGwithAG(for function names likeOAGGraphMutateAttribute->AGGraphMutateAttribute) - Replace
OpenAttributeGraphCxxwithAttributeGraph(for imports) - Replace
// OpenAttributeGraphwith// AttributeGraph(for file headers) - Replace any remaining
OpenAttributeGraphwithAttributeGraph(for doc comments)
- Replace
Cleanup:
- Remove
.doccdocumentation folders - Remove
.DS_Storefiles - If a temporary clone was created, remove it
- Remove
Directory Structure After Sync
AG/DeviceSwiftShims/
├── Attribute/
│ ├── Attribute/
│ ├── Body/
│ ├── Indirect/
│ ├── Optional/
│ ├── Rule/
│ ├── RuleContext/
│ └── Weak/
├── Debug/
├── Graph/
├── Runtime/
└── Export.swift
Notes
- The
_AttributeGraphDeviceSwiftShimstarget provides Swift symbols for iOS device builds where the binary AttributeGraph framework lacks Swift interface - This target depends on the
AttributeGraphbinary target - Files use
public import AttributeGraphto access C/C++ symbols from the binary framework
Sync shims from: $ARGUMENTS