carthage_remote_cache 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.travis.yml +5 -0
- data/Gemfile.lock +41 -3
- data/Guardfile +6 -0
- data/README.md +58 -10
- data/Rakefile +8 -4
- data/bin/carthagerc +67 -62
- data/carthage_remote_cache.gemspec +20 -11
- data/lib/api.rb +37 -32
- data/lib/carthage_archive.rb +84 -77
- data/lib/carthage_dependency.rb +72 -48
- data/lib/carthage_remote_cache.rb +2 -0
- data/lib/commands/download_command.rb +66 -48
- data/lib/commands/init_command.rb +18 -20
- data/lib/commands/server_command.rb +11 -13
- data/lib/commands/upload_command.rb +58 -43
- data/lib/configuration.rb +78 -76
- data/lib/constants.rb +1 -1
- data/lib/errors.rb +8 -8
- data/lib/networking.rb +75 -77
- data/lib/server/server_app.rb +44 -44
- data/lib/shell_wrapper.rb +32 -0
- data/lib/utils.rb +49 -41
- data/lib/version.rb +1 -0
- data/lib/version_file.rb +71 -73
- metadata +77 -3
data/lib/carthage_archive.rb
CHANGED
@@ -1,81 +1,88 @@
|
|
1
1
|
class CarthageArchive
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
archived_paths = [framework_path, dsym_path] + bcsymbolmap_paths
|
35
|
-
|
36
|
-
$LOG.debug("Adding > #{archived_paths.inspect}")
|
37
|
-
|
38
|
-
delete_archive
|
39
|
-
sh("zip -r #{quote @archive_path} #{quote archived_paths}")
|
40
|
-
$LOG.debug("Created #{@archive_path} archive, file size: #{formatted_archive_size}")
|
41
|
-
end
|
42
|
-
|
43
|
-
def unpack_archive
|
44
|
-
raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
|
45
|
-
$LOG.debug("Unpacking #{@archive_path}, file size: #{formatted_archive_size}")
|
46
|
-
sh("unzip -o #{quote @archive_path}")
|
47
|
-
end
|
48
|
-
|
49
|
-
def delete_archive
|
50
|
-
File.delete(@archive_path) if File.exist?(@archive_path)
|
51
|
-
end
|
52
|
-
|
53
|
-
private
|
54
|
-
|
55
|
-
def find_bcsymbolmap_paths(platform_path, binary_path)
|
56
|
-
raw_dwarfdump = dwarfdump(binary_path)
|
57
|
-
uuids = parse_uuids(raw_dwarfdump)
|
58
|
-
bcsymbolmap_paths = uuids.map { |uuid| File.join(platform_path, "#{uuid}.bcsymbolmap") }.select { |path| File.exist?(path) }
|
59
|
-
bcsymbolmap_paths
|
60
|
-
end
|
61
|
-
|
62
|
-
def dwarfdump(binary_path)
|
63
|
-
sh("/usr/bin/xcrun dwarfdump --uuid \"#{binary_path}\"")
|
64
|
-
end
|
65
|
-
|
66
|
-
# Example dwarfdump link:
|
67
|
-
# UUID: 618BEB79-4C7F-3692-B140-131FB983AC5E (i386) Carthage/Build/iOS/CocoaLumberjackSwift.framework/CocoaLumberjackSwift
|
68
|
-
def parse_uuids(raw_dwarfdump)
|
69
|
-
lines = raw_dwarfdump.split("\n")
|
70
|
-
uuids = lines.map { |line| line[/^UUID: ([A-Z0-9\-]+)\s+\(.*$/, 1] }
|
71
|
-
uuids.compact
|
72
|
-
end
|
73
|
-
|
74
|
-
# E.g. "1.4MB"
|
75
|
-
def formatted_archive_size
|
76
|
-
size = File.size(@archive_path)
|
77
|
-
megabytes = size / 1024.0 / 1024.0
|
78
|
-
"#{megabytes.round(1)}MB"
|
2
|
+
attr_reader :archive_filename, :archive_path
|
3
|
+
|
4
|
+
def initialize(framework_name, platform)
|
5
|
+
raise AppError.new, "Platform #{platform.inspect} needs to be a symbol" unless platform.kind_of?(Symbol)
|
6
|
+
|
7
|
+
@framework_name = framework_name
|
8
|
+
@platform = platform
|
9
|
+
@archive_filename = "#{framework_name}-#{platform}.zip"
|
10
|
+
@archive_path = @archive_filename
|
11
|
+
end
|
12
|
+
|
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, should_include_dsym, 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
|
+
if should_include_dsym
|
29
|
+
raise AppError.new, "DSYM File #{dsym_path} not found"
|
30
|
+
else
|
31
|
+
$LOG.error("DSYM File #{dsym_path} not found, continuing")
|
32
|
+
dsym_path = nil
|
33
|
+
end
|
79
34
|
end
|
80
35
|
|
36
|
+
binary_path = File.join(framework_path, @framework_name)
|
37
|
+
raise AppError.new, "Binary #{binary_path} is missing, failed to read .bcsymbolmap files" unless File.exist?(binary_path)
|
38
|
+
|
39
|
+
bcsymbolmap_paths = find_bcsymbolmap_paths(shell, platform_path, binary_path)
|
40
|
+
|
41
|
+
input_paths = []
|
42
|
+
input_paths << framework_path
|
43
|
+
input_paths << dsym_path unless dsym_path.nil?
|
44
|
+
input_paths += bcsymbolmap_paths
|
45
|
+
|
46
|
+
$LOG.debug("Adding > #{input_paths.inspect}")
|
47
|
+
|
48
|
+
delete_archive
|
49
|
+
shell.archive(input_paths, @archive_path)
|
50
|
+
$LOG.debug("Created #{@archive_path} archive, file size: #{formatted_archive_size}")
|
51
|
+
end
|
52
|
+
|
53
|
+
def unpack_archive(shell)
|
54
|
+
raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
|
55
|
+
$LOG.debug("Unpacking #{@archive_path}, file size: #{formatted_archive_size}")
|
56
|
+
shell.unpack(@archive_path)
|
57
|
+
end
|
58
|
+
|
59
|
+
def delete_archive
|
60
|
+
File.delete(@archive_path) if File.exist?(@archive_path)
|
61
|
+
end
|
62
|
+
|
63
|
+
def archive_size
|
64
|
+
raise AppError.new, "Archive #{@archive_path} is missing" unless File.exist?(@archive_path)
|
65
|
+
File.size(@archive_path)
|
66
|
+
end
|
67
|
+
|
68
|
+
private
|
69
|
+
|
70
|
+
def find_bcsymbolmap_paths(shell, platform_path, binary_path)
|
71
|
+
raw_dwarfdump = shell.dwarfdump(binary_path)
|
72
|
+
uuids = parse_uuids(raw_dwarfdump)
|
73
|
+
bcsymbolmap_paths = uuids.map { |uuid| File.join(platform_path, "#{uuid}.bcsymbolmap") }.select { |path| File.exist?(path) }
|
74
|
+
bcsymbolmap_paths
|
75
|
+
end
|
76
|
+
|
77
|
+
# Example dwarfdump link:
|
78
|
+
# UUID: 618BEB79-4C7F-3692-B140-131FB983AC5E (i386) Carthage/Build/iOS/CocoaLumberjackSwift.framework/CocoaLumberjackSwift
|
79
|
+
def parse_uuids(raw_dwarfdump)
|
80
|
+
lines = raw_dwarfdump.split("\n")
|
81
|
+
uuids = lines.map { |line| line[/^UUID: ([A-Z0-9\-]+)\s+\(.*$/, 1] }
|
82
|
+
uuids.compact
|
83
|
+
end
|
84
|
+
|
85
|
+
def formatted_archive_size
|
86
|
+
format_file_size(archive_size)
|
87
|
+
end
|
81
88
|
end
|
data/lib/carthage_dependency.rb
CHANGED
@@ -1,65 +1,89 @@
|
|
1
|
+
# Representation of a Cartfile.resolved entry.
|
2
|
+
# @see https://github.com/Carthage/Carthage/blob/master/Documentation/Artifacts.md#origin
|
1
3
|
class CarthageDependency
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
end
|
15
|
-
end
|
4
|
+
class << self
|
5
|
+
# Parses Cartfile.resolved dependency entry, e.g.
|
6
|
+
# github "CocoaLumberjack/CocoaLumberjack" "3.2.1"
|
7
|
+
def parse_cartfile_resolved_line(line)
|
8
|
+
line.strip!
|
9
|
+
matches = line.match(/^(\w+)\s+\"([^\"]+)\"(\s+\"([^\"]+)\")$/)
|
10
|
+
return nil if matches.nil?
|
11
|
+
if matches.length == 5
|
12
|
+
CarthageDependency.new(origin: matches[1].to_sym, source: matches[2], version: matches[4])
|
13
|
+
else
|
14
|
+
nil
|
15
|
+
end
|
16
16
|
end
|
17
|
+
end
|
17
18
|
|
18
|
-
|
19
|
+
attr_reader :origin, :source, :version
|
19
20
|
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
@version = args[:version]
|
24
|
-
end
|
21
|
+
def initialize(args)
|
22
|
+
raise AppError.new, "Expected Symbol for origin '#{args[:origin]}'" unless args[:origin].kind_of? Symbol
|
23
|
+
raise AppError.new, "Unrecognized origin '#{args[:oriign]}'" unless [:github, :git, :binary].include?(args[:origin])
|
25
24
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
when "github"
|
31
|
-
repository.split("/").last
|
32
|
-
else
|
33
|
-
raise AppError.new, "Determining version_filename from #{@type} dependency is not yet supported"
|
34
|
-
end
|
35
|
-
end
|
25
|
+
@origin = args[:origin]
|
26
|
+
@source = args[:source]
|
27
|
+
@version = args[:version]
|
28
|
+
end
|
36
29
|
|
37
|
-
|
38
|
-
|
30
|
+
# Since one Cartfile.resolved entry may produce multiple differently named frameworks,
|
31
|
+
# this is an entry point to identifying a framework name.
|
32
|
+
def guessed_framework_basename
|
33
|
+
case @origin
|
34
|
+
when :github
|
35
|
+
@source.split("/").last
|
36
|
+
when :git
|
37
|
+
filename = @source.split("/").last
|
38
|
+
filename.chomp(".git")
|
39
|
+
when :binary
|
40
|
+
filename = @source.split("/").last
|
41
|
+
filename.chomp(".json")
|
42
|
+
else
|
43
|
+
raise AppError.new, "Unrecognized origin '#{@origin}'"
|
39
44
|
end
|
45
|
+
end
|
40
46
|
|
41
|
-
|
42
|
-
|
43
|
-
|
47
|
+
def version_filename
|
48
|
+
".#{guessed_framework_basename}.version"
|
49
|
+
end
|
50
|
+
|
51
|
+
def version_filepath
|
52
|
+
File.join(CARTHAGE_BUILD_DIR, version_filename)
|
53
|
+
end
|
44
54
|
|
45
|
-
|
46
|
-
|
55
|
+
def should_include_dsym
|
56
|
+
case @origin
|
57
|
+
when :github
|
58
|
+
true
|
59
|
+
when :git
|
60
|
+
true
|
61
|
+
when :binary
|
62
|
+
false
|
63
|
+
else
|
64
|
+
raise AppError.new, "Unrecognized origin '#{@origin}'"
|
47
65
|
end
|
66
|
+
end
|
48
67
|
|
49
|
-
|
50
|
-
|
68
|
+
def validate_version_file(version_file)
|
69
|
+
if @version != version_file.version
|
70
|
+
raise OutdatedFrameworkBuildError.new, version_validation_message(version_file)
|
51
71
|
end
|
72
|
+
end
|
52
73
|
|
53
|
-
|
74
|
+
def to_s
|
75
|
+
"#{@origin.to_s} \"#{@source}\" \"#{@version}\""
|
76
|
+
end
|
54
77
|
|
55
|
-
|
56
|
-
<<~EOS
|
57
|
-
Outdated version of '#{guessed_framework_basename}' framework detected:
|
58
|
-
Expected version '#{@version}'
|
59
|
-
Found version '#{version_file.version}'
|
78
|
+
private
|
60
79
|
|
61
|
-
|
62
|
-
|
63
|
-
|
80
|
+
def version_validation_message(version_file)
|
81
|
+
<<~EOS
|
82
|
+
Outdated version of '#{guessed_framework_basename}' framework detected:
|
83
|
+
Expected version '#{@version}'
|
84
|
+
Found version '#{version_file.version}'
|
64
85
|
|
86
|
+
Please run `carthage bootstrap` to build frameworks.
|
87
|
+
EOS
|
88
|
+
end
|
65
89
|
end
|
@@ -1,67 +1,85 @@
|
|
1
1
|
require 'concurrent'
|
2
2
|
|
3
3
|
class DownloadCommand
|
4
|
+
def self.new_with_defaults(options)
|
5
|
+
shell = ShellWrapper.new
|
6
|
+
config = Configuration.new(shell)
|
7
|
+
networking = Networking.new(config)
|
8
|
+
api = API.new(shell, networking, options)
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
10
|
+
DownloadCommand.new(
|
11
|
+
config: config,
|
12
|
+
networking: networking,
|
13
|
+
api: api,
|
14
|
+
)
|
15
|
+
end
|
16
|
+
|
17
|
+
def initialize(args)
|
18
|
+
@config = args[:config]
|
19
|
+
@networking = args[:networking]
|
20
|
+
@api = args[:api]
|
21
|
+
end
|
11
22
|
|
12
|
-
|
13
|
-
|
23
|
+
def run
|
24
|
+
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
14
25
|
|
15
|
-
|
16
|
-
|
17
|
-
|
26
|
+
@number_of_downloaded_archives = 0
|
27
|
+
@number_of_skipped_archives = 0
|
28
|
+
@total_archive_size = 0
|
29
|
+
errors = Concurrent::Array.new
|
18
30
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
end
|
26
|
-
end
|
31
|
+
for carthage_dependency in @config.carthage_dependencies
|
32
|
+
pool.post(carthage_dependency) do |carthage_dependency|
|
33
|
+
begin
|
34
|
+
download(carthage_dependency)
|
35
|
+
rescue => e
|
36
|
+
errors << e
|
27
37
|
end
|
38
|
+
end
|
39
|
+
end
|
28
40
|
|
29
|
-
|
30
|
-
|
41
|
+
pool.shutdown
|
42
|
+
pool.wait_for_termination
|
31
43
|
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
44
|
+
if errors.count > 0
|
45
|
+
raise MultipleErrorsError.new(errors)
|
46
|
+
else
|
47
|
+
puts "Downloaded and extracted #{@number_of_downloaded_archives} archives " +
|
48
|
+
"(#{format_file_size(@total_archive_size)}), " +
|
49
|
+
"skipped #{@number_of_skipped_archives} archives."
|
37
50
|
end
|
51
|
+
end
|
38
52
|
|
39
|
-
|
53
|
+
private
|
40
54
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
55
|
+
def download(carthage_dependency)
|
56
|
+
local_version_file =
|
57
|
+
if File.exist?(carthage_dependency.version_filepath)
|
58
|
+
VersionFile.new(carthage_dependency.version_filepath)
|
59
|
+
else
|
60
|
+
nil
|
61
|
+
end
|
47
62
|
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
63
|
+
if !local_version_file.nil? && @api.version_file_matches_server?(carthage_dependency, local_version_file)
|
64
|
+
$LOG.debug("Version file #{local_version_file.path} matches server version, skipping download")
|
65
|
+
@number_of_skipped_archives += local_version_file.number_of_frameworks
|
66
|
+
return
|
67
|
+
end
|
53
68
|
|
54
|
-
|
55
|
-
|
69
|
+
version_file = @networking.download_version_file(carthage_dependency)
|
70
|
+
raise AppError.new, "Version file #{carthage_dependency.version_filename} is not present on the server, please run `carthagerc upload` first" if version_file.nil?
|
56
71
|
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
72
|
+
version_file.frameworks_by_platform.each do |platform, framework_names|
|
73
|
+
for framework_name in framework_names
|
74
|
+
archive_size = @api.download_and_unpack_archive(carthage_dependency, framework_name, platform)
|
75
|
+
if archive_size.nil?
|
76
|
+
raise AppError.new, "Failed to download framework #{carthage_dependency} – #{framework_name} (#{platform}). Please `upload` the framework first."
|
77
|
+
else
|
78
|
+
@number_of_downloaded_archives += 1
|
79
|
+
@total_archive_size += archive_size
|
63
80
|
end
|
64
|
-
|
81
|
+
end
|
65
82
|
end
|
66
|
-
|
83
|
+
version_file.move_to_build_dir
|
84
|
+
end
|
67
85
|
end
|
@@ -1,26 +1,24 @@
|
|
1
1
|
class InitCommand
|
2
|
+
def initialize(options)
|
3
|
+
@options = options
|
4
|
+
end
|
2
5
|
|
3
|
-
|
4
|
-
|
6
|
+
def run
|
7
|
+
path = File.join(Dir.pwd, CARTRCFILE)
|
8
|
+
if File.exist?(path)
|
9
|
+
raise AppError.new, "File #{path} already exists"
|
10
|
+
else
|
11
|
+
File.write(path, file_contents)
|
5
12
|
end
|
13
|
+
end
|
6
14
|
|
7
|
-
|
8
|
-
path = File.join(Dir.pwd, CARTRCFILE)
|
9
|
-
if File.exist?(path)
|
10
|
-
raise AppError.new, "File #{path} already exists"
|
11
|
-
else
|
12
|
-
File.write(path, file_contents)
|
13
|
-
end
|
14
|
-
end
|
15
|
-
|
16
|
-
private
|
17
|
-
|
18
|
-
def file_contents
|
19
|
-
<<~EOS
|
20
|
-
Configuration.setup do |c|
|
21
|
-
c.server = "http://localhost:#{SERVER_DEFAULT_PORT}/"
|
22
|
-
end
|
23
|
-
EOS
|
24
|
-
end
|
15
|
+
private
|
25
16
|
|
17
|
+
def file_contents
|
18
|
+
<<~EOS
|
19
|
+
Configuration.setup do |c|
|
20
|
+
c.server = "http://localhost:#{SERVER_DEFAULT_PORT}/"
|
21
|
+
end
|
22
|
+
EOS
|
23
|
+
end
|
26
24
|
end
|
@@ -1,16 +1,14 @@
|
|
1
1
|
class ServerCommand
|
2
|
+
def initialize(options)
|
3
|
+
@options = options
|
4
|
+
end
|
2
5
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
Sinatra::Application,
|
12
|
-
:Port => @options[:server_port]
|
13
|
-
)
|
14
|
-
end
|
15
|
-
|
6
|
+
def run
|
7
|
+
ENV['RACK_ENV'] = 'production'
|
8
|
+
require 'server/server_app'
|
9
|
+
Rack::Handler::WEBrick.run(
|
10
|
+
Sinatra::Application,
|
11
|
+
:Port => @options[:server_port],
|
12
|
+
)
|
13
|
+
end
|
16
14
|
end
|
@@ -1,63 +1,78 @@
|
|
1
1
|
require 'concurrent'
|
2
2
|
|
3
3
|
class UploadCommand
|
4
|
+
def self.new_with_defaults(options)
|
5
|
+
shell = ShellWrapper.new
|
6
|
+
config = Configuration.new(shell)
|
7
|
+
networking = Networking.new(config)
|
8
|
+
api = API.new(shell, networking, options)
|
4
9
|
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
def run
|
12
|
-
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
10
|
+
UploadCommand.new(
|
11
|
+
config: config,
|
12
|
+
networking: networking,
|
13
|
+
api: api,
|
14
|
+
)
|
15
|
+
end
|
13
16
|
|
14
|
-
|
17
|
+
def initialize(args)
|
18
|
+
@config = args[:config]
|
19
|
+
@networking = args[:networking]
|
20
|
+
@api = args[:api]
|
21
|
+
end
|
15
22
|
|
16
|
-
|
17
|
-
|
18
|
-
errors = Concurrent::Array.new
|
23
|
+
def run
|
24
|
+
pool = Concurrent::FixedThreadPool.new(THREAD_POOL_SIZE)
|
19
25
|
|
20
|
-
|
21
|
-
pool.post(carthage_dependency) do |carthage_dependency|
|
22
|
-
begin
|
23
|
-
upload(carthage_dependency)
|
24
|
-
rescue => e
|
25
|
-
errors << e
|
26
|
-
end
|
27
|
-
end
|
28
|
-
end
|
26
|
+
$LOG.debug("Will upload frameworks: #{@config.all_framework_names}")
|
29
27
|
|
30
|
-
|
31
|
-
|
28
|
+
@number_of_uploaded_archives = 0
|
29
|
+
@number_of_skipped_archives = 0
|
30
|
+
@total_archive_size = 0
|
31
|
+
errors = Concurrent::Array.new
|
32
32
|
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
33
|
+
for carthage_dependency in @config.carthage_dependencies
|
34
|
+
pool.post(carthage_dependency) do |carthage_dependency|
|
35
|
+
begin
|
36
|
+
upload(carthage_dependency)
|
37
|
+
rescue => e
|
38
|
+
errors << e
|
37
39
|
end
|
40
|
+
end
|
38
41
|
end
|
39
42
|
|
40
|
-
|
43
|
+
pool.shutdown
|
44
|
+
pool.wait_for_termination
|
41
45
|
|
42
|
-
|
43
|
-
|
46
|
+
if errors.count > 0
|
47
|
+
raise MultipleErrorsError.new(errors)
|
48
|
+
else
|
49
|
+
puts "Uploaded #{@number_of_uploaded_archives} archives " +
|
50
|
+
"(#{format_file_size(@total_archive_size)}), " +
|
51
|
+
"skipped #{@number_of_skipped_archives}."
|
52
|
+
end
|
53
|
+
end
|
44
54
|
|
45
|
-
|
55
|
+
private
|
46
56
|
|
47
|
-
|
48
|
-
|
49
|
-
@number_of_skipped_archives += version_file.number_of_frameworks
|
50
|
-
return
|
51
|
-
end
|
57
|
+
def upload(carthage_dependency)
|
58
|
+
version_file = VersionFile.new(carthage_dependency.version_filepath)
|
52
59
|
|
53
|
-
|
60
|
+
carthage_dependency.validate_version_file(version_file)
|
54
61
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
end
|
60
|
-
end
|
62
|
+
if @api.version_file_matches_server?(carthage_dependency, version_file)
|
63
|
+
$LOG.debug("Version file #{version_file.path} matches server version, skipping upload")
|
64
|
+
@number_of_skipped_archives += version_file.number_of_frameworks
|
65
|
+
return
|
61
66
|
end
|
62
67
|
|
68
|
+
@networking.upload_version_file(carthage_dependency)
|
69
|
+
|
70
|
+
version_file.frameworks_by_platform.each do |platform, framework_names|
|
71
|
+
for framework_name in framework_names
|
72
|
+
archive_size = @api.create_and_upload_archive(carthage_dependency, framework_name, platform)
|
73
|
+
@number_of_uploaded_archives += 1
|
74
|
+
@total_archive_size += archive_size
|
75
|
+
end
|
76
|
+
end
|
77
|
+
end
|
63
78
|
end
|