Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix SPM integration issues #456

Merged
merged 18 commits into from
Apr 30, 2024
Merged
Show file tree
Hide file tree
Changes from 17 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Framework/PubNub Framework.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -1832,6 +1832,11 @@
A5105B59238F027D00CB693D /* PNDate.m in Sources */ = {isa = PBXBuildFile; fileRef = A5105B4F238F027D00CB693D /* PNDate.m */; };
A5105B5A238F027D00CB693D /* PNDate.m in Sources */ = {isa = PBXBuildFile; fileRef = A5105B4F238F027D00CB693D /* PNDate.m */; };
A5105B5C238F027D00CB693D /* PNDate.m in Sources */ = {isa = PBXBuildFile; fileRef = A5105B4F238F027D00CB693D /* PNDate.m */; };
A51B49E02BDA7806008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E3B9FF2B2F669200D3AA18 /* PNRequestRetryConfiguration+Private.h */; };
A51B49E12BDA7806008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E3B9FF2B2F669200D3AA18 /* PNRequestRetryConfiguration+Private.h */; };
A51B49E22BDA7807008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E3B9FF2B2F669200D3AA18 /* PNRequestRetryConfiguration+Private.h */; };
A51B49E32BDA7808008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E3B9FF2B2F669200D3AA18 /* PNRequestRetryConfiguration+Private.h */; };
A51B49E42BDA7809008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A5E3B9FF2B2F669200D3AA18 /* PNRequestRetryConfiguration+Private.h */; };
A523692924A2270200656C19 /* PNAES+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A523692824A2270200656C19 /* PNAES+Private.h */; };
A523692A24A2270200656C19 /* PNAES+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A523692824A2270200656C19 /* PNAES+Private.h */; };
A523692B24A2270200656C19 /* PNAES+Private.h in Headers */ = {isa = PBXBuildFile; fileRef = A523692824A2270200656C19 /* PNAES+Private.h */; };
Expand Down Expand Up @@ -4382,6 +4387,7 @@
A56865B9230173030014E17C /* PNChannelMetadataChangeParser.h in Headers */,
A57A30DA238DC87400DE8C68 /* PNAPNSNotificationTarget.h in Headers */,
7951954326BD44E9001E308C /* PubNub+PAM.h in Headers */,
A51B49E02BDA7806008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */,
7915825C1BD709C60084FC70 /* PNChannelGroupsResult.h in Headers */,
79E20D151C8AEC3A001BC9CC /* PNEnvelopeInformation.h in Headers */,
A55CA69D2397389100B24E02 /* PNKeychain+Private.h in Headers */,
Expand Down Expand Up @@ -4675,6 +4681,7 @@
A56865BB230173030014E17C /* PNChannelMetadataChangeParser.h in Headers */,
A57A30DC238DC87400DE8C68 /* PNAPNSNotificationTarget.h in Headers */,
7951954526BD44E9001E308C /* PubNub+PAM.h in Headers */,
A51B49E22BDA7807008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */,
791583071BD709D10084FC70 /* PNEventsListener.h in Headers */,
791583051BD709D10084FC70 /* PNChannelGroupsResult.h in Headers */,
A55CA69F2397389100B24E02 /* PNKeychain+Private.h in Headers */,
Expand Down Expand Up @@ -5055,6 +5062,7 @@
A57A30F6238DDCA300DE8C68 /* PNAPNSNotificationPayload+Private.h in Headers */,
798842741C18F1FB003E8948 /* PNStatus+Private.h in Headers */,
798842321C18F0AC003E8948 /* PubNub+Subscribe.h in Headers */,
A51B49E42BDA7809008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */,
A57A30DF238DC87400DE8C68 /* PNAPNSNotificationTarget.h in Headers */,
797ABBA624C4148C0008CA1E /* PNBasePublishRequest.h in Headers */,
7988422C1C18F088003E8948 /* PubNub+Presence.h in Headers */,
Expand Down Expand Up @@ -5260,6 +5268,7 @@
A56865BA230173030014E17C /* PNChannelMetadataChangeParser.h in Headers */,
A57A30DB238DC87400DE8C68 /* PNAPNSNotificationTarget.h in Headers */,
7951954426BD44E9001E308C /* PubNub+PAM.h in Headers */,
A51B49E12BDA7806008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */,
79A8BC741C58F93900015BDE /* PNEventsListener.h in Headers */,
79A8BC721C58F93900015BDE /* PNChannelGroupsResult.h in Headers */,
A55CA69E2397389100B24E02 /* PNKeychain+Private.h in Headers */,
Expand Down Expand Up @@ -5553,6 +5562,7 @@
A56865BC230173030014E17C /* PNChannelMetadataChangeParser.h in Headers */,
A57A30DD238DC87400DE8C68 /* PNAPNSNotificationTarget.h in Headers */,
7951954626BD44E9001E308C /* PubNub+PAM.h in Headers */,
A51B49E32BDA7808008C3370 /* PNRequestRetryConfiguration+Private.h in Headers */,
79CBB1661BD03DE4001FC34D /* PNEventsListener.h in Headers */,
79CBB1261BD03DE4001FC34D /* PNChannelGroupsResult.h in Headers */,
A55CA6A02397389100B24E02 /* PNKeychain+Private.h in Headers */,
Expand Down
31 changes: 26 additions & 5 deletions Framework/scripts/export_for_spm.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ set -e
WORKING_DIRECTORY="$(pwd)"
SOURCES_FOLDER="$1"
[[ "$2" == public-only ]] && PUBLIC_ONLY=1 || PUBLIC_ONLY=0
PRIVATE_HEADERS=()
PUBLIC_HEADERS=()
ALL_HEADERS=()
FILES=()
Expand Down Expand Up @@ -61,32 +62,35 @@ gather_imported_headers_in_file() {
}



