cocoapods-binary-cache 0.1.3 → 0.1.9
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/cache/validation_result.rb +4 -0
- 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/dependencies_graph/dependencies_graph.rb +20 -25
- data/lib/cocoapods-binary-cache/dependencies_graph/graph_visualizer.rb +29 -38
- data/lib/cocoapods-binary-cache/diagnosis/base.rb +13 -0
- data/lib/cocoapods-binary-cache/diagnosis/diagnosis.rb +24 -0
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +23 -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 +4 -1
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +12 -5
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +14 -44
- data/lib/cocoapods-binary-cache/main.rb +2 -2
- 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 +2 -2
- data/lib/cocoapods-binary-cache/pod-binary/helper/detected_prebuilt_pods/target_definition.rb +3 -10
- data/lib/cocoapods-binary-cache/pod-binary/helper/names.rb +2 -11
- data/lib/cocoapods-binary-cache/pod-binary/helper/prebuild_sandbox.rb +15 -15
- data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
- data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -3
- data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +4 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/embed_framework_script.rb +1 -1
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/resolve_dependencies.rb +0 -3
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/sandbox_analyzer_state.rb +29 -0
- data/lib/cocoapods-binary-cache/pod-binary/integration/patch/source_installation.rb +29 -12
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +57 -61
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +49 -115
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +2 -60
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +189 -0
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +42 -0
- data/lib/cocoapods-binary-cache/prebuild_output/metadata.rb +16 -0
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +12 -39
- data/lib/cocoapods-binary-cache/state_store.rb +16 -6
- data/lib/command/binary.rb +21 -2
- data/lib/command/config.rb +179 -10
- data/lib/command/executor/base.rb +9 -1
- data/lib/command/executor/fetcher.rb +4 -4
- data/lib/command/executor/prebuilder.rb +4 -2
- data/lib/command/executor/pusher.rb +1 -1
- data/lib/command/executor/visualizer.rb +3 -2
- data/lib/command/fetch.rb +0 -1
- data/lib/command/prebuild.rb +15 -3
- data/lib/command/push.rb +22 -0
- metadata +13 -11
- data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -90
- data/lib/cocoapods-binary-cache/pod-binary/helper/passer.rb +0 -25
- data/lib/cocoapods-binary-cache/pod-binary/integration/remove_target_files.rb +0 -29
- data/lib/cocoapods-binary-cache/pod-binary/tool/tool.rb +0 -12
- data/lib/cocoapods-binary-cache/pod-rome/build_framework.rb +0 -247
- data/lib/cocoapods-binary-cache/prebuild_cache.rb +0 -47
- data/lib/cocoapods-binary-cache/scheme_editor.rb +0 -35
|
@@ -1,16 +1,15 @@
|
|
|
1
1
|
module Pod
|
|
2
2
|
class Prebuild
|
|
3
|
-
|
|
4
3
|
# Check the targets, for the current limitation of the plugin
|
|
5
4
|
#
|
|
6
5
|
# @param [Array<PodTarget>] prebuilt_targets
|
|
7
6
|
def self.check_one_pod_should_have_only_one_target(prebuilt_targets)
|
|
8
|
-
targets_have_different_platforms = prebuilt_targets.
|
|
7
|
+
targets_have_different_platforms = prebuilt_targets.reject { |t| t.pod_name == t.name }
|
|
8
|
+
return unless targets_have_different_platforms.empty?
|
|
9
9
|
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
message = "Oops, you came across a limitation of cocoapods-binary.
|
|
10
|
+
names = targets_have_different_platforms.map(&:pod_name)
|
|
11
|
+
raw_names = targets_have_different_platforms.map(&:name)
|
|
12
|
+
message = "Oops, you came across a limitation of cocoapods-binary.
|
|
14
13
|
|
|
15
14
|
The plugin requires that one pod should have ONLY ONE target in the 'Pod.xcodeproj'. There are mainly 2 situations \
|
|
16
15
|
causing this problem:
|
|
@@ -36,10 +35,8 @@ causing this problem:
|
|
|
36
35
|
end
|
|
37
36
|
```
|
|
38
37
|
|
|
39
|
-
Related pods: #{names}, target names: #{raw_names}
|
|
40
|
-
|
|
41
|
-
raise Informative, message
|
|
42
|
-
end
|
|
38
|
+
Related pods: #{names}, target names: #{raw_names}"
|
|
39
|
+
raise Informative, message
|
|
43
40
|
end
|
|
44
41
|
end
|
|
45
42
|
end
|
|
@@ -1,12 +1,10 @@
|
|
|
1
1
|
require_relative "helper/podfile_options"
|
|
2
2
|
require_relative "helper/prebuild_sandbox"
|
|
3
|
-
require_relative "helper/passer"
|
|
4
3
|
require_relative "helper/names"
|
|
5
4
|
require_relative "helper/target_checker"
|
|
6
5
|
require_relative "integration/alter_specs"
|
|
7
|
-
require_relative "integration/remove_target_files"
|
|
8
|
-
require_relative "integration/source_installer"
|
|
9
6
|
require_relative "integration/validation"
|
|
10
7
|
require_relative "integration/patch/embed_framework_script"
|
|
8
|
+
require_relative "integration/patch/sandbox_analyzer_state"
|
|
11
9
|
require_relative "integration/patch/resolve_dependencies"
|
|
12
10
|
require_relative "integration/patch/source_installation"
|
|
@@ -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)
|
|
@@ -9,7 +9,7 @@ module Pod
|
|
|
9
9
|
class EmbedFrameworksScript
|
|
10
10
|
old_method = instance_method(:script)
|
|
11
11
|
define_method(:script) do
|
|
12
|
-
script = old_method.bind(self).
|
|
12
|
+
script = old_method.bind(self).call
|
|
13
13
|
patch = <<-SH.strip_heredoc
|
|
14
14
|
#!/bin/sh
|
|
15
15
|
# ---- this is added by cocoapods-binary ---
|
|
@@ -7,9 +7,6 @@ module Pod
|
|
|
7
7
|
# Modify specification to use only the prebuild framework after analyzing
|
|
8
8
|
original_resolve_dependencies = instance_method(:resolve_dependencies)
|
|
9
9
|
define_method(:resolve_dependencies) do
|
|
10
|
-
# Remove the old target files. Otherwise, it will not notice file changes.
|
|
11
|
-
# This call is to make sure subsequent pod installations function properly
|
|
12
|
-
remove_target_files_if_needed
|
|
13
10
|
original_resolve_dependencies.bind(self).call
|
|
14
11
|
|
|
15
12
|
# check the pods
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
module Pod
|
|
2
|
+
class Installer
|
|
3
|
+
class Analyzer
|
|
4
|
+
class SandboxAnalyzer
|
|
5
|
+
original_analyze = instance_method(:analyze)
|
|
6
|
+
define_method(:analyze) do
|
|
7
|
+
state = original_analyze.bind(self).call
|
|
8
|
+
state = alter_state(state)
|
|
9
|
+
state
|
|
10
|
+
end
|
|
11
|
+
|
|
12
|
+
private
|
|
13
|
+
|
|
14
|
+
def alter_state(state)
|
|
15
|
+
return state if PodPrebuild.config.tracked_prebuilt_pod_names.empty?
|
|
16
|
+
|
|
17
|
+
prebuilt = PodPrebuild.config.tracked_prebuilt_pod_names
|
|
18
|
+
Pod::UI.message "Alter sandbox state: treat prebuilt frameworks as added: #{prebuilt.to_a}"
|
|
19
|
+
SpecsState.new(
|
|
20
|
+
:added => (state.added + prebuilt).uniq,
|
|
21
|
+
:changed => state.changed - prebuilt,
|
|
22
|
+
:removed => state.deleted - prebuilt,
|
|
23
|
+
:unchanged => state.unchanged - prebuilt
|
|
24
|
+
)
|
|
25
|
+
end
|
|
26
|
+
end
|
|
27
|
+
end
|
|
28
|
+
end
|
|
29
|
+
end
|
|
@@ -1,27 +1,44 @@
|
|
|
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
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
if should_integrate_prebuilt_pod?(pod_name)
|
|
9
|
-
pod_installer.install_for_prebuild!(sandbox)
|
|
6
|
+
alias original_create_pod_installer create_pod_installer
|
|
7
|
+
def create_pod_installer(name)
|
|
8
|
+
if should_integrate_prebuilt_pod?(name)
|
|
9
|
+
create_prebuilt_source_installer(name)
|
|
10
10
|
else
|
|
11
|
-
|
|
11
|
+
create_normal_source_installer(name)
|
|
12
12
|
end
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
end
|
|
14
|
+
|
|
15
|
+
private
|
|
16
|
+
|
|
17
|
+
def create_normal_source_installer(name)
|
|
18
|
+
original_create_pod_installer(name)
|
|
19
|
+
end
|
|
20
|
+
|
|
21
|
+
def create_prebuilt_source_installer(name)
|
|
22
|
+
source_installer = PodSourceInstaller.new(sandbox, podfile, specs_for_pod(name))
|
|
23
|
+
pod_installer = PrebuiltSourceInstaller.new(
|
|
24
|
+
sandbox,
|
|
25
|
+
podfile,
|
|
26
|
+
specs_for_pod(name),
|
|
27
|
+
source_installer: source_installer
|
|
28
|
+
)
|
|
29
|
+
pod_installers << pod_installer
|
|
30
|
+
pod_installer
|
|
15
31
|
end
|
|
16
32
|
|
|
17
33
|
def should_integrate_prebuilt_pod?(name)
|
|
18
|
-
if
|
|
34
|
+
if PodPrebuild.config.prebuild_job? && PodPrebuild.config.targets_to_prebuild_from_cli.empty?
|
|
19
35
|
# In a prebuild job, at the integration stage, all prebuilt frameworks should be
|
|
20
36
|
# ready for integration regardless of whether there was any cache miss or not.
|
|
21
37
|
# Those that are missed were prebuilt in the prebuild stage.
|
|
22
|
-
PodPrebuild
|
|
38
|
+
PodPrebuild.state.cache_validation.include?(name)
|
|
23
39
|
else
|
|
24
|
-
PodPrebuild
|
|
40
|
+
prebuilt = PodPrebuild.state.cache_validation.hit + PodPrebuild.config.targets_to_prebuild_from_cli
|
|
41
|
+
prebuilt.include?(name)
|
|
25
42
|
end
|
|
26
43
|
end
|
|
27
44
|
end
|
|
@@ -1,79 +1,50 @@
|
|
|
1
|
-
# NOTE:
|
|
2
|
-
# This file will only be loaded on normal pod install step
|
|
3
|
-
# so there's no need to check is_prebuild_stage
|
|
4
|
-
|
|
5
|
-
# Provide a special "download" process for prebuilded pods.
|
|
6
|
-
#
|
|
7
|
-
# As the frameworks is already exsited in local folder. We
|
|
8
|
-
# just create a symlink to the original target folder.
|
|
9
|
-
#
|
|
10
1
|
module Pod
|
|
11
2
|
class Installer
|
|
12
|
-
class PodSourceInstaller
|
|
13
|
-
def
|
|
14
|
-
|
|
3
|
+
class PrebuiltSourceInstaller < PodSourceInstaller
|
|
4
|
+
def initialize(*args, **kwargs)
|
|
5
|
+
@source_installer = kwargs.delete(:source_installer)
|
|
6
|
+
super(*args, **kwargs)
|
|
7
|
+
end
|
|
15
8
|
|
|
16
|
-
|
|
17
|
-
prebuild_sandbox
|
|
18
|
-
|
|
19
|
-
target_names = prebuild_sandbox.existed_target_names_for_pod_name(self.name)
|
|
9
|
+
def prebuild_sandbox
|
|
10
|
+
@prebuild_sandbox ||= Pod::PrebuildSandbox.from_standard_sandbox(sandbox)
|
|
11
|
+
end
|
|
20
12
|
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if child.directory?
|
|
26
|
-
walk(child, &action) if result
|
|
27
|
-
end
|
|
28
|
-
end
|
|
29
|
-
end
|
|
13
|
+
def install!
|
|
14
|
+
@source_installer.install! if PodPrebuild.config.still_download_sources?(name)
|
|
15
|
+
install_prebuilt_framework!
|
|
16
|
+
end
|
|
30
17
|
|
|
31
|
-
|
|
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
|
|
18
|
+
private
|
|
38
19
|
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
make_link(source, target)
|
|
42
|
-
end
|
|
20
|
+
def install_prebuilt_framework!
|
|
21
|
+
return if !PodPrebuild.config.dev_pods_enabled? && sandbox.local?(name)
|
|
43
22
|
|
|
23
|
+
# make a symlink to target folder
|
|
24
|
+
# TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
|
|
25
|
+
# if spec used in multiple platforms, it may return multiple paths
|
|
26
|
+
target_names = prebuild_sandbox.existed_target_names_for_pod_name(name)
|
|
44
27
|
target_names.each do |name|
|
|
45
|
-
|
|
46
|
-
# symbol link copy all substructure
|
|
47
28
|
real_file_folder = prebuild_sandbox.framework_folder_path_for_target_name(name)
|
|
48
29
|
|
|
49
30
|
# If have only one platform, just place int the root folder of this pod.
|
|
50
31
|
# If have multiple paths, we use a sperated folder to store different
|
|
51
32
|
# platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
|
|
52
|
-
|
|
53
|
-
target_folder
|
|
54
|
-
|
|
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
|
|
33
|
+
target_folder = sandbox.pod_dir(self.name)
|
|
34
|
+
target_folder += real_file_folder.basename if target_names.count > 1
|
|
35
|
+
target_folder += PodPrebuild.config.prebuilt_path
|
|
36
|
+
target_folder.rmtree if target_folder.exist?
|
|
37
|
+
target_folder.mkpath
|
|
64
38
|
|
|
65
39
|
walk(real_file_folder) do |child|
|
|
66
40
|
source = child
|
|
67
41
|
# 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
|
|
42
|
+
if child.directory? && [".framework", ".dSYM"].include?(child.extname)
|
|
43
|
+
mirror_with_symlink(source, real_file_folder, target_folder) if child.extname == ".framework"
|
|
44
|
+
# Ignore dsym here to avoid cocoapods from adding install_dsym to buildphase-script
|
|
45
|
+
# That can cause duplicated output files error in Xcode 11 (warning in Xcode 10)
|
|
46
|
+
# We need more setup to support local debuging with prebuilt dSYM
|
|
47
|
+
next false # Don't go deeper
|
|
77
48
|
elsif child.file?
|
|
78
49
|
mirror_with_symlink(source, real_file_folder, target_folder)
|
|
79
50
|
next true
|
|
@@ -87,8 +58,9 @@ module Pod
|
|
|
87
58
|
next unless metadata.static_framework?
|
|
88
59
|
|
|
89
60
|
metadata.resources.each do |path|
|
|
90
|
-
target_file_path = path
|
|
91
|
-
|
|
61
|
+
target_file_path = path
|
|
62
|
+
.sub("${PODS_ROOT}", sandbox.root.to_path)
|
|
63
|
+
.sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
|
|
92
64
|
real_file_path = real_file_folder + metadata.framework_name + File.basename(path)
|
|
93
65
|
case File.extname(path)
|
|
94
66
|
when ".xib"
|
|
@@ -106,6 +78,30 @@ module Pod
|
|
|
106
78
|
end
|
|
107
79
|
end
|
|
108
80
|
end
|
|
81
|
+
|
|
82
|
+
def walk(path, &action)
|
|
83
|
+
return unless path.exist?
|
|
84
|
+
|
|
85
|
+
path.children.each do |child|
|
|
86
|
+
result = action.call(child, &action)
|
|
87
|
+
if child.directory?
|
|
88
|
+
walk(child, &action) if result
|
|
89
|
+
end
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
def make_link(source, target)
|
|
94
|
+
source = Pathname.new(source)
|
|
95
|
+
target = Pathname.new(target)
|
|
96
|
+
target.rmtree if target.exist?
|
|
97
|
+
target.parent.mkpath unless target.parent.exist?
|
|
98
|
+
relative_source = source.relative_path_from(target.parent)
|
|
99
|
+
FileUtils.ln_sf(relative_source, target)
|
|
100
|
+
end
|
|
101
|
+
|
|
102
|
+
def mirror_with_symlink(source, basefolder, target_folder)
|
|
103
|
+
make_link(source, target_folder + source.relative_path_from(basefolder))
|
|
104
|
+
end
|
|
109
105
|
end
|
|
110
106
|
end
|
|
111
107
|
end
|
|
@@ -1,131 +1,63 @@
|
|
|
1
1
|
require "fileutils"
|
|
2
|
-
require_relative "../pod-rome/build_framework"
|
|
3
2
|
require_relative "../prebuild_output/output"
|
|
4
|
-
require_relative "helper/
|
|
3
|
+
require_relative "../helper/lockfile"
|
|
5
4
|
require_relative "helper/target_checker"
|
|
5
|
+
require_relative "helper/build"
|
|
6
6
|
|
|
7
|
-
# patch prebuild ability
|
|
8
7
|
module Pod
|
|
9
|
-
class PrebuildInstaller < Installer
|
|
8
|
+
class PrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength
|
|
9
|
+
attr_reader :lockfile_wrapper
|
|
10
|
+
|
|
10
11
|
def initialize(options)
|
|
11
12
|
super(options[:sandbox], options[:podfile], options[:lockfile])
|
|
12
13
|
@cache_validation = options[:cache_validation]
|
|
14
|
+
@lockfile_wrapper = lockfile && PodPrebuild::Lockfile.new(lockfile)
|
|
13
15
|
end
|
|
14
16
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
def local_manifest
|
|
18
|
-
@local_manifest ||= sandbox.manifest
|
|
19
|
-
end
|
|
20
|
-
|
|
21
|
-
# @return [Analyzer::SpecsState]
|
|
22
|
-
def prebuild_pods_changes
|
|
23
|
-
return nil if local_manifest.nil?
|
|
17
|
+
def run_code_gen!(targets)
|
|
18
|
+
return if PodPrebuild.config.prebuild_code_gen.nil?
|
|
24
19
|
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
|
28
|
-
# save the chagnes info for later stage
|
|
29
|
-
Pod::Prebuild::Passer.prebuild_pods_changes = @prebuild_pods_changes
|
|
20
|
+
Pod::UI.title("Running code generation...") do
|
|
21
|
+
PodPrebuild.config.prebuild_code_gen.call(self, targets)
|
|
30
22
|
end
|
|
31
|
-
@prebuild_pods_changes
|
|
32
|
-
end
|
|
33
|
-
|
|
34
|
-
def blacklisted?(name)
|
|
35
|
-
PodPrebuild::StateStore.excluded_pods.include?(name)
|
|
36
|
-
end
|
|
37
|
-
|
|
38
|
-
def cache_hit?(name)
|
|
39
|
-
@cache_validation.hit?(name)
|
|
40
23
|
end
|
|
41
24
|
|
|
42
|
-
def should_not_prebuild_vendor_pod(name)
|
|
43
|
-
return true if blacklisted?(name)
|
|
44
|
-
return false if Pod::Podfile::DSL.prebuild_all_vendor_pods
|
|
45
|
-
|
|
46
|
-
cache_hit?(name)
|
|
47
|
-
end
|
|
48
|
-
|
|
49
|
-
public
|
|
50
|
-
|
|
51
25
|
def prebuild_output
|
|
52
26
|
@prebuild_output ||= PodPrebuild::Output.new(sandbox)
|
|
53
27
|
end
|
|
54
28
|
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
# build options
|
|
60
|
-
sandbox_path = sandbox.root
|
|
61
|
-
existed_framework_folder = sandbox.generate_framework_path
|
|
62
|
-
bitcode_enabled = Pod::Podfile::DSL.bitcode_enabled
|
|
63
|
-
targets = []
|
|
64
|
-
|
|
65
|
-
if Pod::Podfile::DSL.prebuild_all_vendor_pods
|
|
66
|
-
UI.puts "Rebuild all vendor frameworks"
|
|
67
|
-
targets = pod_targets
|
|
68
|
-
elsif !local_manifest.nil?
|
|
69
|
-
UI.puts "Update some frameworks"
|
|
70
|
-
changes = prebuild_pods_changes
|
|
71
|
-
added = changes.added
|
|
72
|
-
changed = changes.changed
|
|
73
|
-
unchanged = changes.unchanged
|
|
74
|
-
|
|
75
|
-
existed_framework_folder.mkdir unless existed_framework_folder.exist?
|
|
76
|
-
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
|
|
77
|
-
|
|
78
|
-
# additions
|
|
79
|
-
missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }
|
|
80
|
-
|
|
81
|
-
root_names_to_update = (added + changed + missing)
|
|
82
|
-
root_names_to_update += PodPrebuild::StateStore.cache_validation.missed
|
|
83
|
-
|
|
84
|
-
# transform names to targets
|
|
85
|
-
cache = []
|
|
86
|
-
targets = root_names_to_update.map do |pod_name|
|
|
87
|
-
tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache) || []
|
|
88
|
-
raise "There's no target named (#{pod_name}) in Pod.xcodeproj" if tars.empty?
|
|
89
|
-
|
|
90
|
-
tars
|
|
91
|
-
end.flatten
|
|
92
|
-
|
|
93
|
-
# add the dendencies
|
|
94
|
-
dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []
|
|
95
|
-
targets = (targets + dependency_targets).uniq
|
|
96
|
-
else
|
|
97
|
-
UI.puts "Rebuild all frameworks"
|
|
98
|
-
targets = pod_targets
|
|
29
|
+
def targets_to_prebuild
|
|
30
|
+
to_build = PodPrebuild.config.targets_to_prebuild_from_cli
|
|
31
|
+
if to_build.empty?
|
|
32
|
+
to_build = PodPrebuild.config.prebuild_all_pods? ? @cache_validation.all : @cache_validation.missed
|
|
99
33
|
end
|
|
34
|
+
pod_targets.select { |target| to_build.include?(target.name) }
|
|
35
|
+
end
|
|
100
36
|
|
|
101
|
-
|
|
102
|
-
|
|
37
|
+
def prebuild_frameworks!
|
|
38
|
+
existed_framework_folder = sandbox.generate_framework_path
|
|
39
|
+
sandbox_path = sandbox.root
|
|
40
|
+
targets = targets_to_prebuild
|
|
41
|
+
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}".magenta
|
|
103
42
|
|
|
104
|
-
|
|
105
|
-
Pod::UI.puts "Prebuild frameworks (total #{targets.count})"
|
|
106
|
-
Pod::UI.puts targets.map(&:name)
|
|
43
|
+
run_code_gen!(targets)
|
|
107
44
|
|
|
108
45
|
Pod::Prebuild.remove_build_dir(sandbox_path)
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
46
|
+
Pod::Prebuild.build(
|
|
47
|
+
sandbox: sandbox_path,
|
|
48
|
+
targets: targets,
|
|
49
|
+
configuration: PodPrebuild.config.prebuild_config,
|
|
50
|
+
output_path: sandbox.generate_framework_path,
|
|
51
|
+
bitcode_enabled: PodPrebuild.config.bitcode_enabled?,
|
|
52
|
+
device_build_enabled: PodPrebuild.config.device_build_enabled?,
|
|
53
|
+
disable_dsym: PodPrebuild.config.disable_dsym?,
|
|
54
|
+
args: PodPrebuild.config.build_args
|
|
55
|
+
)
|
|
56
|
+
Pod::Prebuild.remove_build_dir(sandbox_path)
|
|
114
57
|
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
Pod::Prebuild.build(
|
|
118
|
-
sandbox_path,
|
|
119
|
-
target,
|
|
120
|
-
Pod::Podfile::DSL.prebuild_config,
|
|
121
|
-
output_path,
|
|
122
|
-
bitcode_enabled,
|
|
123
|
-
Pod::Podfile::DSL.custom_device_build_options,
|
|
124
|
-
Pod::Podfile::DSL.custom_simulator_build_options
|
|
125
|
-
)
|
|
126
|
-
collect_metadata(target, output_path)
|
|
58
|
+
targets.each do |target|
|
|
59
|
+
collect_metadata(target, sandbox.framework_folder_path_for_target_name(target.name))
|
|
127
60
|
end
|
|
128
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
|
129
61
|
|
|
130
62
|
# copy vendored libraries and frameworks
|
|
131
63
|
targets.each do |target|
|
|
@@ -135,7 +67,6 @@ module Pod
|
|
|
135
67
|
# If target shouldn't build, we copy all the original files
|
|
136
68
|
# This is for target with only .a and .h files
|
|
137
69
|
unless target.should_build?
|
|
138
|
-
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
|
|
139
70
|
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
|
|
140
71
|
next
|
|
141
72
|
end
|
|
@@ -166,12 +97,12 @@ module Pod
|
|
|
166
97
|
all_needed_names.include? name
|
|
167
98
|
end
|
|
168
99
|
useless_target_names.each do |name|
|
|
169
|
-
UI.
|
|
100
|
+
Pod::UI.message "Remove: #{name}"
|
|
170
101
|
path = sandbox.framework_folder_path_for_target_name(name)
|
|
171
102
|
path.rmtree if path.exist?
|
|
172
103
|
end
|
|
173
104
|
|
|
174
|
-
if
|
|
105
|
+
if PodPrebuild.config.dont_remove_source_code?
|
|
175
106
|
# just remove the tmp files
|
|
176
107
|
path = sandbox.root + "Manifest.lock.tmp"
|
|
177
108
|
path.rmtree if path.exist?
|
|
@@ -182,13 +113,10 @@ module Pod
|
|
|
182
113
|
to_delete_files.each { |file| file.rmtree if file.exist? }
|
|
183
114
|
end
|
|
184
115
|
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
prebuild_output.write_delta_file(updated_target_names, deleted_target_names)
|
|
191
|
-
prebuild_output.process_prebuilt_dev_pods
|
|
116
|
+
prebuild_output.write_delta_file(
|
|
117
|
+
updated: targets.map { |target| target.label.to_s },
|
|
118
|
+
deleted: useless_target_names
|
|
119
|
+
)
|
|
192
120
|
end
|
|
193
121
|
|
|
194
122
|
def clean_delta_file
|
|
@@ -209,8 +137,14 @@ module Pod
|
|
|
209
137
|
metadata.build_settings = pods_project.targets
|
|
210
138
|
.detect { |native_target| native_target.name == target.name }
|
|
211
139
|
.build_configurations
|
|
212
|
-
.detect { |config| config.name ==
|
|
140
|
+
.detect { |config| config.name == PodPrebuild.config.prebuild_config }
|
|
213
141
|
.build_settings
|
|
142
|
+
metadata.source_hash = @lockfile_wrapper && @lockfile_wrapper.dev_pod_hash(target.name)
|
|
143
|
+
|
|
144
|
+
# Store root path for code-coverage support later
|
|
145
|
+
# TODO: update driver code-coverage logic to use path stored here
|
|
146
|
+
project_root = PathUtils.remove_last_path_component(@sandbox.standard_sanbox_path.to_s)
|
|
147
|
+
metadata.project_root = project_root
|
|
214
148
|
metadata.save!
|
|
215
149
|
end
|
|
216
150
|
|
|
@@ -218,7 +152,7 @@ module Pod
|
|
|
218
152
|
old_method2 = instance_method(:run_plugins_post_install_hooks)
|
|
219
153
|
define_method(:run_plugins_post_install_hooks) do
|
|
220
154
|
old_method2.bind(self).call
|
|
221
|
-
prebuild_frameworks! if
|
|
155
|
+
prebuild_frameworks! if PodPrebuild::Env.prebuild_stage?
|
|
222
156
|
end
|
|
223
157
|
end
|
|
224
158
|
end
|