Skip to content

Commit 0cb5d08

Browse files
committed
Support visionOS binaries & Package.swift
1 parent 9b952d7 commit 0cb5d08

File tree

3 files changed

+135
-7
lines changed

3 files changed

+135
-7
lines changed

[email protected]

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
// swift-tools-version:5.9
2+
3+
import PackageDescription
4+
5+
let buildTests = false
6+
7+
extension Product {
8+
static func allTests() -> [Product] {
9+
if buildTests {
10+
return [.executable(name: "AllTestz", targets: ["AllTestz"])]
11+
} else {
12+
return []
13+
}
14+
}
15+
}
16+
17+
extension Target {
18+
static func rxCocoa() -> [Target] {
19+
#if os(Linux)
20+
return [.target(name: "RxCocoa", dependencies: ["RxSwift", "RxRelay"])]
21+
#else
22+
return [.target(name: "RxCocoa", dependencies: ["RxSwift", "RxRelay", "RxCocoaRuntime"])]
23+
#endif
24+
}
25+
26+
static func rxCocoaRuntime() -> [Target] {
27+
#if os(Linux)
28+
return []
29+
#else
30+
return [.target(name: "RxCocoaRuntime", dependencies: ["RxSwift"])]
31+
#endif
32+
}
33+
34+
static func allTests() -> [Target] {
35+
if buildTests {
36+
return [.target(name: "AllTestz", dependencies: ["RxSwift", "RxCocoa", "RxBlocking", "RxTest"])]
37+
} else {
38+
return []
39+
}
40+
}
41+
}
42+
43+
let package = Package(
44+
name: "RxSwift",
45+
platforms: [.iOS(.v12), .macOS(.v10_13), .watchOS(.v4), .tvOS(.v12), .visionOS(.v1)],
46+
products: ([
47+
[
48+
.library(name: "RxSwift", targets: ["RxSwift"]),
49+
.library(name: "RxCocoa", targets: ["RxCocoa"]),
50+
.library(name: "RxRelay", targets: ["RxRelay"]),
51+
.library(name: "RxBlocking", targets: ["RxBlocking"]),
52+
.library(name: "RxTest", targets: ["RxTest"]),
53+
.library(name: "RxSwift-Dynamic", type: .dynamic, targets: ["RxSwift"]),
54+
.library(name: "RxCocoa-Dynamic", type: .dynamic, targets: ["RxCocoa"]),
55+
.library(name: "RxRelay-Dynamic", type: .dynamic, targets: ["RxRelay"]),
56+
.library(name: "RxBlocking-Dynamic", type: .dynamic, targets: ["RxBlocking"]),
57+
.library(name: "RxTest-Dynamic", type: .dynamic, targets: ["RxTest"]),
58+
],
59+
Product.allTests()
60+
] as [[Product]]).flatMap { $0 },
61+
targets: ([
62+
[
63+
.target(name: "RxSwift", dependencies: []),
64+
],
65+
Target.rxCocoa(),
66+
Target.rxCocoaRuntime(),
67+
[
68+
.target(name: "RxRelay", dependencies: ["RxSwift"]),
69+
.target(name: "RxBlocking", dependencies: ["RxSwift"]),
70+
.target(name: "RxTest", dependencies: ["RxSwift"]),
71+
],
72+
Target.allTests()
73+
] as [[Target]]).flatMap { $0 },
74+
swiftLanguageVersions: [.v5]
75+
)

Rx.xcodeproj/project.pbxproj