if [[ $PUBLIC_ONLY == 1 ]]; then
regex=".*Private.h"
# Retrieve list of potentially public headers.
while IFS='' read -r HEADER_PATH; do
RELATIVE_PATH="${HEADER_PATH#"$WORKING_DIRECTORY/$SOURCES_FOLDER/"}"
FILENAME="$(echo "$RELATIVE_PATH" | rev | cut -d/ -f1 | rev)"
FILES+=( "$FILENAME:$RELATIVE_PATH" )
ALL_HEADERS+=("$RELATIVE_PATH")
[[ "$RELATIVE_PATH" =~ $regex ]] && PRIVATE_HEADERS+=("$RELATIVE_PATH")
done <<< "$(find "$WORKING_DIRECTORY/$SOURCES_FOLDER" -type f ! \( -name "*.m" -o -name ".DS_Store" -o -name "*Private.h" \))"

# Scan for public headers
gather_imported_headers_in_file "$SOURCES_FOLDER/PubNub.h"
else
regex=".*Private.h"
# Retrieve list of all headers.
while IFS='' read -r HEADER_PATH; do
RELATIVE_PATH="${HEADER_PATH#"$WORKING_DIRECTORY/$SOURCES_FOLDER/"}"
FILENAME="$(echo "$RELATIVE_PATH" | rev | cut -d/ -f1 | rev)"
FILES+=( "$FILENAME:$RELATIVE_PATH" )
ALL_HEADERS+=("$RELATIVE_PATH")
[[ "$RELATIVE_PATH" =~ $regex ]] && PRIVATE_HEADERS+=("$RELATIVE_PATH")
done <<< "$(find "$WORKING_DIRECTORY/$SOURCES_FOLDER" -type f ! \( -name "*.m" -o -name ".DS_Store" \))"
fi


# Create required folders structure.
! [[ -d "$WORKING_DIRECTORY/Sources" ]] && mkdir -p "$WORKING_DIRECTORY/Sources"
! [[ -d "$1/include" ]] && mkdir -p "$1/include"
! [[ -d "$1/include" ]] && mkdir -p "$1/include/PubNub"


# Create symbolic link to Objective-C SDK source files.
Expand All @@ -96,8 +100,23 @@ popd


# Create symbolic links for public headers
cd "$1/include"
! [[ -e "PubNub.h" ]] && ln -s "../PubNub.h"
cd "$1/include/PubNub"

