carthage_remote_cache 0.0.8 → 0.0.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: b0378eb00151bc4e33a1ffc537c7cbb6bca23d24
4
- data.tar.gz: 3c8e29aea0bb379b562053fdcf5fb5a707451bae
2
+ SHA256:
3
+ metadata.gz: 3437fb2e13b47b5d1a5479e5d028b0e96447cc232bfa3a9b08e38e014a24bf2a
4
+ data.tar.gz: a84e8493195b8d80622ac63ec76eac05754f5917d12e634c432dcee1a5ff5558
5
5
  SHA512:
6
- metadata.gz: ea26a9202429da4c8a49b1a9080db44b60fb3f27baaa45c71821ef674cac4fbc5caea59a5ae19c728abbd256d26aa69a04de49e0a088708d90e5f58f3d2fffc3
7
- data.tar.gz: 42e74e05ac76e0836be06e92ade5d3aa91935a5315c877e2ba541ba3f1b1a7404d42a6aa9d1161a9d74aa034b4488e0f9561394800201a468694d29790aa01c3
6
+ metadata.gz: 5dae27cbc7028ba7ea772cabf04ff1dd750b2950e3c7e30a11e06c86ed202cfcd8b800263a2214d0475d80572007af5553c79844661d4f537fe6413004e9eed2
7
+ data.tar.gz: f04784fcf41b486a53d1706c0371ea10d3b27fe575ca9687204f9c000713fd58d199eaede9d7ca770ef7681432479b57346bf832d1b482cbb90b3dfe63815faf
@@ -0,0 +1,38 @@
1
+ # This workflow uses actions that are not certified by GitHub.
2
+ # They are provided by a third-party and are governed by
3
+ # separate terms of service, privacy policy, and support
4
+ # documentation.
5
+ # This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
6
+ # For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
7
+
8
+ name: Ruby
9
+
10
+ on:
11
+ push:
12
+ branches: [ "master" ]
13
+ pull_request:
14
+ branches: [ "master" ]
15
+
16
+ permissions:
17
+ contents: read
18
+
19
+ jobs:
20
+ test:
21
+
22
+ runs-on: ubuntu-latest
23
+ strategy:
24
+ matrix:
25
+ ruby-version: ['2.7.2']
26
+
27
+ steps:
28
+ - uses: actions/checkout@v3
29
+ - name: Set up Ruby
30
+ # To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
31
+ # change this to (see https://github.com/ruby/setup-ruby#versioning):
32
+ # uses: ruby/setup-ruby@v1
33
+ uses: ruby/setup-ruby@2b019609e2b0f1ea1a2bc8ca11cb82ab46ada124
34
+ with:
35
+ ruby-version: ${{ matrix.ruby-version }}
36
+ bundler-cache: true # runs 'bundle install' and caches installed gems automatically
37
+ - name: Run tests
38
+ run: bundle exec rake test
data/.ruby-version ADDED
@@ -0,0 +1,2 @@
1
+ 2.7.2
2
+
data/.travis.yml CHANGED
@@ -1,5 +1,5 @@
1
1
  language: ruby
2
2
  rvm:
3
- - 2.5.0
3
+ - 2.7.2
4
4
  script:
5
5
  - bundle exec rake test
data/Dockerfile ADDED
@@ -0,0 +1,7 @@
1
+ FROM ruby:2.7.1-alpine3.12
2
+
3
+ RUN apk add --no-cache g++ make
4
+ RUN gem install carthage_remote_cache
5
+
6
+ EXPOSE 9292
7
+ CMD ["carthagerc", "server"]
data/Gemfile.lock CHANGED
@@ -1,21 +1,21 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- carthage_remote_cache (0.0.8)
4
+ carthage_remote_cache (0.0.11)
5
5
  concurrent-ruby (~> 1.0.5)
6
- rack (~> 2.0.4)
6
+ rack (>= 2.0.6, < 2.3.0)
7
7
  rest-client (~> 2.0.2)
