Skip to content

Commit 8693af2

Browse files
committed
added create-xcframework
moved files
1 parent b7dc292 commit 8693af2

File tree

7 files changed

+127
-4
lines changed

7 files changed

+127
-4
lines changed

InstanceHelper.xcodeproj/project.pbxproj

Lines changed: 20 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,8 @@
7676
A73FEEB627EC7B6500B56ED8 /* Main */ = {
7777
isa = PBXGroup;
7878
children = (
79-
A73FEEC327EC7BBF00B56ED8 /* InstanceHelper.swift */,
80-
A73FEEBF27EC7BAB00B56ED8 /* OBInstanceHelper.h */,
81-
A73FEEC027EC7BAB00B56ED8 /* OBInstanceHelper.m */,
82-
A73FEEB727EC7B6500B56ED8 /* InstanceHelper.h */,
79+
A73FEEF427EC8D2900B56ED8 /* ObjectiveC */,
80+
A73FEEF527EC8D3500B56ED8 /* Swift */,
8381
);
8482
path = Main;
8583
sourceTree = "<group>";
@@ -102,6 +100,24 @@
102100
path = Test;
103101
sourceTree = "<group>";
104102
};
103+
A73FEEF427EC8D2900B56ED8 /* ObjectiveC */ = {
104+
isa = PBXGroup;
105+
children = (
106+
A73FEEBF27EC7BAB00B56ED8 /* OBInstanceHelper.h */,
107+
A73FEEC027EC7BAB00B56ED8 /* OBInstanceHelper.m */,
108+
A73FEEB727EC7B6500B56ED8 /* InstanceHelper.h */,
109+
);
110+
path = ObjectiveC;
111+
sourceTree = "<group>";
112+
};
113+
A73FEEF527EC8D3500B56ED8 /* Swift */ = {
114+
isa = PBXGroup;
115+
children = (
116+
A73FEEC327EC7BBF00B56ED8 /* InstanceHelper.swift */,
117+
);
118+
path = Swift;
119+
sourceTree = "<group>";
120+
};
105121
/* End PBXGroup section */
106122

107123
/* Begin PBXHeadersBuildPhase section */

Package.swift

Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// swift-tools-version:5.3
2+
import PackageDescription
3+
4+
let package = Package(
5+
name: "InstanceHelper",
6+
platforms: [
7+
.iOS(.v14)
8+
],
9+
products: [
10+
.library(name: "InstanceHelperObjectiveC", targets: ["InstanceHelperObjectiveC"]),
11+
.library(name: "InstanceHelper", targets: ["InstanceHelper"]),
12+
],
13+
dependencies: [
14+
],
15+
targets: [
16+
.target(
17+
name: "InstanceHelperObjectiveC",
18+
path: "Source/Main",
19+
exclude: [
20+
"Swift",
21+
],
22+
sources: [
23+
"ObjectiveC",
24+
]
25+
),
26+
.target(
27+
name: "InstanceHelper",
28+
dependencies: [
29+
"InstanceHelperObjectiveC"
30+
],
31+
path: "Source/Main",
32+
exclude: [
33+
"ObjectiveC",
34+
],
35+
sources: [
36+
"Swift",
37+
],
38+
publicHeadersPath: "include",
39+
cSettings: [
40+
CSetting.headerSearchPath("ObjectiveC"),
41+
]
42+
),
43+
]
44+
)

create-xcframework.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/sh
2+
3+
ARCHIVE_DIRECTORY=build/archive
4+
5+
if [ $# -ne 1 ]
6+
then
7+
echo "Version is missing"
8+
exit
9+
fi
10+
11+
VERSION=$1
12+
NAME=InstanceHelper
13+
PROJECT=$NAME.xcodeproj
14+
15+
carthage bootstrap --platform iOS --use-xcframeworks --cache-builds
16+
17+
build() {
18+
local FRAMEWORK_NAME=$1
19+
20+
echo "Building $FRAMEWORK_NAME"
21+
22+
xcodebuild archive \
23+
-project $PROJECT \
24+
-scheme $FRAMEWORK_NAME \
25+
-destination "generic/platform=iOS" \
26+
-archivePath "$ARCHIVE_DIRECTORY/$FRAMEWORK_NAME-iOS" \
27+
SKIP_INSTALL=NO \
28+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcbeautify --disable-colored-output
29+
30+
xcodebuild archive \
31+
-project $PROJECT \
32+
-scheme $FRAMEWORK_NAME \
33+
-destination "generic/platform=iOS Simulator" \
34+
-archivePath "$ARCHIVE_DIRECTORY/$FRAMEWORK_NAME-iOS_Simulator" \
35+
SKIP_INSTALL=NO \
36+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcbeautify --disable-colored-output
37+
38+
xcodebuild archive \
39+
-project $PROJECT \
40+
-scheme $FRAMEWORK_NAME \
41+
-destination "generic/platform=macOS" \
42+
-archivePath "$ARCHIVE_DIRECTORY/$FRAMEWORK_NAME-macOS" \
43+
SKIP_INSTALL=NO \
44+
BUILD_LIBRARY_FOR_DISTRIBUTION=YES | xcbeautify --disable-colored-output
45+
46+
xcodebuild -create-xcframework \
47+
-archive $ARCHIVE_DIRECTORY/${FRAMEWORK_NAME}-iOS.xcarchive -framework ${FRAMEWORK_NAME}.framework \
48+
-archive $ARCHIVE_DIRECTORY/${FRAMEWORK_NAME}-iOS_Simulator.xcarchive -framework ${FRAMEWORK_NAME}.framework \
49+
-archive $ARCHIVE_DIRECTORY/${FRAMEWORK_NAME}-macOS.xcarchive -framework ${FRAMEWORK_NAME}.framework \
50+
-output $ARCHIVE_DIRECTORY/${FRAMEWORK_NAME}.xcframework
51+
}
52+
53+
build $NAME
54+
55+
mkdir build/xcframework
56+
57+
58+
cp LICENSE $ARCHIVE_DIRECTORY
59+
mkdir build/xcframework
60+
61+
cd $ARCHIVE_DIRECTORY
62+
63+
zip -r ../xcframework/$NAME-$VERSION.zip $NAME.xcframework LICENSE

0 commit comments

Comments
 (0)