diff --git a/.github/workflows/release-automated.yml b/.github/workflows/release-automated.yml index 9f27178ae..470548d3c 100644 --- a/.github/workflows/release-automated.yml +++ b/.github/workflows/release-automated.yml @@ -3,12 +3,11 @@ on: push: branches: [ master, release, alpha, beta ] env: - CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer' CI_XCODE_14: '/Applications/Xcode_14.2.app/Contents/Developer' jobs: release: - runs-on: macos-11 + runs-on: macos-12 outputs: current_tag: ${{ steps.tag.outputs.current_tag }} steps: @@ -43,45 +42,6 @@ jobs: id: tag run: echo "::set-output name=current_tag::$(git describe --tags --abbrev=0 --exact-match || echo '')" - assets: - needs: release - if: needs.release.outputs.current_tag != '' - runs-on: macos-11 - env: - GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ needs.release.outputs.current_tag }} - - name: Cache Gems - id: cache-gems - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gem- - - name: Submodules and Bundle Install - run: | - git submodule update --init --recursive - sudo gem install bundler - bundle config set path 'vendor/bundle' - bundle install - carthage bootstrap --use-xcframeworks - - name: Build Release - run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake package:release - env: - DEVELOPER_DIR: ${{ env.CI_XCODE_11 }} - - name: Deploy assets - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/release/* - tag: ${{ needs.release.outputs.current_tag }} - overwrite: true - file_glob: true - publish-docs: needs: release if: needs.release.outputs.current_tag != '' diff --git a/.github/workflows/release-manual-assets.yml b/.github/workflows/release-manual-assets.yml deleted file mode 100644 index 5c9852d68..000000000 --- a/.github/workflows/release-manual-assets.yml +++ /dev/null @@ -1,48 +0,0 @@ -name: release-manual-assets -on: - workflow_dispatch: - inputs: - tag: - default: '' - description: 'Version tag:' -env: - CI_XCODE_11: '/Applications/Xcode_11.7.app/Contents/Developer' - -jobs: - assets: - if: github.event.inputs.tag != '' - runs-on: macos-11 - env: - GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }} - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - ref: ${{ github.event.inputs.tag }} - - name: Cache Gems - id: cache-gems - uses: actions/cache@v2 - with: - path: vendor/bundle - key: ${{ runner.os }}-gem-${{ hashFiles('**/Gemfile.lock') }} - restore-keys: | - ${{ runner.os }}-gem- - - name: Submodules and Bundle Install - run: | - git submodule update --init --recursive - sudo gem install bundler - bundle config set path 'vendor/bundle' - bundle install - carthage bootstrap --use-xcframeworks - - name: Build Release - run: set -o pipefail && env NSUnbufferedIO=YES bundle exec rake package:release - env: - DEVELOPER_DIR: ${{ env.CI_XCODE_11 }} - - name: Deploy assets - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: build/release/* - tag: ${{ github.event.inputs.tag }} - overwrite: true - file_glob: true diff --git a/README.md b/README.md index acdef8977..de686449c 100644 --- a/README.md +++ b/README.md @@ -20,15 +20,11 @@ --- -A library that gives you access to the powerful Parse Server backend from your iOS, iPadOS, macOS, watchOS and tvOS app. For more information about the Parse Platform and its features, see the public [documentation][docs]. Check out some of the [apps using Parse](https://www.appsight.io/sdk/parse). +A library that gives you access to the powerful Parse Server backend from your iOS, iPadOS, macOS, watchOS and tvOS app. For more information about the Parse Platform and its features, see the public [documentation][docs]. --- - [Getting Started](#getting-started) - - [Alternative Installation Options](#alternative-installation-options) - - [Download Builds](#download-builds) - - [Compile Source](#compile-source) - - [Add Sub-Project](#add-sub-project) - [How Do I Contribute?](#how-do-i-contribute) - [Dependencies](#dependencies) @@ -46,44 +42,6 @@ The easiest way to install the SDK is via Swift Package Manager. Take a look at the public [documentation][docs] & [API][api] and start building. -### Alternative Installation Options - -#### Download Builds - -Dowload the compiled builds from the asset section in the [releases][releases] page. - -#### Compile Source - -If you want to manually compile the SDK, clone it locally, and run the following commands in the root directory of the repository: - -``` -# To pull in extra dependencies (Bolts and OCMock) -git submodule update --init --recursive - -# To install bundler -gem install bundler - -# To install all the gems via bundler -bundle install - -# Build & Package the Frameworks -bundle exec rake package:frameworks -``` - -Compiled frameworks will be in multiple archives inside the `build/release` folder: -- `Parse-iOS.zip` -- `Parse-macOS.zip` -- `Parse-tvOS.zip` -- `Parse-watchOS.zip` -- `ParseFacebookUtils-iOS.zip` -- `ParseFacebookUtils-tvOS.zip` -- `ParseTwitterUtils-iOS.zip` -- `ParseUI.zip` - -#### Add Sub-Project - -You can also include parse as a subproject inside of your application if you'd prefer, although we do not recommend this, as it will increase your indexing time significantly. To do so, just drag and drop the Parse.xcodeproj file into your workspace. Note that unit tests will be unavailable if you use Parse like this, as OCMock will be unable to be found. - ## How Do I Contribute? We want to make contributing to this project as easy and transparent as possible. Please refer to the [Contribution Guidelines][contributing]. @@ -97,8 +55,6 @@ We use the following libraries as dependencies inside of Parse: [docs]: http://docs.parseplatform.org/ios/guide/ [api]: http://parseplatform.org/Parse-SDK-iOS-OSX/api/ -[parseui-link]: https://github.com/parse-community/ParseUI-iOS -[releases]: https://github.com/parse-community/Parse-SDK-iOS-OSX/releases [contributing]: https://github.com/parse-community/Parse-SDK-iOS-OSX/blob/master/CONTRIBUTING.md [bolts-framework]: https://github.com/BoltsFramework/Bolts-ObjC [ocmock-framework]: http://ocmock.org diff --git a/Rakefile b/Rakefile index 3261c8042..b4f4c8527 100644 --- a/Rakefile +++ b/Rakefile @@ -12,69 +12,10 @@ require_relative 'Vendor/xctoolchain/Scripts/xctask/build_framework_task' script_folder = File.expand_path(File.dirname(__FILE__)) build_folder = File.join(script_folder, 'build') -release_folder = File.join(build_folder, 'release') -bolts_build_folder = File.join(script_folder, 'Carthage', 'Build') -bolts_folder = File.join(script_folder, 'Carthage', 'Checkouts', 'Bolts-ObjC') ios_simulator = 'platform="iOS Simulator",name="iPhone 14"' tvos_simulator = 'platform="tvOS Simulator",name="Apple TV"' watchos_simulator = 'platform="watchOS Simulator",name="Apple Watch Series 8 (45mm)"' -module Constants - require 'plist' - - script_folder = File.expand_path(File.dirname(__FILE__)) - - PARSE_CONSTANTS_HEADER = File.join(script_folder, 'Parse', 'Parse', 'Source/PFConstants.h') - - PLISTS = [ - File.join(script_folder, 'Parse', 'Parse', 'Resources', 'Parse-iOS.Info.plist'), - File.join(script_folder, 'Parse', 'Parse', 'Resources', 'Parse-OSX.Info.plist'), - File.join(script_folder, 'Parse', 'Parse', 'Resources', 'Parse-watchOS.Info.plist'), - File.join(script_folder, 'Parse', 'Parse', 'Resources', 'Parse-tvOS.Info.plist'), - File.join(script_folder, 'ParseFacebookUtils', 'ParseFacebookUtils', 'Resources', 'Info-iOS.plist'), - File.join(script_folder, 'ParseFacebookUtils', 'ParseFacebookUtils', 'Resources', 'Info-tvOS.plist'), - File.join(script_folder, 'ParseTwitterUtils', 'ParseTwitterUtils', 'Resources', 'Info-iOS.plist'), - File.join(script_folder, 'ParseUI', 'ParseUI', 'Resources', 'Info-iOS.plist'), - File.join(script_folder, 'ParseLiveQuery', 'ParseLiveQuery', 'Resources', 'Info.plist'), - File.join(script_folder, 'ParseLiveQuery', 'ParseLiveQuery-tvOS', 'Info.plist'), - File.join(script_folder, 'ParseLiveQuery', 'ParseLiveQuery-watchOS', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject', 'Resources', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject', 'Resources', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject-Swift', 'Resources', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'tvOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'ParseStarter Extension', 'Info.plist'), - File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift', 'Resources', 'Info.plist'), - ] - - def self.current_version - constants_file = File.open(PARSE_CONSTANTS_HEADER, 'r').read - matches = constants_file.match(/(.*PARSE_VERSION\s*@")(.*)(")/) - matches[2] # Return the second match, which is the version itself - end - - def self.update_version(version) - constants_file = File.open(PARSE_CONSTANTS_HEADER, 'r+') - constants = constants_file.read - constants.gsub!(/(.*PARSE_VERSION\s*@")(.*)(")/, "\\1#{version}\\3") - - constants_file.seek(0) - constants_file.write(constants) - - PLISTS.each do |plist| - update_info_plist_version(plist, version) - end - end - - def self.update_info_plist_version(plist_path, version) - info_plist = Plist.parse_xml(plist_path) - info_plist['CFBundleShortVersionString'] = version - info_plist['CFBundleVersion'] = version - File.open(plist_path, 'w') { |f| f.write(info_plist.to_plist) } - end -end - namespace :build do desc 'Build iOS framework.' task :ios do @@ -83,7 +24,6 @@ namespace :build do t.build_directory = build_folder t.framework_type = XCTask::FrameworkType::IOS t.framework_name = 'Parse.framework' - t.workspace = 'Parse.xcworkspace' t.scheme = 'Parse-iOS' t.configuration = 'Release' @@ -102,7 +42,6 @@ namespace :build do t.build_directory = build_folder t.framework_type = XCTask::FrameworkType::WATCHOS t.framework_name = 'Parse.framework' - t.workspace = 'Parse.xcworkspace' t.scheme = 'Parse-watchOS' t.configuration = 'Release' @@ -121,7 +60,6 @@ namespace :build do t.build_directory = build_folder t.framework_type = XCTask::FrameworkType::OSX t.framework_name = 'Parse.framework' - t.workspace = 'Parse.xcworkspace' t.scheme = 'Parse-macOS' t.configuration = 'Release' @@ -140,7 +78,6 @@ namespace :build do t.build_directory = build_folder t.framework_type = XCTask::FrameworkType::TVOS t.framework_name = 'Parse.framework' - t.workspace = 'Parse.xcworkspace' t.scheme = 'Parse-tvOS' t.configuration = 'Release' @@ -309,7 +246,6 @@ namespace :build do task = XCTask::BuildTask.new do |t| t.directory = script_folder t.workspace = 'Parse.xcworkspace' - t.scheme = 'ParseUIDemo' t.sdk = 'iphonesimulator' t.destinations = [ios_simulator] @@ -332,7 +268,6 @@ namespace :build do task = XCTask::BuildTask.new do |t| t.directory = script_folder t.workspace = 'Parse.xcworkspace' - t.scheme = 'ParseUIDemo-Swift' t.sdk = 'iphonesimulator' t.destinations = [ios_simulator] @@ -354,196 +289,25 @@ namespace :build do end namespace :package do - package_ios_name = 'Parse-iOS.zip' - package_macos_name = 'Parse-macOS.zip' - package_tvos_name = 'Parse-tvOS.zip' - package_watchos_name = 'Parse-watchOS.zip' - package_starter_ios_name = 'ParseStarterProject-iOS.zip' - package_starter_osx_name = 'ParseStarterProject-OSX.zip' - package_starter_tvos_name = 'ParseStarterProject-tvOS.zip' - package_starter_watchos_name = 'ParseStarterProject-watchOS.zip' - package_parseui_name = 'ParseUI.zip' - - task :prepare do - `rm -rf #{build_folder} && mkdir -p #{build_folder}` - `#{bolts_folder}/scripts/build_framework.sh -n -c Release --with-watchos --with-tvos` - end - - task :set_version, [:version] do |_, args| - version = args[:version] || Constants.current_version - Constants.update_version(version) - end - desc 'Build all frameworks and starters' task :release do |_| Rake::Task['package:frameworks'].invoke - Rake::Task['package:starters'].invoke end - desc 'Build and package all frameworks for the release' - task :frameworks, [:version] => :prepare do |_, args| - version = args[:version] || Constants.current_version - Constants.update_version(version) - - ## Build macOS Framework - Rake::Task['build:macos'].invoke - bolts_path = File.join(bolts_build_folder, 'osx', 'Bolts.framework') - osx_framework_path = File.join(build_folder, 'Parse.framework') - make_package(release_folder, - [osx_framework_path, bolts_path], - package_macos_name) - - ## Build iOS Framework + desc 'Build all frameworks' + task :frameworks do |_| Rake::Task['build:ios'].invoke - bolts_path = File.join(bolts_build_folder, 'ios', 'Bolts.framework') - ios_framework_path = File.join(build_folder, 'Parse.framework') - make_package(release_folder, - [ios_framework_path, bolts_path], - package_ios_name) - - ## Build tvOS Framework + Rake::Task['build:macos'].invoke Rake::Task['build:tvos'].invoke - bolts_path = File.join(bolts_build_folder, 'tvOS', 'Bolts.framework') - tvos_framework_path = File.join(build_folder, 'Parse.framework') - make_package(release_folder, - [tvos_framework_path, bolts_path], - package_tvos_name) - - ## Build watchOS Framework Rake::Task['build:watchos'].invoke - bolts_path = File.join(bolts_build_folder, 'watchOS', 'Bolts.framework') - watchos_framework_path = File.join(build_folder, 'Parse.framework') - make_package(release_folder, - [watchos_framework_path, bolts_path], - package_watchos_name) - Rake::Task['build:facebook_utils:ios'].invoke - ios_fb_utils_framework_path = File.join(build_folder, 'iOS', 'ParseFacebookUtilsV4.framework') - make_package(release_folder, [ios_fb_utils_framework_path], 'ParseFacebookUtils-iOS.zip') - Rake::Task['build:twitter_utils:ios'].invoke - ios_tw_utils_framework_path = File.join(build_folder, 'iOS', 'ParseTwitterUtils.framework') - make_package(release_folder, [ios_tw_utils_framework_path], 'ParseTwitterUtils-iOS.zip') - Rake::Task['build:facebook_utils:tvos'].invoke - tvos_fb_utils_framework_path = File.join(build_folder, 'tvOS', 'ParseFacebookUtilsV4.framework') - make_package(release_folder, [tvos_fb_utils_framework_path], 'ParseFacebookUtils-tvOS.zip') - Rake::Task['build:parseui:framework'].invoke - parseui_framework_path = File.join(build_folder, 'iOS', 'ParseUI.framework') - make_package(release_folder, - [parseui_framework_path], - package_parseui_name) - Rake::Task['build:parse_live_query:ios'].invoke - ios_lq_framework_path = File.join(build_folder, 'iOS', 'ParseLiveQuery.framework') - make_package(release_folder, [ios_lq_framework_path], 'ParseLiveQuery-iOS.zip') - - Rake::Task['build:parse_live_query:watchos'].invoke - watchos_lq_fb_utils_framework_path = File.join(build_folder, 'watchOS', 'ParseLiveQuery_watchOS.framework') - make_package(release_folder, [watchos_lq_fb_utils_framework_path], 'ParseLiveQuery-watchOS.zip') - - Rake::Task['build:parse_live_query:tvos'].invoke - tvos_lq_framework_path = File.join(build_folder, 'tvOS', 'ParseLiveQuery_tvOS.framework') - make_package(release_folder, [tvos_lq_framework_path], 'ParseLiveQuery-tvOS.zip') - Rake::Task['build:parse_live_query:macos'].invoke - macos_lq_utils_framework_path = File.join(build_folder, 'macOS', 'ParseLiveQuery.framework') - make_package(release_folder, [macos_lq_utils_framework_path], 'ParseLiveQuery-OSX.zip') - - end - - desc 'Build and package all starter projects for the release' - task :starters, [:version] => :frameworks do |_, _args| - require 'xcodeproj' - - ios_starters = [ - File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject'), - File.join(script_folder, 'ParseStarterProject', 'iOS', 'ParseStarterProject-Swift') - ] - ios_framework_archive = File.join(release_folder, package_ios_name) - make_starter_package(release_folder, ios_starters, ios_framework_archive, package_starter_ios_name) - - osx_starters = [ - File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject'), - File.join(script_folder, 'ParseStarterProject', 'OSX', 'ParseOSXStarterProject-Swift') - ] - osx_framework_archive = File.join(release_folder, package_macos_name) - make_starter_package(release_folder, osx_starters, osx_framework_archive, package_starter_osx_name) - - tvos_starters = [ - File.join(script_folder, 'ParseStarterProject', 'tvOS', 'ParseStarterProject-Swift') - ] - tvos_framework_archive = File.join(release_folder, package_tvos_name) - make_starter_package(release_folder, tvos_starters, tvos_framework_archive, package_starter_tvos_name) - - watchos_starters = [ - File.join(script_folder, 'ParseStarterProject', 'watchOS', 'ParseStarterProject-Swift') - ] - watchos_framework_archive = File.join(release_folder, package_watchos_name) - watchos_starters.each do |project_path| - `git clean -xfd #{project_path}` - `mkdir -p #{project_path}/Frameworks/iOS && mkdir -p #{project_path}/Frameworks/watchOS` - `cd #{project_path}/Frameworks/iOS && unzip -o #{ios_framework_archive}` - `cd #{project_path}/Frameworks/watchOS && unzip -o #{watchos_framework_archive}` - xcodeproj_path = Dir.glob(File.join(project_path, '*.xcodeproj'))[0] - prepare_xcodeproj(xcodeproj_path) - end - make_package(release_folder, watchos_starters, package_starter_watchos_name) - watchos_starters.each do |project_path| - `git clean -xfd #{project_path}` - `git checkout #{project_path}` - end - end - - def make_package(target_path, items, archive_name) - temp_folder = File.join(target_path, 'tmp') - `mkdir -p #{temp_folder}` - - item_list = '' - items.each do |item| - `cp -R #{item} #{temp_folder}` - - file_name = File.basename(item) - item_list << " #{file_name}" - end - - archive_path = File.join(target_path, archive_name) - `cd #{temp_folder}; zip -r --symlinks #{archive_path} #{item_list}` - `rm -rf #{temp_folder}` - puts "Release archive created: #{File.join(target_path, archive_name)}" - end - - def make_starter_package(target_path, starter_projects, framework_archive, archive_name) - starter_projects.each do |project_path| - `git clean -xfd #{project_path}` - `cd #{project_path} && unzip -o #{framework_archive}` - - xcodeproj_path = Dir.glob(File.join(project_path, '*.xcodeproj'))[0] - prepare_xcodeproj(xcodeproj_path) - end - make_package(target_path, starter_projects, archive_name) - - starter_projects.each do |project_path| - `git clean -xfd #{project_path}` - `git checkout #{project_path}` - end - end - - def prepare_xcodeproj(path) - project = Xcodeproj::Project.open(path) - project.targets.each do |target| - if target.name == 'Bootstrap' - target.remove_from_project - else - target.dependencies.each do |dependency| - dependency.remove_from_project if dependency.display_name == 'Bootstrap' - end - end - end - project.save - - `rm -rf #{File.join(path, 'xcshareddata', 'xcschemes', '*')}` + Rake::Task['build:parse_live_query:tvos'].invoke + Rake::Task['build:parse_live_query:watchos'].invoke end end @@ -797,8 +561,7 @@ namespace :test do end end - - desc 'Run Starter Project Tests' + desc 'Build Starter Project' task :starters do |_| results = [] ios_schemes = ['ParseStarterProject',