Skip to content

Commit

Permalink
Use remote spec instead of a local one for Gutenberg via commit
Browse files Browse the repository at this point in the history
The idea was to use a local spec and interpolated the desired commit
SHA1 in the `source` to download the corresponding `tar.gz`.

However, CocoaPods has some issues with local specs that use `http`
`source`, as documented in:

- CocoaPods/CocoaPods#10288 (comment)
- https://github.com/firebase/firebase-ios-sdk/blob/68b39b8edf61f6e643e2396e712c7c67e0f146ff/scripts/pod_lib_lint.rb#L70-L78

Using a remote spec doesn't have the same issue, and the cost in terms
of extra computation and storage is negligible when compared to building
and hosting the `tar.gz` archives.
  • Loading branch information
mokagio committed Jun 5, 2023
1 parent f91c08e commit ec6fe5f
Show file tree
Hide file tree
Showing 4 changed files with 2 additions and 96 deletions.
4 changes: 0 additions & 4 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@ Metrics/MethodLength:
Max: 30
Exclude: *xfiles

Metrics/BlockLength:
Exclude: *.podspec

Layout/LineLength:
Max: 180
Exclude: *xfiles
Expand All @@ -40,4 +37,3 @@ Style/AsciiComments:
Naming/FileName:
Exclude:
- fastlane/Matchfile
- Gutenberg/Gutenberg.podspec
73 changes: 0 additions & 73 deletions Gutenberg/Gutenberg.podspec

This file was deleted.

11 changes: 2 additions & 9 deletions Gutenberg/cocoapods_helpers.rb
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ def gutenberg_pod(config: GUTENBERG_CONFIG)

gutenberg_dependencies(options: options)
elsif options[:commit]
# Notice the use of relative path, otherwise we'd get the full path of the user that run the `pod install` command tracked in Podfile.lock.
# Also notice the path is relative from Dir.pwd, that is, the location where the script running this code is invoked to avoid absolute paths making the checksum non determinstic.
pod 'Gutenberg', path: Pathname.new(File.join(__dir__, 'Gutenberg.podspec')).relative_path_from(Dir.pwd).to_s
pod 'Gutenberg', podspec: "https://d2twmm2nzpx3bg.cloudfront.net/Gutenberg-#{options[:commit]}.podspec"
end
end
# rubocop:enable Metrics/AbcSize
Expand All @@ -103,7 +101,7 @@ def gutenberg_dependencies(options:)
tag = options[:tag]
podspec_prefix = "https://raw.githubusercontent.com/#{GITHUB_ORG}/#{REPO_NAME}/#{tag}"
elsif options[:commit]
return # when referencing via a commit, we donwload pre-built frameworks
return # when referencing via a commit, we download pre-built frameworks
else
raise "Unexpected Gutenberg dependencies configuration '#{options}'"
end
Expand All @@ -118,8 +116,3 @@ def gutenberg_dependencies(options:)
pod pod_name, podspec: "#{podspec_prefix}/#{pod_name}.#{podspec_extension}"
end
end

def archive_url(commit:)
xcframework_storage_url = 'https://d2twmm2nzpx3bg.cloudfront.net'
"#{xcframework_storage_url}/Gutenberg-#{commit}.tar.gz"
end
10 changes: 0 additions & 10 deletions Gutenberg/version.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,3 @@

GITHUB_ORG = 'wordpress-mobile'
REPO_NAME = 'gutenberg-mobile'

# The root working directory for downloading and extracting archives.
# In this location because multiple sources access it.
#
# This path should be ignored by Git.
GUTENBERG_WORKING_DIRECTORY = File.join(__dir__, '.build')
# Where to download the XCFramework archives
GUTENBERG_DOWNLOADS_DIRECTORY = File.join(GUTENBERG_WORKING_DIRECTORY, 'donwloads')
# Where to extract the XCFramework archive version to use for the build.
GUTENBERG_ARCHIVE_DIRECTORY = File.join(GUTENBERG_WORKING_DIRECTORY, 'archive')

0 comments on commit ec6fe5f

Please sign in to comment.