if [[ $PUBLIC_ONLY == 1 ]]; then
for HEADER_PATH in "${PUBLIC_HEADERS[@]}"; do
FILENAME="$(echo "$HEADER_PATH" | rev | cut -d/ -f1 | rev)"
! [[ -e "$FILENAME" ]] && ln -s "../../$HEADER_PATH"
done
else
for HEADER_PATH in "${ALL_HEADERS[@]}"; do
FILENAME="$(echo "$HEADER_PATH" | rev | cut -d/ -f1 | rev)"
! [[ -e "$FILENAME" ]] && ln -s "../../$HEADER_PATH" "$FILENAME"
done
fi

[[ -e "PubNub.h" ]] && rm "PubNub.h"

cd "../"

if [[ $PUBLIC_ONLY == 1 ]]; then
for HEADER_PATH in "${PUBLIC_HEADERS[@]}"; do
Expand All @@ -109,4 +128,6 @@ else
FILENAME="$(echo "$HEADER_PATH" | rev | cut -d/ -f1 | rev)"
! [[ -e "$FILENAME" ]] && ln -s "../$HEADER_PATH" "$FILENAME"
done
fi
fi

[[ -e "PubNub.h" ]] && rm "PubNub.h"
13 changes: 5 additions & 8 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// swift-tools-version:5.0
// swift-tools-version:5.3
//
// Package.swift
//
Expand Down Expand Up @@ -42,21 +42,18 @@ let package = Package(
.watchOS(.v4)
],
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "PubNub",
targets: ["PubNub"]
)
],
dependencies: [
// Dependencies declare other packages that this package depends on.
],
dependencies: [],
targets: [
// Targets are the basic building blocks of a package. A target can define a module or a test suite.
// Targets can depend on other targets in this package, and on products in packages which this package depends on.
.target(
name: "PubNub",
dependencies: []
dependencies: [],
path: "Sources/PubNub",
resources: [.copy("PrivacyInfo.xcprivacy")]
)
],
swiftLanguageVersions: [.v5]
Expand Down
5 changes: 4 additions & 1 deletion PubNub/Network/PNReachability.m
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,11 @@
#import "PNReachability.h"
#import "PubNub+CorePrivate.h"
#import "PNConfiguration.h"
#import "PNTimeResult.h"
#import "PNStructures.h"
#import "PubNub+Time.h"
#import "PubNub+Core.h"
#import "PNLogMacro.h"
#import "PubNub.h"


NS_ASSUME_NONNULL_BEGIN
Expand Down
1 change: 1 addition & 0 deletions PubNub/include/PNRequestRetryConfiguration+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PNRequestRetryConfiguration.h
1 change: 0 additions & 1 deletion PubNub/include/PubNub.h

This file was deleted.

1 change: 1 addition & 0 deletions PubNub/include/PubNub/NSArray+PNMap.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/NSDateFormatter+PNCacheable.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/NSInputStream+PNCrypto.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/NSInputStream+PNURL.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAES+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAES.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAESCBCCryptor+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAESCBCCryptor.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPICallBuilder+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPICallBuilder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSAPICallBuilder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSAuditAPICallBuilder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSEnabledChannelsResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSModificationAPICallBuilder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSNotificationConfiguration.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSNotificationPayload.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSNotificationTarget+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAPNSNotificationTarget.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAcknowledgmentStatus.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAddMessageActionAPICallBuilder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAddMessageActionParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAddMessageActionRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAddMessageActionStatus.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAddPushNotificationsRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNArray.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNAuditPushNotificationsRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBaseMessageActionRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBaseNotificationPayload.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBaseObjectsMembershipRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBaseObjectsRequest+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBaseObjectsRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBasePublishRequest+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBasePublishRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNBasePushNotificationsRequest.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCBORDecoder.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCCCryptorWrapper.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannel.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelClientStateResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelGroupAuditionParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelGroupChannelsResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelGroupClientStateResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelGroupModificationParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelGroupsResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMember+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMember.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMembersParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMetadata+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMetadata.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNChannelMetadataChangeParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNClientInformation.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNClientState.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNClientStateGetResult.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNClientStateParser.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNClientStateUpdateStatus.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNConfiguration+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNConfiguration.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNConstants.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptoModule.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptoProvider.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptor.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptorHeader+Private.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptorHeader.h
1 change: 1 addition & 0 deletions PubNub/include/PubNub/PNCryptorHeaderV1Data.h
Loading
Loading