cocoapods-mapfile 0.2.2 → 0.2.3
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/README.md +65 -64
- data/lib/cocoapods_plugin.rb +16 -16
- data/lib/hmap/command/hmap_gen.rb +19 -27
- data/lib/hmap/command/hmap_reader.rb +5 -5
- data/lib/hmap/command/hmap_writer.rb +5 -3
- data/lib/hmap/command.rb +3 -1
- data/lib/hmap/constants.rb +198 -0
- data/lib/hmap/{executable.rb → helper/executable.rb} +5 -6
- data/lib/hmap/hmap/hmap_bucketstr.rb +20 -0
- data/lib/hmap/{hmap_reader.rb → hmap/hmap_reader.rb} +4 -20
- data/lib/hmap/{hmap_saver.rb → hmap/hmap_saver.rb} +11 -6
- data/lib/hmap/{hmap_struct.rb → hmap/hmap_struct.rb} +0 -0
- data/lib/hmap/hmap/hmap_writer.rb +52 -0
- data/lib/hmap/{mapfile.rb → hmap/mapfile.rb} +1 -1
- data/lib/hmap/user_interface.rb +22 -0
- data/lib/hmap/version.rb +1 -1
- data/lib/hmap/xc/context.rb +23 -0
- data/lib/hmap/xc/header_entry.rb +55 -0
- data/lib/hmap/xc/header_type.rb +32 -0
- data/lib/hmap/xc/pbx_helper.rb +68 -0
- data/lib/hmap/xc/product_helper.rb +36 -0
- data/lib/hmap/xc/resolver.rb +129 -0
- data/lib/hmap/xc/target/build_setting.rb +126 -0
- data/lib/hmap/xc/target/target.rb +76 -0
- data/lib/hmap/xc/target/target_context.rb +29 -0
- data/lib/hmap/xc/target/target_helper.rb +114 -0
- data/lib/hmap/xc/target/target_vfs.rb +122 -0
- data/lib/hmap/xc/target/xcconfig_helper.rb +109 -0
- data/lib/hmap/xc/workspace/project.rb +120 -0
- data/lib/hmap/xc/workspace/project_helper.rb +92 -0
- data/lib/hmap/xc/workspace/workspace.rb +83 -0
- data/lib/hmap.rb +16 -14
- metadata +58 -20
- data/lib/hmap/framework/framework_vfs.rb +0 -94
- data/lib/hmap/helper/build_setting_constants.rb +0 -13
- data/lib/hmap/helper/hmap_helper.rb +0 -212
- data/lib/hmap/helper/pods_helper.rb +0 -98
- data/lib/hmap/helper/xcconfig_helper.rb +0 -105
- data/lib/hmap/hmap_writer.rb +0 -99
- data/lib/hmap/pods_specification.rb +0 -65
@@ -0,0 +1,83 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'hmap/xc/product_helper'
|
4
|
+
require 'hmap/xc/workspace/project'
|
5
|
+
require 'hmap/xc/pbx_helper'
|
6
|
+
|
7
|
+
module HMap
|
8
|
+
class Workspace
|
9
|
+
attr_reader :save_setting, :projects
|
10
|
+
|
11
|
+
def self.new_from_xcworkspaces(paths)
|
12
|
+
paths.flat_map do |path|
|
13
|
+
xc = Xcodeproj::Workspace.new_from_xcworkspace(path)
|
14
|
+
schemes = xc.schemes.values.uniq || []
|
15
|
+
ss = WorkspaceProductPath.new(path)
|
16
|
+
projects = PBXHelper.projects(*schemes)
|
17
|
+
new(ss, projects)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def self.new_from_xcprojects(paths)
|
22
|
+
paths.map do |path|
|
23
|
+
ss = ProjectProductPath.new(path)
|
24
|
+
projects = PBXHelper.projects(path)
|
25
|
+
new(ss, projects)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
def initialize(save_setting, projects)
|
30
|
+
@save_setting = save_setting
|
31
|
+
@projects = projects.map { |project| Project.new(project, self) }
|
32
|
+
end
|
33
|
+
|
34
|
+
def build_root
|
35
|
+
save_setting.build_root
|
36
|
+
end
|
37
|
+
|
38
|
+
def obj_root
|
39
|
+
save_setting.obj_root
|
40
|
+
end
|
41
|
+
|
42
|
+
def name
|
43
|
+
save_setting.name
|
44
|
+
end
|
45
|
+
|
46
|
+
def workspace_dir
|
47
|
+
File.dirname(save_setting.path)
|
48
|
+
end
|
49
|
+
|
50
|
+
def hmap_root
|
51
|
+
dir = build_root.dirname.dirname
|
52
|
+
File.join(dir, Constants::HMAP_DIR)
|
53
|
+
end
|
54
|
+
|
55
|
+
def write_save!
|
56
|
+
UserInterface.puts("[hmapfile] Got workspace/project build directory..............")
|
57
|
+
UserInterface.puts("[hmapfile] #{name} Build directory: #{hmap_root} ..............")
|
58
|
+
write_hmapfile!
|
59
|
+
save_hmap_settings!
|
60
|
+
end
|
61
|
+
|
62
|
+
def write_hmapfile!
|
63
|
+
UserInterface.puts('[hmapfile] Starting generate hmap file..............')
|
64
|
+
projects.each(&:write_hmapfile!)
|
65
|
+
end
|
66
|
+
|
67
|
+
def save_hmap_settings!
|
68
|
+
UserInterface.puts('[hmapfile] Saving hmap settings..............')
|
69
|
+
|
70
|
+
projects.each(&:save_hmap_settings!)
|
71
|
+
end
|
72
|
+
|
73
|
+
def remove_hmap_settings!
|
74
|
+
UserInterface.puts('[hmapfile] Cleanning hmap settings..............')
|
75
|
+
FileUtils.rm_rf(hmap_root) if Dir.exist?(hmap_root)
|
76
|
+
projects.each(&:remove_hmap_settings!)
|
77
|
+
end
|
78
|
+
|
79
|
+
def all_target_headers
|
80
|
+
@projects.flat_map(&:targets).flat_map(&:all_target_headers)
|
81
|
+
end
|
82
|
+
end
|
83
|
+
end
|
data/lib/hmap.rb
CHANGED
@@ -1,22 +1,24 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
+
require 'xcodeproj'
|
4
|
+
|
3
5
|
# The primary namespace for cocoapods-hmap.
|
4
6
|
module HMap
|
7
|
+
require 'pathname'
|
8
|
+
require 'claide'
|
9
|
+
|
5
10
|
require_relative 'hmap/version'
|
6
|
-
require_relative 'hmap/
|
7
|
-
require_relative 'hmap/helper/pods_helper'
|
8
|
-
require_relative 'hmap/exceptions'
|
9
|
-
require_relative 'hmap/framework/framework_vfs'
|
10
|
-
require_relative 'hmap/hmap_saver'
|
11
|
-
require_relative 'hmap/pods_specification'
|
12
|
-
require_relative 'hmap/helper/xcconfig_helper'
|
13
|
-
require_relative 'hmap/helper/utils'
|
14
|
-
require_relative 'hmap/helper/hmap_helper'
|
15
|
-
require_relative 'hmap/helper/build_setting_constants'
|
11
|
+
require_relative 'hmap/user_interface'
|
16
12
|
|
13
|
+
# autoload registers a file path to be loaded the first time
|
14
|
+
# that a specified module or class is accessed in the namespace of the calling module or class.
|
17
15
|
autoload :Command, 'hmap/command'
|
18
|
-
autoload :
|
19
|
-
autoload :
|
20
|
-
autoload :
|
21
|
-
autoload :
|
16
|
+
autoload :Utils, 'hmap/helper/utils'
|
17
|
+
autoload :Constants, 'hmap/constants'
|
18
|
+
autoload :BucketStr, 'hmap/hmap/hmap_bucketstr'
|
19
|
+
autoload :HMapSaver, 'hmap/hmap/hmap_saver'
|
20
|
+
autoload :MapFileWriter, 'hmap/hmap/hmap_writer'
|
21
|
+
autoload :MapFileReader, 'hmap/hmap/hmap_reader'
|
22
|
+
|
23
|
+
# autoload :Struct, 'hmap/hmap/hmap_struct'
|
22
24
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-mapfile
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Cat1237
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-
|
11
|
+
date: 2021-11-08 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -67,33 +67,59 @@ dependencies:
|
|
67
67
|
- !ruby/object:Gem::Version
|
68
68
|
version: '3.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
|
-
name:
|
70
|
+
name: claide
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - ">="
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version:
|
75
|
+
version: 1.0.2
|
76
|
+
- - "<"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '2.0'
|
76
79
|
type: :runtime
|
77
80
|
prerelease: false
|
78
81
|
version_requirements: !ruby/object:Gem::Requirement
|
79
82
|
requirements:
|
80
83
|
- - ">="
|
81
84
|
- !ruby/object:Gem::Version
|
82
|
-
version:
|
85
|
+
version: 1.0.2
|
86
|
+
- - "<"
|
87
|
+
- !ruby/object:Gem::Version
|
88
|
+
version: '2.0'
|
89
|
+
- !ruby/object:Gem::Dependency
|
90
|
+
name: xcodeproj
|
91
|
+
requirement: !ruby/object:Gem::Requirement
|
92
|
+
requirements:
|
93
|
+
- - ">="
|
94
|
+
- !ruby/object:Gem::Version
|
95
|
+
version: 1.19.0
|
96
|
+
- - "<"
|
97
|
+
- !ruby/object:Gem::Version
|
98
|
+
version: '2.0'
|
99
|
+
type: :runtime
|
100
|
+
prerelease: false
|
101
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
|
+
requirements:
|
103
|
+
- - ">="
|
104
|
+
- !ruby/object:Gem::Version
|
105
|
+
version: 1.19.0
|
106
|
+
- - "<"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: '2.0'
|
83
109
|
- !ruby/object:Gem::Dependency
|
84
110
|
name: yaml-vfs
|
85
111
|
requirement: !ruby/object:Gem::Requirement
|
86
112
|
requirements:
|
87
113
|
- - ">="
|
88
114
|
- !ruby/object:Gem::Version
|
89
|
-
version: 0.0.
|
115
|
+
version: 0.0.4
|
90
116
|
type: :runtime
|
91
117
|
prerelease: false
|
92
118
|
version_requirements: !ruby/object:Gem::Requirement
|
93
119
|
requirements:
|
94
120
|
- - ">="
|
95
121
|
- !ruby/object:Gem::Version
|
96
|
-
version: 0.0.
|
122
|
+
version: 0.0.4
|
97
123
|
description: header_reader lets your read Xcode header map file. header-writer lets
|
98
124
|
your analyze the project pod dependencies and gen header map file for all pods.
|
99
125
|
email:
|
@@ -112,21 +138,33 @@ files:
|
|
112
138
|
- lib/hmap/command/hmap_gen.rb
|
113
139
|
- lib/hmap/command/hmap_reader.rb
|
114
140
|
- lib/hmap/command/hmap_writer.rb
|
141
|
+
- lib/hmap/constants.rb
|
115
142
|
- lib/hmap/exceptions.rb
|
116
|
-
- lib/hmap/executable.rb
|
117
|
-
- lib/hmap/framework/framework_vfs.rb
|
118
|
-
- lib/hmap/helper/build_setting_constants.rb
|
119
|
-
- lib/hmap/helper/hmap_helper.rb
|
120
|
-
- lib/hmap/helper/pods_helper.rb
|
143
|
+
- lib/hmap/helper/executable.rb
|
121
144
|
- lib/hmap/helper/utils.rb
|
122
|
-
- lib/hmap/
|
123
|
-
- lib/hmap/hmap_reader.rb
|
124
|
-
- lib/hmap/hmap_saver.rb
|
125
|
-
- lib/hmap/hmap_struct.rb
|
126
|
-
- lib/hmap/hmap_writer.rb
|
127
|
-
- lib/hmap/mapfile.rb
|
128
|
-
- lib/hmap/
|
145
|
+
- lib/hmap/hmap/hmap_bucketstr.rb
|
146
|
+
- lib/hmap/hmap/hmap_reader.rb
|
147
|
+
- lib/hmap/hmap/hmap_saver.rb
|
148
|
+
- lib/hmap/hmap/hmap_struct.rb
|
149
|
+
- lib/hmap/hmap/hmap_writer.rb
|
150
|
+
- lib/hmap/hmap/mapfile.rb
|
151
|
+
- lib/hmap/user_interface.rb
|
129
152
|
- lib/hmap/version.rb
|
153
|
+
- lib/hmap/xc/context.rb
|
154
|
+
- lib/hmap/xc/header_entry.rb
|
155
|
+
- lib/hmap/xc/header_type.rb
|
156
|
+
- lib/hmap/xc/pbx_helper.rb
|
157
|
+
- lib/hmap/xc/product_helper.rb
|
158
|
+
- lib/hmap/xc/resolver.rb
|
159
|
+
- lib/hmap/xc/target/build_setting.rb
|
160
|
+
- lib/hmap/xc/target/target.rb
|
161
|
+
- lib/hmap/xc/target/target_context.rb
|
162
|
+
- lib/hmap/xc/target/target_helper.rb
|
163
|
+
- lib/hmap/xc/target/target_vfs.rb
|
164
|
+
- lib/hmap/xc/target/xcconfig_helper.rb
|
165
|
+
- lib/hmap/xc/workspace/project.rb
|
166
|
+
- lib/hmap/xc/workspace/project_helper.rb
|
167
|
+
- lib/hmap/xc/workspace/workspace.rb
|
130
168
|
homepage: https://github.com/Cat1237/cocoapods-hmap.git
|
131
169
|
licenses:
|
132
170
|
- MIT
|
@@ -146,7 +184,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
146
184
|
- !ruby/object:Gem::Version
|
147
185
|
version: '0'
|
148
186
|
requirements: []
|
149
|
-
rubygems_version: 3.
|
187
|
+
rubygems_version: 3.1.6
|
150
188
|
signing_key:
|
151
189
|
specification_version: 4
|
152
190
|
summary: Read or write header map file.
|
@@ -1,94 +0,0 @@
|
|
1
|
-
require 'yaml_vfs'
|
2
|
-
|
3
|
-
module HMap
|
4
|
-
module Target
|
5
|
-
# Each fremaework vfs informations
|
6
|
-
class FrameworkEntry
|
7
|
-
attr_reader :configuration, :platform, :app_build_dir, :project_temp_dir
|
8
|
-
attr_accessor :headers_real_paths, :modules_real_paths
|
9
|
-
|
10
|
-
def initialize(configuration, platform, app_build_dir, project_temp_dir)
|
11
|
-
@configuration = configuration
|
12
|
-
@platform = platform
|
13
|
-
@app_build_dir = app_build_dir
|
14
|
-
@project_temp_dir = project_temp_dir
|
15
|
-
@headers_real_paths = []
|
16
|
-
@modules_real_paths = []
|
17
|
-
end
|
18
|
-
|
19
|
-
def framework_moduler_path
|
20
|
-
File.join(app_build_dir, 'Modules')
|
21
|
-
end
|
22
|
-
|
23
|
-
def self.new_from_configuration_platform(configuration, platform, name, framework_name)
|
24
|
-
dir = "#{configuration}-#{platform}"
|
25
|
-
app_build_dir = File.join(PodsSpecification.instance.app_build_dir, dir, name,
|
26
|
-
"#{framework_name}.framework")
|
27
|
-
project_temp_dir = File.join(PodsSpecification.instance.project_temp_dir, dir, "#{name}.build")
|
28
|
-
new(configuration, platform, app_build_dir, project_temp_dir)
|
29
|
-
end
|
30
|
-
|
31
|
-
def self.new_entrys_from_configurations_platforms(configurations, platforms, name, framework_name, module_path, headers)
|
32
|
-
effective_platforms = Utils.effective_platforms_names(platforms)
|
33
|
-
configurations.flat_map do |configuration|
|
34
|
-
effective_platforms.map do |platform|
|
35
|
-
entry = new_from_configuration_platform(configuration, platform, name, framework_name)
|
36
|
-
entry.add_headers_modules(module_path, framework_name, headers)
|
37
|
-
entry
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def add_headers_modules(module_path, framework_name, headers)
|
43
|
-
has_private_module = module_path.glob('module*.modulemap').length > 1
|
44
|
-
e_headers = ->(path, *names) { names.inject(Pathname(path)) { |e, n| e.join(n) } }
|
45
|
-
@headers_real_paths += headers
|
46
|
-
@headers_real_paths << e_headers.call(app_build_dir, 'Headers', "#{framework_name}-Swift.h")
|
47
|
-
@modules_real_paths << e_headers.call(project_temp_dir, 'module.modulemap')
|
48
|
-
return unless has_private_module
|
49
|
-
|
50
|
-
@modules_real_paths << e_headers.call(entry.project_temp_dir, 'module.private.modulemap')
|
51
|
-
end
|
52
|
-
end
|
53
|
-
|
54
|
-
# A collection of Each FrameworkEntrys
|
55
|
-
class FrameworkVFS
|
56
|
-
attr_reader :entrys
|
57
|
-
|
58
|
-
def initialize(entrys = [])
|
59
|
-
@entrys = entrys
|
60
|
-
end
|
61
|
-
|
62
|
-
def vfs_path
|
63
|
-
return {} if entrys.empty?
|
64
|
-
|
65
|
-
entrys.each_with_object({}) do |entry, paths|
|
66
|
-
c = "#{entry.configuration}-#{entry.platform}"
|
67
|
-
paths[c] ||= []
|
68
|
-
paths[c] << entry
|
69
|
-
end
|
70
|
-
end
|
71
|
-
|
72
|
-
def vfs_path_by_platform_and_configuration(platform, config)
|
73
|
-
return vfs_path if platform.nil? && config.nil?
|
74
|
-
|
75
|
-
key = platform if config.nil?
|
76
|
-
key = config if platform.nil?
|
77
|
-
vfs_path.select { |k, _| k.include?(key) }
|
78
|
-
end
|
79
|
-
|
80
|
-
def write(path)
|
81
|
-
vfs_path.each do |key, values|
|
82
|
-
es = values.map do |value|
|
83
|
-
VFS::FileCollectorEntry.new(Pathname(value.app_build_dir), value.modules_real_paths,
|
84
|
-
value.headers_real_paths)
|
85
|
-
end
|
86
|
-
fc = VFS::FileCollector.new(es)
|
87
|
-
pa = path.join(key)
|
88
|
-
pa.mkpath unless pa.exist?
|
89
|
-
fc.write_mapping(pa)
|
90
|
-
end
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
@@ -1,13 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
module HMap
|
4
|
-
# A collection of build settings key.
|
5
|
-
module BuildSettingConstants
|
6
|
-
OTHER_CFLAGS = 'OTHER_CFLAGS'
|
7
|
-
OTHER_CPLUSPLUSFLAGS = 'OTHER_CPLUSPLUSFLAGS'
|
8
|
-
HEAD_SEARCH_PATHS = 'HEADER_SEARCH_PATHS'
|
9
|
-
USER_HEADER_SEARCH_PATHS = 'USER_HEADER_SEARCH_PATHS'
|
10
|
-
USE_HEADERMAP = 'USE_HEADERMAP'
|
11
|
-
INGERITED = '$(inherited)'
|
12
|
-
end
|
13
|
-
end
|
@@ -1,212 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'set'
|
4
|
-
|
5
|
-
module HMap
|
6
|
-
# HMap file information
|
7
|
-
class HMapHeaderEntry
|
8
|
-
attr_reader :type, :headers
|
9
|
-
|
10
|
-
def initialize(type)
|
11
|
-
@type = type
|
12
|
-
@headers = []
|
13
|
-
end
|
14
|
-
|
15
|
-
def add_header(header)
|
16
|
-
headers << header
|
17
|
-
end
|
18
|
-
|
19
|
-
def file_name(name)
|
20
|
-
name = 'hmap' if name.nil?
|
21
|
-
[name, '-', type, '.hmap'].join
|
22
|
-
end
|
23
|
-
|
24
|
-
def build_setting_key
|
25
|
-
case type
|
26
|
-
when :i_headers, :iextra_headers
|
27
|
-
yield('-I', :HEADER_SEARCH_PATHS) if block_given?
|
28
|
-
when :iquote_headers, :extra_headers
|
29
|
-
yield('-iquote', :USER_HEADER_SEARCH_PATHS) if block_given?
|
30
|
-
else
|
31
|
-
raise Informative, "Error: header type not expect#{type}"
|
32
|
-
end
|
33
|
-
end
|
34
|
-
|
35
|
-
def build_setting(path, name)
|
36
|
-
full_path = File.join(path, file_name(name))
|
37
|
-
build_setting_key do |key|
|
38
|
-
[key, "\"#{full_path}\""]
|
39
|
-
end
|
40
|
-
end
|
41
|
-
|
42
|
-
def build_setting_xcconfig(path, name)
|
43
|
-
full_path = File.join(path, file_name(name))
|
44
|
-
build_setting_key do |_, xc|
|
45
|
-
[xc, "\"#{full_path}\""]
|
46
|
-
end
|
47
|
-
end
|
48
|
-
end
|
49
|
-
|
50
|
-
# A collection of Each HMapHeaderEntry
|
51
|
-
class HMapHeaders
|
52
|
-
def initialize
|
53
|
-
@public_headers = HMapHeaderEntry.new(:i_headers)
|
54
|
-
@public_headers_e = HMapHeaderEntry.new(:iextra_headers)
|
55
|
-
@private_headers = HMapHeaderEntry.new(:iquote_headers)
|
56
|
-
@private_headers_e = HMapHeaderEntry.new(:extra_headers)
|
57
|
-
@unqi_headers = Set.new
|
58
|
-
end
|
59
|
-
|
60
|
-
def headers
|
61
|
-
public_headers + private_headers
|
62
|
-
end
|
63
|
-
|
64
|
-
def public_headers
|
65
|
-
[@public_headers, @public_headers_e]
|
66
|
-
end
|
67
|
-
|
68
|
-
def private_headers
|
69
|
-
[@private_headers, @private_headers_e]
|
70
|
-
end
|
71
|
-
|
72
|
-
def private_setting_for_reference(path, name)
|
73
|
-
headers_build_settings_for_reference(private_headers, path, name)
|
74
|
-
end
|
75
|
-
|
76
|
-
def public_setting_for_reference(path, name)
|
77
|
-
headers_build_settings_for_reference(public_headers, path, name)
|
78
|
-
end
|
79
|
-
|
80
|
-
def private_setting_for_options(path, name)
|
81
|
-
headers_build_settings_for_options(private_headers, path, name, ' ').join(' ')
|
82
|
-
end
|
83
|
-
|
84
|
-
def public_setting_for_options(path, name)
|
85
|
-
headers_build_settings_for_options(public_headers, path, name).join(' ')
|
86
|
-
end
|
87
|
-
|
88
|
-
def headers_build_settings_for_reference(headers, path, name)
|
89
|
-
headers.each_with_object({}) do |header, setting|
|
90
|
-
se = header.build_setting_xcconfig(path, name)
|
91
|
-
setting.merge!(Hash[*se]) { |_, oldval, newval| [oldval, newval].join(' ') }
|
92
|
-
end
|
93
|
-
end
|
94
|
-
|
95
|
-
def headers_build_settings_for_options(headers, path, name, key = '')
|
96
|
-
headers.each_with_object([]) do |header, setting|
|
97
|
-
setting << header.build_setting(path, name).join(key)
|
98
|
-
end
|
99
|
-
end
|
100
|
-
|
101
|
-
def add_headers(type, headers, module_name, headers_sandbox)
|
102
|
-
headers.each do |header|
|
103
|
-
next unless @unqi_headers.add?(header)
|
104
|
-
|
105
|
-
header_name = header.basename.to_s
|
106
|
-
header_dir = "#{header.dirname}/"
|
107
|
-
header_module_path = "#{module_name}/#{header_name}"
|
108
|
-
header_module_name = "#{module_name}/"
|
109
|
-
header_relative_path = header.relative_path_from(headers_sandbox).to_s
|
110
|
-
header_last_dir_name = "#{header.dirname.basename}/#{header_name}"
|
111
|
-
case type
|
112
|
-
when :private_header_files, :public_header_files
|
113
|
-
@public_headers.add_header([header_name, header_module_name, header_name]) if type == :public_header_files
|
114
|
-
@public_headers_e.add_header([header_module_path, header_dir, header_name])
|
115
|
-
@private_headers.add_header([header_name, header_module_name, header_name])
|
116
|
-
unless header_relative_path == header_module_path || header_relative_path == header_name
|
117
|
-
@private_headers_e.add_header([header_relative_path, header_dir, header_name])
|
118
|
-
end
|
119
|
-
unless header_last_dir_name == header_module_path
|
120
|
-
@private_headers_e.add_header([header_last_dir_name, header_dir, header_name])
|
121
|
-
end
|
122
|
-
when :source_files
|
123
|
-
@private_headers_e.add_header([header_name, header_dir, header_name])
|
124
|
-
@private_headers_e.add_header([header_last_dir_name, header_dir, header_name])
|
125
|
-
@private_headers_e.add_header([header_relative_path, header_dir, header_name])
|
126
|
-
end
|
127
|
-
end
|
128
|
-
end
|
129
|
-
end
|
130
|
-
|
131
|
-
# Gen hmap file and vfs file
|
132
|
-
class HMapHelper
|
133
|
-
attr_reader :i_headers, :iquote_headers, :directory, :framework_entrys, :headers
|
134
|
-
|
135
|
-
def initialize(directory)
|
136
|
-
puts "Current hmap files dir: #{directory}"
|
137
|
-
@directory = Pathname(directory)
|
138
|
-
@framework_entrys = []
|
139
|
-
@headers = HMapHeaders.new
|
140
|
-
end
|
141
|
-
|
142
|
-
def write_hmapfile(name = nil)
|
143
|
-
return if directory.nil?
|
144
|
-
|
145
|
-
@headers.headers.each do |entry|
|
146
|
-
path = directory.join(entry.file_name(name))
|
147
|
-
hmap_write_headers_to_path(path, entry.headers)
|
148
|
-
end
|
149
|
-
end
|
150
|
-
|
151
|
-
def write_vfsfiles(name = '')
|
152
|
-
return if framework_entrys.empty?
|
153
|
-
|
154
|
-
vfs_directory = directory.join(name).join('vfs')
|
155
|
-
puts "Current vfs files dir: #{vfs_directory}"
|
156
|
-
Target::FrameworkVFS.new(framework_entrys).write(vfs_directory)
|
157
|
-
puts 'vfs files write finish.'
|
158
|
-
end
|
159
|
-
|
160
|
-
def write_hmap_vfs_to_paths(hmap_name = nil, vfs_name = '')
|
161
|
-
write_vfsfiles(vfs_name)
|
162
|
-
write_hmapfile(hmap_name)
|
163
|
-
end
|
164
|
-
|
165
|
-
def add_framework_entry(configurations, platforms,
|
166
|
-
name, framework_name, module_path, headers)
|
167
|
-
entry = Target::FrameworkEntry.new_entrys_from_configurations_platforms(configurations, platforms, name,
|
168
|
-
framework_name, module_path, headers)
|
169
|
-
@framework_entrys += entry
|
170
|
-
end
|
171
|
-
|
172
|
-
def header_mappings(headers, headers_sandbox, module_name, type)
|
173
|
-
@headers.add_headers(type, headers, module_name, headers_sandbox)
|
174
|
-
end
|
175
|
-
|
176
|
-
def xcconfig_header_setting(is_framework, path = nil, name = nil)
|
177
|
-
i_s = @headers.public_setting_for_options(path, name)
|
178
|
-
setting_values = [[BuildSettingConstants::INGERITED, i_s].join(' ')]
|
179
|
-
setting_values << xcconfig_vfs_setting(path) if is_framework
|
180
|
-
setting_values << @headers.private_setting_for_options(path, name)
|
181
|
-
setting_values.each_with_object({}) do |value, setting|
|
182
|
-
setting.merge!({
|
183
|
-
BuildSettingConstants::OTHER_CFLAGS => value,
|
184
|
-
BuildSettingConstants::OTHER_CPLUSPLUSFLAGS => value
|
185
|
-
}) { |_, oldval, newval| [oldval, newval].join(' ') }
|
186
|
-
end
|
187
|
-
end
|
188
|
-
|
189
|
-
private
|
190
|
-
|
191
|
-
def xcconfig_vfs_setting(path)
|
192
|
-
path = directory if path.nil?
|
193
|
-
"-ivfsoverlay \"#{path}/vfs/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)/all-product-headers.yaml\""
|
194
|
-
end
|
195
|
-
|
196
|
-
def i_headers_name(name)
|
197
|
-
directory.join("#{name}.hmap")
|
198
|
-
end
|
199
|
-
|
200
|
-
def iquote_headers_name
|
201
|
-
directory.join("#{name}-iquote.hmap")
|
202
|
-
end
|
203
|
-
|
204
|
-
def hmap_write_headers_to_path(path, headers)
|
205
|
-
return if headers.empty?
|
206
|
-
|
207
|
-
print "\t - Save hmap file to path: "
|
208
|
-
puts path.to_s.yellow
|
209
|
-
HMapSaver.new_from_buckets(headers).write_to(path)
|
210
|
-
end
|
211
|
-
end
|
212
|
-
end
|
@@ -1,98 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cocoapods'
|
4
|
-
|
5
|
-
module HMap
|
6
|
-
# A collection of Pods Helper functions used throughout cocoapods-hmap.
|
7
|
-
module Pods
|
8
|
-
# mapfile dir name
|
9
|
-
# @api private
|
10
|
-
HMAP_DIR = 'HMap'
|
11
|
-
HEADER_EXTENSIONS = %w[h hh hpp ipp tpp hxx def inl inc].join(',')
|
12
|
-
def self.hmap_files_dir
|
13
|
-
Pathname(File.join(Pod::Config.instance.sandbox.headers_root, HMAP_DIR))
|
14
|
-
end
|
15
|
-
|
16
|
-
def self.pods_hmap_files_dir
|
17
|
-
"${PODS_ROOT}/Headers/#{HMAP_DIR}"
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.target_support_platforms(spec_path)
|
21
|
-
validator = Pod::Validator.new(spec_path, Pod::Config.instance.sources_manager.master.map(&:url))
|
22
|
-
validator.platforms_to_lint(validator.spec).map(&:name)
|
23
|
-
end
|
24
|
-
|
25
|
-
def self.paths_for_attribute(path)
|
26
|
-
return [] unless path.exist?
|
27
|
-
|
28
|
-
path_list = Pod::Sandbox::PathList.new(path)
|
29
|
-
path_list.glob("**/*.{#{HEADER_EXTENSIONS}}")
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.headers_mappings_by_file_accessor(target, type = :source_files)
|
33
|
-
valid_accessors = target.file_accessors.reject { |fa| fa.spec.non_library_specification? }
|
34
|
-
valid_accessors.each_with_object({}) do |file_accessor, sum|
|
35
|
-
sum[:private_header_files] ||= []
|
36
|
-
sum[:public_header_files] ||= []
|
37
|
-
sum[:source_files] ||= []
|
38
|
-
case type
|
39
|
-
when :private_header_files
|
40
|
-
sum[:private_header_files] += file_accessor.private_headers
|
41
|
-
when :source_files
|
42
|
-
header_mappings_dir = file_accessor.spec_consumer.header_mappings_dir
|
43
|
-
headers = paths_for_attribute(file_accessor.path_list.root)
|
44
|
-
unless header_mappings_dir.nil?
|
45
|
-
headers = paths_for_attribute(file_accessor.path_list.root + header_mappings_dir)
|
46
|
-
end
|
47
|
-
sum[:private_header_files] += file_accessor.private_headers
|
48
|
-
sum[:public_header_files] += file_accessor.public_headers
|
49
|
-
sum[:public_header_files] << target.umbrella_header_path if target.build_as_framework?
|
50
|
-
sum[:source_files] << target.prefix_header_path if target.build_as_framework?
|
51
|
-
sum[:source_files] += (headers - file_accessor.public_headers - file_accessor.private_headers)
|
52
|
-
when :public_header_files
|
53
|
-
sum[:public_header_files] += file_accessor.public_headers
|
54
|
-
sum[:public_header_files] << target.umbrella_header_path if target.build_as_framework?
|
55
|
-
end
|
56
|
-
end
|
57
|
-
end
|
58
|
-
|
59
|
-
def self.headers_mappings_by_file(target, type = :source_files)
|
60
|
-
valid_accessors = target.file_accessors.reject { |fa| fa.spec.non_library_specification? }
|
61
|
-
valid_accessors.each_with_object([]) do |file_accessor, sum|
|
62
|
-
sum << case type
|
63
|
-
when :private_header_files then file_accessor.headers - file_accessor.public_headers
|
64
|
-
when :source_files then file_accessor.headers
|
65
|
-
when :public_header_files then file_accessor.public_headers
|
66
|
-
end
|
67
|
-
end.flatten.compact
|
68
|
-
end
|
69
|
-
|
70
|
-
def self.xcconfig_path_from(target)
|
71
|
-
raise ClassIncludedError.new(target.class, Pod::Target) unless target.is_a?(Pod::Target)
|
72
|
-
|
73
|
-
config_h = Pod::Target.instance_method(:build_settings).bind(target).call
|
74
|
-
config_h.each_key do |configuration_name|
|
75
|
-
xcconfig = target.xcconfig_path(configuration_name)
|
76
|
-
yield(xcconfig, target) if block_given?
|
77
|
-
end
|
78
|
-
end
|
79
|
-
|
80
|
-
def self.clean_hmap_setting(clean_hmap, *targets)
|
81
|
-
return clean_hmap unless clean_hmap
|
82
|
-
|
83
|
-
FileUtils.rm_rf(Pods.hmap_files_dir)
|
84
|
-
targets.each { |target| clean_hmap_build_setting(target, log: true) }
|
85
|
-
clean_hmap
|
86
|
-
end
|
87
|
-
|
88
|
-
def self.clean_hmap_build_setting(targets, log: false)
|
89
|
-
puts 'Clean build setting: '.blue if log
|
90
|
-
targets.each do |target|
|
91
|
-
xcconfig_path_from(target) do |xcconfig|
|
92
|
-
HMap::XcodeprojHelper.new(xcconfig).clean_hmap_build_setting_and_save
|
93
|
-
puts "\t -xcconfig path: #{xcconfig} clean finish." if log
|
94
|
-
end
|
95
|
-
end
|
96
|
-
end
|
97
|
-
end
|
98
|
-
end
|