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

Swift migration #456

Merged
merged 6 commits into from
Sep 21, 2021
Merged
Show file tree
Hide file tree
Changes from all 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
4 changes: 3 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,9 @@ deploy:
- provider: releases
skip_cleanup: true
api_key: $GITHUB_TOKEN
file: Release/Leanplum.framework.zip
file:
- Release/Leanplum.framework.zip
- Release/dynamic/Leanplum.xcframework.zip
draft: true
on:
tags: true
2 changes: 1 addition & 1 deletion Leanplum-iOS-SDK.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ Pod::Spec.new do |s|
s.weak_frameworks = 'AdSupport', 'StoreKit'
s.library = 'sqlite3'
s.documentation_url = 'https://docs.leanplum.com/'
s.source_files = 'LeanplumSDK/LeanplumSDK/Classes/**/*'
s.source_files = 'LeanplumSDK/LeanplumSDK/Classes/**/*', 'LeanplumSDK/LeanplumSDK/ClassesSwift/**/*'
s.module_name = 'Leanplum'
s.resource_bundle = {
'Leanplum-iOS-SDK' => 'LeanplumSDK/LeanplumSDKBundle/Resources/**/*'
Expand Down
1,102 changes: 653 additions & 449 deletions LeanplumSDK/LeanplumSDK.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
buildForAnalyzing = "YES">
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "075AAD1626847C6F007CA1BD"
BuildableName = "libLeanplum.a"
BlueprintIdentifier = "6A714AEF26F8B317004A34A9"
BuildableName = "Leanplum.framework"
BlueprintName = "Leanplum-Static"
ReferencedContainer = "container:LeanplumSDK.xcodeproj">
</BuildableReference>
Expand Down Expand Up @@ -50,8 +50,8 @@
<MacroExpansion>
<BuildableReference
BuildableIdentifier = "primary"
BlueprintIdentifier = "075AAD1626847C6F007CA1BD"
BuildableName = "libLeanplum.a"
BlueprintIdentifier = "6A714AEF26F8B317004A34A9"
BuildableName = "Leanplum.framework"
BlueprintName = "Leanplum-Static"
ReferencedContainer = "container:LeanplumSDK.xcodeproj">
</BuildableReference>
Expand Down
2 changes: 1 addition & 1 deletion LeanplumSDK/LeanplumSDK/Classes/Utilities/LPUtils.m
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
#import "LPAPIConfig.h"
#import "LPConstants.h"
#import "Leanplum.h"

#import <Leanplum/Leanplum-Swift.h>

@implementation LPUtils

Expand Down
11 changes: 11 additions & 0 deletions LeanplumSDK/LeanplumSDK/ClassesSwift/LeanplumUtils.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
//
// LeanplumUtils.swift
// LeanplumSDK
//
// Created by Nikola Zagorchev on 20.09.21.
//

import Foundation

public class LeanplumUtils: NSObject {
}
18 changes: 6 additions & 12 deletions Package.swift
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,15 @@
import PackageDescription

let package = Package(
name: "LeanplumSDK",
name: "Leanplum",
products: [
.library(name: "LeanplumSDK", targets: ["LeanplumSDK"])
.library(name: "Leanplum", targets: ["Leanplum"])
],
targets: [
.target(
name: "LeanplumSDK",
path: "LeanplumSDK/LeanplumSDK",
exclude: [
"Supporting Files/Info.plist"
],
resources: [
.process("Resources")
],
publicHeadersPath: "include"
.binaryTarget(
name: "Leanplum",
url: "github/Leanplum.xcframework.zip";
checksum: "checksum";
)
]
)
45 changes: 19 additions & 26 deletions Tools/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -168,32 +168,6 @@ build_ios_static() {
-sdk iphoneos \
SKIP_INSTALL=NO

run "Creating simulator static library from libLeanplum.a ..." \
lipo -create \
Release/static/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/libLeanplum.a \
-output Release/static/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework/Leanplum

run "Creating ios static library from libLeanplum.a ..." \
lipo -create \
Release/static/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/libLeanplum.a \
-output Release/static/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/Leanplum.framework/Leanplum

run "Copying modulemap for simulator ..." \
cp -r Release/dynamic/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework/Modules \
Release/static/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework/Modules

run "Copying modulemap for ios ..." \
cp -r Release/dynamic/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/Leanplum.framework/Modules \
Release/static/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/Leanplum.framework/Modules

run "Copying Info.plist to static simulator framework ..." \
cp Release/dynamic/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework/Info.plist \
Release/static/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework/Info.plist

run "Copying Info.plist to static iphone framework ..." \
cp Release/dynamic/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/Leanplum.framework/Info.plist \
Release/static/LeanplumSDK-iphoneos.xcarchive/Products/Library/Frameworks/Leanplum.framework/Info.plist

run "Creating Leanplum-SDK-iOS static xcframework ..." \
xcodebuild -create-xcframework \
-framework Release/static/LeanplumSDK-iphonesimulator.xcarchive/Products/Library/Frameworks/Leanplum.framework \
Expand Down Expand Up @@ -235,9 +209,28 @@ zip_ios() {
cd Release/dynamic
zip -r Leanplum.framework.zip *
mv Leanplum.framework.zip ..

echo "zipping dynamic xcframework for SPM"
zip -r Leanplum.xcframework.zip *
cd -
}

update_spm_info(){
echo "updating SPM checksum and url"
package_file=Package.swift
package_tmp_file=Package_tmp.swift
checksum=`swift package compute-checksum Release/dynamic/Leanplum.xcframework.zip`
awk -v value="\"$checksum\";" '!x{x=sub(/checksum:.*/, "checksum: "value)}1' $package_file > $package_tmp_file \
&& mv $package_tmp_file $package_file

version=`cat sdk-version.txt`
lp_framework="Leanplum.xcframework.zip"
github_url="https://github.com/Leanplum/Leanplum-iOS-SDK/releases/download"
url="$github_url/$version/$lp_framework"
awk -v value="\"$url\";" '!x{x=sub(/url: .*/, "url: "value)}1' $package_file > $package_tmp_file \
&& mv $package_tmp_file $package_file
}

zip_unreal_engine() {
echo "zipping for Unreal Engine release"
pwd
Expand Down
32 changes: 0 additions & 32 deletions Tools/spm.sh

This file was deleted.