8
- sinatra (~> 2.0.1)
8
+ sinatra (>= 2.0.4, < 2.3.0)
9
9
 
10
10
  GEM
11
11
  remote: https://rubygems.org/
12
12
  specs:
13
- coderay (1.1.2)
13
+ coderay (1.1.3)
14
14
  concurrent-ruby (1.0.5)
15
- domain_name (0.5.20180417)
15
+ domain_name (0.5.20190701)
16
16
  unf (>= 0.0.5, < 1.0.0)
17
- ffi (1.9.21)
18
- formatador (0.2.5)
17
+ ffi (1.15.5)
18
+ formatador (1.1.0)
19
19
  guard (2.14.2)
20
20
  formatador (>= 0.2.4)
21
21
  listen (>= 2.7, < 4.0)
@@ -29,72 +29,72 @@ GEM
29
29
  guard-test (2.0.8)
30
30
  guard-compat (~> 1.2)
31
31
  test-unit (~> 3.0)
32
- http-cookie (1.0.3)
32
+ http-cookie (1.0.5)
33
33
  domain_name (~> 0.5)
34
- listen (3.1.5)
35
- rb-fsevent (~> 0.9, >= 0.9.4)
36
- rb-inotify (~> 0.9, >= 0.9.7)
37
- ruby_dep (~> 1.2)
38
- lumberjack (1.0.12)
34
+ listen (3.7.1)
35
+ rb-fsevent (~> 0.10, >= 0.10.3)
36
+ rb-inotify (~> 0.9, >= 0.9.10)
37
+ lumberjack (1.2.8)
39
38
  metaclass (0.0.4)
40
- method_source (0.9.0)
41
- mime-types (3.1)
39
+ method_source (1.0.0)
40
+ mime-types (3.4.1)
42
41
  mime-types-data (~> 3.2015)
43
- mime-types-data (3.2016.0521)
42
+ mime-types-data (3.2022.0105)
44
43
  mocha (1.3.0)
45
44
  metaclass (~> 0.0.1)
46
- mustermann (1.0.2)
45
+ mustermann (1.1.1)
46
+ ruby2_keywords (~> 0.0.1)
47
47
  nenv (0.3.0)
48
48
  netrc (0.11.0)
49
- notiffany (0.1.1)
49
+ notiffany (0.1.3)
50
50
  nenv (~> 0.1)
51
51
  shellany (~> 0.0)
52
- power_assert (1.1.1)
53
- pry (0.11.3)
54
- coderay (~> 1.1.0)
55
- method_source (~> 0.9.0)
56
- rack (2.0.5)
57
- rack-protection (2.0.1)
52
+ power_assert (2.0.1)
53
+ pry (0.14.1)
54
+ coderay (~> 1.1)
55
+ method_source (~> 1.0)
56
+ rack (2.2.4)
57
+ rack-protection (2.2.0)
58
58
  rack
59
- rake (10.5.0)
60
- rb-fsevent (0.10.2)
61
- rb-inotify (0.9.10)
62
- ffi (>= 0.5.0, < 2)
63
- rerun (0.13.0)
59
+ rake (13.0.6)
60
+ rb-fsevent (0.11.1)
61
+ rb-inotify (0.10.1)
62
+ ffi (~> 1.0)
63
+ rerun (0.13.1)
64
64
  listen (~> 3.0)
65
65
  rest-client (2.0.2)
66
66
  http-cookie (>= 1.0.2, < 2.0)
67
67
  mime-types (>= 1.16, < 4.0)
68
68
  netrc (~> 0.8)
69
- ruby_dep (1.5.0)
70
- rufo (0.2.0)
69
+ ruby2_keywords (0.0.5)
70
+ rufo (0.13.0)
71
71
  shellany (0.0.1)
72
- sinatra (2.0.1)
72
+ sinatra (2.2.0)
73
73
  mustermann (~> 1.0)
