Skip to content

Commit c7f94cc

Browse files
committed
Add Tuist support for project generation
- Add root Project.swift replacing hand-maintained xcodeproj - Add Tuist.swift and .mise.toml (pins tuist 4.115.1) - Add Example/ with minimal commandLine app consuming OpenAttributeGraph - Update build_xcframework.sh to use tuist generate - Update .gitignore for Tuist-generated files
1 parent 2d5c015 commit c7f94cc

10 files changed

Lines changed: 133 additions & 4 deletions

File tree

.gitignore

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,4 +14,8 @@ Checkouts/*
1414
build/
1515
.ag_repo/
1616
.oag_repo/
17+
## Tuist generated files
18+
*.xcodeproj
19+
*.xcworkspace
20+
Derived/
1721
.claude

.mise.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[tools]
2+
tuist = "4.115.1"

Example/.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
## Tuist generated files
2+
*.xcodeproj
3+
*.xcworkspace
4+
Derived/
5+
build/
6+
.build

Example/Project.swift

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import ProjectDescription
2+
3+
let project = Project(
4+
name: "Example",
5+
targets: [
6+
.target(
7+
name: "Example",
8+
destinations: [.mac],
9+
product: .commandLineTool,
10+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph.Example",
11+
deploymentTargets: .macOS("15.0"),
12+
sources: ["Sources/**"],
13+
dependencies: [
14+
.external(name: "OpenAttributeGraph"),
15+
]
16+
),
17+
]
18+
)

Example/Sources/main.swift

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
import OpenAttributeGraph
2+
3+
let _ = Graph()
4+
print("OpenAttributeGraph Example: Graph created successfully")

Example/Tuist.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import ProjectDescription
2+
3+
let config = Config()

Example/Tuist/Package.swift

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
// swift-tools-version: 6.1
2+
3+
import PackageDescription
4+
5+
let package = Package(
6+
name: "ExampleDependencies",
7+
dependencies: [
8+
.package(path: "../../"),
9+
]
10+
)

Project.swift

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
import ProjectDescription
2+
3+
// MARK: - Process Headers Script
4+
5+
let processHeadersScript: TargetScript = .pre(
6+
script: """
7+
Scripts/Xcode/process_headers.sh
8+
""",
9+
name: "Process Headers",
10+
inputFileListPaths: [
11+
"Scripts/Xcode/process_headers_inputs.xcfilelist",
12+
],
13+
outputFileListPaths: [
14+
"Scripts/Xcode/process_headers_outputs.xcfilelist",
15+
]
16+
)
17+
18+
// MARK: - Project
19+
20+
let project = Project(
21+
name: "OpenAttributeGraph",
22+
settings: .settings(
23+
configurations: [
24+
.debug(name: .debug, xcconfig: "Configs/Common.xcconfig"),
25+
.release(name: .release, xcconfig: "Configs/Common.xcconfig"),
26+
]
27+
),
28+
targets: [
29+
.target(
30+
name: "OpenAttributeGraph",
31+
destinations: [.iPhone, .iPad, .mac, .appleVision],
32+
product: .framework,
33+
bundleId: "org.OpenSwiftUIProject.OpenAttributeGraph",
34+
deploymentTargets: .multiplatform(
35+
iOS: "18.0",
36+
macOS: "15.0",
37+
visionOS: "2.0"
38+
),
39+
sources: .sourceFilesList(globs: [
40+
.glob(
41+
"Sources/Platform/**",
42+
excluding: ["Sources/Platform/README.md"]
43+
),
44+
.glob(
45+
"Sources/Utilities/**",
46+
excluding: [
47+
"Sources/Utilities/README.md",
48+
"Sources/Utilities/include/SwiftBridging/README.md",
49+
]
50+
),
51+
.glob(
52+
"Sources/OpenAttributeGraphCxx/**",
53+
excluding: [
54+
"Sources/OpenAttributeGraphCxx/include/OpenAttributeGraphCxx/Vector/vector.tpp",
55+
"Sources/OpenAttributeGraphCxx/include/SwiftBridging/README.md",
56+
]
57+
),
58+
"Sources/OpenAttributeGraph/**",
59+
]),
60+
scripts: [processHeadersScript],
61+
dependencies: [
62+
.sdk(name: "libz", type: .library),
63+
],
64+
settings: .settings(
65+
configurations: [
66+
.debug(name: .debug, xcconfig: "Configs/OpenAttributeGraph.xcconfig"),
67+
.release(name: .release, xcconfig: "Configs/OpenAttributeGraph.xcconfig"),
68+
]
69+
)
70+
),
71+
]
72+
)

Scripts/build_xcframework.sh

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@ PROJECT_ROOT="$(dirname "$SCRIPT_DIR")"
88
BUILD_DIR="$PROJECT_ROOT/.build/Xcode"
99
SCHEME="OpenAttributeGraph"
1010

11+
# Generate Xcode project via Tuist
12+
pushd "$PROJECT_ROOT" > /dev/null
13+
tuist generate --no-open
14+
popd > /dev/null
15+
16+
XCODEPROJ="$PROJECT_ROOT/OpenAttributeGraph.xcodeproj"
17+
1118
# Copy and modify modulemap for framework distribution
1219
mkdir -p "$BUILD_DIR/Archives" "$BUILD_DIR/Frameworks"
1320
cat > "$BUILD_DIR/module.modulemap" << 'EOF'
@@ -34,23 +41,23 @@ done
3441

3542
echo "Building xcframework for $SCHEME (debug info: $DEBUG_INFO)"
3643

37-
# Archive for each platform using the xcodeproj
44+
# Archive for each platform using the Tuist-generated xcodeproj
3845
xcodebuild archive \
39-
-project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \
46+
-project "$XCODEPROJ" \
4047
-scheme "$SCHEME" \
4148
-destination "generic/platform=macOS" \
4249
-archivePath "$BUILD_DIR/Archives/$SCHEME-macOS.xcarchive" \
4350
ENABLE_USER_SCRIPT_SANDBOXING=NO
4451

4552
xcodebuild archive \
46-
-project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \
53+
-project "$XCODEPROJ" \
4754
-scheme "$SCHEME" \
4855
-destination "generic/platform=iOS" \
4956
-archivePath "$BUILD_DIR/Archives/$SCHEME-iOS.xcarchive" \
5057
ENABLE_USER_SCRIPT_SANDBOXING=NO
5158

5259
xcodebuild archive \
53-
-project "$PROJECT_ROOT/OpenAttributeGraph.xcodeproj" \
60+
-project "$XCODEPROJ" \
5461
-scheme "$SCHEME" \
5562
-destination "generic/platform=iOS Simulator" \
5663
-archivePath "$BUILD_DIR/Archives/$SCHEME-iOS-Simulator.xcarchive" \

Tuist.swift

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
import ProjectDescription
2+
3+
let config = Config()

0 commit comments

Comments
 (0)