cocoapods-mapfile 0.2.0 → 0.2.5
Sign up to get free protection for your applications and to get access to all the features.
- 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
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 8eb57eb32ca81d86a3af1b1fa9b49115c3a7607bf1e6c2c546060e865a855652
|
4
|
+
data.tar.gz: 78ce44dbd5d258ffa4baa8d27201447fc8c2c995163239ec48cdc163fa1ab661
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e5acfc25fe04df059e746b82d1e4d6661ef598a378a19790bad48b04f5b10e11ad3e975bb61aa38b53a801bfe98234ed526744090be4cbb6477de4f982dce515
|
7
|
+
data.tar.gz: 73714efd5ea58856fd5170f2df67a036a15c9581bd5b4fd935f416b1508bf8b41d50f1e220d1cf81930891fb010ad3552583ee9925f8011801ca57feac14f18d
|
data/README.md
CHANGED
@@ -7,23 +7,21 @@ A CocoaPods plugin which can gen/read header map file.
|
|
7
7
|
**hmap-gen** is able to scan the header files of the target referenced components in the specified Cocoapods project, and generates a header map file that public to all the components
|
8
8
|
as well as generates a public and private header map file for each referenced component.
|
9
9
|
|
10
|
-
|
11
|
-
|
10
|
+
- <header.h> : -I<hmap file path>
|
11
|
+
- "header.h" : -iquote <hmap file path>
|
12
12
|
|
13
13
|
For framework, use [yaml-vfs](https://github.com/Cat1237/yaml-vfs) create VFS file to map framework Headers and Modules dir and pass VFS file to `-ivfsoverlay` parameter.
|
14
14
|
|
15
|
-
|
16
|
-
|
17
|
-
- header.h
|
18
|
-
- <module/header.h> **based on podspec**
|
19
|
-
- <project_name/header.h> **based on podspec**
|
20
|
-
- <podspec source header/**/header.h> **based on podspec**
|
21
|
-
|
22
|
-
At the same time, **hmap-reader** can read the header, bucktes, string_table information saved in the header map file.
|
15
|
+
- vfs : -ivfsoverlay <all-product-headers.yaml>
|
23
16
|
|
24
|
-
|
17
|
+
A hmap file includes four types of headers:
|
25
18
|
|
26
|
-
-
|
19
|
+
- "header.h"
|
20
|
+
- <module/header.h> **based on project**
|
21
|
+
- <project_name/header.h> **based on project**
|
22
|
+
- <*\*/**/header.h> **based on project**
|
23
|
+
- "*\*/**/header.h" **based on project**
|
24
|
+
- "module/header.h" **based on project**
|
27
25
|
|
28
26
|
## Installation
|
29
27
|
|
@@ -47,56 +45,95 @@ Or install it yourself as:
|
|
47
45
|
$ gem install cocoapods-mapfile
|
48
46
|
```
|
49
47
|
|
50
|
-
##
|
48
|
+
## Quickstart
|
49
|
+
To begin gen hmap file by opening an Xcodeproj dir, and to your command line with:
|
50
|
+
```shell
|
51
|
+
$ hmapfile gen
|
52
|
+
```
|
53
|
+
or to your podfile, add this line:
|
54
|
+
```
|
55
|
+
$ plugin 'cocoapods-mapfile'
|
56
|
+
```
|
57
|
+
|
58
|
+
|
59
|
+
## Command Line Tool
|
60
|
+
|
61
|
+
Installing the `cocoapods-mapfile` gem will also install two command-line tool `hmapfile reader` and `hmapfile writer` which you can use to generate header map file and read hmap file.
|
62
|
+
|
63
|
+
For more information consult
|
64
|
+
- `hmapfile --help`
|
65
|
+
- `hmapfile gen --help`
|
66
|
+
- `hmapfile reader --help`
|
67
|
+
- `hmapfile writer --help`
|
68
|
+
|
69
|
+
### Usage
|
70
|
+
|
71
|
+
```shell
|
72
|
+
|
73
|
+
# Read or write header map file.
|
74
|
+
$ hmapfile COMMAND
|
75
|
+
|
76
|
+
```
|
77
|
+
|
78
|
+
#### Commands
|
79
|
+
|
80
|
+
1. `hmapfile gen`:
|
81
|
+
|
82
|
+
- `--project-directory=/porject/dir`: Read .xcworkspace/.xcodeproj file to gen hmap files.
|
83
|
+
- `--clean-hmap`: Clean up hmap file settings.
|
51
84
|
|
52
|
-
|
85
|
+
2. `hmapfile reader`:
|
86
|
+
- `--hmap-path=/hmap/dir/file`: Read this path of the hmap file.
|
87
|
+
|
88
|
+
3. `hmapfile writer`:
|
89
|
+
- `--json-path=/project/dir/json`: The path to the hmap json data.
|
90
|
+
- `--output-path=/project/dir/hmap file`: The path json data to the hmap file.
|
91
|
+
|
92
|
+
example:
|
53
93
|
|
54
94
|
```shell
|
55
|
-
#
|
56
|
-
$
|
95
|
+
# Read current dir .xcworkspace/.xcodeproj file to Gen hmap files.
|
96
|
+
$ hmapfile gen
|
57
97
|
|
58
|
-
#
|
59
|
-
$
|
98
|
+
# Read the specified directory .xcworkspace/.xcodeproj file to Gen hmap files.
|
99
|
+
$ hmapfile gen --project-directory=<project path>
|
60
100
|
|
61
|
-
#
|
62
|
-
$
|
101
|
+
# Clean up hmap file settings.
|
102
|
+
$ hmapfile gen --clean-hmap
|
103
|
+
$ hmapfile gen --project-directory=<project path> --clean-hmap
|
63
104
|
|
64
|
-
|
65
|
-
$ pod hmap-gen --clean-hmap
|
105
|
+
$ hmapfile writer --json-path=../cat.json --output-path=../cat.hmap
|
66
106
|
|
67
|
-
|
68
|
-
$ pod hmap-reader --hmap-path=/hmap/dir/file
|
107
|
+
$ hmapfile reader --hmap-path=../cat.hmap
|
69
108
|
```
|
70
109
|
|
71
|
-
|
110
|
+
## For Cocoapods
|
111
|
+
|
112
|
+
Add this line in your podfile:
|
72
113
|
|
73
114
|
```rb
|
74
115
|
plugin 'cocoapods-mapfile'
|
75
116
|
```
|
117
|
+
|
76
118
|
This was equl:
|
119
|
+
|
77
120
|
```rb
|
78
|
-
|
121
|
+
$ hmapfile gen --project-directory=<project path>
|
79
122
|
```
|
123
|
+
or, you can set some value:
|
80
124
|
|
81
|
-
Every time you execute pod install or pod update, `cocoapods-mapfile` will automatically generate a `header map file` for you and modify
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
`
|
86
|
-
|
87
|
-
- `--project-directory=/project/dir/`: The path to the root of the project directory.
|
88
|
-
- `--nosave-origin-header-search-paths`: This option will not save xcconfig origin [HEADER_SEARCH_PATHS] and put `hmap file path` first.
|
89
|
-
- `--clean-hmap`: This option will clean up all `hmap-gen/hmap-writer` setup for hmap.
|
90
|
-
|
91
|
-
`hmap-reader`:
|
92
|
-
|
93
|
-
- `--hmap-path=/hmap/dir/file`: The path of the hmap file.
|
94
|
-
|
95
|
-
## Command Line Tool
|
125
|
+
Every time you execute pod install or pod update, `cocoapods-mapfile` will automatically generate a `header map file` for you and modify:
|
126
|
+
- `OTHER_CPLUSPLUSFLAGS`
|
127
|
+
- `OTHER_CFLAGS`
|
128
|
+
- `USE_HEADERMAP`
|
129
|
+
- `USER_HEADER_SEARCH_PATHS`
|
130
|
+
- `HEAD_SEARCH_PATHS`
|
96
131
|
|
97
|
-
|
132
|
+
## TODO
|
98
133
|
|
99
|
-
|
134
|
+
- File generation speed
|
135
|
+
- Perfect interface
|
136
|
+
- Optimize the code
|
100
137
|
|
101
138
|
## Contributing
|
102
139
|
|
data/lib/cocoapods_plugin.rb
CHANGED
@@ -1,13 +1,25 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require '
|
4
|
-
require 'cocoapods-hmap/command/hmap_reader'
|
3
|
+
require 'hmap'
|
5
4
|
|
6
5
|
module Pod
|
7
6
|
# hook
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
7
|
+
@HooksManager = HooksManager
|
8
|
+
@HooksManager.register('cocoapods-mapfile', :post_install) do |_, _options|
|
9
|
+
args = ['gen', "--project-directory=#{Config.instance.installation_root}"]
|
10
|
+
# allow_targets = options['allow_targets']
|
11
|
+
# unless allow_targets.nil?
|
12
|
+
# if allow_targets.is_a?(Array)
|
13
|
+
# args << "--allow-targets=#{allow_targets.join(', ')}" unless allow_targets.empty?
|
14
|
+
# else
|
15
|
+
# print 'waring:'.yellow, \
|
16
|
+
# 'plugin cocoapods-mapfile args allow_targets must be a array, like ## allow_targets: [target1, targte2] ##'
|
17
|
+
# end
|
18
|
+
# end
|
19
|
+
# save_origin = options['save_oripodgin'].nil? ? true : options['save_origin']
|
20
|
+
# use_origin_headermap = options['use_origin_headermap'].nil? ? true : options['use_origin_headermap']
|
21
|
+
# args << '--fno-save-origin' unless save_origin
|
22
|
+
# args << '--fno-use-origin-headermap' unless use_origin_headermap
|
23
|
+
HMap::Command.run(args)
|
12
24
|
end
|
13
25
|
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HMap
|
4
|
+
class Command
|
5
|
+
# hmap file gen cmd
|
6
|
+
class Gen < Command
|
7
|
+
# summary
|
8
|
+
self.summary = 'Analyzes the dependencies and gen each dependencie hmap file.'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
Analyzes the dependencies of any projects and gen each dependencie hmap file.
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
CLAide::Argument.new('--project-directory', false),
|
16
|
+
CLAide::Argument.new('--clean-hmap', false)
|
17
|
+
]
|
18
|
+
|
19
|
+
def initialize(argv)
|
20
|
+
super
|
21
|
+
project_directory = argv.option('project-directory')
|
22
|
+
@clean_hmap = argv.flag?('clean-hmap', false)
|
23
|
+
project_directory = Dir.pwd if project_directory.nil?
|
24
|
+
@project_directory = Pathname.new(project_directory).expand_path
|
25
|
+
end
|
26
|
+
|
27
|
+
def validate!
|
28
|
+
super
|
29
|
+
if @project_directory.nil?
|
30
|
+
help! 'error: no input project directory which to use with the `--project-directory` option.'
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
# help
|
35
|
+
def self.options
|
36
|
+
[
|
37
|
+
['--project-directory=/project/dir/', 'The path to the root of the project directory'],
|
38
|
+
['--clean-hmap', 'This option will clean up all hmap-gen setup for hmap.']
|
39
|
+
].concat(super)
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
name = 'Gen'
|
44
|
+
name = 'Clean' if @clean_hmap
|
45
|
+
UserInterface.puts("\n[hmapfile] #{name} start..............")
|
46
|
+
HMap::MapFileWriter.new(true, @project_directory, @clean_hmap)
|
47
|
+
UserInterface.puts("[hmapfile] #{name} finish..............")
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
52
|
+
|
@@ -1,27 +1,31 @@
|
|
1
1
|
# frozen_string_literal: false
|
2
2
|
|
3
|
-
|
4
|
-
require 'cocoapods'
|
5
|
-
|
6
|
-
module Pod
|
3
|
+
module HMap
|
7
4
|
class Command
|
8
5
|
# hmap file reader cmd
|
9
|
-
class
|
6
|
+
class Reader < Command
|
10
7
|
self.summary = 'Read mapfile and puts result.'
|
11
8
|
|
12
9
|
self.description = <<-DESC
|
13
10
|
Read mapfile and puts result, header, buckets, string_table.
|
14
11
|
DESC
|
15
12
|
|
13
|
+
self.arguments = [
|
14
|
+
# framework_p, r_header, r_m
|
15
|
+
CLAide::Argument.new('--hmap-path', true)
|
16
|
+
]
|
17
|
+
|
16
18
|
def initialize(argv)
|
17
19
|
super
|
18
20
|
mapfile_path = argv.option('hmap-path')
|
19
|
-
|
21
|
+
raise ArgumentError, "#{mapfile_path}: no such file!" if mapfile_path.nil? || !File.exist?(mapfile_path)
|
22
|
+
|
23
|
+
@mapfile_path = Pathname.new(mapfile_path).expand_path
|
20
24
|
end
|
21
25
|
|
22
26
|
def validate!
|
23
27
|
super
|
24
|
-
banner! if help?
|
28
|
+
# banner! if help?
|
25
29
|
raise '[ERROR]: --hmap-path no set'.red unless File.exist?(@mapfile_path)
|
26
30
|
end
|
27
31
|
|
@@ -32,10 +36,9 @@ module Pod
|
|
32
36
|
end
|
33
37
|
|
34
38
|
def run
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
UI.puts("\n[hmap-reader] finish..............\n".yellow)
|
39
|
+
UserInterface.puts "\n[hmapfile] Reader start..............\n".yellow
|
40
|
+
HMap::MapFileReader.new(@mapfile_path)
|
41
|
+
UserInterface.puts "\n[hmapfile] Reader finish..............\n".yellow
|
39
42
|
end
|
40
43
|
end
|
41
44
|
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HMap
|
4
|
+
class Command
|
5
|
+
# hmap file gen cmd
|
6
|
+
class Writer < Command
|
7
|
+
# summary
|
8
|
+
self.summary = 'Analyzes the input json and gen each dependencie mapfile.'
|
9
|
+
|
10
|
+
self.description = <<-DESC
|
11
|
+
Analyzes the input json and gen each dependencie mapfile.
|
12
|
+
DESC
|
13
|
+
|
14
|
+
self.arguments = [
|
15
|
+
# framework_p, r_header, r_m
|
16
|
+
CLAide::Argument.new('--json-path', true),
|
17
|
+
CLAide::Argument.new('--output-path', false)
|
18
|
+
]
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
super
|
22
|
+
json_path = argv.option('json-path')
|
23
|
+
@json_path = json_path unless json_path.nil?
|
24
|
+
output_path = argv.option('output-path')
|
25
|
+
@output_path = output_path.nil? ? Pathname('.') : Pathname(output_path)
|
26
|
+
end
|
27
|
+
|
28
|
+
def validate!
|
29
|
+
super
|
30
|
+
help! 'error: no input json files which to use with the `--json-path` option.' if @json_path.nil?
|
31
|
+
help! "error: Input json file #{@json_path}: no such file" unless File.exist?(@json_path)
|
32
|
+
end
|
33
|
+
|
34
|
+
# help
|
35
|
+
def self.options
|
36
|
+
[
|
37
|
+
['--json-path=/project/dir/json', 'The path to the hmap json data.'],
|
38
|
+
['--output-path=/project/dir/hmap file', 'The path json data to the hmap file.']
|
39
|
+
].concat(super)
|
40
|
+
end
|
41
|
+
|
42
|
+
def run
|
43
|
+
require 'json'
|
44
|
+
UserInterface.puts "\n[hmapfile-from-json] start..............".yellow
|
45
|
+
json_file = File.read(@json_path)
|
46
|
+
json = JSON.parse(json_file)
|
47
|
+
strs = json.map { |e| HMap::BucketStr.new(*e) }
|
48
|
+
path = @output_path
|
49
|
+
path = path.join("#{File.basename(@json_path, '.*')}.hmap") if path.directory?
|
50
|
+
HMapSaver.new_from_buckets(strs).write_to(path)
|
51
|
+
UserInterface.puts '[hmapfile-from-json] finish..............'.yellow
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
data/lib/hmap/command.rb
ADDED
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
# The primary namespace for VFS.
|
4
|
+
module HMap
|
5
|
+
require 'colored2'
|
6
|
+
require 'claide'
|
7
|
+
# The primary Command for VFS.
|
8
|
+
class Command < CLAide::Command
|
9
|
+
require 'hmap/command/hmap_writer'
|
10
|
+
require 'hmap/command/hmap_reader'
|
11
|
+
require 'hmap/command/hmap_gen'
|
12
|
+
|
13
|
+
|
14
|
+
self.abstract_command = false
|
15
|
+
self.command = 'hmapfile'
|
16
|
+
self.version = VERSION
|
17
|
+
self.description = 'Read or write header map file.'
|
18
|
+
self.plugin_prefixes = %w[claide writer reader gen]
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
super
|
22
|
+
return if ansi_output?
|
23
|
+
|
24
|
+
Colored2.disable!
|
25
|
+
String.send(:define_method, :colorize) { |string, _| string }
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,198 @@
|
|
1
|
+
module HMap
|
2
|
+
# This modules groups all the constants known to HMap.
|
3
|
+
#
|
4
|
+
class Constants
|
5
|
+
BUILD_DIR = 'BUILD_DIR'
|
6
|
+
BUILD_DIR_KEY = '${BUILD_DIR}'
|
7
|
+
OBJROOT = 'OBJROOT'
|
8
|
+
SRCROOT = '${SRCROOT}'
|
9
|
+
HMAP_DIR = 'HMap'
|
10
|
+
HMAP_GEN_DIR = 'HMAP_GEN_DIR'
|
11
|
+
HMAP_GEN_DIR_VALUE = '${HMAP_GEN_DIR}'
|
12
|
+
XCBuildData = 'XCBuildData'
|
13
|
+
PROJECT_TEMP_DIR = '${PROJECT}.build'
|
14
|
+
TARGET_TEMP_DIR = '${TARGET_NAME}.build'
|
15
|
+
TARGET_NAME = '${TARGET_NAME}'
|
16
|
+
PRODUCT_NAME = 'PRODUCT_NAME'
|
17
|
+
PRODUCT_NAME_VALUE = '${PRODUCT_NAME}'
|
18
|
+
CONFIGURATION_EFFECTIVE_PLATFORM = '$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)'
|
19
|
+
USE_HEADERMAP = 'USE_HEADERMAP'
|
20
|
+
USER_HEADER_SEARCH_PATHS = 'USER_HEADER_SEARCH_PATHS'
|
21
|
+
HEADER_SEARCH_PATHS = 'HEADER_SEARCH_PATHS'
|
22
|
+
HMAP_HEADER_SETTING = 'HMAP_HEADER_SETTING'
|
23
|
+
HMAP_HEADER_SETTING_KEY = '${HMAP_HEADER_SETTING}'
|
24
|
+
|
25
|
+
OTHER_CFLAGS = 'OTHER_CFLAGS'
|
26
|
+
OTHER_CPLUSPLUSFLAGS = 'OTHER_CPLUSPLUSFLAGS'
|
27
|
+
CONFIGURATION_BUILD_DIR = 'CONFIGURATION_BUILD_DIR'
|
28
|
+
|
29
|
+
XCBuildConfiguration = Xcodeproj::Project::Object::XCBuildConfiguration
|
30
|
+
PBXSourcesBuildPhase = Xcodeproj::Project::Object::PBXSourcesBuildPhase
|
31
|
+
PBXHeadersBuildPhase = Xcodeproj::Project::Object::PBXHeadersBuildPhase
|
32
|
+
PBXGroup = Xcodeproj::Project::Object::PBXGroup
|
33
|
+
PBXFileReference = Xcodeproj::Project::Object::PBXFileReference
|
34
|
+
PBXBuildFile = Xcodeproj::Project::Object::PBXBuildFile
|
35
|
+
PBXAggregateTarget = Xcodeproj::Project::Object::PBXAggregateTarget
|
36
|
+
|
37
|
+
HMAP_TARGET_ROOT = [BUILD_DIR_KEY, '..', '..', HMAP_DIR,
|
38
|
+
PROJECT_TEMP_DIR, CONFIGURATION_EFFECTIVE_PLATFORM,
|
39
|
+
TARGET_TEMP_DIR].join('/')
|
40
|
+
|
41
|
+
HMAP_GEN_DIR_ATTRIBUTE = { HMAP_GEN_DIR => HMAP_TARGET_ROOT }
|
42
|
+
|
43
|
+
HMAP_FILE_TYPE = %i[own_target_headers all_non_framework_target_headers all_target_headers all_product_headers
|
44
|
+
project_headers workspace_headers]
|
45
|
+
|
46
|
+
def self.instance
|
47
|
+
@instance ||= new
|
48
|
+
end
|
49
|
+
|
50
|
+
# Sets the current config instance. If set to nil the config will be
|
51
|
+
# recreated when needed.
|
52
|
+
#
|
53
|
+
# @param [Config, Nil] the instance.
|
54
|
+
#
|
55
|
+
# @return [void]
|
56
|
+
#
|
57
|
+
class << self
|
58
|
+
attr_writer :instance
|
59
|
+
end
|
60
|
+
|
61
|
+
# def full_product_name(name, type)
|
62
|
+
# name.join('.', FILE_TYPES_BY_EXTENSION[type])
|
63
|
+
# end
|
64
|
+
|
65
|
+
def hmap_filename(type)
|
66
|
+
filenames[type]
|
67
|
+
end
|
68
|
+
|
69
|
+
def full_hmap_filename(type, product_name = nil)
|
70
|
+
name = hmap_filename(type)
|
71
|
+
name = "#{product_name}-#{name}" if type != :all_product_headers && !product_name.nil?
|
72
|
+
name
|
73
|
+
end
|
74
|
+
|
75
|
+
def full_hmap_filepath(type, path, dir = nil, product_name = nil)
|
76
|
+
name = full_hmap_filename(type, product_name) unless path.end_with?(hmap_filename(type))
|
77
|
+
path = Pathname.new(path)
|
78
|
+
path = path.join(dir) unless dir.nil?
|
79
|
+
path = path.join(name) unless name.nil?
|
80
|
+
path
|
81
|
+
end
|
82
|
+
|
83
|
+
def hmap_build_setting_key(type)
|
84
|
+
build_setting_keys(type)
|
85
|
+
end
|
86
|
+
|
87
|
+
def hmap_build_setting_values
|
88
|
+
ss = build_setting_values.values.join(' ')
|
89
|
+
['$(inherited)', ss].join(' ')
|
90
|
+
end
|
91
|
+
|
92
|
+
def hmap_build_setting_value(type)
|
93
|
+
build_setting_values[type]
|
94
|
+
end
|
95
|
+
|
96
|
+
def hmap_xc_filename(type)
|
97
|
+
xc_filenames[type]
|
98
|
+
end
|
99
|
+
|
100
|
+
def hmap_build_settings
|
101
|
+
build_settings
|
102
|
+
end
|
103
|
+
|
104
|
+
private
|
105
|
+
|
106
|
+
def build_settings
|
107
|
+
return @build_settings if defined? @build_settings
|
108
|
+
|
109
|
+
attributes = HMAP_GEN_DIR_ATTRIBUTE
|
110
|
+
settings = hmap_build_setting_values
|
111
|
+
# attributes[HMAP_HEADER_SETTING] = settings
|
112
|
+
attributes[HEADER_SEARCH_PATHS] = build_setting_values_i
|
113
|
+
attributes[OTHER_CFLAGS] = build_setting_values_c
|
114
|
+
attributes[OTHER_CPLUSPLUSFLAGS] = build_setting_values_c
|
115
|
+
attributes[USER_HEADER_SEARCH_PATHS] = build_setting_values_iquote
|
116
|
+
# attributes[OTHER_CFLAGS] = HMAP_HEADER_SETTING_KEY
|
117
|
+
# attributes[OTHER_CPLUSPLUSFLAGS] = HMAP_HEADER_SETTING_KEY
|
118
|
+
attributes[USE_HEADERMAP] = 'NO'
|
119
|
+
@build_settings = attributes
|
120
|
+
end
|
121
|
+
|
122
|
+
def filenames
|
123
|
+
return @filenames if defined? @filenames
|
124
|
+
|
125
|
+
@filenames = Hash[HMAP_FILE_TYPE.map do |type|
|
126
|
+
t_type = type
|
127
|
+
t_type = :all_target_headers if type == :workspace_headers
|
128
|
+
name = t_type.to_s.gsub(/_/, '-')
|
129
|
+
extname = '.hmap'
|
130
|
+
extname = '.yaml' if type == :all_product_headers
|
131
|
+
[type, name + extname]
|
132
|
+
end]
|
133
|
+
end
|
134
|
+
|
135
|
+
def build_setting_values_i
|
136
|
+
%i[own_target_headers all_non_framework_target_headers].map do |type|
|
137
|
+
value = xc_filenames[type]
|
138
|
+
"\"#{HMAP_GEN_DIR_VALUE}/#{value}\""
|
139
|
+
end.join(' ')
|
140
|
+
end
|
141
|
+
|
142
|
+
def build_setting_values_iquote
|
143
|
+
%i[project_headers all_target_headers].map do |type|
|
144
|
+
value = xc_filenames[type]
|
145
|
+
"\"#{HMAP_GEN_DIR_VALUE}/#{value}\""
|
146
|
+
end.join(' ')
|
147
|
+
end
|
148
|
+
|
149
|
+
def build_setting_values_c
|
150
|
+
%i[all_target_headers all_product_headers].map do |type|
|
151
|
+
key = build_setting_keys[type]
|
152
|
+
value = xc_filenames[type]
|
153
|
+
blank = ' ' unless key == :I
|
154
|
+
["-#{key}", "\"#{HMAP_GEN_DIR_VALUE}/#{value}\""].join(blank || '')
|
155
|
+
end.join(' ')
|
156
|
+
end
|
157
|
+
|
158
|
+
def build_setting_keys
|
159
|
+
return @build_setting_keys if defined? @build_setting_keys
|
160
|
+
|
161
|
+
@build_setting_keys =
|
162
|
+
Hash[HMAP_FILE_TYPE.map do |type|
|
163
|
+
[type, case type
|
164
|
+
when :workspace_headers, :project_headers then :iquote
|
165
|
+
when :all_product_headers then :ivfsoverlay
|
166
|
+
else
|
167
|
+
:I
|
168
|
+
end]
|
169
|
+
end]
|
170
|
+
end
|
171
|
+
|
172
|
+
def build_setting_values
|
173
|
+
return @build_setting_values if defined? @build_setting_values
|
174
|
+
|
175
|
+
@build_setting_values =
|
176
|
+
Hash[HMAP_FILE_TYPE.map do |type|
|
177
|
+
key = build_setting_keys[type]
|
178
|
+
value = xc_filenames[type]
|
179
|
+
blank = ' ' unless key == :I
|
180
|
+
[type, ["-#{key}", "\"#{HMAP_GEN_DIR_VALUE}/#{value}\""].join(blank || '')]
|
181
|
+
end]
|
182
|
+
end
|
183
|
+
|
184
|
+
def xc_filenames
|
185
|
+
return @xc_filenames if defined? @xc_filenames
|
186
|
+
|
187
|
+
@xc_filenames =
|
188
|
+
Hash[HMAP_FILE_TYPE.map do |type|
|
189
|
+
file_name = filenames[type]
|
190
|
+
[type, case type
|
191
|
+
when :all_product_headers then file_name
|
192
|
+
else
|
193
|
+
"#{Constants::PRODUCT_NAME_VALUE}-#{file_name}"
|
194
|
+
end]
|
195
|
+
end]
|
196
|
+
end
|
197
|
+
end
|
198
|
+
end
|
File without changes
|
@@ -44,10 +44,10 @@ module HMap
|
|
44
44
|
end
|
45
45
|
full_command = "#{bin} #{command.join(' ')}"
|
46
46
|
|
47
|
-
if
|
47
|
+
if Resolver.instance.verbose?
|
48
48
|
p("$ #{full_command}")
|
49
|
-
stdout = Indenter.new(
|
50
|
-
stderr = Indenter.new(
|
49
|
+
stdout = Indenter.new($stdout)
|
50
|
+
stderr = Indenter.new($stderr)
|
51
51
|
else
|
52
52
|
stdout = Indenter.new
|
53
53
|
stderr = Indenter.new
|
@@ -64,7 +64,6 @@ module HMap
|
|
64
64
|
p("[!] Failed: #{full_command}".red)
|
65
65
|
end
|
66
66
|
end
|
67
|
-
|
68
67
|
stdout
|
69
68
|
end
|
70
69
|
|
@@ -185,8 +184,8 @@ module HMap
|
|
185
184
|
output << (string << separator)
|
186
185
|
end
|
187
186
|
end
|
188
|
-
rescue
|
189
|
-
output << (buf <<
|
187
|
+
rescue IOError, EOFError
|
188
|
+
output << (buf << $RS) unless buf.empty?
|
190
189
|
end
|
191
190
|
end
|
192
191
|
end
|
@@ -0,0 +1,20 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module HMap
|
4
|
+
# hmap bucket string
|
5
|
+
class BucketStr
|
6
|
+
attr_reader :key, :perfix, :suffix
|
7
|
+
|
8
|
+
def initialize(key, perfix, suffix)
|
9
|
+
@key = key
|
10
|
+
@perfix = perfix
|
11
|
+
@suffix = suffix
|
12
|
+
end
|
13
|
+
|
14
|
+
def description
|
15
|
+
<<-DESC
|
16
|
+
Key #{@key} -> Prefix #{@perfix}, Suffix #{@suffix}
|
17
|
+
DESC
|
18
|
+
end
|
19
|
+
end
|
20
|
+
end
|