-
Notifications
You must be signed in to change notification settings - Fork 14
Project Dependencies
Su Ho edited this page Aug 11, 2021
·
3 revisions
To simplify setup for developers new to the application, as well as having a reliable build system that is also able to run past builds again in a reproducible fashion. The creation and set up of a new project will be faster and safer requiring only the language runtime (Ruby
) and dependency manager installed as prerequisites.
It always includes two basic dependencies:
- Fastlane: is the easiest way to automate beta deployments and releases for the
iOS
(alsoAndroid
) applications. 🚀 It handles all tedious tasks, like generating screenshots, dealing with code signing, and releasing the application. - Cocoapods: manages dependencies for Xcode projects. Cocoapods aims to improve the engagement with, and discoverability of, third party open-source Cocoa libraries. Developers need to specify the dependencies in a file named
Podfile
only. Cocoapods recursively resolves dependencies between libraries, fetches source code for all dependencies, and creates and maintains an Xcode workspace to build the project.
- Bundler provides a consistent environment for Ruby by tracking and installing the exact gems and versions that are needed
- We have
bundler
because it manages two default dependencies we want above (Fastlane
,Cocoapods
). - That's why we have an exactly
Gemfile
like below:
source "https://rubygems.org"
# Gems here
gem "fastlane"
gem "cocoapods"
platform :ios, '10.0'
use_frameworks!
inhibit_all_warnings!
def testing_pods
pod 'Quick'
pod 'Nimble'
pod 'Sourcery'
pod 'OHHTTPStubs/Swift'
end
target '___PACKAGENAME___' do
pod 'NimbleExtension', :git => 'https://github.com/nimblehq/NimbleExtension', :branch => 'master'
pod 'SnapKit'
pod 'Alamofire'
pod 'R.swift'
pod 'SwiftLint'
pod 'Crashlytics'
target 'UnitTests' do
inherit! :search_paths
testing_pods
end
target 'UITests' do
testing_pods
end
end
post_install do |installer|
installer.pods_project.targets.each do |target|
target.build_configurations.each do |config|
config.build_settings.delete 'IPHONEOS_DEPLOYMENT_TARGET'
end
end
end
- We have one Constants definition Constants.rb
- There are three Managers for Testing and Code signing
- Including lanes:
build_for_testing
unit_tests
ui_tests
code_signing
clean_up
skip_docs
require './Constants/Constants'
require './Managers/TestManager'
require './Managers/CodeSigningManager'
test_manager = TestManager.new(
fastlane: self
)
code_signing_manager = CodeSigningManager.new(
fastlane: self,
keychain_name: Constants.KEYCHAIN_NAME,
keychain_password: Constants.DEFAULT_KEYCHAIN_PASSWORD,
bundle_id_staging: Constants.BUNDLE_ID_STAGING,
bundle_id_uat: Constants.BUNDLE_ID_UAT,
bundle_id_production: Constants.BUNDLE_ID_PRODUCTION,
dev_portal_apple_id: Constants.DEV_PORTAL_APPLE_ID,
dev_portal_team_id: Constants.DEV_PORTAL_TEAM_ID
)
default_platform(:ios)
platform :ios do
### Testing ###
desc 'build for testing'
lane :build_for_testing do
test_manager.build(scheme: Constants.SCHEME_NAME_TEST_SUITE)
end
desc 'run unit tests'
lane :unit_tests do
test_manager.test(scheme: Constants.SCHEME_NAME_UNIT_TESTS)
end
desc 'run ui tests'
lane :ui_tests do
test_manager.test(scheme: Constants.SCHEME_NAME_UI_TESTS)
end
### Code Sign ###
desc 'create or update certificate and provisioning profile'
lane :code_signing do |options|
code_signing_manager.sync_code_sign(
update_adhoc: options.fetch(:update_adhoc, false),
update_development: options.fetch(:update_development, false),
update_appstore: options.fetch(:update_appstore, false)
)
end
### Utilities ###
desc 'clean up derived data'
lane :clean_up do
clear_derived_data(derived_data_path: Constants.DERIVED_DATA_PATH)
end
end
-
Homebew
is a free and open-source software package management system that simplifies the installation of software on Apple's macOS operating system and Linux. The name is intended to suggest the idea of building software on the Mac depending on the user's state.
$ /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
Ruby
$ brew install ruby
Bundler
$ gem install bundler
$ bundle install
$ bundle exec pod install
$ bundle exec fastlane code_signing
- Parameters
- update_development: Bool # optional default is false
- update_adhoc: Bool # optional default is false
- update_appstore: Bool # optional default is false
$ bundle exec fastlane build_for_testing
This project is maintained and funded by Nimble.