Skip to content

Commit 4ef1062

Browse files
authored
Merge pull request #93 from devxoul/fix/bundle-identifier-plus-character
fix: replace + with - in bundle identifier for Tuist+SPM compatibility
2 parents bedaf19 + dcd0c93 commit 4ef1062

File tree

4 files changed

+107
-5
lines changed

4 files changed

+107
-5
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ jobs:
2020

2121
- name: Test SPM Integration
2222
run: ./Scripts/test-spm-integration.sh
23+
24+
- name: Test Tuist+SPM Integration
25+
run: ./Scripts/test-tuist-spm-integration.sh

Package.swift

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,16 @@
33
import PackageDescription
44

55
let package = Package(
6-
name: "UITextView+Placeholder",
6+
name: "UITextView-Placeholder",
77
platforms: [.iOS(.v12)],
88
products: [
99
.library(
10-
name: "UITextView+Placeholder",
11-
targets: ["UITextView+Placeholder"]),
10+
name: "UITextView-Placeholder",
11+
targets: ["UITextView-Placeholder"]),
1212
],
1313
targets: [
1414
.target(
15-
name: "UITextView+Placeholder",
15+
name: "UITextView-Placeholder",
1616
path: "Sources",
1717
publicHeadersPath: "."),
1818
]

Scripts/test-spm-integration.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ let package = Package(
2626
.target(
2727
name: "SPMIntegrationTest",
2828
dependencies: [
29-
.product(name: "UITextView+Placeholder", package: "UITextView-Placeholder")
29+
.product(name: "UITextView-Placeholder", package: "UITextView-Placeholder")
3030
]
3131
)
3232
]
Lines changed: 99 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,99 @@
1+
#!/bin/bash
2+
set -e
3+
4+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
5+
PACKAGE_DIR="$(cd "$SCRIPT_DIR/.." && pwd)"
6+
TEST_DIR=$(mktemp -d)
7+
8+
cleanup() {
9+
rm -rf "$TEST_DIR"
10+
}
11+
trap cleanup EXIT
12+
13+
echo "==> Creating Tuist+SPM test project in $TEST_DIR"
14+
15+
cat > "$TEST_DIR/Tuist.swift" << 'EOF'
16+
import ProjectDescription
17+
18+
let tuist = Tuist()
19+
EOF
20+
21+
cat > "$TEST_DIR/Package.swift" << EOF
22+
// swift-tools-version:6.0
23+
import PackageDescription
24+
25+
#if TUIST
26+
import ProjectDescription
27+
28+
let packageSettings = PackageSettings(
29+
baseSettings: .settings()
30+
)
31+
#endif
32+
33+
let package = Package(
34+
name: "TuistSPMTest",
35+
dependencies: [
36+
.package(path: "$PACKAGE_DIR")
37+
]
38+
)
39+
EOF
40+
41+
cat > "$TEST_DIR/Project.swift" << 'EOF'
42+
import ProjectDescription
43+
44+
let project = Project(
45+
name: "TuistSPMTest",
46+
targets: [
47+
.target(
48+
name: "TuistSPMTest",
49+
destinations: .iOS,
50+
product: .app,
51+
bundleId: "com.test.TuistSPMTest",
52+
deploymentTargets: .iOS("15.0"),
53+
infoPlist: .default,
54+
sources: ["Sources/**"],
55+
dependencies: [
56+
.external(name: "UITextView-Placeholder")
57+
]
58+
)
59+
]
60+
)
61+
EOF
62+
63+
mkdir -p "$TEST_DIR/Sources"
64+
cat > "$TEST_DIR/Sources/App.swift" << 'EOF'
65+
import UIKit
66+
import UITextView_Placeholder
67+
68+
@main
69+
class AppDelegate: UIResponder, UIApplicationDelegate {
70+
func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey: Any]?) -> Bool {
71+
let textView = UITextView()
72+
textView.placeholder = "Hello, Tuist+SPM!"
73+
return true
74+
}
75+
}
76+
EOF
77+
78+
echo "==> Installing external dependencies with Tuist..."
79+
cd "$TEST_DIR"
80+
tuist install
81+
82+
echo "==> Generating Xcode project with Tuist..."
83+
tuist generate --no-open
84+
85+
echo "==> Building with xcodebuild..."
86+
SIMULATOR=$(xcrun simctl list devices available | grep -E "iPhone" | head -1 | sed 's/^[[:space:]]*//' | cut -d'(' -f1 | xargs)
87+
if [ -z "$SIMULATOR" ]; then
88+
echo "Error: No iOS Simulator found"
89+
exit 1
90+
fi
91+
echo " Using simulator: $SIMULATOR"
92+
93+
xcodebuild -workspace TuistSPMTest.xcworkspace \
94+
-scheme TuistSPMTest \
95+
-destination "platform=iOS Simulator,name=$SIMULATOR" \
96+
build \
97+
-quiet
98+
99+
echo "==> Tuist+SPM integration test passed!"

0 commit comments

Comments
 (0)