diff --git a/.gitignore b/.gitignore deleted file mode 100644 index 24e5b0a..0000000 --- a/.gitignore +++ /dev/null @@ -1 +0,0 @@ -.build diff --git a/Docs/MobilePaymentsSDK_DocC.zip b/Docs/MobilePaymentsSDK_DocC.zip index 5f6b227..8a2260f 100644 Binary files a/Docs/MobilePaymentsSDK_DocC.zip and b/Docs/MobilePaymentsSDK_DocC.zip differ diff --git a/MockReaderUI.podspec b/MockReaderUI.podspec index 50d1bff..dd93d55 100644 --- a/MockReaderUI.podspec +++ b/MockReaderUI.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'MockReaderUI' - s.version = '2.0.0-beta2' + s.version = '2.0.0-beta1' s.license = {:type=>"Square Developer License", :text=>"Copyright (c) 2020-present, Square, Inc. All rights reserved.\n\nYour use of this software is subject to the Square Developer Terms of\nService (https://squareup.com/legal/developers). This copyright notice shall\nbe included in all copies or substantial portions of the software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"} s.homepage = 'https://github.com/square/mobile-payments-sdk-ios' s.authors = 'Square' @@ -8,7 +8,11 @@ Pod::Spec.new do |s| s.ios.deployment_target = '15.0' - s.source ={ :http => "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/MockReaderUI_b854a2f0e98b.zip" } + s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git" , :tag => "2.0.0-beta1" } + s.vendored_frameworks = 'MockReaderUI.xcframework' + s.prepare_command = <<-CMD + unzip XCFrameworks/MockReaderUI_6432c60c8568.zip + CMD end diff --git a/Package.swift b/Package.swift index d453b1f..4d9cd6b 100644 --- a/Package.swift +++ b/Package.swift @@ -12,13 +12,11 @@ let package = Package( targets: [ .binaryTarget( name: "SquareMobilePaymentsSDK", - url: "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/SquareMobilePaymentsSDK_b854a2f0e98b.zip", - checksum: "0b7b6244183048b49cc8d392e6127bb5cf59bfc23de23b2715db7b51146fab15" + path: "XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip" ), .binaryTarget( name: "MockReaderUI", - url: "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/MockReaderUI_b854a2f0e98b.zip", - checksum: "4e22f18fe259e2e490d04f2c2e422415188469aae06185f6268dc9ded353707e" + path: "XCFrameworks/MockReaderUI_6432c60c8568.zip" ), ] ) diff --git a/README.md b/README.md index 5ec51ca..f3762a2 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ Install with [Swift Package Manager](https://www.swift.org/documentation/package 1. Select `File > Add Package Dependencies...`. 2. Enter the repository URL: `https://github.com/square/mobile-payments-sdk-ios`. -3. Select the `Exact Version` dependency rule and specify the version as `2.0.0-beta2`. +3. Select the `Exact Version` dependency rule and specify the version as `2.0.0-beta1`. 4. Ensure the `SquareMobilePaymentsSDK` product is added to your target. Optionally, you can also add the `MockReaderUI` product to your target to simulate a physical reader when one is not present in a sandbox environment. @@ -29,11 +29,11 @@ Install with [CocoaPods](http://cocoapods.org/) by adding the following to your ``` use_frameworks! -pod "SquareMobilePaymentsSDK", "~> 2.0.0-beta2" +pod "SquareMobilePaymentsSDK", "~> 2.0.0-beta1" # Optionally include MockReaderUI if you wish to simulate a physical reader when one is not present. # This feature is only available when provided a sandbox application ID. -pod "MockReaderUI", "~> 2.0.0-beta2", configurations: ['Debug'] +pod "MockReaderUI", "~> 2.0.0-beta1", configurations: ['Debug'] ``` _Note that MockReaderUI framework **requires** the `SquareMobilePaymentsSDK` framework to also be present in your `Podfile`._ diff --git a/Scripts/sdk_constants.rb b/Scripts/sdk_constants.rb index 345e4f4..9bdea81 100644 --- a/Scripts/sdk_constants.rb +++ b/Scripts/sdk_constants.rb @@ -1,7 +1,6 @@ module SquareMobilePaymentsSDK - VERSION = '2.0.0-beta2' - COMMIT_SHA = 'b854a2f0e98b' - CLOUDFRONT_DOMAIN = 'd3eygymyzkbhx3.cloudfront.net' + VERSION = '2.0.0-beta1' + COMMIT_SHA = '6432c60c8568' LICENSE_TYPE = 'Square Developer License' LICENSE_TEXT = <<-LICENSE Copyright (c) 2020-present, Square, Inc. All rights reserved. diff --git a/Scripts/sdk_utilities.rb b/Scripts/sdk_utilities.rb index 3f0d058..23e4141 100644 --- a/Scripts/sdk_utilities.rb +++ b/Scripts/sdk_utilities.rb @@ -1,20 +1,15 @@ require 'erb' require 'fileutils' require 'open3' -require 'net/http' -require 'uri' -require 'digest' class TemplateBuilder - def initialize(version, commit_sha, license, homepage_url, authors, ios_deployment_target, cloudfront_domain) + def initialize(version, commit_sha, license, homepage_url, authors, ios_deployment_target) @version = version @commit_sha = commit_sha @license = license @homepage_url = homepage_url @authors = authors @ios_deployment_target = ios_deployment_target - @cloudfront_domain = cloudfront_domain - @sdk_checksum, @mock_reader_checksum = checksums(@cloudfront_domain, @version, @commit_sha) end def build_and_write(template_path, file_name, output_dir) @@ -25,10 +20,6 @@ def build_and_write(template_path, file_name, output_dir) file.write(result) end end - - def checksums(cloudfront_domain, version, commit_sha) - SdkDownloader.download_and_return_checksum(cloudfront_domain, version, commit_sha) - end end class CommandExecutor @@ -52,49 +43,3 @@ def self.compare(file1_path, file2_path) return true end end - -class SdkDownloader - class << self - def download_and_return_checksum(cloudfront_domain, version, commit_sha) - sdk_url = "https://#{cloudfront_domain}/mpsdk/#{version}/SquareMobilePaymentsSDK_#{commit_sha}.zip" - mock_reader_url = "https://#{cloudfront_domain}/mpsdk/#{version}/MockReaderUI_#{commit_sha}.zip" - - self.http_download(sdk_url) - file_content = File.read("t.zip", mode: 'rb') - sdk_hash = Digest::SHA256.hexdigest(file_content) - puts "SHA-256 hash: #{sdk_hash}" - - self.http_download(mock_reader_url) - file_content = File.read("t.zip", mode: 'rb') - mock_reader_hash = Digest::SHA256.hexdigest(file_content) - puts "SHA-256 hash: #{mock_reader_hash}" - - FileUtils.rm("t.zip") - - [sdk_hash, mock_reader_hash] - end - - def http_download(uri, filename: "t.zip") - url = URI.parse(uri) - progress = 0 - Net::HTTP.start(url.host, url.port, use_ssl: true) do |http| - response_for_size = http.request_head(url) - size = response_for_size['content-length'].to_f - - puts "Starting download: #{uri}" - http.request_get(url.path) do |response| - # This here is only so we can show some progress, files are heavy - open(filename, 'w') do |f| - response.read_body do |chunk| - f.write chunk - progress += chunk.length - printf("\rDownloaded: %.2f%%", 100*(progress/size)) - end - end - - end - end - puts "\nDownload Complete" - end - end -end diff --git a/Scripts/sdk_validator.rb b/Scripts/sdk_validator.rb index f8a79b8..c120c72 100644 --- a/Scripts/sdk_validator.rb +++ b/Scripts/sdk_validator.rb @@ -9,6 +9,7 @@ def self.validate_podspecs # Runs pod spec lint validation command = "pod spec lint" stdout, stderr = CommandExecutor.execute(command) + stdout.scan(/^(\w+)/).flatten # Validates output unless stdout.include?("All the specs passed validation.") @@ -27,10 +28,10 @@ def self.validate_spm_package # Resolves all packages in Package.swift command = "swift package resolve" _stdout, stderr = CommandExecutor.execute(command) - any_errors = stderr.scan("error").flatten + stderr.scan(/^(\w+)/).flatten # Validates output of resolve does not have errors. - unless any_errors.nil? || any_errors.empty? + unless stderr.nil? || stderr.empty? puts "❌ SPM Package could not be validated" puts stderr return false @@ -67,8 +68,7 @@ def self.validate_template_files SquareMobilePaymentsSDK::LICENSE, SquareMobilePaymentsSDK::HOMEPAGE_URL, SquareMobilePaymentsSDK::AUTHORS, - SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET, - SquareMobilePaymentsSDK::CLOUDFRONT_DOMAIN + SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET ) files_to_test = [ diff --git a/Scripts/templates/MockReaderUI.podspec.erb b/Scripts/templates/MockReaderUI.podspec.erb index 334baf7..fb389c1 100644 --- a/Scripts/templates/MockReaderUI.podspec.erb +++ b/Scripts/templates/MockReaderUI.podspec.erb @@ -8,7 +8,11 @@ Pod::Spec.new do |s| s.ios.deployment_target = '<%= @ios_deployment_target %>' - s.source ={ :http => "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/MockReaderUI_<%= @commit_sha %>.zip" } + s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git" , :tag => "<%= @version %>" } + s.vendored_frameworks = 'MockReaderUI.xcframework' + s.prepare_command = <<-CMD + unzip XCFrameworks/MockReaderUI_<%= @commit_sha %>.zip + CMD end diff --git a/Scripts/templates/Package.swift.erb b/Scripts/templates/Package.swift.erb index 6012046..35ee0e4 100644 --- a/Scripts/templates/Package.swift.erb +++ b/Scripts/templates/Package.swift.erb @@ -12,13 +12,11 @@ let package = Package( targets: [ .binaryTarget( name: "SquareMobilePaymentsSDK", - url: "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip", - checksum: "<%= @sdk_checksum %>" + path: "XCFrameworks/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip" ), .binaryTarget( name: "MockReaderUI", - url: "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/MockReaderUI_<%= @commit_sha %>.zip", - checksum: "<%= @mock_reader_checksum %>" + path: "XCFrameworks/MockReaderUI_<%= @commit_sha %>.zip" ), ] ) diff --git a/Scripts/templates/SquareMobilePaymentsSDK.podspec.erb b/Scripts/templates/SquareMobilePaymentsSDK.podspec.erb index 9f29e81..a516a9a 100644 --- a/Scripts/templates/SquareMobilePaymentsSDK.podspec.erb +++ b/Scripts/templates/SquareMobilePaymentsSDK.podspec.erb @@ -8,7 +8,11 @@ Pod::Spec.new do |s| s.ios.deployment_target = '<%= @ios_deployment_target %>' - s.source ={ :http => "https://<%= @cloudfront_domain %>/mpsdk/<%= @version %>/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip" } + s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git", :tag => "<%= @version %>" } + s.vendored_frameworks = 'SquareMobilePaymentsSDK.xcframework' + s.prepare_command = <<-CMD + unzip XCFrameworks/SquareMobilePaymentsSDK_<%= @commit_sha %>.zip + CMD end diff --git a/Scripts/update-sdk-version.rb b/Scripts/update-sdk-version.rb index ca41add..587dd3c 100644 --- a/Scripts/update-sdk-version.rb +++ b/Scripts/update-sdk-version.rb @@ -7,8 +7,7 @@ SquareMobilePaymentsSDK::LICENSE, SquareMobilePaymentsSDK::HOMEPAGE_URL, SquareMobilePaymentsSDK::AUTHORS, - SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET, - SquareMobilePaymentsSDK::CLOUDFRONT_DOMAIN + SquareMobilePaymentsSDK::IOS_DEPLOYMENT_TARGET ) # Generate README @@ -25,4 +24,4 @@ # Generate Package.swift template_builder.build_and_write('./Scripts/templates/Package.swift.erb', 'Package.swift', './') -puts "✅ Updated Package.swift" \ No newline at end of file +puts "✅ Updated Package.swift" diff --git a/SquareMobilePaymentsSDK.podspec b/SquareMobilePaymentsSDK.podspec index 0901060..f240241 100644 --- a/SquareMobilePaymentsSDK.podspec +++ b/SquareMobilePaymentsSDK.podspec @@ -1,6 +1,6 @@ Pod::Spec.new do |s| s.name = 'SquareMobilePaymentsSDK' - s.version = '2.0.0-beta2' + s.version = '2.0.0-beta1' s.license = {:type=>"Square Developer License", :text=>"Copyright (c) 2020-present, Square, Inc. All rights reserved.\n\nYour use of this software is subject to the Square Developer Terms of\nService (https://squareup.com/legal/developers). This copyright notice shall\nbe included in all copies or substantial portions of the software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n"} s.homepage = 'https://github.com/square/mobile-payments-sdk-ios' s.authors = 'Square' @@ -8,7 +8,11 @@ Pod::Spec.new do |s| s.ios.deployment_target = '15.0' - s.source ={ :http => "https://d3eygymyzkbhx3.cloudfront.net/mpsdk/2.0.0-beta2/SquareMobilePaymentsSDK_b854a2f0e98b.zip" } + s.source ={ :git => "https://github.com/square/mobile-payments-sdk-ios.git", :tag => "2.0.0-beta1" } + s.vendored_frameworks = 'SquareMobilePaymentsSDK.xcframework' + s.prepare_command = <<-CMD + unzip XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip + CMD end diff --git a/XCFrameworks/MockReaderUI_6432c60c8568.zip b/XCFrameworks/MockReaderUI_6432c60c8568.zip new file mode 100644 index 0000000..d56c5dc Binary files /dev/null and b/XCFrameworks/MockReaderUI_6432c60c8568.zip differ diff --git a/XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip b/XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip new file mode 100644 index 0000000..7ce6885 Binary files /dev/null and b/XCFrameworks/SquareMobilePaymentsSDK_6432c60c8568.zip differ