Skip to content

Commit

Permalink
Add support for SPM
Browse files Browse the repository at this point in the history
  • Loading branch information
frederoni committed Jun 7, 2019
1 parent 374638e commit d17cb8c
Show file tree
Hide file tree
Showing 46 changed files with 175 additions and 119 deletions.
98 changes: 98 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
version: 2.1

step-library:
- &restore-cache
restore_cache:
keys:
- carthage-cache-mbstatic-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cartfile.resolved" }}
- carthage-cache-mbstatic-v1-{{ .Environment.CIRCLE_JOB }} # used if checksum fails

- &save-cache
save_cache:
key: carthage-cache-mbstatic-v1-{{ .Environment.CIRCLE_JOB }}-{{ checksum "Cartfile.resolved" }}
paths:
- Carthage

- &prepare
run:
name: Prepare
command: |
echo "foo" > ~/.mapbox
jobs:
SPM-job:
parameters:
xcode:
type: string
macos:
xcode: << parameters.xcode >>
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- run: swift build

build-job:
parameters:
xcode:
type: string
device:
type: string
default: "iPhone 6 Plus"
iOS:
type: string
default: "12.1"
watchOS:
type: string
default: "5.0"
tvOS:
type: string
default: "12.0"
test:
type: boolean
default: true
macos:
xcode: << parameters.xcode >>
environment:
HOMEBREW_NO_AUTO_UPDATE: 1
steps:
- checkout
- *prepare
- *restore-cache
- run:
name: Install prerequisites
command: |
if [ $(xcversion simulators | grep -cF "iOS << parameters.iOS >> Simulator (installed)") -eq 0 ]; then xcversion simulators --install="iOS << parameters.iOS >>" || true; fi
- run:
name: Dependencies
command: |
carthage bootstrap --platform ios --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform tvos --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform macos --cache-builds --configuration Debug --no-use-binaries
carthage bootstrap --platform watchos --cache-builds --configuration Debug --no-use-binaries
- *save-cache
- run:
name: iOS
command: xcodebuild -sdk iphonesimulator -project MapboxStatic.xcodeproj -scheme 'MapboxStatic iOS' -destination 'platform=iOS Simulator,OS=<< parameters.iOS >>,name=<< parameters.device >>' clean build <<# parameters.test >>test<</ parameters.test >>
- run:
name: tvOS
command: xcodebuild -project MapboxStatic.xcodeproj -scheme 'MapboxStatic tvOS' -destination 'platform=tvOS Simulator,name=Apple TV 4K (at 1080p),OS=<< parameters.tvOS >>' clean build <<# parameters.test >>test <</ parameters.test >>
- run:
name: macOS
command: xcodebuild -project MapboxStatic.xcodeproj -scheme 'MapboxStatic Mac' clean build<<# parameters.test >> test <</ parameters.test >>
- run:
name: watchOS
command: xcodebuild -project MapboxStatic.xcodeproj -scheme 'MapboxStatic watchOS' -destination 'platform=watchOS Simulator,name=Apple Watch Series 3 - 42mm,OS=<< parameters.watchOS >>' clean build

workflows:
workflow:
jobs:
- build-job:
name: "Xcode_10.2"
xcode: "10.2.0"
iOS: "12.2"
tvOS: "12.2"
watchOS: "5.2"
- SPM-job:
name: "SPM"
xcode: "10.2.1"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ xcuserdata

Carthage/Build
Carthage/Checkouts