74
- rack (~> 2.0)
75
- rack-protection (= 2.0.1)
74
+ rack (~> 2.2)
75
+ rack-protection (= 2.2.0)
76
76
  tilt (~> 2.0)
77
- test-unit (3.2.7)
77
+ test-unit (3.2.9)
78
78
  power_assert
79
- thor (0.20.0)
80
- tilt (2.0.8)
79
+ thor (1.2.1)
80
+ tilt (2.0.10)
81
81
  unf (0.1.4)
82
82
  unf_ext
83
- unf_ext (0.0.7.5)
83
+ unf_ext (0.0.8.2)
84
84
 
85
85
  PLATFORMS
86
86
  ruby
87
87
 
88
88
  DEPENDENCIES
89
- bundler (~> 1.16)
89
+ bundler
90
90
  carthage_remote_cache!
91
91
  guard (~> 2.14.2)
92
92
  guard-test (~> 2.0.8)
93
93
  mocha (~> 1.3.0)
94
- rake (~> 10.0)
94
+ rake (~> 13.0)
95
95
  rerun
96
96
  rufo
97
97
  test-unit (~> 3.2.7)
98
98
 
99
99
  BUNDLED WITH
100
- 1.16.1
100
+ 2.2.11
data/Guardfile CHANGED
@@ -1,6 +1,6 @@
1
1
  guard :test do
2
2
  watch(%r{^test/.+_tests\.rb$})
3
- watch('test/test_helper.rb') { 'test' }
4
- watch('test/fixtures.rb') { 'test' }
3
+ watch("test/test_helper.rb") { "test" }
4
+ watch("test/fixtures.rb") { "test" }
5
5
  watch(%r{^lib/(.+)\.rb$}) { |m| "test/#{m[1]}_tests.rb" }
6
6
  end
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  # CarthageRemoteCache
2
2
 
