Merge pull request #3509 from vector-im/fix-ci

[Internal] [CI] Fix switcheroo logic
This commit is contained in:
manuroe 2020-08-05 14:13:54 +02:00 committed by GitHub
commit 1ff5de918b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -317,19 +317,24 @@ platform :ios do
kit_branch = find_branch(kit_slug, branch_pattern) || 'develop'
sdk_branch = find_branch(sdk_slug, branch_pattern) || 'develop'
kit_spec = { git: 'https://github.com/matrix-org/matrix-ios-kit.git', branch: kit_branch }
kit_podspec = { podspec: 'MatrixKit.edited.podspec' }
sdk_spec = { git: 'https://github.com/matrix-org/matrix-ios-sdk.git', branch: sdk_branch }
UI.message("✏️ Making a local copy of MatrixKit.podspec from the \`#{kit_branch}\` branch...")
podspec_content = Net::HTTP.get(URI("https://raw.githubusercontent.com/#{kit_slug}/#{kit_branch}/MatrixKit.podspec"))
UI.message "✏️ Editing local MatrixKit podspec to remove version constaint on 'MatrixSDK*' dependencies..."
podspec_content.gsub!(%r{(\.dependency\s+(['"])MatrixSDK(\/[^'"]+)?\2).*$}, '\1')
podspec_content.gsub!(%r{(\.source\s*=\s*).*$}, "\\1#{kit_spec}")
File.write('../MatrixKit.edited.podspec', podspec_content) # current dir is 'fastlane/' hence the '../'
UI.command_output("Content of MatrixKit.edited.podspec:\n" + podspec_content)
UI.message "✏️ Modify Podfile to point MatrixKit to local podspec and `MatrixSDK/*` to \`#{sdk_branch}\` branch..."
podfile_content = File.read('../Podfile') # current dir is 'fastlane/' hence the '../'
kit_spec = { podspec: 'MatrixKit.edited.podspec' }
sdk_spec = { git: 'https://github.com/matrix-org/matrix-ios-sdk.git', branch: sdk_branch }
podfile_content.gsub!(%r{^\$matrixKitVersion\s*=\s*.*$}, "$matrixKitVersion = { #{kit_spec} => #{sdk_spec} }")
podfile_content.gsub!(%r{^\$matrixKitVersion\s*=\s*.*$}, "$matrixKitVersion = { #{kit_podspec} => #{sdk_spec} }")
File.write('../Podfile', podfile_content)
UI.command_output("Content of modified Podfile:\n" + podfile_content)
end
# Find the latest branch with the given name pattern in the given repo