cocoapods-binary-cache 0.1.6 → 0.1.7
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/cocoapods-binary-cache/cache/validator.rb +1 -1
- data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +1 -1
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +4 -2
- data/lib/cocoapods-binary-cache/env.rb +1 -1
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +1 -1
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +4 -4
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +41 -50
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +14 -14
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -64
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +1 -1
- data/lib/cocoapods-binary-cache/scheme_editor.rb +1 -1
- data/lib/command/binary.rb +20 -1
- data/lib/command/config.rb +148 -7
- data/lib/command/executor/fetcher.rb +3 -3
- data/lib/command/fetch.rb +0 -1
- data/lib/command/prebuild.rb +10 -6
- data/lib/command/push.rb +0 -1
- metadata +4 -4
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: e068bdcb9e91a8e599e3ad1732837a1a7dbd49a4409e05b97b1cdc476bfb76a7
|
4
|
+
data.tar.gz: 21d3e3fa0374a8818efa927bb822ce9386e43e18ec26a1ab5be7d8b481a688d6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f5588698b1d818071b2bfb568bcbd44bc1e02084f7caf0b4b554a50277f2064209ec527339de4c8166ab74ff358b0a173f149b5db67f33a808c8d562f8d02625
|
7
|
+
data.tar.gz: dd21d19ff94f2a8dcf3b4b1dd7372484993e0aba4705512fde75be14e66d72ddadc592fc88b9ea81ae3983f156e5fe251e4dbcfe8047f7904db1b0fd3cf0cbcf
|
@@ -5,7 +5,7 @@ module PodPrebuild
|
|
5
5
|
PodPrebuild::PodfileChangesCacheValidator.new(options),
|
6
6
|
PodPrebuild::NonDevPodsCacheValidator.new(options)
|
7
7
|
]
|
8
|
-
@validators << PodPrebuild::DevPodsCacheValidator.new(options) if
|
8
|
+
@validators << PodPrebuild::DevPodsCacheValidator.new(options) if PodPrebuild.config.dev_pods_enabled?
|
9
9
|
@validators << PodPrebuild::DependenciesGraphCacheValidator.new(options)
|
10
10
|
@validators << PodPrebuild::ExclusionCacheValidator.new(options)
|
11
11
|
end
|
@@ -10,7 +10,7 @@ module PodPrebuild
|
|
10
10
|
|
11
11
|
dependencies_graph = DependenciesGraph.new(@pod_lockfile.lockfile)
|
12
12
|
clients = dependencies_graph.get_clients(accumulated.discard(@ignored_pods).missed.to_a)
|
13
|
-
unless
|
13
|
+
unless PodPrebuild.config.dev_pods_enabled?
|
14
14
|
clients = clients.reject { |client| @pod_lockfile.dev_pods.keys.include?(client) }
|
15
15
|
end
|
16
16
|
|
@@ -3,14 +3,16 @@ require_relative "base"
|
|
3
3
|
module PodPrebuild
|
4
4
|
class IntegrationDiagnosis < BaseDiagnosis
|
5
5
|
def run
|
6
|
-
should_be_integrated = if
|
6
|
+
should_be_integrated = if PodPrebuild.config.prebuild_job? \
|
7
7
|
then @cache_validation.hit + @cache_validation.missed \
|
8
8
|
else @cache_validation.hit \
|
9
9
|
end
|
10
10
|
should_be_integrated = should_be_integrated.map { |name| name.split("/")[0] }.to_set
|
11
11
|
unintegrated = should_be_integrated.reject do |name|
|
12
12
|
module_name = spec(name)&.module_name || name
|
13
|
-
framework_path =
|
13
|
+
framework_path = \
|
14
|
+
@standard_sandbox.pod_dir(name) + \
|
15
|
+
PodPrebuild.config.prebuilt_path(path: "#{module_name}.framework")
|
14
16
|
framework_path.exist?
|
15
17
|
end
|
16
18
|
Pod::UI.puts "🚩 Unintegrated frameworks: #{unintegrated}".yellow unless unintegrated.empty?
|
@@ -22,7 +22,7 @@ module PodPrebuild
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def edit_scheme_for_code_coverage
|
25
|
-
return unless
|
25
|
+
return unless PodPrebuild.config.dev_pods_enabled? && @installer_context.sandbox.instance_of?(Pod::PrebuildSandbox)
|
26
26
|
|
27
27
|
# Modify pods scheme to support code coverage
|
28
28
|
# If we don't prebuild dev pod -> no need to care about this in Pod project
|
@@ -24,7 +24,7 @@ module PodPrebuild
|
|
24
24
|
create_prebuild_sandbox
|
25
25
|
Pod::UI.section("Detect implicit dependencies") { detect_implicit_dependencies }
|
26
26
|
Pod::UI.section("Validate prebuilt cache") { validate_cache }
|
27
|
-
prebuild! if
|
27
|
+
prebuild! if PodPrebuild.config.prebuild_job?
|
28
28
|
Pod::UI.section("Reset environment") { reset_environment }
|
29
29
|
|
30
30
|
PodPrebuild::Env.next_stage!
|
@@ -72,7 +72,7 @@ module PodPrebuild
|
|
72
72
|
# Note: DSL is reloaded when creating an installer (Pod::Installer.new).
|
73
73
|
# Any mutation to DSL is highly discouraged
|
74
74
|
# --> Rather, perform mutation on PodPrebuild::StateStore instead
|
75
|
-
PodPrebuild::StateStore.excluded_pods +=
|
75
|
+
PodPrebuild::StateStore.excluded_pods += PodPrebuild.config.excluded_pods
|
76
76
|
end
|
77
77
|
|
78
78
|
def create_prebuild_sandbox
|
@@ -101,13 +101,13 @@ module PodPrebuild
|
|
101
101
|
podfile: podfile,
|
102
102
|
pod_lockfile: installer_context.lockfile,
|
103
103
|
prebuilt_lockfile: prebuilt_lockfile,
|
104
|
-
validate_prebuilt_settings:
|
104
|
+
validate_prebuilt_settings: PodPrebuild.config.validate_prebuilt_settings,
|
105
105
|
generated_framework_path: prebuild_sandbox.generate_framework_path,
|
106
106
|
sandbox_root: prebuild_sandbox.root,
|
107
107
|
ignored_pods: PodPrebuild::StateStore.excluded_pods,
|
108
108
|
prebuilt_pod_names: @original_installer.prebuilt_pod_names
|
109
109
|
).validate
|
110
|
-
path_to_save_cache_validation =
|
110
|
+
path_to_save_cache_validation = PodPrebuild.config.save_cache_validation_to
|
111
111
|
@cache_validation.update_to(path_to_save_cache_validation) unless path_to_save_cache_validation.nil?
|
112
112
|
cache_validation.print_summary
|
113
113
|
PodPrebuild::StateStore.cache_validation = cache_validation
|
@@ -17,7 +17,7 @@ module Pod
|
|
17
17
|
targets = pod_targets.select { |target| explicit_prebuilt_pod_names.include?(target.pod_name) }
|
18
18
|
dependencies = targets.flat_map(&:recursive_dependent_targets) # Treat dependencies as prebuilt pods
|
19
19
|
all = (targets + dependencies).uniq
|
20
|
-
all = all.reject { |target| sandbox.local?(target.pod_name) } unless
|
20
|
+
all = all.reject { |target| sandbox.local?(target.pod_name) } unless PodPrebuild.config.dev_pods_enabled?
|
21
21
|
all
|
22
22
|
end
|
23
23
|
end
|
@@ -4,7 +4,7 @@ module Pod
|
|
4
4
|
class PrebuildSandbox < Sandbox
|
5
5
|
# [String] standard_sandbox_path
|
6
6
|
def self.from_standard_sanbox_path(path)
|
7
|
-
prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild
|
7
|
+
prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild.config.prebuild_sandbox_path
|
8
8
|
self.new(prebuild_sandbox_path)
|
9
9
|
end
|
10
10
|
|
@@ -15,6 +15,7 @@ module Pod
|
|
15
15
|
# as to compitable with older version and be less wordy.
|
16
16
|
framework_file_path = target.framework_name
|
17
17
|
framework_file_path = target.name + "/" + framework_file_path if targets.count > 1
|
18
|
+
framework_file_path = PodPrebuild.config.prebuilt_path(path: framework_file_path)
|
18
19
|
add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
|
19
20
|
end
|
20
21
|
|
@@ -61,7 +62,9 @@ module Pod
|
|
61
62
|
attributes["resource_bundles"] = nil
|
62
63
|
attributes["resources"] ||= []
|
63
64
|
attributes["resources"] = [attributes["resources"]] if attributes["resources"].is_a?(String)
|
64
|
-
attributes["resources"] += resource_bundle_names.map
|
65
|
+
attributes["resources"] += resource_bundle_names.map do |name|
|
66
|
+
PodPrebuild.config.prebuilt_path(path: "#{name}.bundle")
|
67
|
+
end
|
65
68
|
end
|
66
69
|
|
67
70
|
add_resource_bundles_to_resources.call(spec.attributes_hash)
|
@@ -17,13 +17,13 @@ module Pod
|
|
17
17
|
end
|
18
18
|
|
19
19
|
def should_integrate_prebuilt_pod?(name)
|
20
|
-
if
|
20
|
+
if PodPrebuild.config.prebuild_job? && PodPrebuild.config.targets_to_prebuild_from_cli.empty?
|
21
21
|
# In a prebuild job, at the integration stage, all prebuilt frameworks should be
|
22
22
|
# ready for integration regardless of whether there was any cache miss or not.
|
23
23
|
# Those that are missed were prebuilt in the prebuild stage.
|
24
24
|
PodPrebuild::StateStore.cache_validation.include?(name)
|
25
25
|
else
|
26
|
-
prebuilt = PodPrebuild::StateStore.cache_validation.hit +
|
26
|
+
prebuilt = PodPrebuild::StateStore.cache_validation.hit + PodPrebuild.config.targets_to_prebuild_from_cli
|
27
27
|
prebuilt.include?(name)
|
28
28
|
end
|
29
29
|
end
|
@@ -11,70 +11,34 @@ module Pod
|
|
11
11
|
class Installer
|
12
12
|
class PodSourceInstaller
|
13
13
|
def install_for_prebuild!(standard_sanbox)
|
14
|
-
return if !
|
14
|
+
return if !PodPrebuild.config.dev_pods_enabled? && standard_sanbox.local?(name)
|
15
15
|
|
16
16
|
# make a symlink to target folder
|
17
17
|
# TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
|
18
18
|
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
19
19
|
# if spec used in multiple platforms, it may return multiple paths
|
20
|
-
target_names = prebuild_sandbox.existed_target_names_for_pod_name(
|
21
|
-
|
22
|
-
def walk(path, &action)
|
23
|
-
return unless path.exist?
|
24
|
-
path.children.each do |child|
|
25
|
-
result = action.call(child, &action)
|
26
|
-
if child.directory?
|
27
|
-
walk(child, &action) if result
|
28
|
-
end
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def make_link(source, target)
|
33
|
-
source = Pathname.new(source)
|
34
|
-
target = Pathname.new(target)
|
35
|
-
target.parent.mkpath unless target.parent.exist?
|
36
|
-
relative_source = source.relative_path_from(target.parent)
|
37
|
-
FileUtils.ln_sf(relative_source, target)
|
38
|
-
end
|
39
|
-
|
40
|
-
def mirror_with_symlink(source, basefolder, target_folder)
|
41
|
-
target = target_folder + source.relative_path_from(basefolder)
|
42
|
-
make_link(source, target)
|
43
|
-
end
|
44
|
-
|
20
|
+
target_names = prebuild_sandbox.existed_target_names_for_pod_name(name)
|
45
21
|
target_names.each do |name|
|
46
|
-
|
47
|
-
# symbol link copy all substructure
|
48
22
|
real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
|
49
23
|
|
50
24
|
# If have only one platform, just place int the root folder of this pod.
|
51
25
|
# If have multiple paths, we use a sperated folder to store different
|
52
26
|
# platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
|
53
|
-
|
54
27
|
target_folder = standard_sanbox.pod_dir(self.name)
|
55
|
-
if target_names.count > 1
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
if !standard_sanbox.local?(name)
|
60
|
-
target_folder.rmtree if target_folder.exist?
|
61
|
-
target_folder.mkpath
|
62
|
-
else
|
63
|
-
system "find #{target_folder} -type l -delete" # Only clean up symlink, keep source code for local pod
|
64
|
-
end
|
28
|
+
target_folder += real_file_folder.basename if target_names.count > 1
|
29
|
+
target_folder += PodPrebuild.config.prebuilt_path
|
30
|
+
target_folder.rmtree if target_folder.exist?
|
31
|
+
target_folder.mkpath
|
65
32
|
|
66
33
|
walk(real_file_folder) do |child|
|
67
34
|
source = child
|
68
35
|
# only make symlink to file and `.framework` folder
|
69
|
-
if child.directory?
|
70
|
-
if child.extname == ".framework"
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
# We need more setup to support local debuging with prebuilt dSYM
|
76
|
-
end
|
77
|
-
next false # return false means don't go deeper
|
36
|
+
if child.directory? && [".framework", ".dSYM"].include?(child.extname)
|
37
|
+
mirror_with_symlink(source, real_file_folder, target_folder) if child.extname == ".framework"
|
38
|
+
# Ignore dsym here to avoid cocoapods from adding install_dsym to buildphase-script
|
39
|
+
# That can cause duplicated output files error in Xcode 11 (warning in Xcode 10)
|
40
|
+
# We need more setup to support local debuging with prebuilt dSYM
|
41
|
+
next false # Don't go deeper
|
78
42
|
elsif child.file?
|
79
43
|
mirror_with_symlink(source, real_file_folder, target_folder)
|
80
44
|
next true
|
@@ -88,8 +52,9 @@ module Pod
|
|
88
52
|
next unless metadata.static_framework?
|
89
53
|
|
90
54
|
metadata.resources.each do |path|
|
91
|
-
target_file_path = path
|
92
|
-
|
55
|
+
target_file_path = path
|
56
|
+
.sub("${PODS_ROOT}", sandbox.root.to_path)
|
57
|
+
.sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
|
93
58
|
real_file_path = real_file_folder + metadata.framework_name + File.basename(path)
|
94
59
|
case File.extname(path)
|
95
60
|
when ".xib"
|
@@ -107,6 +72,32 @@ module Pod
|
|
107
72
|
end
|
108
73
|
end
|
109
74
|
end
|
75
|
+
|
76
|
+
private
|
77
|
+
|
78
|
+
def walk(path, &action)
|
79
|
+
return unless path.exist?
|
80
|
+
|
81
|
+
path.children.each do |child|
|
82
|
+
result = action.call(child, &action)
|
83
|
+
if child.directory?
|
84
|
+
walk(child, &action) if result
|
85
|
+
end
|
86
|
+
end
|
87
|
+
end
|
88
|
+
|
89
|
+
def make_link(source, target)
|
90
|
+
source = Pathname.new(source)
|
91
|
+
target = Pathname.new(target)
|
92
|
+
target.rmtree if target.exist?
|
93
|
+
target.parent.mkpath unless target.parent.exist?
|
94
|
+
relative_source = source.relative_path_from(target.parent)
|
95
|
+
FileUtils.ln_sf(relative_source, target)
|
96
|
+
end
|
97
|
+
|
98
|
+
def mirror_with_symlink(source, basefolder, target_folder)
|
99
|
+
make_link(source, target_folder + source.relative_path_from(basefolder))
|
100
|
+
end
|
110
101
|
end
|
111
102
|
end
|
112
103
|
end
|
@@ -44,14 +44,14 @@ module Pod
|
|
44
44
|
|
45
45
|
def should_not_prebuild_vendor_pod(name)
|
46
46
|
return true if blacklisted?(name)
|
47
|
-
return false if
|
47
|
+
return false if PodPrebuild.config.prebuild_all_pods?
|
48
48
|
end
|
49
49
|
|
50
50
|
def run_code_gen!(targets)
|
51
|
-
return if
|
51
|
+
return if PodPrebuild.config.prebuild_code_gen.nil?
|
52
52
|
|
53
53
|
Pod::UI.title("Running code generation...") do
|
54
|
-
|
54
|
+
PodPrebuild.config.prebuild_code_gen.call(self, targets)
|
55
55
|
end
|
56
56
|
end
|
57
57
|
|
@@ -59,10 +59,10 @@ module Pod
|
|
59
59
|
existed_framework_folder = sandbox.generate_framework_path
|
60
60
|
targets = pod_targets
|
61
61
|
|
62
|
-
targets_from_cli =
|
62
|
+
targets_from_cli = PodPrebuild.config.targets_to_prebuild_from_cli
|
63
63
|
if !targets_from_cli.empty?
|
64
64
|
targets = targets.select { |target| targets_from_cli.include?(target.name) }
|
65
|
-
elsif !
|
65
|
+
elsif !PodPrebuild.config.prebuild_all_pods? && !local_manifest.nil?
|
66
66
|
changes = prebuild_pods_changes
|
67
67
|
added = changes.added
|
68
68
|
changed = changes.changed
|
@@ -91,11 +91,11 @@ module Pod
|
|
91
91
|
targets = (targets + dependency_targets).uniq
|
92
92
|
end
|
93
93
|
|
94
|
-
unless
|
94
|
+
unless PodPrebuild.config.prebuild_all_pods?
|
95
95
|
targets = targets.select { |pod_target| cache_missed?(pod_target.name) }
|
96
96
|
end
|
97
97
|
targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }
|
98
|
-
unless
|
98
|
+
unless PodPrebuild.config.dev_pods_enabled?
|
99
99
|
targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }
|
100
100
|
end
|
101
101
|
targets
|
@@ -123,12 +123,12 @@ module Pod
|
|
123
123
|
Pod::Prebuild.build(
|
124
124
|
sandbox: sandbox_path,
|
125
125
|
target: target,
|
126
|
-
configuration:
|
126
|
+
configuration: PodPrebuild.config.prebuild_config,
|
127
127
|
output_path: output_path,
|
128
|
-
bitcode_enabled:
|
129
|
-
device_build_enabled:
|
130
|
-
disable_dsym:
|
131
|
-
args:
|
128
|
+
bitcode_enabled: PodPrebuild.config.bitcode_enabled?,
|
129
|
+
device_build_enabled: PodPrebuild.config.device_build_enabled?,
|
130
|
+
disable_dsym: PodPrebuild.config.disable_dsym?,
|
131
|
+
args: PodPrebuild.config.build_args
|
132
132
|
)
|
133
133
|
collect_metadata(target, output_path)
|
134
134
|
end
|
@@ -178,7 +178,7 @@ module Pod
|
|
178
178
|
path.rmtree if path.exist?
|
179
179
|
end
|
180
180
|
|
181
|
-
if
|
181
|
+
if PodPrebuild.config.dont_remove_source_code?
|
182
182
|
# just remove the tmp files
|
183
183
|
path = sandbox.root + "Manifest.lock.tmp"
|
184
184
|
path.rmtree if path.exist?
|
@@ -215,7 +215,7 @@ module Pod
|
|
215
215
|
metadata.build_settings = pods_project.targets
|
216
216
|
.detect { |native_target| native_target.name == target.name }
|
217
217
|
.build_configurations
|
218
|
-
.detect { |config| config.name ==
|
218
|
+
.detect { |config| config.name == PodPrebuild.config.prebuild_config }
|
219
219
|
.build_settings
|
220
220
|
metadata.source_hash = @lockfile_wrapper && @lockfile_wrapper.dev_pod_hash(target.name)
|
221
221
|
|
@@ -3,71 +3,9 @@ require_relative "tool/tool"
|
|
3
3
|
module Pod
|
4
4
|
class Podfile
|
5
5
|
module DSL
|
6
|
-
@binary_cache_config = {}
|
7
|
-
@binary_cache_cli_config = {}
|
8
6
|
def config_cocoapods_binary_cache(options)
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
class << self
|
13
|
-
attr_accessor :binary_cache_config
|
14
|
-
attr_accessor :binary_cache_cli_config
|
15
|
-
|
16
|
-
def prebuild_config
|
17
|
-
@binary_cache_config[:prebuild_config] || "Debug"
|
18
|
-
end
|
19
|
-
|
20
|
-
def prebuild_job?
|
21
|
-
@binary_cache_cli_config[:prebuild_job] || @binary_cache_config[:prebuild_job]
|
22
|
-
end
|
23
|
-
|
24
|
-
def prebuild_all_pods?
|
25
|
-
@binary_cache_cli_config[:prebuild_all_pods] || @binary_cache_config[:prebuild_all_pods]
|
26
|
-
end
|
27
|
-
|
28
|
-
def excluded_pods
|
29
|
-
@binary_cache_config[:excluded_pods] || Set.new
|
30
|
-
end
|
31
|
-
|
32
|
-
def dev_pods_enabled?
|
33
|
-
@binary_cache_config[:dev_pods_enabled]
|
34
|
-
end
|
35
|
-
|
36
|
-
def bitcode_enabled?
|
37
|
-
@binary_cache_config[:bitcode_enabled]
|
38
|
-
end
|
39
|
-
|
40
|
-
def device_build_enabled?
|
41
|
-
@binary_cache_config[:device_build_enabled]
|
42
|
-
end
|
43
|
-
|
44
|
-
def disable_dsym?
|
45
|
-
@binary_cache_config[:disable_dsym]
|
46
|
-
end
|
47
|
-
|
48
|
-
def dont_remove_source_code?
|
49
|
-
@binary_cache_config[:dont_remove_source_code]
|
50
|
-
end
|
51
|
-
|
52
|
-
def build_args
|
53
|
-
@binary_cache_config[:build_args]
|
54
|
-
end
|
55
|
-
|
56
|
-
def save_cache_validation_to
|
57
|
-
@binary_cache_config[:save_cache_validation_to]
|
58
|
-
end
|
59
|
-
|
60
|
-
def validate_prebuilt_settings
|
61
|
-
@binary_cache_config[:validate_prebuilt_settings]
|
62
|
-
end
|
63
|
-
|
64
|
-
def prebuild_code_gen
|
65
|
-
@binary_cache_config[:prebuild_code_gen]
|
66
|
-
end
|
67
|
-
|
68
|
-
def targets_to_prebuild_from_cli
|
69
|
-
@binary_cache_cli_config[:prebuild_targets] || []
|
70
|
-
end
|
7
|
+
PodPrebuild.config.dsl_config = options
|
8
|
+
PodPrebuild.config.validate_dsl_config
|
71
9
|
end
|
72
10
|
end
|
73
11
|
end
|
@@ -12,7 +12,7 @@ class SchemeEditor
|
|
12
12
|
scheme_name = File.basename(file_path, '.*')
|
13
13
|
next unless sandbox.local?(scheme_name)
|
14
14
|
|
15
|
-
|
15
|
+
Pod::UI.message "Modify scheme to enable coverage symbol when prebuild: #{scheme_name}"
|
16
16
|
|
17
17
|
doc = File.open(file_path, 'r') { |f| REXML::Document.new(f) }
|
18
18
|
scheme = doc.elements['Scheme']
|
data/lib/command/binary.rb
CHANGED
@@ -9,9 +9,28 @@ module Pod
|
|
9
9
|
class Command
|
10
10
|
class Binary < Command
|
11
11
|
self.abstract_command = true
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
["--repo", "Cache repo (in accordance with `cache_repo` in `config_cocoapods_binary_cache`)"]
|
15
|
+
]
|
16
|
+
end
|
17
|
+
|
18
|
+
def initialize(argv)
|
19
|
+
super
|
20
|
+
load_podfile
|
21
|
+
update_cli_config(:repo => argv.option("repo"))
|
22
|
+
end
|
12
23
|
|
13
24
|
def prebuild_config
|
14
|
-
@prebuild_config ||= PodPrebuild
|
25
|
+
@prebuild_config ||= PodPrebuild.config
|
26
|
+
end
|
27
|
+
|
28
|
+
def load_podfile
|
29
|
+
Pod::Config.instance.podfile
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_cli_config(options)
|
33
|
+
PodPrebuild.config.cli_config.merge!(options)
|
15
34
|
end
|
16
35
|
end
|
17
36
|
end
|
data/lib/command/config.rb
CHANGED
@@ -1,31 +1,172 @@
|
|
1
1
|
require_relative "../cocoapods-binary-cache/helper/json"
|
2
2
|
|
3
3
|
module PodPrebuild
|
4
|
+
def self.config
|
5
|
+
PodPrebuild::Config.instance
|
6
|
+
end
|
7
|
+
|
4
8
|
class Config
|
5
|
-
|
9
|
+
attr_accessor :dsl_config, :cli_config
|
6
10
|
|
7
11
|
def initialize(path)
|
8
|
-
@
|
9
|
-
@
|
10
|
-
@
|
11
|
-
@prebuild_path = @data["prebuild_path"] || "_Prebuild"
|
12
|
-
@prebuild_delta_path = @data["prebuild_delta_path"] || "_Prebuild_delta/changes.json"
|
12
|
+
@deprecated_config = File.exist?(path) ? PodPrebuild::JSONFile.new(path).data : {}
|
13
|
+
@dsl_config = {}
|
14
|
+
@cli_config = {}
|
13
15
|
end
|
14
16
|
|
15
17
|
def self.instance
|
16
18
|
@instance ||= new("PodBinaryCacheConfig.json")
|
17
19
|
end
|
18
20
|
|
21
|
+
def reset!
|
22
|
+
@deprecated_config = {}
|
23
|
+
@dsl_config = {}
|
24
|
+
@cli_config = {}
|
25
|
+
end
|
26
|
+
|
27
|
+
def cache_repo
|
28
|
+
@cache_repo ||= cache_repo_config["remote"]
|
29
|
+
end
|
30
|
+
|
31
|
+
def cache_path
|
32
|
+
@cache_path ||= File.expand_path(cache_repo_config["local"])
|
33
|
+
end
|
34
|
+
|
35
|
+
def prebuild_sandbox_path
|
36
|
+
@dsl_config[:prebuild_sandbox_path] || @deprecated_config["prebuild_path"] || "_Prebuild"
|
37
|
+
end
|
38
|
+
|
39
|
+
def prebuild_delta_path
|
40
|
+
@dsl_config[:prebuild_delta_path] || @deprecated_config["prebuild_delta_path"] || "_Prebuild_delta/changes.json"
|
41
|
+
end
|
42
|
+
|
19
43
|
def manifest_path(in_cache: false)
|
20
44
|
root_dir(in_cache) + "/Manifest.lock"
|
21
45
|
end
|
22
46
|
|
23
47
|
def root_dir(in_cache)
|
24
|
-
in_cache ?
|
48
|
+
in_cache ? cache_path : prebuild_sandbox_path
|
25
49
|
end
|
26
50
|
|
27
51
|
def generated_frameworks_dir(in_cache: false)
|
28
52
|
root_dir(in_cache) + "/GeneratedFrameworks"
|
29
53
|
end
|
54
|
+
|
55
|
+
def prebuilt_path(path: nil)
|
56
|
+
path.nil? ? "_Prebuilt" : "_Prebuilt/#{path}"
|
57
|
+
end
|
58
|
+
|
59
|
+
def validate_dsl_config
|
60
|
+
inapplicable_options = @dsl_config.keys - applicable_dsl_config
|
61
|
+
return if inapplicable_options.empty?
|
62
|
+
|
63
|
+
message = <<~HEREDOC
|
64
|
+
[WARNING] The following options (in `config_cocoapods_binary_cache`) are not correct: #{inapplicable_options}.
|
65
|
+
Available options: #{applicable_dsl_config}.
|
66
|
+
Check out the following doc for more details
|
67
|
+
https://github.com/grab/cocoapods-binary-cache/blob/master/docs/configure_cocoapods_binary_cache.md
|
68
|
+
HEREDOC
|
69
|
+
|
70
|
+
Pod::UI.puts message.yellow
|
71
|
+
end
|
72
|
+
|
73
|
+
def prebuild_config
|
74
|
+
@cli_config[:prebuild_config] || @dsl_config[:prebuild_config] || "Debug"
|
75
|
+
end
|
76
|
+
|
77
|
+
def prebuild_job?
|
78
|
+
@cli_config[:prebuild_job] || @dsl_config[:prebuild_job]
|
79
|
+
end
|
80
|
+
|
81
|
+
def prebuild_all_pods?
|
82
|
+
@cli_config[:prebuild_all_pods] || @dsl_config[:prebuild_all_pods]
|
83
|
+
end
|
84
|
+
|
85
|
+
def excluded_pods
|
86
|
+
@dsl_config[:excluded_pods] || Set.new
|
87
|
+
end
|
88
|
+
|
89
|
+
def dev_pods_enabled?
|
90
|
+
@dsl_config[:dev_pods_enabled]
|
91
|
+
end
|
92
|
+
|
93
|
+
def bitcode_enabled?
|
94
|
+
@dsl_config[:bitcode_enabled]
|
95
|
+
end
|
96
|
+
|
97
|
+
def device_build_enabled?
|
98
|
+
@dsl_config[:device_build_enabled]
|
99
|
+
end
|
100
|
+
|
101
|
+
def disable_dsym?
|
102
|
+
@dsl_config[:disable_dsym]
|
103
|
+
end
|
104
|
+
|
105
|
+
def dont_remove_source_code?
|
106
|
+
@dsl_config[:dont_remove_source_code]
|
107
|
+
end
|
108
|
+
|
109
|
+
def build_args
|
110
|
+
@dsl_config[:build_args]
|
111
|
+
end
|
112
|
+
|
113
|
+
def save_cache_validation_to
|
114
|
+
@dsl_config[:save_cache_validation_to]
|
115
|
+
end
|
116
|
+
|
117
|
+
def validate_prebuilt_settings
|
118
|
+
@dsl_config[:validate_prebuilt_settings]
|
119
|
+
end
|
120
|
+
|
121
|
+
def prebuild_code_gen
|
122
|
+
@dsl_config[:prebuild_code_gen]
|
123
|
+
end
|
124
|
+
|
125
|
+
def targets_to_prebuild_from_cli
|
126
|
+
@cli_config[:prebuild_targets] || []
|
127
|
+
end
|
128
|
+
|
129
|
+
private
|
130
|
+
|
131
|
+
def applicable_dsl_config
|
132
|
+
[
|
133
|
+
:cache_repo,
|
134
|
+
:prebuild_sandbox_path,
|
135
|
+
:prebuild_delta_path,
|
136
|
+
:prebuild_config,
|
137
|
+
:prebuild_job,
|
138
|
+
:prebuild_all_pods,
|
139
|
+
:excluded_pods,
|
140
|
+
:dev_pods_enabled,
|
141
|
+
:bitcode_enabled,
|
142
|
+
:device_build_enabled,
|
143
|
+
:disable_dsym,
|
144
|
+
:dont_remove_source_code,
|
145
|
+
:build_args,
|
146
|
+
:save_cache_validation_to,
|
147
|
+
:validate_prebuilt_settings,
|
148
|
+
:prebuild_code_gen
|
149
|
+
]
|
150
|
+
end
|
151
|
+
|
152
|
+
def cache_repo_config
|
153
|
+
@cache_repo_config ||= begin
|
154
|
+
repo = @cli_config[:repo] || "default"
|
155
|
+
config_ = @dsl_config[:cache_repo] || {}
|
156
|
+
if config_[repo].nil?
|
157
|
+
message = <<~HEREDOC
|
158
|
+
[Deprecated] Configs in `PodBinaryCacheConfig.json` are deprecated.
|
159
|
+
Declare option `cache_repo` in `config_cocoapods_binary_cache` instead.
|
160
|
+
Check out the following doc for more details
|
161
|
+
https://github.com/grab/cocoapods-binary-cache/blob/master/docs/configure_cocoapods_binary_cache.md
|
162
|
+
HEREDOC
|
163
|
+
Pod::UI.puts message.yellow
|
164
|
+
end
|
165
|
+
config_[repo] || {
|
166
|
+
"remote" => @deprecated_config["cache_repo"] || @deprecated_config["prebuilt_cache_repo"],
|
167
|
+
"local" => @deprecated_config["cache_path"] || "~/.cocoapods-binary-cache/prebuilt-frameworks"
|
168
|
+
}
|
169
|
+
end
|
170
|
+
end
|
30
171
|
end
|
31
172
|
end
|
@@ -31,9 +31,9 @@ module PodPrebuild
|
|
31
31
|
end
|
32
32
|
|
33
33
|
def unzip_cache
|
34
|
-
Pod::UI.puts "Unzipping cache: #{@config.cache_path} -> #{@config.
|
35
|
-
FileUtils.rm_rf(@config.
|
36
|
-
FileUtils.mkdir_p(@config.
|
34
|
+
Pod::UI.puts "Unzipping cache: #{@config.cache_path} -> #{@config.prebuild_sandbox_path}".green
|
35
|
+
FileUtils.rm_rf(@config.prebuild_sandbox_path)
|
36
|
+
FileUtils.mkdir_p(@config.prebuild_sandbox_path)
|
37
37
|
|
38
38
|
if File.exist?(@config.manifest_path(in_cache: true))
|
39
39
|
FileUtils.cp(
|
data/lib/command/fetch.rb
CHANGED
data/lib/command/prebuild.rb
CHANGED
@@ -8,16 +8,23 @@ module Pod
|
|
8
8
|
self.arguments = [CLAide::Argument.new("CACHE-BRANCH", false)]
|
9
9
|
def self.options
|
10
10
|
[
|
11
|
+
["--config", "Config (Debug, Test...) to prebuild"],
|
11
12
|
["--push", "Push cache to repo upon completion"],
|
12
13
|
["--all", "Prebuild all binary pods regardless of cache validation"],
|
13
14
|
["--targets", "Targets to prebuild. Use comma (,) to specify a list of targets"]
|
14
|
-
]
|
15
|
+
].concat(super)
|
15
16
|
end
|
16
17
|
|
17
18
|
def initialize(argv)
|
18
19
|
super
|
19
|
-
|
20
|
-
|
20
|
+
prebuild_all_pods = argv.flag?("all")
|
21
|
+
prebuild_targets = argv.option("targets", "").split(",")
|
22
|
+
update_cli_config(
|
23
|
+
:prebuild_job => true,
|
24
|
+
:prebuild_all_pods => prebuild_all_pods,
|
25
|
+
:prebuild_config => argv.option("config")
|
26
|
+
)
|
27
|
+
update_cli_config(:prebuild_targets => prebuild_targets) unless prebuild_all_pods
|
21
28
|
@prebuilder = PodPrebuild::CachePrebuilder.new(
|
22
29
|
config: prebuild_config,
|
23
30
|
cache_branch: argv.shift_argument || "master",
|
@@ -26,9 +33,6 @@ module Pod
|
|
26
33
|
end
|
27
34
|
|
28
35
|
def run
|
29
|
-
Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_job] = true
|
30
|
-
Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_all_pods] = @prebuild_all_pods
|
31
|
-
Pod::Podfile::DSL.binary_cache_cli_config[:prebuild_targets] = @prebuild_targets unless @prebuild_all_pods
|
32
36
|
@prebuilder.run
|
33
37
|
end
|
34
38
|
end
|
data/lib/command/push.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-binary-cache
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.7
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Bang Nguyen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-09-
|
11
|
+
date: 2020-09-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: cocoapods
|
@@ -70,14 +70,14 @@ dependencies:
|
|
70
70
|
name: bundler
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
|
-
- - "
|
73
|
+
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
75
|
version: '1.3'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
|
-
- - "
|
80
|
+
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '1.3'
|
83
83
|
- !ruby/object:Gem::Dependency
|