3
- [![Build Status](https://travis-ci.org/kayak/carthage_remote_cache.svg?branch=master)](https://travis-ci.org/kayak/carthage_remote_cache)
3
+ [![Test Status](https://github.com/kayak/carthage_remote_cache/actions/workflows/ruby.yml/badge.svg)](https://github.com/kayak/carthage_remote_cache/actions/workflows/ruby.yml)
4
4
  [![Gem Version](https://badge.fury.io/rb/carthage_remote_cache.svg)](https://badge.fury.io/rb/carthage_remote_cache)
5
5
 
6
6
  Centralized cache to serve Carthage frameworks. Useful for distributed CI setup with several build machines. It's aware of your `xcodebuild` and `swift` versions and builds on top of Carthage's `.xyz.version` file mechanism.
@@ -68,22 +68,29 @@ It is recommended to always perform the upload workflow after upgrading Xcode an
68
68
 
69
69
  ### Download Workflow
70
70
 
71
- Once cache server has been populated with framework binaries, it's time to fetch frameworks from a different machine. Make sure to pull in `Cartrcfile` from respository before executing:
71
+ Once the cache server has been populated with framework binaries, it's time to fetch frameworks from a different machine. Make sure to pull in `Cartrcfile` from the repository before executing:
72
72
 
73
73
  $ carthagerc download
74
74
 
75
- You should expect to see following output on a machine with empty `Carthage` folder:
75
+ You should expect to see the following output on a machine with empty `Carthage` folder:
76
76
 
77
77
  Downloaded and extracted 53 archives (97.2 MB), skipped 0 archives.
78
78
 
79
79
  Your project should be ready for building.
80
80
 
81
- #### Overwriting Local Carthage Folder
81
+ #### Overwrite Local Carthage Folder
82
82
 
83
83
  In case you happen to change a file in `Carthage/Build` by accident, it's possible to force download all frameworks again with:
84
84
 
85
85
  $ carthagerc download --force
86
86
 
87
+ #### Download Only Some Platforms
88
+
89
+ The example above downloaded all frameworks for all platforms (iOS, macOS, tvOS, watchOS). If large dependencies or network speed are an issue, you can download only a subset of the platforms by using the `--platform` argument:
90
+
91
+ $ carthagerc download --platform iOS,macOS,tvOS,watchOS
92
+
93
+ Please note, that invoking the `download` command multiple times with different platform arguments is not supported. The `.version` file will "forget" that `carthagerc` already downloaded the platform specified before the last download. If you need multiple platforms, specify them in a single `download` command once, delimited with a comma.
87
94
 
88
95
  ### Config
89
96
 
@@ -205,6 +212,30 @@ If you want to stop the agent, run:
205
212
 
206
213
  Check out official documentation on [Launch Agents](https://developer.apple.com/library/content/documentation/MacOSX/Conceptual/BPSystemStartup/Chapters/CreatingLaunchdJobs.html) for more info.
207
214
 
215
+ #### Docker
216
+
217
+ To build an image based on the latest released gem, run
218
+
219
+ $ docker build -t carthagerc .
220
+
221
+ Afterwards you can run the image in a container using
222
+
223
+ $ docker run -d --publish 9292:9292 --name carthagerc carthagerc:latest
224
+
225
+ The server will now be available on port 9292 on `localhost`. Note that the command above will cause any data added to `~/.carthagerc_server` to be written into the container layer. While this works, it's generally discouraged due to decreased performance and portability. To avoid this, you can use a volume.
226
+
227
+ $ docker run -d --publish 9292:9292 --mount "source=carthagerc,target=/root/.carthagerc_server" --name carthagerc carthagerc:latest
228
+
229
+ We also recommend adding the `--log-opt` option to limit the size of logs, e.g. `--log-opt max-size=50m`.
230
+
231
+ To inspect the logs after running, use
232
+
233
+ $ docker logs carthagerc
234
+
235
+ To stop the container, run
236
+
237
+ $ docker container stop carthagerc
238
+
208
239
  ### Version
209
240
 
210
241
  $ carthagerc version
@@ -221,7 +252,7 @@ Documentation is also available when running `carthagerc` or `carthagerc --help`
221
252
  config
222
253
  print environment information and Cartrcfile configuration
223
254
 
224
- download [-f|--force] [-v|--verbose]
255
+ download [-f|--force] [-v|--verbose] [-mPLATFORM|--platform=PLATFORM]
225
256
  fetch missing frameworks into Carthage/Build
226
257
 
227
258
  init
@@ -242,6 +273,8 @@ Documentation is also available when running `carthagerc` or `carthagerc --help`
242
273
  OPTIONS
243
274
  -f, --force Force upload/download of framework archives even if local and server .version files match
244
275
  -h, --help Show help
276
+ -m, --platform=PLATFORM Comma delimited list of platforms which should be downloaded from the server; e.g. `--platform iOS,macOS`; Supported values: iOS, macOS, tvOS, watchOS
277
+ -n, --no-retry Don't retry download or upload on network failures
245
278
  -p, --port=PORT Server application port used when starting server, default port is 9292
246
279
  -v, --verbose Show extra runtime information
247
280
 
data/Rakefile CHANGED
@@ -5,10 +5,10 @@ task :default => :spec
5
5
 
6
6
  Rake::TestTask.new do |t|
7
7
  t.libs << "test"
8
- t.test_files = FileList['test/*_tests.rb']
8
+ t.test_files = FileList["test/*_tests.rb"]
9
9
  t.verbose = true
10
10
  end
11
11
 
12
12
  task :format do
13
- system('rufo bin/carthagerc lib test Gemfile Guardfile Rakefile carthage_remote_cache.gemspec')
13
+ system("bundle exec rufo bin/carthagerc lib test Gemfile Guardfile Rakefile carthage_remote_cache.gemspec")
14
14
  end
data/bin/carthagerc CHANGED
@@ -2,13 +2,15 @@
2
2
 
3
3
  $LOAD_PATH.push File.expand_path("../../lib", __FILE__)
4
4
 
5
- require 'optparse'
6
- require 'carthage_remote_cache'
7
- require 'commands'
5
+ require "optparse"
6
+ require "carthage_remote_cache"
7
+ require "commands"
8
8
 
9
- ARGV << '-h' if ARGV.empty?
9
+ ARGV << "-h" if ARGV.empty?
10
+ command = ARGV[0]
10
11
  options = {
11
12
  :force => false,
13
+ :is_retry_enabled => true,
12
14
  :server_port => SERVER_DEFAULT_PORT,
13
15
  :verbose => false,
14
16
  }
@@ -30,7 +32,7 @@ opt_parser = OptionParser.new do |opt|
30
32
  opt.separator " config"
31
33
  opt.separator " print environment information and #{CARTRCFILE} configuration"
32
34
  opt.separator ""
33
- opt.separator " download [-f|--force] [-v|--verbose]"
35
+ opt.separator " download [-f|--force] [-v|--verbose] [-mPLATFORM|--platform=PLATFORM]"
34
36
  opt.separator " fetch missing frameworks into Carthage/Build"
35
37
  opt.separator ""
36
38
  opt.separator " init"
@@ -59,6 +61,15 @@ opt_parser = OptionParser.new do |opt|
59
61
  exit
60
62
  end
61
63
 
64
+ opt.on("-m", "--platform=PLATFORM", "Comma delimited list of platforms which should be downloaded from the server; e.g. `--platform iOS,macOS`; Supported values: #{PLATFORMS.map(&:to_s).join(", ")}") do |platform|
65
+ raise AppError.new("[-p|--platform] is only supported for the 'download' command") if command != "download"
66
+ options[:platforms] = platform_to_symbols(platform)
67
+ end
68
+
69
+ opt.on("-n", "--no-retry", "Don't retry download or upload on network failures") do
70
+ options[:is_retry_enabled] = false
71
+ end
72
+
62
73
  opt.on("-pPORT", "--port=PORT", "Server application port used when starting server, default port is #{SERVER_DEFAULT_PORT}") do |port|
63
74
  options[:server_port] = port
64
75
  end
@@ -68,10 +79,9 @@ opt_parser = OptionParser.new do |opt|
68
79
  end
69
80
  end
70
81
 
71
- opt_parser.parse!
72
-
73
82
  begin
74
- command = ARGV[0]
83
+ opt_parser.parse!
84
+
75
85
  case command
76
86
  when "config"
77
87
  puts Configuration.new_with_defaults
@@ -20,17 +20,17 @@ Gem::Specification.new do |spec|
20
20
  spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
21
21
  spec.require_paths = ["lib"]
22
22
 
23
- spec.add_development_dependency "bundler", "~> 1.16"
23
+ spec.add_development_dependency "bundler"
24
24
  spec.add_development_dependency "guard", "~> 2.14.2"
25
25
  spec.add_development_dependency "guard-test", "~> 2.0.8"
26
26
  spec.add_development_dependency "mocha", "~> 1.3.0"
27
- spec.add_development_dependency "rake", "~> 10.0"
27
+ spec.add_development_dependency "rake", "~> 13.0"
28
28
  spec.add_development_dependency "rerun"
29
29
  spec.add_development_dependency "rufo"
30
30
  spec.add_development_dependency "test-unit", "~> 3.2.7"
31
31
 
32
32
  spec.add_runtime_dependency "concurrent-ruby", "~> 1.0.5"
33
- spec.add_runtime_dependency "rack", "~> 2.0.4"
33
+ spec.add_runtime_dependency "rack", ">= 2.0.6", "< 2.3.0"
34
34
  spec.add_runtime_dependency "rest-client", "~> 2.0.2"
35
- spec.add_runtime_dependency "sinatra", "~> 2.0.1"
35
+ spec.add_runtime_dependency "sinatra", ">= 2.0.4", "< 2.3.0"
36
36
  end
data/dev/start_server CHANGED
@@ -3,6 +3,6 @@
3
3
  DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
4
4
  pushd "$DIR/../lib/server"
5
5
 
6
- rerun --no-notify rackup
6
+ bundle exec rerun --no-notify rackup
7
7
 
8
8
  popd
data/lib/api.rb CHANGED
@@ -23,7 +23,7 @@ class API
23
23
  rescue VersionFileDoesNotExistError => e
24
24
  errors << OutdatedFrameworkBuildError.new(
25
25
  carthage_dependency.guessed_framework_basename,
26
- '-',
26
+ "-",
27
27
  carthage_dependency.version
28
28
  )
29
29
  rescue OutdatedFrameworkBuildError => e
@@ -35,11 +35,11 @@ class API
35
35
  end
36
36
  end
37
37
 
38
- def version_file_matches_server?(carthage_dependency, version_file)
38
+ def version_file_matches_server?(carthage_dependency, version_file, platforms)
39
39
  if @options[:force]
40
40
  false
41
41
  else
42
- server_version_file = @networking.download_version_file(carthage_dependency)
42
+ server_version_file = @networking.download_version_file(carthage_dependency, platforms)
43
43
  result = version_file.same_content?(server_version_file)
44
44
  server_version_file.remove unless server_version_file.nil?
45
45
  result
@@ -47,13 +47,13 @@ class API
47
47
  end
48
48
 
49
49
  # @return zip archive size in Bytes
50
- def create_and_upload_archive(carthage_dependency, framework_name, platform)
51
- archive = CarthageArchive.new(framework_name, platform)
52
- archive.create_archive(@shell)
50
+ def create_and_upload_archive(carthage_dependency, framework, platform)
51
+ archive = framework.make_archive(platform)
52
+ archive.compress_archive(@shell)
53
53
  archive_size = archive.archive_size
54
54
  begin
55
55
  checksum = crc32(archive.archive_path)
56
- @networking.upload_framework_archive(archive.archive_path, carthage_dependency, framework_name, platform, checksum)
56
+ @networking.upload_framework_archive(archive.archive_path, carthage_dependency, framework.name, platform, checksum)
57
57
  ensure
58
58
  archive.delete_archive
59
59
  end
@@ -62,10 +62,10 @@ class API
62
62
 
63
63
  # @return zip archive size in Bytes
64
64
  # @raise AppError if download or checksum validation fails
65
- def download_and_unpack_archive(carthage_dependency, framework_name, platform)
66
- result = @networking.download_framework_archive(carthage_dependency, framework_name, platform)
65
+ def download_and_unpack_archive(carthage_dependency, framework, platform)
66
+ result = @networking.download_framework_archive(carthage_dependency, framework, platform)
67
67
  if result.nil?
68
- raise AppError.new, "Failed to download framework #{carthage_dependency} – #{framework_name} (#{platform}). Please `upload` the framework first."
68
+ raise AppError.new, "Failed to download framework #{carthage_dependency} – #{framework.name} (#{platform}). Please `upload` the framework first."
69
69
  end
70
70
 
71
71
  archive = result[:archive]
@@ -1,3 +1,5 @@
1
+ require "fileutils"
2
+
1
3
  class CarthageArchive
2
4
  attr_reader :archive_filename, :archive_path
3
5
 
@@ -10,44 +12,11 @@ class CarthageArchive
10
12
  @archive_path = @archive_filename
11
13
  end
12
14
 
13
- # Aggregate following files:
14
- # - Carthage/Build/iOS/Alamofire.framework
15
- # - Carthage/Build/iOS/Alamofire.framework/Alamofire
16
- # - Carthage/Build/iOS/618BEB79-4C7F-3692-B140-131FB983AC5E.bcsymbolmap
17
- # into Alamofire-iOS.zip
18
- def create_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR)
19
- $LOG.debug("Archiving #{@framework_name} for #{@platform}")
20
-
21
- platform_path = File.join(carthage_build_dir, platform_to_carthage_dir_string(@platform))
22
- framework_path = File.join(platform_path, "#{@framework_name}.framework")
23
- raise MissingFrameworkDirectoryError.new, "Archive can't be created, no framework directory at #{framework_path}" unless Dir.exist?(framework_path)
24
-
25
- # It's very likely, that binary releases don't contain DSYMs.
26
- dsym_path = File.join(platform_path, "#{@framework_name}.framework.dSYM")
27
- unless File.exist?(dsym_path)
28
- $LOG.error("DSYM File #{dsym_path} not found, continuing")
29
- dsym_path = nil
30
- end
31
-
32
- binary_path = File.join(framework_path, @framework_name)
33
- raise AppError.new, "Binary #{binary_path} is missing, failed to read .bcsymbolmap files" unless File.exist?(binary_path)
34
-
35
- bcsymbolmap_paths = find_bcsymbolmap_paths(shell, platform_path, binary_path)
36
-
37
- input_paths = []
38
- input_paths << framework_path
39
- input_paths << dsym_path unless dsym_path.nil?
40
- input_paths += bcsymbolmap_paths
41
-
42
- $LOG.debug("Adding > #{input_paths.inspect}")
15
+ def unpack_archive(shell, carthage_build_dir = CARTHAGE_BUILD_DIR)
16
+ raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
43
17
 
44
- delete_archive
45
- shell.archive(input_paths, @archive_path)
46
- $LOG.debug("Created #{@archive_path} archive, file size: #{formatted_archive_size}")
47
- end
18
+ delete_existing_build_framework_if_exists(carthage_build_dir)
48
19
 
49
- def unpack_archive(shell)
50
- raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
51
20
  $LOG.debug("Unpacking #{@archive_path}, file size: #{formatted_archive_size}")
52
21
  shell.unpack(@archive_path)
53
22
  end
@@ -63,22 +32,15 @@ class CarthageArchive
63
32
 
64
33
  private
65
34
 
66
- def find_bcsymbolmap_paths(shell, platform_path, binary_path)
67
- raw_dwarfdump = shell.dwarfdump(binary_path)
68
- uuids = parse_uuids(raw_dwarfdump)
69
- bcsymbolmap_paths = uuids.map { |uuid| File.join(platform_path, "#{uuid}.bcsymbolmap") }.select { |path| File.exist?(path) }
70
- bcsymbolmap_paths
71
- end
72
-
73
- # Example dwarfdump link:
74
- # UUID: 618BEB79-4C7F-3692-B140-131FB983AC5E (i386) Carthage/Build/iOS/CocoaLumberjackSwift.framework/CocoaLumberjackSwift
75
- def parse_uuids(raw_dwarfdump)
76
- lines = raw_dwarfdump.split("\n")
77
- uuids = lines.map { |line| line[/^UUID: ([A-Z0-9\-]+)\s+\(.*$/, 1] }
78
- uuids.compact
79
- end
80
-
81
35
  def formatted_archive_size
82
36
  format_file_size(archive_size)
83
37
  end
38
+
39
+ def delete_existing_build_framework_if_exists(carthage_build_dir)
40
+ framework_path = File.join(carthage_build_dir, "#{@framework_name}.xcframework")
41
+ if File.exist?(framework_path)
42
+ $LOG.debug("Deleting #{framework_path}")
43
+ FileUtils.rm_rf(framework_path)
44
+ end
45
+ end
84
46
  end
@@ -1,17 +1,21 @@
1
1
  lib = File.expand_path("..", __FILE__)
2
2
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
- require 'api'
5
- require 'carthage_archive'
6
- require 'carthage_dependency'
7
- require 'constants'
8
- require 'configuration'
9
- require 'crc32'
10
- require 'errors'
11
- require 'log'
12
- require 'networking'
13
- require 'shell_wrapper'
14
- require 'table'
15
- require 'utils'
16
- require 'version'
17
- require 'version_file'
4
+ require "api"
5
+ require "carthage_archive"
6
+ require "framework_carthage_archive"
7
+ require "xcframework_carthage_archive"
8
+ require "framework"
9
+ require "xcframework"
10
+ require "carthage_dependency"
11
+ require "constants"
12
+ require "configuration"
13
+ require "crc32"
14
+ require "errors"
15
+ require "log"
16
+ require "networking"
17
+ require "shell_wrapper"
18
+ require "table"
19
+ require "utils"
20
+ require "version"
21
+ require "version_file"
@@ -1,16 +1,17 @@
1
- require 'concurrent'
1
+ require "concurrent"
2
2
 
3
3
  class DownloadCommand
4
4
  def self.new_with_defaults(options)
5
5
  shell = ShellWrapper.new
6
6
  config = Configuration.new(shell)
7
- networking = Networking.new(config)
7
+ networking = Networking.new(config, options[:is_retry_enabled])
8
8
  api = API.new(shell, config, networking, options)
9
9
 
10
10
  DownloadCommand.new(
11
11
  config: config,
12
12
  networking: networking,
13
13
  api: api,
14
+ platforms: options[:platforms],
14
15
  )
15
16
  end
16
17
 
@@ -18,6 +19,7 @@ class DownloadCommand
18
19
  @config = args[:config]
19
20
  @networking = args[:networking]
20
21
  @api = args[:api]
22
+ @platforms = args[:platforms]
21
23
  end
22
24
 
23
25
  def run
@@ -57,14 +59,13 @@ class DownloadCommand
57
59
  private
58
60
 
59
61
  def download(carthage_dependency)
60
- local_version_file =
61
- if File.exist?(carthage_dependency.version_filepath)
62
+ local_version_file = if File.exist?(carthage_dependency.version_filepath)
62
63
  carthage_dependency.new_version_file
63
64
  else
64
65
  nil
65
66
  end
66
67
 
67
- if !local_version_file.nil? && @api.version_file_matches_server?(carthage_dependency, local_version_file)
68
+ if !local_version_file.nil? && @api.version_file_matches_server?(carthage_dependency, local_version_file, @platforms)
68
69
  $LOG.debug("Version file #{local_version_file.path} matches server version, skipping download")
69
70
  @mutex.synchronize do
70
71
  @number_of_skipped_archives += local_version_file.number_of_frameworks
@@ -72,12 +73,12 @@ class DownloadCommand
72
73
  return
73
74
  end
74
75
 
75
- version_file = @networking.download_version_file(carthage_dependency)
76
+ version_file = @networking.download_version_file(carthage_dependency, @platforms)
76
77
  raise AppError.new, "Version file #{carthage_dependency.version_filename} is not present on the server, please run `carthagerc upload` first" if version_file.nil?
77
78
 
78
- version_file.frameworks_by_platform.each do |platform, framework_names|
79
- for framework_name in framework_names
80
- archive_size = @api.download_and_unpack_archive(carthage_dependency, framework_name, platform)
79
+ version_file.frameworks_by_platform.each do |platform, frameworks|
80
+ for framework in frameworks
81
+ archive_size = @api.download_and_unpack_archive(carthage_dependency, framework, platform)
81
82
  @mutex.synchronize do
82
83
  @number_of_downloaded_archives += 1
83
84
  @total_archive_size += archive_size
@@ -4,8 +4,8 @@ class ServerCommand
4
4
  end
5
5
 
6
6
  def run
7
- ENV['RACK_ENV'] = 'production'
8
- require 'server/server_app'
7
+ ENV["RACK_ENV"] = "production"
8
+ require "server/server_app"
9
9
  Rack::Handler::WEBrick.run(
10
10
  Sinatra::Application,
11
11
  :Port => @options[:server_port],