Lines changed: 53 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
archiveVersion = 1;
44
classes = {
55
};
6-
objectVersion = 54;
6+
objectVersion = 55;
77
objects = {
88

99
/* Begin PBXBuildFile section */
@@ -3934,6 +3934,13 @@
39343934
};
39353935
C88FA4FE1C25C44800CCFEA4 /* PBXTargetDependency */ = {
39363936
isa = PBXTargetDependency;
3937+
platformFilters = (
3938+
ios,
3939+
maccatalyst,
3940+
macos,
3941+
tvos,
3942+
xros,
3943+
);
39373944
target = C8A56AD61AD7424700B4673B /* RxSwift */;
39383945
targetProxy = C88FA4FF1C25C44800CCFEA4 /* PBXContainerItemProxy */;
39393946
};
@@ -3972,6 +3979,9 @@
39723979
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
39733980
PRODUCT_NAME = "$(TARGET_NAME)";
39743981
SKIP_INSTALL = YES;
3982+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
3983+
SUPPORTS_MACCATALYST = YES;
3984+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
39753985
};
39763986
name = Debug;
39773987
};
@@ -3992,6 +4002,9 @@
39924002
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
39934003
PRODUCT_NAME = "$(TARGET_NAME)";
39944004
SKIP_INSTALL = YES;
4005+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4006+
SUPPORTS_MACCATALYST = YES;
4007+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
39954008
};
39964009
name = Release;
39974010
};
@@ -4012,6 +4025,9 @@
40124025
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
40134026
PRODUCT_NAME = "$(TARGET_NAME)";
40144027
SKIP_INSTALL = YES;
4028+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4029+
SUPPORTS_MACCATALYST = YES;
4030+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
40154031
};
40164032
name = "Release-Tests";
40174033
};
@@ -4032,6 +4048,9 @@
40324048
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
40334049
PRODUCT_NAME = RxCocoa;
40344050
SKIP_INSTALL = YES;
4051+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4052+
SUPPORTS_MACCATALYST = YES;
4053+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
40354054
};
40364055
name = Debug;
40374056
};
@@ -4052,6 +4071,9 @@
40524071
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
40534072
PRODUCT_NAME = RxCocoa;
40544073
SKIP_INSTALL = YES;
4074+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4075+
SUPPORTS_MACCATALYST = YES;
4076+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
40554077
};
40564078
name = Release;
40574079
};
@@ -4072,6 +4094,9 @@
40724094
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
40734095
PRODUCT_NAME = RxCocoa;
40744096
SKIP_INSTALL = YES;
4097+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4098+
SUPPORTS_MACCATALYST = YES;
4099+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
40754100
};
40764101
name = "Release-Tests";
40774102
};
@@ -4092,6 +4117,9 @@
40924117
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
40934118
PRODUCT_NAME = RxBlocking;
40944119
SKIP_INSTALL = YES;
4120+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4121+
SUPPORTS_MACCATALYST = YES;
4122+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
40954123
};
40964124
name = Debug;
40974125
};
@@ -4112,6 +4140,9 @@
41124140
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
41134141
PRODUCT_NAME = RxBlocking;
41144142
SKIP_INSTALL = YES;
4143+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4144+
SUPPORTS_MACCATALYST = YES;
4145+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
41154146
};
41164147
name = Release;
41174148
};
@@ -4132,6 +4163,9 @@
41324163
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
41334164
PRODUCT_NAME = RxBlocking;
41344165
SKIP_INSTALL = YES;
4166+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4167+
SUPPORTS_MACCATALYST = YES;
4168+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
41354169
};
41364170
name = "Release-Tests";
41374171
};
@@ -4487,6 +4521,9 @@
44874521
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
44884522
PRODUCT_NAME = RxSwift;
44894523
SKIP_INSTALL = YES;
4524+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4525+
SUPPORTS_MACCATALYST = YES;
4526+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
44904527
};
44914528
name = "Release-Tests";
44924529
};
@@ -4512,8 +4549,9 @@
45124549
PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest;
45134550
PRODUCT_NAME = RxTest;
45144551
SKIP_INSTALL = YES;
4515-
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator";
4516-
TARGETED_DEVICE_FAMILY = "1,2,3";
4552+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
4553+
SUPPORTS_MACCATALYST = YES;
4554+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
45174555
};
45184556
name = Debug;
45194557
};
@@ -4539,8 +4577,9 @@
45394577
PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest;
45404578
PRODUCT_NAME = RxTest;
45414579
SKIP_INSTALL = YES;
4542-
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator";
4543-
TARGETED_DEVICE_FAMILY = "1,2,3";
4580+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
4581+
SUPPORTS_MACCATALYST = YES;
4582+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
45444583
};
45454584
name = Release;
45464585
};
@@ -4566,8 +4605,9 @@
45664605
PRODUCT_BUNDLE_IDENTIFIER = io.rx.RxTest;
45674606
PRODUCT_NAME = RxTest;
45684607
SKIP_INSTALL = YES;
4569-
SUPPORTED_PLATFORMS = "iphonesimulator iphoneos macosx appletvos appletvsimulator";
4570-
TARGETED_DEVICE_FAMILY = "1,2,3";
4608+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx xros xrsimulator";
4609+
SUPPORTS_MACCATALYST = YES;
4610+
TARGETED_DEVICE_FAMILY = "1,2,3,7";
45714611
};
45724612
name = "Release-Tests";
45734613
};
@@ -4723,6 +4763,9 @@
47234763
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
47244764
PRODUCT_NAME = RxSwift;
47254765
SKIP_INSTALL = YES;
4766+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4767+
SUPPORTS_MACCATALYST = YES;
4768+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
47264769
};
47274770
name = Debug;
47284771
};
@@ -4743,6 +4786,9 @@
47434786
PRODUCT_BUNDLE_IDENTIFIER = "io.rx.$(PRODUCT_NAME:rfc1034identifier)";
47444787
PRODUCT_NAME = RxSwift;
47454788
SKIP_INSTALL = YES;
4789+
SUPPORTED_PLATFORMS = "appletvos appletvsimulator iphoneos iphonesimulator macosx watchos watchsimulator xros xrsimulator";
4790+
SUPPORTS_MACCATALYST = YES;
4791+
TARGETED_DEVICE_FAMILY = "1,2,3,4,7";
47464792
};
47474793
name = Release;
47484794
};

scripts/make-xcframeworks.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@ for product in ${products[@]}; do
2525
# Generate tvOS Simulator framework
2626
xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive" -destination "generic/platform=tvOS Simulator" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify
2727

28+
# Generate tvOS Simulator framework
29+
xcodebuild -workspace Rx.xcworkspace -configuration Release -archivePath "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive" -destination "generic/platform=visionOS" SKIP_INSTALL=NO SWIFT_SERIALIZE_DEBUGGING_OPTIONS=NO BUILD_LIBRARIES_FOR_DISTRIBUTION=YES -scheme $PROJECT_NAME archive | xcbeautify
30+
2831
# RxTest doesn't work on watchOS
2932
if [[ "$product" != "RxTest" ]]; then
3033
# Generate watchOS framework
@@ -51,6 +54,8 @@ for product in ${products[@]}; do
5154
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
5255
-framework "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
5356
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
57+
-framework "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
58+
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
5459
-output "./${PROJECT_NAME}.xcframework" | xcbeautify
5560
else
5661
# Generate XCFramework
@@ -67,6 +72,8 @@ for product in ${products[@]}; do
6772
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
6873
-framework "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
6974
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-appletvsimulator.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
75+
-framework "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/Products/Library/Frameworks/${PROJECT_NAME}.framework" \
76+
-debug-symbols "${BUILD_PATH}/${PROJECT_NAME}-visionos.xcarchive/dSYMs/${PROJECT_NAME}.framework.dSYM" \
7077
-output "./${PROJECT_NAME}.xcframework" | xcbeautify
7178
fi
7279

0 commit comments

Comments
 (0)