/.build
/Packages
42 changes: 24 additions & 18 deletions MapboxStatic.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,8 @@
DA20FBA91CE401E800B07762 /* Color.swift */,
DA20FB9F1CE3DEBB00B07762 /* Info.plist */,
);
path = MapboxStatic;
name = MapboxStatic;
path = Sources/MapboxStatic;
sourceTree = "<group>";
};
DA9CC6891E5C550000A14964 /* Frameworks */ = {
Expand Down Expand Up @@ -498,7 +499,8 @@
DDAD19841BD9B2F80057AC9F /* Info.plist */,
DD0C88151BE1A9CC00606E9F /* Fixtures */,
);
path = MapboxStaticTests;
name = MapboxStaticTests;
path = Tests/MapboxStaticTests;
sourceTree = "<group>";
};
/* End PBXGroup section */
Expand Down Expand Up @@ -722,11 +724,11 @@
};
DA20FBB81CE4757E00B07762 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0820;
LastSwiftMigration = 1020;
};
DA20FBC11CE4757E00B07762 = {
CreatedOnToolsVersion = 7.3.1;
LastSwiftMigration = 0820;
LastSwiftMigration = 1020;
};
DA4B4B911CE8F83100296A52 = {
CreatedOnToolsVersion = 7.3.1;
Expand Down Expand Up @@ -1129,7 +1131,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
Expand All @@ -1155,7 +1157,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStatic;
Expand All @@ -1182,14 +1184,15 @@
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStatic;
PRODUCT_NAME = MapboxStatic;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1211,13 +1214,14 @@
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
FRAMEWORK_VERSION = A;
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStatic;
PRODUCT_NAME = MapboxStatic;
SDKROOT = macosx;
SKIP_INSTALL = YES;
SWIFT_VERSION = 5.0;
VERSIONING_SYSTEM = "apple-generic";
VERSION_INFO_PREFIX = "";
};
Expand All @@ -1233,11 +1237,12 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStaticTests;
PRODUCT_NAME = MapboxStaticTests;
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Debug;
};
Expand All @@ -1251,11 +1256,12 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/Mac",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @loader_path/../Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStaticTests;
PRODUCT_NAME = MapboxStaticTests;
SDKROOT = macosx;
SWIFT_VERSION = 5.0;
};
name = Release;
};
Expand All @@ -1273,7 +1279,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = "$(SRCROOT)/MapboxStatic/Info.plist";
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
Expand Down Expand Up @@ -1302,7 +1308,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = "$(SRCROOT)/MapboxStatic/Info.plist";
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStatic;
Expand All @@ -1324,7 +1330,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStaticTests;
PRODUCT_NAME = MapboxStaticTests;
Expand All @@ -1341,7 +1347,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/tvOS",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStaticTests;
PRODUCT_NAME = MapboxStaticTests;
Expand All @@ -1365,7 +1371,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
OTHER_SWIFT_FLAGS = "-D DEBUG";
Expand Down Expand Up @@ -1395,7 +1401,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/watchOS",
);
INFOPLIST_FILE = MapboxStatic/Info.plist;
INFOPLIST_FILE = Sources/MapboxStatic/Info.plist;
INSTALL_PATH = "$(LOCAL_LIBRARY_DIR)/Frameworks";
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.MapboxStatic;
Expand Down Expand Up @@ -1584,7 +1590,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.StaticTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand All @@ -1601,7 +1607,7 @@
"$(inherited)",
"$(PROJECT_DIR)/Carthage/Build/iOS",
);
INFOPLIST_FILE = MapboxStaticTests/Info.plist;
INFOPLIST_FILE = Tests/MapboxStaticTests/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
PRODUCT_BUNDLE_IDENTIFIER = com.mapbox.StaticTests;
PRODUCT_NAME = "$(TARGET_NAME)";
Expand Down
16 changes: 16 additions & 0 deletions Package.resolved
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"object": {
"pins": [
{
"package": "Polyline",
"repositoryURL": "https://github.com/raphaelmor/Polyline.git",
"state": {
"branch": null,
"revision": "011fbc1b0f27a3398bd0fb7c5e2cf5c62ae82717",
"version": "4.2.1"
}
}
]
},
"version": 1
}
28 changes: 28 additions & 0 deletions Package.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
// swift-tools-version:5.0
// The swift-tools-version declares the minimum version of Swift required to build this package.

import PackageDescription

let package = Package(
name: "MapboxStatic",
products: [
// Products define the executables and libraries produced by a package, and make them visible to other packages.
.library(
name: "MapboxStatic",
targets: ["MapboxStatic"]),
],
dependencies: [
// Dependencies declare other packages that this package depends on.
.package(url: "https://github.com/raphaelmor/Polyline.git", from: "4.2.1")
],
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: "MapboxStatic",
dependencies: ["Polyline"]),
.testTarget(
name: "MapboxStaticTests",
dependencies: ["MapboxStatic"]),
]
)
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#else
import UIKit
#endif
import CoreLocation


/**
A structure that determines what a snapshot depicts and how it is formatted. A classic snapshot is made by compositing one or more [tile sets](https://www.mapbox.com/help/define-tileset/) with optional overlays using the [Legacy Static Images API](https://docs.mapbox.com/api/legacy/static-classic).
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
import UIKit
#endif
import Polyline
import CoreLocation


let allowedCharacterSet: CharacterSet = {
var characterSet = CharacterSet.urlPathAllowed
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#else
import UIKit
#endif
import CoreLocation


/**
A structure defining the viewpoint from which a snapshot is taken.
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes
Loading

0 comments on commit d17cb8c

Please sign in to comment.