cocoapods-binary-cache 0.1.1 → 0.1.7
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 +4 -4
- data/lib/cocoapods-binary-cache.rb +0 -2
- data/lib/cocoapods-binary-cache/cache/validator.rb +2 -3
- data/lib/cocoapods-binary-cache/cache/validator_base.rb +28 -8
- data/lib/cocoapods-binary-cache/cache/validator_dependencies_graph.rb +7 -2
- data/lib/cocoapods-binary-cache/cache/validator_dev_pods.rb +21 -13
- data/lib/cocoapods-binary-cache/cache/validator_non_dev_pods.rb +1 -1
- data/lib/cocoapods-binary-cache/diagnosis/base.rb +13 -0
- data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +16 -0
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +21 -0
- data/lib/cocoapods-binary-cache/env.rb +32 -0
- data/lib/cocoapods-binary-cache/helper/checksum.rb +10 -4
- data/lib/cocoapods-binary-cache/helper/lockfile.rb +26 -3
- data/lib/cocoapods-binary-cache/helper/podspec.rb +1 -0
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +19 -2
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +11 -14
- data/lib/cocoapods-binary-cache/main.rb +2 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +39 -0
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/installer.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +3 -10
- data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -38
- data/lib/cocoapods-binary-cache/pod-binary/helper/names.rb +2 -11
- data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +1 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration.rb +0 -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 +5 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +42 -50
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +59 -47
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -59
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +176 -0
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +43 -0
- data/lib/cocoapods-binary-cache/prebuild_output/metadata.rb +16 -0
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +8 -37
- data/lib/cocoapods-binary-cache/scheme_editor.rb +1 -1
- data/lib/command/binary.rb +21 -2
- data/lib/command/config.rb +150 -9
- data/lib/command/executor/fetcher.rb +10 -5
- data/lib/command/executor/prebuilder.rb +2 -1
- data/lib/command/executor/pusher.rb +1 -1
- data/lib/command/fetch.rb +0 -1
- data/lib/command/helper/zip.rb +1 -1
- data/lib/command/prebuild.rb +14 -2
- data/lib/command/push.rb +22 -0
- metadata +19 -14
- data/lib/cocoapods-binary-cache/gem_version.rb +0 -6
- data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -247
- data/lib/cocoapods-binary-cache/prebuild_cache.rb +0 -49
|
@@ -9,13 +9,14 @@ require_relative "helper/json"
|
|
|
9
9
|
require_relative "helper/lockfile"
|
|
10
10
|
require_relative "helper/path_utils"
|
|
11
11
|
require_relative "helper/podspec"
|
|
12
|
+
require_relative "env"
|
|
12
13
|
require_relative "state_store"
|
|
13
14
|
require_relative "hooks/post_install"
|
|
14
15
|
require_relative "hooks/pre_install"
|
|
15
16
|
require_relative "pod-binary/prebuild_dsl"
|
|
16
17
|
require_relative "pod-binary/prebuild_hook"
|
|
17
18
|
require_relative "pod-binary/prebuild"
|
|
18
|
-
require_relative "prebuild_cache"
|
|
19
19
|
require_relative "prebuild_output/metadata"
|
|
20
20
|
require_relative "prebuild_output/output"
|
|
21
21
|
require_relative "scheme_editor"
|
|
22
|
+
require_relative "diagnosis/diagnosis"
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
require_relative "../../pod-rome/xcodebuild_raw"
|
|
2
|
+
require_relative "../../pod-rome/xcodebuild_command"
|
|
3
|
+
|
|
4
|
+
module Pod
|
|
5
|
+
class Prebuild
|
|
6
|
+
def self.build(options)
|
|
7
|
+
target = options[:target]
|
|
8
|
+
return if target.nil?
|
|
9
|
+
|
|
10
|
+
options[:sandbox] = Pod::Sandbox.new(Pathname(options[:sandbox])) unless options[:sandbox].is_a?(Pod::Sandbox)
|
|
11
|
+
options[:build_dir] = build_dir(options[:sandbox].root)
|
|
12
|
+
|
|
13
|
+
case target.platform.name
|
|
14
|
+
when :ios, :tvos, :watchos
|
|
15
|
+
XcodebuildCommand.new(options).run
|
|
16
|
+
when :osx
|
|
17
|
+
xcodebuild(
|
|
18
|
+
sandbox: options[:sandbox],
|
|
19
|
+
target: target.label,
|
|
20
|
+
configuration: options[:configuration],
|
|
21
|
+
sdk: "macosx",
|
|
22
|
+
args: options[:args]
|
|
23
|
+
)
|
|
24
|
+
else
|
|
25
|
+
raise "Unsupported platform for '#{target.name}': '#{target.platform.name}'"
|
|
26
|
+
end
|
|
27
|
+
raise "The build directory was not found in the expected location" unless options[:build_dir].directory?
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
def self.remove_build_dir(sandbox_root)
|
|
31
|
+
path = build_dir(sandbox_root)
|
|
32
|
+
path.rmtree if path.exist?
|
|
33
|
+
end
|
|
34
|
+
|
|
35
|
+
def self.build_dir(sandbox_root)
|
|
36
|
+
sandbox_root.parent + "build"
|
|
37
|
+
end
|
|
38
|
+
end
|
|
39
|
+
end
|
|
@@ -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
|
data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb
CHANGED
|
@@ -3,20 +3,13 @@ module Pod
|
|
|
3
3
|
class TargetDefinition
|
|
4
4
|
def detect_prebuilt_pod(name, requirements)
|
|
5
5
|
@explicit_prebuilt_pod_names ||= []
|
|
6
|
-
options = requirements.last
|
|
7
|
-
if
|
|
8
|
-
@explicit_prebuilt_pod_names << Specification.root_name(name)
|
|
9
|
-
elsif options.is_a?(Hash) && options[:binary]
|
|
10
|
-
@explicit_prebuilt_pod_names << Specification.root_name(name)
|
|
11
|
-
end
|
|
6
|
+
options = requirements.last || {}
|
|
7
|
+
@explicit_prebuilt_pod_names << Specification.root_name(name) if options.is_a?(Hash) && options[:binary]
|
|
12
8
|
options.delete(:binary) if options.is_a?(Hash)
|
|
13
9
|
requirements.pop if options.empty?
|
|
14
10
|
end
|
|
15
11
|
|
|
16
|
-
# Returns the names of pod targets explicitly declared as prebuilt in Podfile
|
|
17
|
-
# using `:binary => true`.
|
|
18
|
-
# In case `prebuild_all` is ON via `config_cocoapods_binary_cache`, returns the
|
|
19
|
-
# name of all pod targets
|
|
12
|
+
# Returns the names of pod targets explicitly declared as prebuilt in Podfile using `:binary => true`.
|
|
20
13
|
def explicit_prebuilt_pod_names
|
|
21
14
|
names = @explicit_prebuilt_pod_names || []
|
|
22
15
|
names += parent.explicit_prebuilt_pod_names if !parent.nil? && parent.is_a?(TargetDefinition)
|
|
@@ -2,44 +2,6 @@ require_relative "../tool/tool"
|
|
|
2
2
|
require_relative "prebuild_sandbox"
|
|
3
3
|
|
|
4
4
|
module Pod
|
|
5
|
-
|
|
6
|
-
# a flag that indicate stages
|
|
7
|
-
class_attr_accessor :is_prebuild_stage
|
|
8
|
-
|
|
9
|
-
# a switch for the `pod` DSL to make it only valid for ':binary => true'
|
|
10
|
-
class Podfile
|
|
11
|
-
module DSL
|
|
12
|
-
@@enable_prebuild_patch = false
|
|
13
|
-
|
|
14
|
-
# when enable, `pod` function will skip all pods without 'prebuild => true'
|
|
15
|
-
def self.enable_prebuild_patch(value)
|
|
16
|
-
@@enable_prebuild_patch = value
|
|
17
|
-
end
|
|
18
|
-
|
|
19
|
-
# --- patch ---
|
|
20
|
-
old_method = instance_method(:pod)
|
|
21
|
-
|
|
22
|
-
define_method(:pod) do |name, *args|
|
|
23
|
-
if !@@enable_prebuild_patch
|
|
24
|
-
old_method.bind(self).(name, *args)
|
|
25
|
-
return
|
|
26
|
-
end
|
|
27
|
-
|
|
28
|
-
# patched content
|
|
29
|
-
should_prebuild = Pod::Podfile::DSL.prebuild_all
|
|
30
|
-
local = false
|
|
31
|
-
|
|
32
|
-
options = args.last
|
|
33
|
-
if options.is_a?(Hash) and options[Pod::Prebuild.keyword] != nil
|
|
34
|
-
should_prebuild = options[Pod::Prebuild.keyword]
|
|
35
|
-
local = (options[:path] != nil)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
old_method.bind(self).call(name, *args) if should_prebuild && (!local || Podfile::DSL.dev_pods_enabled)
|
|
39
|
-
end
|
|
40
|
-
end
|
|
41
|
-
end
|
|
42
|
-
|
|
43
5
|
# a force disable option for integral
|
|
44
6
|
class Installer
|
|
45
7
|
def self.force_disable_integration(value)
|
|
@@ -18,19 +18,10 @@
|
|
|
18
18
|
module Pod
|
|
19
19
|
def self.fast_get_targets_for_pod_name(pod_name, targets, cache)
|
|
20
20
|
pod_name = pod_name.split("/")[0] # Look for parent spec instead of subspecs
|
|
21
|
-
pod_name_to_targets_hash = nil
|
|
22
21
|
if cache.empty?
|
|
23
|
-
|
|
24
|
-
array = sum[target.pod_name] || []
|
|
25
|
-
array << target
|
|
26
|
-
sum[target.pod_name] = array
|
|
27
|
-
sum
|
|
28
|
-
end
|
|
29
|
-
cache << pod_name_to_targets_hash
|
|
22
|
+
targets.select { |target| target.name == pod_name }
|
|
30
23
|
else
|
|
31
|
-
|
|
24
|
+
cache.first[pod_name] || []
|
|
32
25
|
end
|
|
33
|
-
|
|
34
|
-
pod_name_to_targets_hash[pod_name] || []
|
|
35
26
|
end
|
|
36
27
|
end
|
|
@@ -2,10 +2,9 @@ require_relative "names"
|
|
|
2
2
|
|
|
3
3
|
module Pod
|
|
4
4
|
class PrebuildSandbox < Sandbox
|
|
5
|
-
|
|
6
5
|
# [String] standard_sandbox_path
|
|
7
6
|
def self.from_standard_sanbox_path(path)
|
|
8
|
-
prebuild_sandbox_path = Pathname.new(path).realpath + "
|
|
7
|
+
prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild.config.prebuild_sandbox_path
|
|
9
8
|
self.new(prebuild_sandbox_path)
|
|
10
9
|
end
|
|
11
10
|
|
|
@@ -5,7 +5,6 @@ require_relative "helper/names"
|
|
|
5
5
|
require_relative "helper/target_checker"
|
|
6
6
|
require_relative "integration/alter_specs"
|
|
7
7
|
require_relative "integration/remove_target_files"
|
|
8
|
-
require_relative "integration/source_installer"
|
|
9
8
|
require_relative "integration/validation"
|
|
10
9
|
require_relative "integration/patch/embed_framework_script"
|
|
11
10
|
require_relative "integration/patch/resolve_dependencies"
|
|
@@ -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)
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
+
require_relative "../source_installer"
|
|
2
|
+
|
|
1
3
|
module Pod
|
|
2
4
|
class Installer
|
|
3
5
|
# Override the download step to skip download and prepare file in target folder
|
|
@@ -15,13 +17,14 @@ module Pod
|
|
|
15
17
|
end
|
|
16
18
|
|
|
17
19
|
def should_integrate_prebuilt_pod?(name)
|
|
18
|
-
if
|
|
20
|
+
if PodPrebuild.config.prebuild_job? && PodPrebuild.config.targets_to_prebuild_from_cli.empty?
|
|
19
21
|
# In a prebuild job, at the integration stage, all prebuilt frameworks should be
|
|
20
22
|
# ready for integration regardless of whether there was any cache miss or not.
|
|
21
23
|
# Those that are missed were prebuilt in the prebuild stage.
|
|
22
24
|
PodPrebuild::StateStore.cache_validation.include?(name)
|
|
23
25
|
else
|
|
24
|
-
PodPrebuild::StateStore.cache_validation.hit
|
|
26
|
+
prebuilt = PodPrebuild::StateStore.cache_validation.hit + PodPrebuild.config.targets_to_prebuild_from_cli
|
|
27
|
+
prebuilt.include?(name)
|
|
25
28
|
end
|
|
26
29
|
end
|
|
27
30
|
end
|
|
@@ -15,9 +15,9 @@ module Pod
|
|
|
15
15
|
|
|
16
16
|
updated_names.each do |name|
|
|
17
17
|
root_name = Specification.root_name(name)
|
|
18
|
-
next if
|
|
18
|
+
next if sandbox.local?(root_name)
|
|
19
19
|
|
|
20
|
-
UI.
|
|
20
|
+
UI.message "Delete cached files: #{root_name}"
|
|
21
21
|
target_path = sandbox.pod_dir(root_name)
|
|
22
22
|
target_path.rmtree if target_path.exist?
|
|
23
23
|
|
|
@@ -11,69 +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
|
+
# TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
|
|
17
18
|
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
|
18
19
|
# if spec used in multiple platforms, it may return multiple paths
|
|
19
|
-
target_names = prebuild_sandbox.existed_target_names_for_pod_name(
|
|
20
|
-
|
|
21
|
-
def walk(path, &action)
|
|
22
|
-
return unless path.exist?
|
|
23
|
-
path.children.each do |child|
|
|
24
|
-
result = action.call(child, &action)
|
|
25
|
-
if child.directory?
|
|
26
|
-
walk(child, &action) if result
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
30
|
-
|
|
31
|
-
def make_link(source, target)
|
|
32
|
-
source = Pathname.new(source)
|
|
33
|
-
target = Pathname.new(target)
|
|
34
|
-
target.parent.mkpath unless target.parent.exist?
|
|
35
|
-
relative_source = source.relative_path_from(target.parent)
|
|
36
|
-
FileUtils.ln_sf(relative_source, target)
|
|
37
|
-
end
|
|
38
|
-
|
|
39
|
-
def mirror_with_symlink(source, basefolder, target_folder)
|
|
40
|
-
target = target_folder + source.relative_path_from(basefolder)
|
|
41
|
-
make_link(source, target)
|
|
42
|
-
end
|
|
43
|
-
|
|
20
|
+
target_names = prebuild_sandbox.existed_target_names_for_pod_name(name)
|
|
44
21
|
target_names.each do |name|
|
|
45
|
-
|
|
46
|
-
# symbol link copy all substructure
|
|
47
22
|
real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
|
|
48
23
|
|
|
49
24
|
# If have only one platform, just place int the root folder of this pod.
|
|
50
25
|
# If have multiple paths, we use a sperated folder to store different
|
|
51
26
|
# platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
|
|
52
|
-
|
|
53
27
|
target_folder = standard_sanbox.pod_dir(self.name)
|
|
54
|
-
if target_names.count > 1
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
if !standard_sanbox.local?(name)
|
|
59
|
-
target_folder.rmtree if target_folder.exist?
|
|
60
|
-
target_folder.mkpath
|
|
61
|
-
else
|
|
62
|
-
system "find #{target_folder} -type l -delete" # Only clean up symlink, keep source code for local pod
|
|
63
|
-
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
|
|
64
32
|
|
|
65
33
|
walk(real_file_folder) do |child|
|
|
66
34
|
source = child
|
|
67
35
|
# only make symlink to file and `.framework` folder
|
|
68
|
-
if child.directory?
|
|
69
|
-
if child.extname == ".framework"
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
# We need more setup to support local debuging with prebuilt dSYM
|
|
75
|
-
end
|
|
76
|
-
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
|
|
77
42
|
elsif child.file?
|
|
78
43
|
mirror_with_symlink(source, real_file_folder, target_folder)
|
|
79
44
|
next true
|
|
@@ -87,8 +52,9 @@ module Pod
|
|
|
87
52
|
next unless metadata.static_framework?
|
|
88
53
|
|
|
89
54
|
metadata.resources.each do |path|
|
|
90
|
-
target_file_path = path
|
|
91
|
-
|
|
55
|
+
target_file_path = path
|
|
56
|
+
.sub("${PODS_ROOT}", sandbox.root.to_path)
|
|
57
|
+
.sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
|
|
92
58
|
real_file_path = real_file_folder + metadata.framework_name + File.basename(path)
|
|
93
59
|
case File.extname(path)
|
|
94
60
|
when ".xib"
|
|
@@ -106,6 +72,32 @@ module Pod
|
|
|
106
72
|
end
|
|
107
73
|
end
|
|
108
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
|
|
109
101
|
end
|
|
110
102
|
end
|
|
111
103
|
end
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
require "fileutils"
|
|
2
|
-
require_relative "../pod-rome/build_framework"
|
|
3
2
|
require_relative "../prebuild_output/output"
|
|
3
|
+
require_relative "../helper/lockfile"
|
|
4
4
|
require_relative "helper/passer"
|
|
5
5
|
require_relative "helper/target_checker"
|
|
6
|
+
require_relative "helper/build"
|
|
6
7
|
|
|
7
|
-
# patch prebuild ability
|
|
8
8
|
module Pod
|
|
9
9
|
class PrebuildInstaller < Installer
|
|
10
|
+
attr_reader :lockfile_wrapper
|
|
11
|
+
|
|
10
12
|
def initialize(options)
|
|
11
13
|
super(options[:sandbox], options[:podfile], options[:lockfile])
|
|
12
14
|
@cache_validation = options[:cache_validation]
|
|
15
|
+
@lockfile_wrapper = lockfile && PodPrebuild::Lockfile.new(lockfile)
|
|
13
16
|
end
|
|
14
17
|
|
|
15
18
|
private
|
|
@@ -35,38 +38,31 @@ module Pod
|
|
|
35
38
|
PodPrebuild::StateStore.excluded_pods.include?(name)
|
|
36
39
|
end
|
|
37
40
|
|
|
38
|
-
def
|
|
39
|
-
@cache_validation.
|
|
41
|
+
def cache_missed?(name)
|
|
42
|
+
@cache_validation.missed?(name)
|
|
40
43
|
end
|
|
41
44
|
|
|
42
45
|
def should_not_prebuild_vendor_pod(name)
|
|
43
46
|
return true if blacklisted?(name)
|
|
44
|
-
return false if
|
|
45
|
-
|
|
46
|
-
cache_hit?(name)
|
|
47
|
+
return false if PodPrebuild.config.prebuild_all_pods?
|
|
47
48
|
end
|
|
48
49
|
|
|
49
|
-
|
|
50
|
+
def run_code_gen!(targets)
|
|
51
|
+
return if PodPrebuild.config.prebuild_code_gen.nil?
|
|
50
52
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
+
Pod::UI.title("Running code generation...") do
|
|
54
|
+
PodPrebuild.config.prebuild_code_gen.call(self, targets)
|
|
55
|
+
end
|
|
53
56
|
end
|
|
54
57
|
|
|
55
|
-
|
|
56
|
-
def prebuild_frameworks!
|
|
57
|
-
UI.puts "Start prebuild_frameworks"
|
|
58
|
-
|
|
59
|
-
# build options
|
|
60
|
-
sandbox_path = sandbox.root
|
|
58
|
+
def targets_to_prebuild
|
|
61
59
|
existed_framework_folder = sandbox.generate_framework_path
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
if
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
elsif !local_manifest.nil?
|
|
69
|
-
UI.puts "Update some frameworks"
|
|
60
|
+
targets = pod_targets
|
|
61
|
+
|
|
62
|
+
targets_from_cli = PodPrebuild.config.targets_to_prebuild_from_cli
|
|
63
|
+
if !targets_from_cli.empty?
|
|
64
|
+
targets = targets.select { |target| targets_from_cli.include?(target.name) }
|
|
65
|
+
elsif !PodPrebuild.config.prebuild_all_pods? && !local_manifest.nil?
|
|
70
66
|
changes = prebuild_pods_changes
|
|
71
67
|
added = changes.added
|
|
72
68
|
changed = changes.changed
|
|
@@ -93,35 +89,46 @@ module Pod
|
|
|
93
89
|
# add the dendencies
|
|
94
90
|
dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []
|
|
95
91
|
targets = (targets + dependency_targets).uniq
|
|
96
|
-
else
|
|
97
|
-
UI.puts "Rebuild all frameworks"
|
|
98
|
-
targets = pod_targets
|
|
99
92
|
end
|
|
100
93
|
|
|
94
|
+
unless PodPrebuild.config.prebuild_all_pods?
|
|
95
|
+
targets = targets.select { |pod_target| cache_missed?(pod_target.name) }
|
|
96
|
+
end
|
|
101
97
|
targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }
|
|
102
|
-
|
|
98
|
+
unless PodPrebuild.config.dev_pods_enabled?
|
|
99
|
+
targets = targets.reject { |pod_target| sandbox.local?(pod_target.pod_name) }
|
|
100
|
+
end
|
|
101
|
+
targets
|
|
102
|
+
end
|
|
103
103
|
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
104
|
+
public
|
|
105
|
+
|
|
106
|
+
def prebuild_output
|
|
107
|
+
@prebuild_output ||= PodPrebuild::Output.new(sandbox)
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
# Build the needed framework files
|
|
111
|
+
def prebuild_frameworks!
|
|
112
|
+
UI.puts "Start prebuild_frameworks"
|
|
113
|
+
existed_framework_folder = sandbox.generate_framework_path
|
|
114
|
+
sandbox_path = sandbox.root
|
|
115
|
+
targets = targets_to_prebuild
|
|
107
116
|
|
|
117
|
+
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}"
|
|
108
118
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
|
119
|
+
run_code_gen!(targets)
|
|
109
120
|
targets.each do |target|
|
|
110
|
-
unless target.should_build?
|
|
111
|
-
Pod::UI.puts "Skip prebuilding #{target.label} because of no source files".yellow
|
|
112
|
-
next
|
|
113
|
-
end
|
|
114
|
-
|
|
115
121
|
output_path = sandbox.framework_folder_path_for_target_name(target.name)
|
|
116
122
|
output_path.mkpath unless output_path.exist?
|
|
117
123
|
Pod::Prebuild.build(
|
|
118
|
-
sandbox_path,
|
|
119
|
-
target,
|
|
120
|
-
|
|
121
|
-
output_path,
|
|
122
|
-
bitcode_enabled
|
|
123
|
-
|
|
124
|
-
|
|
124
|
+
sandbox: sandbox_path,
|
|
125
|
+
target: target,
|
|
126
|
+
configuration: PodPrebuild.config.prebuild_config,
|
|
127
|
+
output_path: output_path,
|
|
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
|
|
125
132
|
)
|
|
126
133
|
collect_metadata(target, output_path)
|
|
127
134
|
end
|
|
@@ -171,7 +178,7 @@ module Pod
|
|
|
171
178
|
path.rmtree if path.exist?
|
|
172
179
|
end
|
|
173
180
|
|
|
174
|
-
if
|
|
181
|
+
if PodPrebuild.config.dont_remove_source_code?
|
|
175
182
|
# just remove the tmp files
|
|
176
183
|
path = sandbox.root + "Manifest.lock.tmp"
|
|
177
184
|
path.rmtree if path.exist?
|
|
@@ -188,7 +195,6 @@ module Pod
|
|
|
188
195
|
Pod::UI.puts "Targets to cleanup: #{deleted_target_names}"
|
|
189
196
|
|
|
190
197
|
prebuild_output.write_delta_file(updated_target_names, deleted_target_names)
|
|
191
|
-
prebuild_output.process_prebuilt_dev_pods
|
|
192
198
|
end
|
|
193
199
|
|
|
194
200
|
def clean_delta_file
|
|
@@ -209,8 +215,14 @@ module Pod
|
|
|
209
215
|
metadata.build_settings = pods_project.targets
|
|
210
216
|
.detect { |native_target| native_target.name == target.name }
|
|
211
217
|
.build_configurations
|
|
212
|
-
.detect { |config| config.name ==
|
|
218
|
+
.detect { |config| config.name == PodPrebuild.config.prebuild_config }
|
|
213
219
|
.build_settings
|
|
220
|
+
metadata.source_hash = @lockfile_wrapper && @lockfile_wrapper.dev_pod_hash(target.name)
|
|
221
|
+
|
|
222
|
+
# Store root path for code-coverage support later
|
|
223
|
+
# TODO: update driver code-coverage logic to use path stored here
|
|
224
|
+
project_root = PathUtils.remove_last_path_component(@sandbox.standard_sanbox_path.to_s)
|
|
225
|
+
metadata.project_root = project_root
|
|
214
226
|
metadata.save!
|
|
215
227
|
end
|
|
216
228
|
|
|
@@ -218,7 +230,7 @@ module Pod
|
|
|
218
230
|
old_method2 = instance_method(:run_plugins_post_install_hooks)
|
|
219
231
|
define_method(:run_plugins_post_install_hooks) do
|
|
220
232
|
old_method2.bind(self).call
|
|
221
|
-
prebuild_frameworks! if
|
|
233
|
+
prebuild_frameworks! if PodPrebuild::Env.prebuild_stage?
|
|
222
234
|
end
|
|
223
235
|
end
|
|
224
236
|
end
|