This repository has been archived by the owner on Jan 31, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Setup for CocoaPods and SPM distribution #5
Merged
Merged
Changes from all commits
Commits
Show all changes
12 commits
Select commit
Hold shift + click to select a range
f60e551
Add Package.swift
jkmassel 6a621bb
Build XCFramework as a ZIP file for distribution
jkmassel ab6deed
Add SwiftPM Instructions
jkmassel 982dc8e
Add CocoaPods Quickstart
jkmassel f3772ea
Add CocoaPod
jkmassel a79e92d
Add RuboCop configuration file and address violations
mokagio d503c9e
Merge pull request #6 from woocommerce/mokagio/fix-rubocop
jkmassel 42fbf15
Fix CocoaPods
jkmassel 5ea95cb
Fix Ruby issues
jkmassel 8215d9e
Try using source
jkmassel 41673dc
Fix CocoaPods Issues
jkmassel 073284a
Add Release Steps
jkmassel File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
AllCops: | ||
Exclude: | ||
- DerivedData/**/* | ||
- Pods/**/* | ||
- vendor/**/* | ||
- node_modules/**/* | ||
NewCops: enable | ||
|
||
Naming/FileName: | ||
Exclude: | ||
- '*.podspec' | ||
|
||
|
||
Metrics/BlockLength: | ||
Exclude: | ||
- '*.podspec' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// swift-tools-version:5.3 | ||
import PackageDescription | ||
|
||
let package = Package( | ||
name: "WooCommerceShared", | ||
platforms: [ | ||
.iOS(.v13), | ||
], | ||
products: [ | ||
// Products define the executables and libraries a package produces, and make them visible to other packages. | ||
.library( | ||
name: "WooCommerceShared", | ||
targets: ["WooCommerceShared"]) | ||
], | ||
dependencies: [ | ||
// Dependencies declare other packages that this package depends on. | ||
], | ||
targets: [ | ||
.binaryTarget( | ||
name: "WooCommerceShared", | ||
url: "https://cdn.a8c-ci.services/woocommerce-shared/6cba1e9/WooCommerceShared.xcframework.zip", | ||
checksum: "d815fb1b3a897e1a42c27c6ea1373ab25c818d3beaa4a73205390c6031768d1c" | ||
) | ||
] | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,7 +2,57 @@ | |
|
||
A React Native project used to share code between WooCommerce iOS and Android. | ||
|
||
## Getting Started | ||
## Quickstart | ||
|
||
### iOS – CocoaPods | ||
|
||
#### Production Builds | ||
```ruby | ||
pod 'woocommerce-shared', '~> 0.0.1' | ||
``` | ||
|
||
#### Development Builds | ||
```ruby | ||
# Reference a commit hash | ||
pod 'WooCommerceShared', git: 'https://github.com/woocommerce/WooCommerce-Shared.git', commit: '6cba1e9' | ||
|
||
# Reference a branch | ||
pod 'WooCommerceShared', git: 'https://github.com/woocommerce/WooCommerce-Shared.git', branch: 'trunk' | ||
Comment on lines
+14
to
+20
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because this CocoaPod uses pre-built binaries, referencing a commit or a branch might not result in the binary that's downloaded reflecting the state of the source code. |
||
|
||
# Reference a local copy | ||
pod 'WooCommerceShared', path: '../WooCommerce-Shared' | ||
``` | ||
|
||
### iOS – SwiftPM | ||
|
||
#### Production Builds | ||
```swift | ||
dependencies: [ | ||
.package(url: "https://github.com/woocommerce/woocommerce-shared.git", .upToNextMajor(from: "0.0.1")) | ||
] | ||
``` | ||
|
||
#### Development Builds | ||
```swift | ||
// Development Builds require two entries – one for the binary target: | ||
targets: [ | ||
.binaryTarget( | ||
name: "WooCommerceShared", | ||
url: "https://cdn.a8c-ci.services/woocommerce-shared/[commit-hash]/WooCommerceShared.xcframework.zip", | ||
checksum: "[Contents of https://cdn.a8c-ci.services/woocommerce-shared/[commit-hash]/WooCommerceShared.xcframework.zip.checksum.txt]" | ||
) | ||
|
||
] | ||
|
||
// And a second to make the target depend on it: | ||
.executable(name: "MyApp", targets: [ | ||
"WooCommerceShared", | ||
]) | ||
|
||
``` | ||
|
||
|
||
## Development | ||
|
||
This project uses `make` for most of its operations. You probably already have it installed if you've used your computer for development tasks in the past. | ||
|
||
|
@@ -17,3 +67,13 @@ Run `make dev` to start working on this project locally. | |
## Build + Ship | ||
|
||
Running `make` (with no other arguments) will build every component of the project (if possible on the current machine). See the `Makefile` for all of the individual build tasks involved in this. | ||
|
||
## Releases | ||
|
||
Because of various CocoaPods and SwiftPM idiosyncracies around `xcframework` distribution, releases are a bit tricky. To perform a release, you should: | ||
|
||
1. Create a `release/$VERSION` branch, and push it up to github.com | ||
2. Wait for CI to publish the tip of your release branch, and note the commit shorthash. | ||
3. Update the URL in `Package.swift`, and update the `checksum` field with the hash printed in the build log (if you need it, it's also published to `https://cdn.a8c-ci.services/woocommerce-shared/{commit-hash}/WooCommerceShared.xcframework.zip.checksum.txt`. | ||
4. Commit your change as `Tag {$VERSION}`, then tag that commit with your version number. | ||
5. Publish the tag to github.com |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
# frozen_string_literal: true | ||
|
||
CURRENT_SHORTHASH = `git rev-parse --short HEAD`.strip!.freeze | ||
|
||
Pod::Spec.new do |s| | ||
s.name = 'WooCommerceShared' | ||
s.version = '0.1.0' | ||
|
||
s.summary = 'Shared components used for the iOS and Android WooCommerce Apps.' | ||
s.description = "#{s.summary} It's a React Native library project." | ||
|
||
s.homepage = 'https://github.com/woocommerce/WooCommerce-Shared' | ||
s.license = { type: 'MPL', text: File.read('LICENSE') } | ||
s.author = { 'The WooCommerce Mobile Team' => '[email protected]' } | ||
|
||
s.platform = :ios, '13.0' | ||
s.swift_version = '5.0' | ||
|
||
s.source_files = 'WooCommerceShared.xcframework' | ||
|
||
s.source = { | ||
http: "https://cdn.a8c-ci.services/woocommerce-shared/#{CURRENT_SHORTHASH}/WooCommerceShared.xcframework.zip" | ||
} | ||
|
||
s.vendored_frameworks = 'WooCommerceShared.xcframework' | ||
end |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I started building an
upload_to_s3
command in the CI toolkit, but I half regret it now... There's really little difference than callingaws
directly