cocoapods-binary-cache 0.1.7 → 0.1.12
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/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/diagnosis.rb +9 -1
- data/lib/cocoapods-binary-cache/diagnosis/integration.rb +3 -1
- data/lib/cocoapods-binary-cache/helper/podspec.rb +4 -2
- data/lib/cocoapods-binary-cache/hooks/post_install.rb +2 -12
- data/lib/cocoapods-binary-cache/hooks/pre_install.rb +19 -36
- data/lib/cocoapods-binary-cache/main.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-binary/helper/build.rb +27 -29
- 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 +14 -13
- data/lib/cocoapods-binary-cache/pod-binary/helper/target_checker.rb +7 -10
- data/lib/cocoapods-binary-cache/pod-binary/integration.rb +1 -2
- data/lib/cocoapods-binary-cache/pod-binary/integration/alter_specs.rb +32 -15
- 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 +25 -11
- data/lib/cocoapods-binary-cache/pod-binary/integration/source_installer.rb +30 -19
- data/lib/cocoapods-binary-cache/pod-binary/prebuild.rb +30 -108
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_dsl.rb +0 -2
- data/lib/cocoapods-binary-cache/pod-binary/prebuild_hook.rb +0 -1
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_command.rb +222 -146
- data/lib/cocoapods-binary-cache/pod-rome/xcodebuild_raw.rb +45 -32
- data/lib/cocoapods-binary-cache/prebuild_output/output.rb +6 -4
- data/lib/cocoapods-binary-cache/state_store.rb +16 -6
- data/lib/command/config.rb +42 -4
- data/lib/command/executor/base.rb +18 -1
- data/lib/command/executor/fetcher.rb +21 -3
- data/lib/command/executor/prebuilder.rb +9 -7
- data/lib/command/executor/pusher.rb +20 -4
- data/lib/command/executor/visualizer.rb +3 -2
- data/lib/command/prebuild.rb +6 -0
- metadata +17 -7
- data/lib/cocoapods-binary-cache/pod-binary/helper/feature_switches.rb +0 -52
- 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/scheme_editor.rb +0 -35
@@ -3,7 +3,7 @@ module Pod
|
|
3
3
|
# Returns the names of pod targets detected as prebuilt, including
|
4
4
|
# those declared in Podfile and their dependencies
|
5
5
|
def prebuilt_pod_names
|
6
|
-
prebuilt_pod_targets.map(&:name)
|
6
|
+
prebuilt_pod_targets.map(&:name).to_set
|
7
7
|
end
|
8
8
|
|
9
9
|
# Returns the pod targets detected as prebuilt, including
|
@@ -5,42 +5,43 @@ module Pod
|
|
5
5
|
# [String] standard_sandbox_path
|
6
6
|
def self.from_standard_sanbox_path(path)
|
7
7
|
prebuild_sandbox_path = Pathname.new(path).realpath + ".." + PodPrebuild.config.prebuild_sandbox_path
|
8
|
-
|
8
|
+
new(prebuild_sandbox_path)
|
9
9
|
end
|
10
10
|
|
11
11
|
def self.from_standard_sandbox(sandbox)
|
12
|
-
|
12
|
+
from_standard_sanbox_path(sandbox.root)
|
13
13
|
end
|
14
14
|
|
15
15
|
def standard_sanbox_path
|
16
|
-
|
16
|
+
root.parent
|
17
17
|
end
|
18
18
|
|
19
19
|
def generate_framework_path
|
20
|
-
|
20
|
+
root + "GeneratedFrameworks"
|
21
21
|
end
|
22
22
|
|
23
23
|
# @param name [String] pass the target.name (may containing platform suffix)
|
24
24
|
# @return [Pathname] the folder containing the framework file.
|
25
25
|
def framework_folder_path_for_target_name(name)
|
26
|
-
|
26
|
+
generate_framework_path + name
|
27
27
|
end
|
28
28
|
|
29
29
|
def exsited_framework_target_names
|
30
|
-
|
30
|
+
existed_framework_name_pairs.map { |pair| pair[0] }.uniq
|
31
31
|
end
|
32
32
|
|
33
33
|
def exsited_framework_pod_names
|
34
|
-
|
34
|
+
existed_framework_name_pairs.map { |pair| pair[1] }.uniq
|
35
35
|
end
|
36
36
|
|
37
37
|
def existed_target_names_for_pod_name(pod_name)
|
38
|
-
|
38
|
+
existed_framework_name_pairs.select { |pair| pair[1] == pod_name }.map { |pair| pair[0] }
|
39
39
|
end
|
40
40
|
|
41
41
|
def save_pod_name_for_target(target)
|
42
42
|
folder = framework_folder_path_for_target_name(target.name)
|
43
43
|
return unless folder.exist?
|
44
|
+
|
44
45
|
flag_file_path = folder + "#{target.pod_name}.pod_name"
|
45
46
|
File.write(flag_file_path.to_s, "")
|
46
47
|
end
|
@@ -53,16 +54,16 @@ module Pod
|
|
53
54
|
end
|
54
55
|
name = name.basename(".pod_name").to_s unless name.nil?
|
55
56
|
name ||= Pathname.new(target_folder_path).basename.to_s # for compatibility with older version
|
57
|
+
name
|
56
58
|
end
|
57
59
|
|
58
60
|
# Array<[target_name, pod_name]>
|
59
|
-
def
|
61
|
+
def existed_framework_name_pairs
|
60
62
|
return [] unless generate_framework_path.exist?
|
61
|
-
|
62
|
-
|
63
|
+
|
64
|
+
generate_framework_path.children.map do |framework_path|
|
65
|
+
if framework_path.directory? && !framework_path.children.empty?
|
63
66
|
[framework_path.basename.to_s, pod_name_for_target_folder(framework_path)]
|
64
|
-
else
|
65
|
-
nil
|
66
67
|
end
|
67
68
|
end.reject(&:nil?).uniq
|
68
69
|
end
|
@@ -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,11 +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
6
|
require_relative "integration/validation"
|
9
7
|
require_relative "integration/patch/embed_framework_script"
|
8
|
+
require_relative "integration/patch/sandbox_analyzer_state"
|
10
9
|
require_relative "integration/patch/resolve_dependencies"
|
11
10
|
require_relative "integration/patch/source_installation"
|
@@ -4,26 +4,43 @@ module Pod
|
|
4
4
|
cache = []
|
5
5
|
analysis_result.specifications
|
6
6
|
.select { |spec| should_integrate_prebuilt_pod?(spec.root.name) }
|
7
|
-
.
|
7
|
+
.group_by(&:root)
|
8
|
+
.each do |_, specs|
|
9
|
+
first_subspec_or_self = specs.find(&:subspec?) || specs[0]
|
10
|
+
specs.each do |spec|
|
11
|
+
alterations = {
|
12
|
+
:source_files => true,
|
13
|
+
:resources => true,
|
14
|
+
:license => true,
|
15
|
+
:vendored_framework => spec == first_subspec_or_self
|
16
|
+
}
|
17
|
+
alter_spec(spec, alterations, cache)
|
18
|
+
end
|
19
|
+
end
|
8
20
|
end
|
9
21
|
|
10
|
-
|
22
|
+
private
|
23
|
+
|
24
|
+
def alter_spec(spec, alterations, cache)
|
11
25
|
targets = Pod.fast_get_targets_for_pod_name(spec.root.name, pod_targets, cache)
|
12
|
-
targets.
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
26
|
+
platforms = targets.map { |target| target.platform.name.to_s }.uniq
|
27
|
+
|
28
|
+
if alterations[:vendored_framework]
|
29
|
+
targets.each do |target|
|
30
|
+
# Use the prebuilt frameworks as vendered frameworks.
|
31
|
+
# The framework_file_path rule is decided in `install_for_prebuild`,
|
32
|
+
# as to compitable with older version and be less wordy.
|
33
|
+
framework_file_path = target.framework_name
|
34
|
+
framework_file_path = target.name + "/" + framework_file_path if targets.count > 1
|
35
|
+
framework_file_path = PodPrebuild.config.prebuilt_path(path: framework_file_path)
|
36
|
+
add_vendered_framework(spec, target.platform.name.to_s, framework_file_path)
|
37
|
+
end
|
20
38
|
end
|
21
39
|
|
22
|
-
platforms
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
empty_liscence(spec) # to avoid the warning of missing license
|
40
|
+
empty_source_files(spec, platforms) if alterations[:source_files]
|
41
|
+
tweak_resources_for_xib(spec, platforms) if alterations[:resources]
|
42
|
+
tweak_resources_for_resource_bundles(spec, platforms) if alterations[:resources]
|
43
|
+
empty_liscence(spec) if alterations[:license]
|
27
44
|
end
|
28
45
|
|
29
46
|
def tweak_resources_for_xib(spec, platforms)
|
@@ -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
|
@@ -3,17 +3,31 @@ require_relative "../source_installer"
|
|
3
3
|
module Pod
|
4
4
|
class Installer
|
5
5
|
# Override the download step to skip download and prepare file in target folder
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
if should_integrate_prebuilt_pod?(pod_name)
|
11
|
-
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)
|
12
10
|
else
|
13
|
-
|
11
|
+
create_normal_source_installer(name)
|
14
12
|
end
|
15
|
-
|
16
|
-
|
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
|
17
31
|
end
|
18
32
|
|
19
33
|
def should_integrate_prebuilt_pod?(name)
|
@@ -21,9 +35,9 @@ module Pod
|
|
21
35
|
# In a prebuild job, at the integration stage, all prebuilt frameworks should be
|
22
36
|
# ready for integration regardless of whether there was any cache miss or not.
|
23
37
|
# Those that are missed were prebuilt in the prebuild stage.
|
24
|
-
PodPrebuild
|
38
|
+
PodPrebuild.state.cache_validation.include?(name)
|
25
39
|
else
|
26
|
-
prebuilt = PodPrebuild
|
40
|
+
prebuilt = PodPrebuild.state.cache_validation.hit + PodPrebuild.config.targets_to_prebuild_from_cli
|
27
41
|
prebuilt.include?(name)
|
28
42
|
end
|
29
43
|
end
|
@@ -1,21 +1,27 @@
|
|
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
|
8
|
+
|
9
|
+
def prebuild_sandbox
|
10
|
+
@prebuild_sandbox ||= Pod::PrebuildSandbox.from_standard_sandbox(sandbox)
|
11
|
+
end
|
12
|
+
|
13
|
+
def install!
|
14
|
+
@source_installer.install!
|
15
|
+
install_prebuilt_framework!
|
16
|
+
end
|
17
|
+
|
18
|
+
private
|
19
|
+
|
20
|
+
def install_prebuilt_framework!
|
21
|
+
return if !PodPrebuild.config.dev_pods_enabled? && sandbox.local?(name)
|
15
22
|
|
16
23
|
# make a symlink to target folder
|
17
24
|
# TODO (bang): Unify to 1 sandbox to optimize and avoid inconsistency
|
18
|
-
prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sanbox)
|
19
25
|
# if spec used in multiple platforms, it may return multiple paths
|
20
26
|
target_names = prebuild_sandbox.existed_target_names_for_pod_name(name)
|
21
27
|
target_names.each do |name|
|
@@ -24,7 +30,7 @@ module Pod
|
|
24
30
|
# If have only one platform, just place int the root folder of this pod.
|
25
31
|
# If have multiple paths, we use a sperated folder to store different
|
26
32
|
# platform frameworks. e.g. AFNetworking/AFNetworking-iOS/AFNetworking.framework
|
27
|
-
target_folder =
|
33
|
+
target_folder = sandbox.pod_dir(self.name)
|
28
34
|
target_folder += real_file_folder.basename if target_names.count > 1
|
29
35
|
target_folder += PodPrebuild.config.prebuilt_path
|
30
36
|
target_folder.rmtree if target_folder.exist?
|
@@ -33,8 +39,10 @@ module Pod
|
|
33
39
|
walk(real_file_folder) do |child|
|
34
40
|
source = child
|
35
41
|
# only make symlink to file and `.framework` folder
|
36
|
-
if child.directory? && [".framework", ".dSYM"].include?(child.extname)
|
37
|
-
|
42
|
+
if child.directory? && [".framework", ".xcframework", ".dSYM"].include?(child.extname)
|
43
|
+
if [".framework", ".xcframework"].include?(child.extname)
|
44
|
+
mirror_with_symlink(source, real_file_folder, target_folder)
|
45
|
+
end
|
38
46
|
# Ignore dsym here to avoid cocoapods from adding install_dsym to buildphase-script
|
39
47
|
# That can cause duplicated output files error in Xcode 11 (warning in Xcode 10)
|
40
48
|
# We need more setup to support local debuging with prebuilt dSYM
|
@@ -52,10 +60,15 @@ module Pod
|
|
52
60
|
next unless metadata.static_framework?
|
53
61
|
|
54
62
|
metadata.resources.each do |path|
|
55
|
-
target_file_path = path
|
63
|
+
target_file_path = Pathname(path)
|
56
64
|
.sub("${PODS_ROOT}", sandbox.root.to_path)
|
57
65
|
.sub("${PODS_CONFIGURATION_BUILD_DIR}", sandbox.root.to_path)
|
66
|
+
next if target_file_path.exist?
|
67
|
+
|
58
68
|
real_file_path = real_file_folder + metadata.framework_name + File.basename(path)
|
69
|
+
|
70
|
+
# TODO (thuyen): Fix https://github.com/grab/cocoapods-binary-cache/issues/45
|
71
|
+
|
59
72
|
case File.extname(path)
|
60
73
|
when ".xib"
|
61
74
|
# https://github.com/grab/cocoapods-binary-cache/issues/7
|
@@ -73,8 +86,6 @@ module Pod
|
|
73
86
|
end
|
74
87
|
end
|
75
88
|
|
76
|
-
private
|
77
|
-
|
78
89
|
def walk(path, &action)
|
79
90
|
return unless path.exist?
|
80
91
|
|
@@ -1,12 +1,11 @@
|
|
1
1
|
require "fileutils"
|
2
2
|
require_relative "../prebuild_output/output"
|
3
3
|
require_relative "../helper/lockfile"
|
4
|
-
require_relative "helper/passer"
|
5
4
|
require_relative "helper/target_checker"
|
6
5
|
require_relative "helper/build"
|
7
6
|
|
8
7
|
module Pod
|
9
|
-
class PrebuildInstaller < Installer
|
8
|
+
class PrebuildInstaller < Installer # rubocop:disable Metrics/ClassLength
|
10
9
|
attr_reader :lockfile_wrapper
|
11
10
|
|
12
11
|
def initialize(options)
|
@@ -15,38 +14,6 @@ module Pod
|
|
15
14
|
@lockfile_wrapper = lockfile && PodPrebuild::Lockfile.new(lockfile)
|
16
15
|
end
|
17
16
|
|
18
|
-
private
|
19
|
-
|
20
|
-
def local_manifest
|
21
|
-
@local_manifest ||= sandbox.manifest
|
22
|
-
end
|
23
|
-
|
24
|
-
# @return [Analyzer::SpecsState]
|
25
|
-
def prebuild_pods_changes
|
26
|
-
return nil if local_manifest.nil?
|
27
|
-
|
28
|
-
if @prebuild_pods_changes.nil?
|
29
|
-
changes = local_manifest.detect_changes_with_podfile(podfile)
|
30
|
-
@prebuild_pods_changes = Analyzer::SpecsState.new(changes)
|
31
|
-
# save the chagnes info for later stage
|
32
|
-
Pod::Prebuild::Passer.prebuild_pods_changes = @prebuild_pods_changes
|
33
|
-
end
|
34
|
-
@prebuild_pods_changes
|
35
|
-
end
|
36
|
-
|
37
|
-
def blacklisted?(name)
|
38
|
-
PodPrebuild::StateStore.excluded_pods.include?(name)
|
39
|
-
end
|
40
|
-
|
41
|
-
def cache_missed?(name)
|
42
|
-
@cache_validation.missed?(name)
|
43
|
-
end
|
44
|
-
|
45
|
-
def should_not_prebuild_vendor_pod(name)
|
46
|
-
return true if blacklisted?(name)
|
47
|
-
return false if PodPrebuild.config.prebuild_all_pods?
|
48
|
-
end
|
49
|
-
|
50
17
|
def run_code_gen!(targets)
|
51
18
|
return if PodPrebuild.config.prebuild_code_gen.nil?
|
52
19
|
|
@@ -55,84 +22,42 @@ module Pod
|
|
55
22
|
end
|
56
23
|
end
|
57
24
|
|
58
|
-
def targets_to_prebuild
|
59
|
-
existed_framework_folder = sandbox.generate_framework_path
|
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?
|
66
|
-
changes = prebuild_pods_changes
|
67
|
-
added = changes.added
|
68
|
-
changed = changes.changed
|
69
|
-
unchanged = changes.unchanged
|
70
|
-
|
71
|
-
existed_framework_folder.mkdir unless existed_framework_folder.exist?
|
72
|
-
exsited_framework_pod_names = sandbox.exsited_framework_pod_names
|
73
|
-
|
74
|
-
# additions
|
75
|
-
missing = unchanged.reject { |pod_name| exsited_framework_pod_names.include?(pod_name) }
|
76
|
-
|
77
|
-
root_names_to_update = (added + changed + missing)
|
78
|
-
root_names_to_update += PodPrebuild::StateStore.cache_validation.missed
|
79
|
-
|
80
|
-
# transform names to targets
|
81
|
-
cache = []
|
82
|
-
targets = root_names_to_update.map do |pod_name|
|
83
|
-
tars = Pod.fast_get_targets_for_pod_name(pod_name, pod_targets, cache) || []
|
84
|
-
raise "There's no target named (#{pod_name}) in Pod.xcodeproj" if tars.empty?
|
85
|
-
|
86
|
-
tars
|
87
|
-
end.flatten
|
88
|
-
|
89
|
-
# add the dendencies
|
90
|
-
dependency_targets = targets.map(&:recursive_dependent_targets).flatten.uniq || []
|
91
|
-
targets = (targets + dependency_targets).uniq
|
92
|
-
end
|
93
|
-
|
94
|
-
unless PodPrebuild.config.prebuild_all_pods?
|
95
|
-
targets = targets.select { |pod_target| cache_missed?(pod_target.name) }
|
96
|
-
end
|
97
|
-
targets = targets.reject { |pod_target| should_not_prebuild_vendor_pod(pod_target.name) }
|
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
|
-
|
104
|
-
public
|
105
|
-
|
106
25
|
def prebuild_output
|
107
26
|
@prebuild_output ||= PodPrebuild::Output.new(sandbox)
|
108
27
|
end
|
109
28
|
|
110
|
-
|
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
|
33
|
+
end
|
34
|
+
pod_targets.select { |target| to_build.include?(target.name) }
|
35
|
+
end
|
36
|
+
|
111
37
|
def prebuild_frameworks!
|
112
|
-
UI.puts "Start prebuild_frameworks"
|
113
38
|
existed_framework_folder = sandbox.generate_framework_path
|
114
39
|
sandbox_path = sandbox.root
|
115
40
|
targets = targets_to_prebuild
|
41
|
+
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}".magenta
|
116
42
|
|
117
|
-
Pod::UI.puts "Prebuild frameworks (total #{targets.count}): #{targets.map(&:name)}"
|
118
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
119
43
|
run_code_gen!(targets)
|
44
|
+
|
45
|
+
PodPrebuild.remove_build_dir(sandbox_path)
|
46
|
+
PodPrebuild.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
|
+
PodPrebuild.remove_build_dir(sandbox_path)
|
57
|
+
|
120
58
|
targets.each do |target|
|
121
|
-
|
122
|
-
output_path.mkpath unless output_path.exist?
|
123
|
-
Pod::Prebuild.build(
|
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
|
132
|
-
)
|
133
|
-
collect_metadata(target, output_path)
|
59
|
+
collect_metadata(target, sandbox.framework_folder_path_for_target_name(target.name))
|
134
60
|
end
|
135
|
-
Pod::Prebuild.remove_build_dir(sandbox_path)
|
136
61
|
|
137
62
|
# copy vendored libraries and frameworks
|
138
63
|
targets.each do |target|
|
@@ -142,7 +67,6 @@ module Pod
|
|
142
67
|
# If target shouldn't build, we copy all the original files
|
143
68
|
# This is for target with only .a and .h files
|
144
69
|
unless target.should_build?
|
145
|
-
Prebuild::Passer.target_names_to_skip_integration_framework << target.name
|
146
70
|
FileUtils.cp_r(root_path, target_folder, :remove_destination => true)
|
147
71
|
next
|
148
72
|
end
|
@@ -173,7 +97,7 @@ module Pod
|
|
173
97
|
all_needed_names.include? name
|
174
98
|
end
|
175
99
|
useless_target_names.each do |name|
|
176
|
-
UI.
|
100
|
+
Pod::UI.message "Remove: #{name}"
|
177
101
|
path = sandbox.framework_folder_path_for_target_name(name)
|
178
102
|
path.rmtree if path.exist?
|
179
103
|
end
|
@@ -189,12 +113,10 @@ module Pod
|
|
189
113
|
to_delete_files.each { |file| file.rmtree if file.exist? }
|
190
114
|
end
|
191
115
|
|
192
|
-
|
193
|
-
|
194
|
-
|
195
|
-
|
196
|
-
|
197
|
-
prebuild_output.write_delta_file(updated_target_names, deleted_target_names)
|
116
|
+
prebuild_output.write_delta_file(
|
117
|
+
updated: targets.map { |target| target.label.to_s },
|
118
|
+
deleted: useless_target_names
|
119
|
+
)
|
198
120
|
end
|
199
121
|
|
200
122
|
def clean_delta_file
|