diff --git a/Gemfile b/Gemfile deleted file mode 100644 index cdd3a6b349..0000000000 --- a/Gemfile +++ /dev/null @@ -1,6 +0,0 @@ -source "https://rubygems.org" - -gem "fastlane" - -plugins_path = File.join(File.dirname(__FILE__), 'fastlane', 'Pluginfile') -eval_gemfile(plugins_path) if File.exist?(plugins_path) diff --git a/ci/Jenkinsfile.android b/ci/Jenkinsfile.android index b26a8f648e..d7a59a52de 100644 --- a/ci/Jenkinsfile.android +++ b/ci/Jenkinsfile.android @@ -31,8 +31,6 @@ pipeline { CI_ENVIRONMENT = 'jenkins' /* since we are mounting it we need to specify location */ STATUS_RELEASE_STORE_FILE = '/home/jenkins/status-im.keystore' - /* bundle cache is sensitive to being used by different ruby versions */ - BUNDLE_PATH = "/var/tmp/bundle-${EXECUTOR_NUMBER}" /* We use EXECUTOR_NUMBER to avoid multiple instances clashing */ LEIN_HOME = "/var/tmp/lein-${EXECUTOR_NUMBER}" YARN_CACHE_FOLDER = "/var/tmp/yarn-${EXECUTOR_NUMBER}" diff --git a/ci/Jenkinsfile.fastlane.clean b/ci/Jenkinsfile.fastlane.clean index 0a78cdb4fc..78285f5e61 100644 --- a/ci/Jenkinsfile.fastlane.clean +++ b/ci/Jenkinsfile.fastlane.clean @@ -19,7 +19,7 @@ pipeline { stages { stage('Install Deps'){ steps { - sh ('bundle install') + sh ('bundle install --gemfile=fastlane/Gemfile') } } @@ -32,7 +32,7 @@ pipeline { passwordVariable: 'FASTLANE_PASSWORD' ), ]) { - sh ('bundle exec fastlane ios clean') + sh ('bundle exec --gemfile=fastlane/Gemfile fastlane ios clean') } } } diff --git a/ci/android.groovy b/ci/android.groovy index 824cd19c99..7d031a4a94 100644 --- a/ci/android.groovy +++ b/ci/android.groovy @@ -42,7 +42,7 @@ def uploadToPlayStore(type = 'nightly') { withCredentials([ string(credentialsId: "SUPPLY_JSON_KEY_DATA", variable: 'GOOGLE_PLAY_JSON_KEY'), ]) { - utils.nix_sh "bundle exec fastlane android ${type}" + utils.nix_fastlane_sh "android ${type}" } } @@ -58,7 +58,7 @@ def uploadToSauceLabs() { string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'), string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'), ]) { - utils.nix_sh 'bundle exec fastlane android saucelabs' + utils.nix_fastlane_sh 'android saucelabs' } return env.SAUCE_LABS_NAME } @@ -68,7 +68,7 @@ def uploadToDiawi() { withCredentials([ string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'), ]) { - utils.nix_sh 'bundle exec fastlane android upload_diawi' + utils.nix_fastlane_sh 'android upload_diawi' } diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out" return diawiUrl diff --git a/ci/common.groovy b/ci/common.groovy index cd3b1b2f2d..9cbdf520a1 100644 --- a/ci/common.groovy +++ b/ci/common.groovy @@ -65,8 +65,11 @@ def prep(type = 'nightly') { if (env.TARGET_OS == 'android' || env.TARGET_OS == 'ios') { /* Run at start to void mismatched numbers */ utils.genBuildNumber() + } + + if (env.TARGET_OS == 'ios') { /* install ruby dependencies */ - utils.nix_sh 'bundle install --quiet' + utils.nix_sh 'bundle install --gemfile=fastlane/Gemfile --quiet' } def prepareTarget=env.TARGET_OS diff --git a/ci/ios.groovy b/ci/ios.groovy index 80b99f32ff..573b52dcc4 100644 --- a/ci/ios.groovy +++ b/ci/ios.groovy @@ -33,7 +33,7 @@ def bundle() { passwordVariable: 'FASTLANE_PASSWORD' ), ]) { - utils.nix_sh "bundle exec fastlane ios ${target}" + utils.nix_sh "bundle exec --gemfile=fastlane/Gemfile fastlane ios ${target}" } /* rename built file for uploads and archivization */ def pkg = '' @@ -56,7 +56,7 @@ def uploadToDiawi() { withCredentials([ string(credentialsId: 'diawi-token', variable: 'DIAWI_TOKEN'), ]) { - utils.nix_sh 'bundle exec fastlane ios upload_diawi' + utils.nix_sh 'bundle exec --gemfile=fastlane/Gemfile fastlane ios upload_diawi' } diawiUrl = readFile "${env.WORKSPACE}/fastlane/diawi.out" return diawiUrl @@ -73,7 +73,7 @@ def uploadToSauceLabs() { string(credentialsId: 'SAUCE_ACCESS_KEY', variable: 'SAUCE_ACCESS_KEY'), string(credentialsId: 'SAUCE_USERNAME', variable: 'SAUCE_USERNAME'), ]) { - utils.nix_sh 'bundle exec fastlane ios saucelabs' + utils.nix_sh 'bundle exec --gemfile=fastlane/Gemfile fastlane ios saucelabs' } return env.SAUCE_LABS_NAME } diff --git a/ci/utils.groovy b/ci/utils.groovy index 5229d97ecf..093974a496 100644 --- a/ci/utils.groovy +++ b/ci/utils.groovy @@ -17,7 +17,7 @@ def getToolVersion(name) { def nix_sh(cmd) { def isPure = env.TARGET_OS == 'linux' || env.TARGET_OS == 'android' - def pureFlag = isPure ? '--pure' : '' + def pureFlag = isPure ? '--pure --keep LOCALE_ARCHIVE_2_27 --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep STATUS_RELEASE_STORE_PASSWORD --keep STATUS_RELEASE_KEY_ALIAS --keep STATUS_RELEASE_KEY_PASSWORD --keep VERBOSE_LEVEL' : '' sh """ set +x @@ -29,6 +29,20 @@ def nix_sh(cmd) { """ } +def nix_fastlane_sh(cmd) { + def isPure = env.TARGET_OS == 'android' + def pureFlag = isPure ? '--pure --keep LANG --keep LANGUAGE --keep LC_ALL --keep DIAWI_TOKEN --keep DIAWI_IPA --keep APK_PATH --keep GOOGLE_PLAY_JSON_KEY --keep SAUCE_LABS_NAME --keep SAUCE_USERNAME --keep SAUCE_ACCESS_KEY --keep FASTLANE_DISABLE_COLORS --keep FASTLANE_APPLE_ID --keep FASTLANE_PASSWORD --keep KEYCHAIN_PASSWORD --keep MATCH_PASSWORD --keep REALM_DISABLE_ANALYTICS --keep STATUS_RELEASE_STORE_FILE --keep GRADLE_USER_HOME' : '' + + sh """ + set +x + . ~/.nix-profile/etc/profile.d/nix.sh + set -x + nix-shell --argstr target-os \'${env.TARGET_OS}\' \\ + ${pureFlag} --run \'printenv && \$FASTLANE_SCRIPT ${cmd}\' \\ + \'${env.WORKSPACE}/shell.nix\' + """ +} + def branchName() { return env.GIT_BRANCH.replaceAll(/.*origin\//, '') } diff --git a/fastlane/Gemfile b/fastlane/Gemfile new file mode 100644 index 0000000000..1d29b045c6 --- /dev/null +++ b/fastlane/Gemfile @@ -0,0 +1,9 @@ +source "https://rubygems.org" + +gem "fastlane" + +plugins_path = File.join(File.dirname(__FILE__), 'Pluginfile') +eval_gemfile(plugins_path) if File.exist?(plugins_path) + +plugins_path = ENV["FASTLANE_PLUGINFILE_PATH"] +eval_gemfile(plugins_path) if plugins_path \ No newline at end of file diff --git a/Gemfile.lock b/fastlane/Gemfile.lock similarity index 99% rename from Gemfile.lock rename to fastlane/Gemfile.lock index aae8c79986..d3206f8004 100644 --- a/Gemfile.lock +++ b/fastlane/Gemfile.lock @@ -109,7 +109,7 @@ GEM nanaimo (0.2.6) naturally (2.2.0) netrc (0.11.0) - os (1.0.0) + os (1.0.1) plist (3.5.0) public_suffix (2.0.5) representable (3.0.4) diff --git a/fastlane/default.nix b/fastlane/default.nix new file mode 100644 index 0000000000..c55422da6a --- /dev/null +++ b/fastlane/default.nix @@ -0,0 +1,63 @@ +{ stdenv, bundlerEnv, ruby, makeWrapper }: + +let + fastlane = stdenv.mkDerivation rec { + name = "${pname}-${version}"; + pname = "fastlane"; + version = (import ./gemset.nix).fastlane.version; + + nativeBuildInputs = [ makeWrapper ]; + + env = bundlerEnv { + name = "${name}-gems"; + inherit pname ruby; + gemdir = ./.; + }; + + phases = [ "installPhase" ]; + + installPhase = '' + mkdir -p $out/bin + makeWrapper ${env}/bin/fastlane $out/bin/fastlane \ + --set FASTLANE_SKIP_UPDATE_CHECK 1 + ''; + + meta = with stdenv.lib; { + description = "A tool to automate building and releasing iOS and Android apps"; + longDescription = "fastlane is a tool for iOS and Android developers to automate tedious tasks like generating screenshots, dealing with provisioning profiles, and releasing your application."; + homepage = https://github.com/fastlane/fastlane; + license = licenses.mit; + maintainers = with maintainers; [ + peterromfeldhk + ]; + }; + }; + +in { + package = fastlane; + + shellHook = '' + export FASTLANE_PLUGINFILE_PATH=$PWD/fastlane/Pluginfile + export FASTLANE_SCRIPT="${fastlane}/bin/fastlane" # the ruby package also exposes the fastlane Gem, so we want to make sure we don't rely on PATH ordering to get the right package + ''; +} + +## This nix file cannot currently be used for iOS due to an error in BUILD TARGET ReactNativeConfig OF PROJECT ReactNativeConfig WITH CONFIGURATION Release +## The log shows: +## PhaseScriptExecution Run\ Script /Users/jenkins/Library/Developer/Xcode/DerivedData/StatusIm-gzbepwnrlqbukxbmmpfskimspfch/Build/Intermediates.noindex/ArchiveIntermediates/StatusIm/IntermediateBuildFilesPath/ReactNativeConfig.build/Release-iphoneos/ReactNativeConfig.build/Script-EBE4E8281C7BF689000F8875.sh +## /bin/sh -c /Users/jenkins/Library/Developer/Xcode/DerivedData/StatusIm-gzbepwnrlqbukxbmmpfskimspfch/Build/Intermediates.noindex/ArchiveIntermediates/StatusIm/IntermediateBuildFilesPath/ReactNativeConfig.build/Release-iphoneos/ReactNativeConfig.build/Script-EBE4E8281C7BF689000F8875.sh +## which calls node_modules/react-native-config/ios/ReactNativeConfig/BuildDotenvConfig.ruby. The log further shows: +## Ignoring json-2.2.0 because its extensions are not built. Try: gem pristine json --version 2.2.0 +## Ignoring unf_ext-0.0.7.6 because its extensions are not built. Try: gem pristine unf_ext --version 0.0.7.6 +## /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:91:in `block in materialize': Could not find unf_ext-0.0.7.6 in any of the sources (Bundler::GemNotFound) +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:85:in `map!' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/spec_set.rb:85:in `materialize' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/definition.rb:170:in `specs' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/definition.rb:237:in `specs_for' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/definition.rb:226:in `requested_specs' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:108:in `block in definition_method' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/runtime.rb:20:in `setup' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler.rb:107:in `setup' +## from /nix/store/w7rysr83rd8jga24mp3a2m3vx50n4nva-bundler-1.17.2/lib/ruby/gems/2.5.0/gems/bundler-1.17.2/lib/bundler/setup.rb:20:in `' +## from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' +## from /System/Library/Frameworks/Ruby.framework/Versions/2.3/usr/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require' diff --git a/fastlane/gemset.nix b/fastlane/gemset.nix new file mode 100644 index 0000000000..ee88e227ca --- /dev/null +++ b/fastlane/gemset.nix @@ -0,0 +1,707 @@ +{ + addressable = { + dependencies = ["public_suffix"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0bcm2hchn897xjhqj9zzsxf3n9xhddymj4lsclz508f4vw3av46l"; + type = "gem"; + }; + version = "2.6.0"; + }; + atomos = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "17vq6sjyswr5jfzwdccw748kgph6bdw30bakwnn6p8sl4hpv4hvx"; + type = "gem"; + }; + version = "0.1.3"; + }; + babosa = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "05rgxg4pz4bc4xk34w5grv0yp1j94wf571w84lf3xgqcbs42ip2f"; + type = "gem"; + }; + version = "1.0.2"; + }; + CFPropertyList = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ykjag3k5msz3sf1j91rb55da2xh596y06m3a4yl79fiy2id0w9z"; + type = "gem"; + }; + version = "3.0.0"; + }; + claide = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0az54rp691hc42yl1xyix2cxv58byhaaf4gxbpghvvq29l476rzc"; + type = "gem"; + }; + version = "1.0.2"; + }; + colored = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0b0x5jmsyi0z69bm6sij1k89z7h0laag3cb4mdn7zkl9qmxb90lx"; + type = "gem"; + }; + version = "1.2"; + }; + colored2 = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0jlbqa9q4mvrm73aw9mxh23ygzbjiqwisl32d8szfb5fxvbjng5i"; + type = "gem"; + }; + version = "3.1.2"; + }; + commander-fastlane = { + dependencies = ["highline"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0y8d3ac9qwm1cg6rnpf8rcdsy1yxacrd2g2kl809xsp2vi973g65"; + type = "gem"; + }; + version = "4.4.6"; + }; + declarative = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0642xvwzzbgi3kp1bg467wma4g3xqrrn0sk369hjam7w579gnv5j"; + type = "gem"; + }; + version = "0.0.10"; + }; + declarative-option = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1g4ibxq566f1frnhdymzi9hxxcm4g2gw4n21mpjk2mhwym4q6l0p"; + type = "gem"; + }; + version = "0.1.0"; + }; + digest-crc = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "08q8p0fk51aa6dwhy2xmjaj76arcq9nn22gyia162jmqpccfx50l"; + type = "gem"; + }; + version = "0.4.1"; + }; + domain_name = { + dependencies = ["unf"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0abdlwb64ns7ssmiqhdwgl27ly40x2l27l8hs8hn0z4kb3zd2x3v"; + type = "gem"; + }; + version = "0.5.20180417"; + }; + dotenv = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "13cis6bf06hmz744xrsl163p6gb78xcm8g8q4pcabsy5ywyv6kag"; + type = "gem"; + }; + version = "2.7.2"; + }; + emoji_regex = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1jfsv8ik2h1msqf3if1f121pnx3lccp8fqnka9na309mnw3bq532"; + type = "gem"; + }; + version = "1.0.1"; + }; + excon = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0vcplvlykirg2vc56jjxavgpkllzq26xgp7ind7wc5ikaqaz64gn"; + type = "gem"; + }; + version = "0.64.0"; + }; + faraday = { + dependencies = ["multipart-post"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0s72m05jvzc1pd6cw1i289chas399q0a14xrwg4rvkdwy7bgzrh0"; + type = "gem"; + }; + version = "0.15.4"; + }; + faraday-cookie_jar = { + dependencies = ["faraday" "http-cookie"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1di4gx6446a6zdkrpj679m5k515i53wvb4yxcsqvy8d8zacxiiv6"; + type = "gem"; + }; + version = "0.0.6"; + }; + faraday_middleware = { + dependencies = ["faraday"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1a93rs58bakqck7bcihasz66a1riy22h2zpwrpmb13gp8mw3wkmr"; + type = "gem"; + }; + version = "0.13.1"; + }; + fastimage = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1iy9jm13r2r4yz41xaivhxs8mvqn57fjwihxvazbip002mq6rxfz"; + type = "gem"; + }; + version = "2.1.5"; + }; + fastlane = { + dependencies = ["CFPropertyList" "addressable" "babosa" "colored" "commander-fastlane" "dotenv" "emoji_regex" "excon" "faraday" "faraday-cookie_jar" "faraday_middleware" "fastimage" "gh_inspector" "google-api-client" "google-cloud-storage" "highline" "json" "mini_magick" "multi_json" "multi_xml" "multipart-post" "plist" "public_suffix" "rubyzip" "security" "simctl" "slack-notifier" "terminal-notifier" "terminal-table" "tty-screen" "tty-spinner" "word_wrap" "xcodeproj" "xcpretty" "xcpretty-travis-formatter"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "03lzpws5xy5alla96sf4h7qapklylpaq8qzln8r1p11qbpgnrrlc"; + type = "gem"; + }; + version = "2.121.1"; + }; + fastlane-plugin-clean_testflight_testers = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0r9qh2p1rpry68dddf380k25qg0f1xn1bamdr9255v6kaxd8vq42"; + type = "gem"; + }; + version = "0.2.0"; + }; + fastlane-plugin-diawi = { + dependencies = ["rest-client"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "01zaq5ykpn8j04pfyd4p3p0dnlil3cbbzcw5hayc70dpak09cr6x"; + type = "gem"; + }; + version = "1.3.0"; + }; + gh_inspector = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0f8r9byajj3bi2c7c5sqrc7m0zrv3nblfcd4782lw5l73cbsgk04"; + type = "gem"; + }; + version = "1.1.3"; + }; + google-api-client = { + dependencies = ["addressable" "googleauth" "httpclient" "mime-types" "representable" "retriable" "signet"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1z925kbqyaxdi6ld3gvaqc9527xfi8k3rr6snq5mvx5kibdi072a"; + type = "gem"; + }; + version = "0.23.9"; + }; + google-cloud-core = { + dependencies = ["google-cloud-env"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gqn523gqj6dwbj9ddcb8rjw0sai4x138pk3l3qzmq8jxz67qqj5"; + type = "gem"; + }; + version = "1.3.0"; + }; + google-cloud-env = { + dependencies = ["faraday"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "038jcy9nm1liah5ywaxm5xx2adbd28y6p8fk2frgv63v80pj8mw4"; + type = "gem"; + }; + version = "1.0.5"; + }; + google-cloud-storage = { + dependencies = ["digest-crc" "google-api-client" "google-cloud-core" "googleauth"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0lslrlrrhjj8imbpzvbbwflrvq06r0x5h74mlq726yvkr7akyqlq"; + type = "gem"; + }; + version = "1.16.0"; + }; + googleauth = { + dependencies = ["faraday" "jwt" "memoist" "multi_json" "os" "signet"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1yj7j1rnyamxpn5ybgdgbiw89v9bq2r0h85s2y2jzvqanvm7iflq"; + type = "gem"; + }; + version = "0.6.7"; + }; + highline = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "01ib7jp85xjc4gh4jg0wyzllm46hwv8p0w1m4c75pbgi41fps50y"; + type = "gem"; + }; + version = "1.7.10"; + }; + http-cookie = { + dependencies = ["domain_name"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "004cgs4xg5n6byjs7qld0xhsjq3n6ydfh897myr2mibvh6fjc49g"; + type = "gem"; + }; + version = "1.0.3"; + }; + httpclient = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "19mxmvghp7ki3klsxwrlwr431li7hm1lczhhj8z4qihl2acy8l99"; + type = "gem"; + }; + version = "2.8.3"; + }; + json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0sx97bm9by389rbzv8r1f43h06xcz8vwi3h5jv074gvparql7lcx"; + type = "gem"; + }; + version = "2.2.0"; + }; + jwt = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1w0kaqrbl71cq9sbnixc20x5lqah3hs2i93xmhlfdg2y3by7yzky"; + type = "gem"; + }; + version = "2.1.0"; + }; + memoist = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0pq8fhqh8w25qcw9v3vzfb0i6jp0k3949ahxc3wrwz2791dpbgbh"; + type = "gem"; + }; + version = "0.16.0"; + }; + mime-types = { + dependencies = ["mime-types-data"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0fjxy1jm52ixpnv3vg9ld9pr9f35gy0jp66i1njhqjvmnvq0iwwk"; + type = "gem"; + }; + version = "3.2.2"; + }; + mime-types-data = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1m00pg19cm47n1qlcxgl91ajh2yq0fszvn1vy8fy0s1jkrp9fw4a"; + type = "gem"; + }; + version = "3.2019.0331"; + }; + mini_magick = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1a59k5l29vj060yscaqk370rg5vyr132kbw6x3zar7khzjqjqd8p"; + type = "gem"; + }; + version = "4.5.1"; + }; + multi_json = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1rl0qy4inf1mp8mybfk56dfga0mvx97zwpmq5xmiwl5r770171nv"; + type = "gem"; + }; + version = "1.13.1"; + }; + multi_xml = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0lmd4f401mvravi1i1yq7b2qjjli0yq7dfc4p1nj5nwajp7r6hyj"; + type = "gem"; + }; + version = "0.6.0"; + }; + multipart-post = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "09k0b3cybqilk1gwrwwain95rdypixb2q9w65gd44gfzsd84xi1x"; + type = "gem"; + }; + version = "2.0.0"; + }; + nanaimo = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ajfyaqjw3dzykk612yw8sm21savfqy292hgps8h8l4lvxww1lz6"; + type = "gem"; + }; + version = "0.2.6"; + }; + naturally = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0dzqdawqr4agx7zr1fr5zxdwl8vb5rhpz57l1lk7d2y46ha6l4l7"; + type = "gem"; + }; + version = "2.2.0"; + }; + netrc = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0gzfmcywp1da8nzfqsql2zqi648mfnx6qwkig3cv36n9m0yy676y"; + type = "gem"; + }; + version = "0.11.0"; + }; + os = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "06r55k01g32lvz4wf2s6hpjlxbbag113jsvff3w64jllfr315a73"; + type = "gem"; + }; + version = "1.0.1"; + }; + plist = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ra0910xxbhfsmdi0ig36pr3q0khdqzwb5da3wg7y3n8d1sh9ffp"; + type = "gem"; + }; + version = "3.5.0"; + }; + public_suffix = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "040jf98jpp6w140ghkhw2hvc1qx41zvywx5gj7r2ylr1148qnj7q"; + type = "gem"; + }; + version = "2.0.5"; + }; + representable = { + dependencies = ["declarative" "declarative-option" "uber"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0qm9rgi1j5a6nv726ka4mmixivlxfsg91h8rpp72wwd4vqbkkm07"; + type = "gem"; + }; + version = "3.0.4"; + }; + rest-client = { + dependencies = ["http-cookie" "mime-types" "netrc"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1hzcs2r7b5bjkf2x2z3n8z6082maz0j8vqjiciwgg3hzb63f958j"; + type = "gem"; + }; + version = "2.0.2"; + }; + retriable = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1q48hqws2dy1vws9schc0kmina40gy7sn5qsndpsfqdslh65snha"; + type = "gem"; + }; + version = "3.1.2"; + }; + rouge = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0sfikq1q8xyqqx690iiz7ybhzx87am4w50w8f2nq36l3asw4x89d"; + type = "gem"; + }; + version = "2.0.7"; + }; + rubyzip = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1n1lb2sdwh9h27y244hxzg1lrxxg2m53pk1vq7p33bna003qkyrj"; + type = "gem"; + }; + version = "1.2.2"; + }; + security = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ryjxs0j66wrbky2c08yf0mllwalvpg12rpxzbdx2rdhj3cbrlxa"; + type = "gem"; + }; + version = "0.1.3"; + }; + signet = { + dependencies = ["addressable" "faraday" "jwt" "multi_json"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1f5d3bz5bjc4b0r2jmqd15qf07lgsqkgd25f0h46jihrf9l5fsi4"; + type = "gem"; + }; + version = "0.11.0"; + }; + simctl = { + dependencies = ["CFPropertyList" "naturally"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0bbvbpdk955q1g797md960fdznw6p6hmj2pc62yrbpvb1ymag1sf"; + type = "gem"; + }; + version = "1.6.5"; + }; + slack-notifier = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1pkfn99dhy5s526r6k8d87fwwb6j287ga9s7lxqmh60z28xqh3bv"; + type = "gem"; + }; + version = "2.3.2"; + }; + terminal-notifier = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1slc0y8pjpw30hy21v8ypafi8r7z9jlj4bjbgz03b65b28i2n3bs"; + type = "gem"; + }; + version = "2.0.0"; + }; + terminal-table = { + dependencies = ["unicode-display_width"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1512cngw35hsmhvw4c05rscihc59mnj09m249sm9p3pik831ydqk"; + type = "gem"; + }; + version = "1.8.0"; + }; + tty-cursor = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0n9mcb1jdyhz11fg0s7wy3q57xkh77p1r60w7rjibjfpkyx9v8q3"; + type = "gem"; + }; + version = "0.6.1"; + }; + tty-screen = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0azpjgyhdm8ycblnx9crq3dgb2x8yg454a13n60zfpsc0n138sw1"; + type = "gem"; + }; + version = "0.6.5"; + }; + tty-spinner = { + dependencies = ["tty-cursor"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0248h3x77634b41w5xv6k10p7767li5b6pc90h23635xv7kdkdyd"; + type = "gem"; + }; + version = "0.9.0"; + }; + uber = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1p1mm7mngg40x05z52md3mbamkng0zpajbzqjjwmsyw0zw3v9vjv"; + type = "gem"; + }; + version = "0.1.0"; + }; + unf = { + dependencies = ["unf_ext"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0bh2cf73i2ffh4fcpdn9ir4mhq8zi50ik0zqa1braahzadx536a9"; + type = "gem"; + }; + version = "0.1.4"; + }; + unf_ext = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ll6w64ibh81qwvjx19h8nj7mngxgffg7aigjx11klvf5k2g4nxf"; + type = "gem"; + }; + version = "0.0.7.6"; + }; + unicode-display_width = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1ssnc6rja9ii97z7m35y4zd0rd7cpv3bija20l7cpd7y4jyyx44q"; + type = "gem"; + }; + version = "1.5.0"; + }; + word_wrap = { + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1iyc5bc7dbgsd8j3yk1i99ral39f23l6wapi0083fbl19hid8mpm"; + type = "gem"; + }; + version = "1.0.0"; + }; + xcodeproj = { + dependencies = ["CFPropertyList" "atomos" "claide" "colored2" "nanaimo"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "0ji3wmpr6xm4172vxh9y6731vm2xrvv7ccwk4ijd5n4if1dakm03"; + type = "gem"; + }; + version = "1.8.2"; + }; + xcpretty = { + dependencies = ["rouge"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "1xq47q2h5llj7b54rws4796904vnnjz7qqnacdv7wlp3gdbwrivm"; + type = "gem"; + }; + version = "0.3.0"; + }; + xcpretty-travis-formatter = { + dependencies = ["xcpretty"]; + groups = ["default"]; + platforms = []; + source = { + remotes = ["https://rubygems.org"]; + sha256 = "15b5c0lxz2blmichfdlabzlbyw5nlh1ci898pxwb661m9bahz3ml"; + type = "gem"; + }; + version = "1.0.0"; + }; +} \ No newline at end of file diff --git a/fastlane/update b/fastlane/update new file mode 100755 index 0000000000..12a1567768 --- /dev/null +++ b/fastlane/update @@ -0,0 +1,11 @@ +#!/usr/bin/env nix-shell +#! nix-shell -i bash -p bash ruby bundler bundix + +rm -f Gemfile.lock +bundler install --path .bundle/vendor +bundix +rm -rf .bundle/vendor + +if [ "clean" == "$1" ]; then + rm -r ~/.gem +fi diff --git a/nix/mobile/android.nix b/nix/mobile/android.nix index 4d552b4680..81a0ad2524 100644 --- a/nix/mobile/android.nix +++ b/nix/mobile/android.nix @@ -40,6 +40,6 @@ in export ANDROID_NDK="$ANDROID_NDK_ROOT" export PATH="$ANDROID_HOME/bin:$ANDROID_HOME/tools:$ANDROID_HOME/tools/bin:$ANDROID_HOME/platform-tools:$ANDROID_HOME/build-tools:$PATH" - $(git rev-parse --show-toplevel)/scripts/generate-keystore.sh + $STATUS_REACT_HOME/scripts/generate-keystore.sh ''; } diff --git a/nix/mobile/default.nix b/nix/mobile/default.nix index efbf896692..a6739f9533 100644 --- a/nix/mobile/default.nix +++ b/nix/mobile/default.nix @@ -16,6 +16,7 @@ let xcodewrapperArgs = { version = "10.1"; }; + xcodeWrapper = xcodeenv.composeXcodeWrapper xcodewrapperArgs; android = callPackage ./android.nix { inherit config; }; in @@ -24,7 +25,8 @@ in inherit xcodewrapperArgs; buildInputs = - lib.optional targetAndroid android.buildInputs; + lib.optional targetAndroid android.buildInputs ++ + lib.optional (targetIOS && isDarwin) xcodeWrapper; shellHook = lib.optionalString targetIOS '' export RCTSTATUS_FILEPATH=${status-go}/lib/ios/Statusgo.framework diff --git a/shell.nix b/shell.nix index ef48e13626..e451915b55 100644 --- a/shell.nix +++ b/shell.nix @@ -4,14 +4,25 @@ with pkgs; let projectDeps = import ./default.nix { inherit target-os; }; + targetAndroid = { + "android" = true; + "all" = true; + }.${target-os} or false; targetMobile = { "android" = true; "ios" = true; "all" = true; }.${target-os} or false; + useFastlanePkg = (targetAndroid && !_stdenv.isDarwin); # TODO: Try to use stdenv for iOS. The problem is with building iOS as the build is trying to pass parameters to Apple's ld that are meant for GNU's ld (e.g. -dynamiclib) _stdenv = stdenvNoCC; _mkShell = mkShell.override { stdenv = _stdenv; }; + _fastlane = callPackage ./fastlane { + bundlerEnv = _: pkgs.bundlerEnv { + name = "fastlane-gems"; + gemdir = ./fastlane; + }; + }; in _mkShell { buildInputs = [ @@ -27,16 +38,19 @@ in _mkShell { ps # used in scripts/start-react-native.sh unzip wget - ] ++ lib.optionals targetMobile [ bundler ruby ]; # bundler/ruby used for fastlane + ] ++ + (if useFastlanePkg then [ _fastlane.package ] else [ bundler ruby ]); # bundler/ruby used for fastlane on macOS inputsFrom = [ projectDeps ]; TARGET_OS=target-os; shellHook = '' set -e - - ${projectDeps.shellHook} STATUS_REACT_HOME=$(git rev-parse --show-toplevel) + + ${projectDeps.shellHook} + ${lib.optionalString useFastlanePkg _fastlane.shellHook} + if [ ! -f $STATUS_REACT_HOME/.ran-setup ]; then $STATUS_REACT_HOME/scripts/setup touch $STATUS_REACT_HOME/.ran-setup