cocoapods-mapfile 0.2.0 → 0.2.5
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 +80 -43
- data/bin/{hmap_writer → hmapfile} +2 -2
- data/lib/cocoapods_plugin.rb +18 -6
- data/lib/hmap/command/hmap_gen.rb +52 -0
- data/lib/{cocoapods-hmap → hmap}/command/hmap_reader.rb +14 -11
- data/lib/hmap/command/hmap_writer.rb +55 -0
- data/lib/hmap/command.rb +28 -0
- data/lib/hmap/constants.rb +198 -0
- data/lib/{cocoapods-hmap → hmap}/exceptions.rb +0 -0
- data/lib/{cocoapods-hmap → hmap/helper}/executable.rb +5 -6
- data/lib/{cocoapods-hmap → hmap/helper}/utils.rb +0 -4
- data/lib/hmap/hmap/hmap_bucketstr.rb +20 -0
- data/lib/{cocoapods-hmap → hmap/hmap}/hmap_reader.rb +4 -19
- data/lib/{cocoapods-hmap/hmap_save.rb → hmap/hmap/hmap_saver.rb} +21 -6
- data/lib/{cocoapods-hmap → hmap/hmap}/hmap_struct.rb +5 -4
- data/lib/hmap/hmap/hmap_writer.rb +52 -0
- data/lib/{cocoapods-hmap → hmap/hmap}/mapfile.rb +1 -1
- data/lib/hmap/user_interface.rb +22 -0
- data/lib/hmap/version.rb +5 -0
- 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 +24 -0
- metadata +76 -38
- data/bin/hmap_reader +0 -12
- data/lib/cocoapods-hmap/command/hmap_gen.rb +0 -52
- data/lib/cocoapods-hmap/framework/framework_vfs.rb +0 -95
- data/lib/cocoapods-hmap/helper/build_setting_helper.rb +0 -40
- data/lib/cocoapods-hmap/helper/pods_helper.rb +0 -104
- data/lib/cocoapods-hmap/helper/xcconfig_helper.rb +0 -82
- data/lib/cocoapods-hmap/hmap_writer.rb +0 -107
- data/lib/cocoapods-hmap/pods_specification.rb +0 -60
- data/lib/cocoapods-hmap/version.rb +0 -5
- data/lib/cocoapods-hmap/view.rb +0 -34
- data/lib/cocoapods_hmap.rb +0 -21
@@ -0,0 +1,92 @@
|
|
1
|
+
require 'hmap/xc/header_type'
|
2
|
+
require 'hmap/xc/context'
|
3
|
+
|
4
|
+
module HMap
|
5
|
+
class Project
|
6
|
+
module Helper
|
7
|
+
include HMap::HeaderType
|
8
|
+
|
9
|
+
define_method(:all_product_headers) do
|
10
|
+
return @all_product_headers if defined? @all_product_headers
|
11
|
+
|
12
|
+
@all_product_headers = targets.each_with_object({}) do |target, sum|
|
13
|
+
next if target.all_product_headers.nil?
|
14
|
+
|
15
|
+
sum.merge!(target.all_product_headers) { |_, oldval, newval| newval + oldval }
|
16
|
+
end
|
17
|
+
end
|
18
|
+
|
19
|
+
define_method(:all_non_framework_target_headers) do
|
20
|
+
return @all_non_framework_target_headers if defined?(@all_non_framework_target_headers)
|
21
|
+
|
22
|
+
@all_non_framework_target_headers = targets.flat_map(&:all_non_framework_target_headers).compact
|
23
|
+
end
|
24
|
+
|
25
|
+
# all_targets include header full module path
|
26
|
+
define_method(:all_target_headers) do
|
27
|
+
return @all_target_headers if defined?(@all_target_headers)
|
28
|
+
|
29
|
+
@all_target_headers = workspace.all_target_headers
|
30
|
+
end
|
31
|
+
|
32
|
+
define_method(:project_headers) do
|
33
|
+
return @project_headers if defined?(@project_headers)
|
34
|
+
|
35
|
+
@project_headers = all_target_headers + project_entrys.flat_map { |entry| entry.project_buckets_extra }
|
36
|
+
end
|
37
|
+
|
38
|
+
def project_references
|
39
|
+
return @project_references if defined? @project_references
|
40
|
+
|
41
|
+
project_references = PBXHelper.project_references(project)
|
42
|
+
@project_references = project_references.map { |pr| Project.new(pr, workspace) }
|
43
|
+
end
|
44
|
+
|
45
|
+
def temp_name
|
46
|
+
"#{project_name}.build"
|
47
|
+
end
|
48
|
+
|
49
|
+
def build_dir() end
|
50
|
+
|
51
|
+
def project_name
|
52
|
+
project.root_object.name
|
53
|
+
end
|
54
|
+
|
55
|
+
def project_dir
|
56
|
+
project.project_dir
|
57
|
+
end
|
58
|
+
|
59
|
+
def temp_name
|
60
|
+
"#{project_name}.build"
|
61
|
+
end
|
62
|
+
|
63
|
+
def temp_root
|
64
|
+
File.join(workspace.obj_root, temp_name)
|
65
|
+
end
|
66
|
+
|
67
|
+
def build_root
|
68
|
+
workspace.build_root
|
69
|
+
end
|
70
|
+
|
71
|
+
def temp_dir
|
72
|
+
workspace.obj_root
|
73
|
+
end
|
74
|
+
|
75
|
+
def hmap_root
|
76
|
+
File.join(workspace.hmap_root, temp_name)
|
77
|
+
end
|
78
|
+
|
79
|
+
def build_data_dir
|
80
|
+
Constants::XCBuildData
|
81
|
+
end
|
82
|
+
|
83
|
+
def context
|
84
|
+
HMap::Context.new(build_root,
|
85
|
+
temp_dir,
|
86
|
+
File.join(hmap_root, build_data_dir),
|
87
|
+
'',
|
88
|
+
build_dir)
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
@@ -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
ADDED
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'xcodeproj'
|
4
|
+
|
5
|
+
# The primary namespace for cocoapods-hmap.
|
6
|
+
module HMap
|
7
|
+
require 'pathname'
|
8
|
+
require 'claide'
|
9
|
+
|
10
|
+
require_relative 'hmap/version'
|
11
|
+
require_relative 'hmap/user_interface'
|
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.
|
15
|
+
autoload :Command, 'hmap/command'
|
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'
|
24
|
+
end
|
metadata
CHANGED
@@ -1,132 +1,170 @@
|
|
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.5
|
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-16 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "
|
17
|
+
- - ">="
|
18
18
|
- !ruby/object:Gem::Version
|
19
19
|
version: '2.1'
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- - "
|
24
|
+
- - ">="
|
25
25
|
- !ruby/object:Gem::Version
|
26
26
|
version: '2.1'
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: coveralls
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- - "
|
31
|
+
- - ">="
|
32
32
|
- !ruby/object:Gem::Version
|
33
33
|
version: '0'
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- - "
|
38
|
+
- - ">="
|
39
39
|
- !ruby/object:Gem::Version
|
40
40
|
version: '0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: rake
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
|
-
- - "
|
45
|
+
- - ">="
|
46
46
|
- !ruby/object:Gem::Version
|
47
47
|
version: '10.0'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
|
-
- - "
|
52
|
+
- - ">="
|
53
53
|
- !ruby/object:Gem::Version
|
54
54
|
version: '10.0'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rspec
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
|
-
- - "
|
59
|
+
- - ">="
|
60
60
|
- !ruby/object:Gem::Version
|
61
61
|
version: '3.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
|
-
- - "
|
66
|
+
- - ">="
|
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:
|
100
126
|
- wangson1237@outlook.com
|
101
127
|
executables:
|
102
|
-
-
|
103
|
-
- hmap_writer
|
128
|
+
- hmapfile
|
104
129
|
extensions: []
|
105
130
|
extra_rdoc_files: []
|
106
131
|
files:
|
107
132
|
- LICENSE
|
108
133
|
- README.md
|
109
|
-
- bin/
|
110
|
-
- bin/hmap_writer
|
111
|
-
- lib/cocoapods-hmap/command/hmap_gen.rb
|
112
|
-
- lib/cocoapods-hmap/command/hmap_reader.rb
|
113
|
-
- lib/cocoapods-hmap/exceptions.rb
|
114
|
-
- lib/cocoapods-hmap/executable.rb
|
115
|
-
- lib/cocoapods-hmap/framework/framework_vfs.rb
|
116
|
-
- lib/cocoapods-hmap/helper/build_setting_helper.rb
|
117
|
-
- lib/cocoapods-hmap/helper/pods_helper.rb
|
118
|
-
- lib/cocoapods-hmap/helper/xcconfig_helper.rb
|
119
|
-
- lib/cocoapods-hmap/hmap_reader.rb
|
120
|
-
- lib/cocoapods-hmap/hmap_save.rb
|
121
|
-
- lib/cocoapods-hmap/hmap_struct.rb
|
122
|
-
- lib/cocoapods-hmap/hmap_writer.rb
|
123
|
-
- lib/cocoapods-hmap/mapfile.rb
|
124
|
-
- lib/cocoapods-hmap/pods_specification.rb
|
125
|
-
- lib/cocoapods-hmap/utils.rb
|
126
|
-
- lib/cocoapods-hmap/version.rb
|
127
|
-
- lib/cocoapods-hmap/view.rb
|
128
|
-
- lib/cocoapods_hmap.rb
|
134
|
+
- bin/hmapfile
|
129
135
|
- lib/cocoapods_plugin.rb
|
136
|
+
- lib/hmap.rb
|
137
|
+
- lib/hmap/command.rb
|
138
|
+
- lib/hmap/command/hmap_gen.rb
|
139
|
+
- lib/hmap/command/hmap_reader.rb
|
140
|
+
- lib/hmap/command/hmap_writer.rb
|
141
|
+
- lib/hmap/constants.rb
|
142
|
+
- lib/hmap/exceptions.rb
|
143
|
+
- lib/hmap/helper/executable.rb
|
144
|
+
- lib/hmap/helper/utils.rb
|
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
|
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.
|
data/bin/hmap_reader
DELETED
@@ -1,12 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# frozen_string_literal: true
|
3
|
-
|
4
|
-
|
5
|
-
if $PROGRAM_NAME == __FILE__
|
6
|
-
ENV['BUNDLE_GEMFILE'] = File.expand_path('../Gemfile', __dir__)
|
7
|
-
require 'bundler/setup'
|
8
|
-
end
|
9
|
-
|
10
|
-
require 'cocoapods-hmap/command/hmap_reader'
|
11
|
-
|
12
|
-
Pod::Command::HMapReader.run(ARGV)
|
@@ -1,52 +0,0 @@
|
|
1
|
-
# frozen_string_literal: true
|
2
|
-
|
3
|
-
require 'cocoapods_hmap'
|
4
|
-
require 'cocoapods'
|
5
|
-
|
6
|
-
module Pod
|
7
|
-
class Command
|
8
|
-
# hmap file gen cmd
|
9
|
-
class HMapGen < Command
|
10
|
-
# summary
|
11
|
-
self.summary = 'Analyzes the dependencies and gen each dependencie mapfile.'
|
12
|
-
|
13
|
-
self.description = <<-DESC
|
14
|
-
Analyzes the dependencies of any cocoapods projects and gen each dependencie mapfile.
|
15
|
-
DESC
|
16
|
-
|
17
|
-
def initialize(argv)
|
18
|
-
super
|
19
|
-
project_directory = argv.option('project-directory')
|
20
|
-
@save_origin_header_search_paths = !argv.flag?('nosave-origin-header-search-paths', false)
|
21
|
-
@clean_hmap = argv.flag?('clean-hmap', false)
|
22
|
-
|
23
|
-
return if project_directory.nil?
|
24
|
-
|
25
|
-
@project_directory = Pathname.new(project_directory).expand_path
|
26
|
-
config.installation_root = @project_directory
|
27
|
-
end
|
28
|
-
|
29
|
-
def validate!
|
30
|
-
super
|
31
|
-
verify_podfile_exists!
|
32
|
-
end
|
33
|
-
|
34
|
-
# help
|
35
|
-
def self.options
|
36
|
-
[
|
37
|
-
['--project-directory=/project/dir/', 'The path to the root of the project
|
38
|
-
directory'],
|
39
|
-
['--nosave-origin-header-search-paths', 'This option will not save xcconfig origin [HEADER_SEARCH_PATHS] and put hmap file first'],
|
40
|
-
['--clean-hmap', 'This option will clean up all hmap-gen setup for hmap.']
|
41
|
-
].concat(super)
|
42
|
-
end
|
43
|
-
|
44
|
-
def run
|
45
|
-
UI.section "\n[hmap-gen] start.............." do
|
46
|
-
HMap::MapFileWriter.new(@save_origin_header_search_paths, @clean_hmap)
|
47
|
-
end
|
48
|
-
UI.puts('[hmap-gen] finish..............')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
end
|
@@ -1,95 +0,0 @@
|
|
1
|
-
module HMap
|
2
|
-
module Target
|
3
|
-
class FrameworkEntry
|
4
|
-
attr_reader :configuration, :platform, :app_build_dir, :project_temp_dir
|
5
|
-
attr_accessor :headers_real_paths, :modules_real_paths
|
6
|
-
|
7
|
-
def initialize(configuration, platform, app_build_dir, project_temp_dir)
|
8
|
-
@configuration = configuration
|
9
|
-
@platform = platform
|
10
|
-
@app_build_dir = app_build_dir
|
11
|
-
@project_temp_dir = project_temp_dir
|
12
|
-
@headers_real_paths = []
|
13
|
-
@modules_real_paths = []
|
14
|
-
end
|
15
|
-
|
16
|
-
def framework_moduler_path
|
17
|
-
File.join(app_build_dir, 'Modules')
|
18
|
-
end
|
19
|
-
|
20
|
-
def self.new_from_configuration_platform(configuration, platform, name, framework_name)
|
21
|
-
dir = "#{configuration}-#{platform}"
|
22
|
-
app_build_dir = File.join(PodsSpecification.instance.app_build_dir, dir, name,
|
23
|
-
"#{framework_name}.framework")
|
24
|
-
project_temp_dir = File.join(PodsSpecification.instance.project_temp_dir, dir, "#{name}.build")
|
25
|
-
new(configuration, platform, app_build_dir, project_temp_dir)
|
26
|
-
end
|
27
|
-
|
28
|
-
def self.new_entrys_from_configurations_platforms(configurations, platforms, name, framework_name, module_path, headers)
|
29
|
-
effective_platforms = Utils.effective_platforms_names(platforms)
|
30
|
-
configurations.flat_map do |configuration|
|
31
|
-
effective_platforms.map do |platform|
|
32
|
-
entry = new_from_configuration_platform(configuration, platform, name, framework_name)
|
33
|
-
entry.add_headers_modules(module_path, framework_name, headers)
|
34
|
-
entry
|
35
|
-
end
|
36
|
-
end
|
37
|
-
end
|
38
|
-
|
39
|
-
def add_headers_modules(module_path, framework_name, headers)
|
40
|
-
has_private_module = module_path.glob('module*.modulemap').length > 1
|
41
|
-
e_headers = ->(path, *names) { names.inject(Pathname(path)) { |e, n| e.join(n) } }
|
42
|
-
@headers_real_paths += headers
|
43
|
-
@headers_real_paths << e_headers.call(app_build_dir, 'Headers',
|
44
|
-
"#{framework_name}-Swift.h")
|
45
|
-
@modules_real_paths << e_headers.call(project_temp_dir, 'module.modulemap')
|
46
|
-
if has_private_module
|
47
|
-
@modules_real_paths << e_headers.call(entry.project_temp_dir,
|
48
|
-
'module.private.modulemap')
|
49
|
-
end
|
50
|
-
end
|
51
|
-
end
|
52
|
-
|
53
|
-
class FrameworkVFS
|
54
|
-
attr_reader :entrys
|
55
|
-
|
56
|
-
def initialize(entrys = [])
|
57
|
-
@entrys = entrys
|
58
|
-
end
|
59
|
-
|
60
|
-
def vfs_path
|
61
|
-
return {} if entrys.empty?
|
62
|
-
|
63
|
-
entrys.each_with_object({}) do |entry, paths|
|
64
|
-
c = "#{entry.configuration}-#{entry.platform}"
|
65
|
-
paths[c] ||= []
|
66
|
-
paths[c] << entry
|
67
|
-
end
|
68
|
-
end
|
69
|
-
|
70
|
-
def vfs_path_by_platform_and_configuration(platform, config)
|
71
|
-
return vfs_path if platform.nil? && config.nil?
|
72
|
-
|
73
|
-
key = platform if config.nil?
|
74
|
-
key = config if platform.nil?
|
75
|
-
vfs_path.select { |k, _| k.include?(key) }
|
76
|
-
end
|
77
|
-
|
78
|
-
def write(path = nil)
|
79
|
-
vfs_path.each do |key, values|
|
80
|
-
es = values.map do |value|
|
81
|
-
headers_real_paths = value.headers_real_paths
|
82
|
-
modules_real_paths = value.modules_real_paths
|
83
|
-
VFS::FileCollectorEntry.new(Pathname(value.app_build_dir), modules_real_paths, headers_real_paths)
|
84
|
-
end
|
85
|
-
fc = VFS::FileCollector.new(es)
|
86
|
-
pa = Helper::Pods.vfs_files_dir.join(key)
|
87
|
-
pa = File.join(path, key) unless path.nil?
|
88
|
-
pa = Pathname(pa)
|
89
|
-
pa.mkpath unless pa.exist?
|
90
|
-
fc.write_mapping(pa)
|
91
|
-
end
|
92
|
-
end
|
93
|
-
end
|
94
|
-
end
|
95
|
-
end
|
@@ -1,40 +0,0 @@
|
|
1
|
-
module HMap
|
2
|
-
# A collection of build setting functions used throughout cocoapods-hmap.
|
3
|
-
module BuildSettingHelper
|
4
|
-
def self.clean_hmap(clean_hmap, *targets)
|
5
|
-
return clean_hmap unless clean_hmap
|
6
|
-
|
7
|
-
FileUtils.rm_rf(Helper::Pods.hmap_files_dir)
|
8
|
-
targets.each { |target| clean_other_c_flags_build_setting(target) }
|
9
|
-
clean_hmap
|
10
|
-
end
|
11
|
-
|
12
|
-
def self.target_xcconfig_path(targets)
|
13
|
-
targets.each do |target|
|
14
|
-
raise ClassIncludedError.new(target.class, Pod::Target) unless target.is_a?(Pod::Target)
|
15
|
-
|
16
|
-
config_h = Pod::Target.instance_method(:build_settings).bind(target).call
|
17
|
-
config_h.each_key do |configuration_name|
|
18
|
-
xcconfig = target.xcconfig_path(configuration_name)
|
19
|
-
yield(xcconfig, target) if block_given?
|
20
|
-
end
|
21
|
-
end
|
22
|
-
end
|
23
|
-
|
24
|
-
def self.clean_other_c_flags_build_setting(targets)
|
25
|
-
target_xcconfig_path(targets) do |xc, _|
|
26
|
-
c = HMap::XcodeprojHelper.new(xc)
|
27
|
-
c.clean_hmap_xcconfig_other_c_flags_and_save
|
28
|
-
puts "\t -xcconfig path: #{xc} clean finish."
|
29
|
-
end
|
30
|
-
end
|
31
|
-
|
32
|
-
def self.change_other_c_flags_xcconfig_build_settings(hmap_h, targets, use_headermap: false, save_origin: true)
|
33
|
-
target_xcconfig_path(targets) do |xc, target|
|
34
|
-
c = HMap::XcodeprojHelper.new(xc)
|
35
|
-
c.change_xcconfig_other_c_flags_and_save(hmap_h, target.build_as_framework?, use_headermap: use_headermap,
|
36
|
-
save_origin: save_origin)
|
37
|
-
end
|
38
|
-
end
|
39
|
-
end
|
40
|
-
end
|