cocoapods-mapfile 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
Files changed (41) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +65 -64
  3. data/lib/cocoapods_plugin.rb +16 -16
  4. data/lib/hmap/command/hmap_gen.rb +19 -27
  5. data/lib/hmap/command/hmap_reader.rb +5 -5
  6. data/lib/hmap/command/hmap_writer.rb +5 -3
  7. data/lib/hmap/command.rb +3 -1
  8. data/lib/hmap/constants.rb +198 -0
  9. data/lib/hmap/{executable.rb → helper/executable.rb} +5 -6
  10. data/lib/hmap/hmap/hmap_bucketstr.rb +20 -0
  11. data/lib/hmap/{hmap_reader.rb → hmap/hmap_reader.rb} +4 -20
  12. data/lib/hmap/{hmap_saver.rb → hmap/hmap_saver.rb} +11 -6
  13. data/lib/hmap/{hmap_struct.rb → hmap/hmap_struct.rb} +0 -0
  14. data/lib/hmap/hmap/hmap_writer.rb +52 -0
  15. data/lib/hmap/{mapfile.rb → hmap/mapfile.rb} +1 -1
  16. data/lib/hmap/user_interface.rb +22 -0
  17. data/lib/hmap/version.rb +1 -1
  18. data/lib/hmap/xc/context.rb +23 -0
  19. data/lib/hmap/xc/header_entry.rb +55 -0
  20. data/lib/hmap/xc/header_type.rb +32 -0
  21. data/lib/hmap/xc/pbx_helper.rb +68 -0
  22. data/lib/hmap/xc/product_helper.rb +36 -0
  23. data/lib/hmap/xc/resolver.rb +129 -0
  24. data/lib/hmap/xc/target/build_setting.rb +126 -0
  25. data/lib/hmap/xc/target/target.rb +76 -0
  26. data/lib/hmap/xc/target/target_context.rb +29 -0
  27. data/lib/hmap/xc/target/target_helper.rb +114 -0
  28. data/lib/hmap/xc/target/target_vfs.rb +122 -0
  29. data/lib/hmap/xc/target/xcconfig_helper.rb +109 -0
  30. data/lib/hmap/xc/workspace/project.rb +120 -0
  31. data/lib/hmap/xc/workspace/project_helper.rb +92 -0
  32. data/lib/hmap/xc/workspace/workspace.rb +83 -0
  33. data/lib/hmap.rb +16 -14
  34. metadata +58 -20
  35. data/lib/hmap/framework/framework_vfs.rb +0 -94
  36. data/lib/hmap/helper/build_setting_constants.rb +0 -13
  37. data/lib/hmap/helper/hmap_helper.rb +0 -212
  38. data/lib/hmap/helper/pods_helper.rb +0 -98
  39. data/lib/hmap/helper/xcconfig_helper.rb +0 -105
  40. data/lib/hmap/hmap_writer.rb +0 -99
  41. data/lib/hmap/pods_specification.rb +0 -65
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7638b72b3d9fe0246d6dd7a06aba65b29ad95ccc30fdf7567626141f90c58d43
4
- data.tar.gz: 62b76aa9a97ada6c2e0e187092c2c8ad669e1d55bd07e6efe0f95f00cc0ba5a1
3
+ metadata.gz: cd22ad1c9300a50d1e79ad4e19c349784d632ef50766b00741faad26d4e350a4
4
+ data.tar.gz: 425b0e5b884e3eaa4ad9f9f60bdc8680e5a4d4573e72e97af2f2f0707305e0e9
5
5
  SHA512:
6
- metadata.gz: 723055fb0d1a47079499121296b2c0236f007a96a6cc023f6518a1888a3cb0d87e09de92dc6a820193187e1b9e3e8cdfc5d7c4d6fa2820942768b4972ddde1a7
7
- data.tar.gz: 05d078150dca66846048b6dc73b29e2c6dd8d8e182bf1504dd3a17b973cd5101c2429d8c63cbd0d4d886ef92d920116481415c56542f1ae4adeda7574b48691d
6
+ metadata.gz: bad97e72c3cde2ae26a510a8f1e3cf97e0f60ab219f187d440658950a47d0d9a46af541bfa18f46a9e37f2bec39512e84e3da7aa750a9e04bfe1f5963216e729
7
+ data.tar.gz: 96a82f5e9926050be9cb1fb4c225cdd5b54a0ae4c5e982736680bf97558145a2f1a5ca1058259d4ba366272bb073abcca9d96c3020cce7847cb16408db3821a2
data/README.md CHANGED
@@ -7,19 +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
- - <header.h> : -I<hmap file path>
11
- - "header.h" : -iquote <hmap file path>
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
- - vfs : -ivfsoverlay <all-product-headers.yaml>
15
+ - vfs : -ivfsoverlay <all-product-headers.yaml>
16
16
 
17
17
  A hmap file includes four types of headers:
18
18
 
19
- - header.h
20
- - <module/header.h> **based on podspec**
21
- - <project_name/header.h> **based on podspec**
22
- - <podspec source header/**/header.h> **based on podspec**
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**
23
25
 
24
26
  ## Installation
25
27
 
@@ -43,91 +45,90 @@ Or install it yourself as:
43
45
  $ gem install cocoapods-mapfile
44
46
  ```
45
47
 
46
- ## Usage
47
-
48
- The command should be executed in directory that contains podfile.
49
-
48
+ ## Quickstart
49
+ To begin gen hmap file by opening an Xcodeproj dir, and to your command line with:
50
50
  ```shell
51
- # write the hmap file to podfile/Pods/Headers/HMap
52
- $ pod hmap-gen
53
-
54
- # write the hmap file to /project/dir/Pods/Headers/HMap
55
- $ pod hmap-gen --project-directory=/project/dir/
56
-
57
- # write the hmap file to /project/dir/Pods/Headers/HMap and no save origin [HEADER_SEARCH_PATHS]
58
- $ pod hmap-gen --project-directory=/project/dir/ --nosave-origin-header-search-paths
59
-
60
- # cleanup the hmap file
61
- $ pod hmap-gen --clean-hmap
62
-
63
- # no keep xcconfig file [HEADER_SEARCH_PATHS] and [USER_HEADER_SEARCH_PATHS] value
64
- $ pod hmap-gen --fno-save-origin
65
-
66
- # ⚠️no keep xcconfig file [HEADER_SEARCH_PATHS] and [USER_HEADER_SEARCH_PATHS] value, except for the values ​​set by[--allow-targets]
67
- $ pod hmap-gen --fno-save-origin --allow-targets=Realm, YYKit
68
-
69
- # not use automatically generated hmap file from Xcode, use [hmap-gen]
70
- $ pod hmap-gen --fno-use-origin-headermap
71
-
72
- # read the hmap file from /hmap/dir/file
73
- $ pod hmap-reader --hmap-path=/hmap/dir/file
74
- ```
75
-
76
- ```rb
77
- plugin 'cocoapods-mapfile'
78
- ```
79
- This was equl:
80
- ```rb
81
- $ pod hmap-gen --project-directory=/project/dir/
51
+ $ hmapfile gen
82
52
  ```
83
- or, you can set some value:
84
-
85
- ```rb
86
- plugin('cocoapods-mapfile', allow_targets: ['Realm', 'YYKit'], save_origin: false, use_origin_headermap: false)
53
+ or to your podfile, add this line:
87
54
  ```
88
- This was equl:
89
- ```rb
90
- $ pod hmap-gen --fno-save-origin --fno-use-origin-headermap --allow-targets=Realm, YYKit
55
+ $ plugin 'cocoapods-mapfile'
91
56
  ```
92
57
 
93
- Every time you execute pod install or pod update, `cocoapods-mapfile` will automatically generate a `header map file` for you and modify:
94
- - `OTHER_CPLUSPLUSFLAGS`
95
- - `OTHER_CFLAGS`
96
- - `USE_HEADERMAP`
97
- - `USER_HEADER_SEARCH_PATHS`
98
- - `HEAD_SEARCH_PATHS`
99
58
 
100
59
  ## Command Line Tool
101
60
 
102
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.
103
62
 
104
- For more information consult
105
- - `hmapfile --help`,
63
+ For more information consult
64
+ - `hmapfile --help`
65
+ - `hmapfile gen --help`
106
66
  - `hmapfile reader --help`
107
67
  - `hmapfile writer --help`
108
68
 
109
69
  ### Usage
110
70
 
111
71
  ```shell
72
+
112
73
  # Read or write header map file.
113
74
  $ hmapfile COMMAND
75
+
114
76
  ```
77
+
115
78
  #### Commands
116
- `hmapfile reader`:
117
- - `--hmap-path=/hmap/dir/file`: Read this path of the hmap file.
118
79
 
119
- `hmapfile writer`:
120
- - `--json-path=/project/dir/json`: The path to the hmap json data.
121
- - `--output-path=/project/dir/hmap file`: The path json data to the hmap file.
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.
84
+
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.
122
91
 
123
92
  example:
124
93
 
125
94
  ```shell
126
- hmapfile writer --json-path=../cat.json --output-path=../cat.hmap
95
+ # Read current dir .xcworkspace/.xcodeproj file to Gen hmap files.
96
+ $ hmapfile gen
97
+
98
+ # Read the specified directory .xcworkspace/.xcodeproj file to Gen hmap files.
99
+ $ hmapfile gen --project-directory=<project path>
100
+
101
+ # Clean up hmap file settings.
102
+ $ hmapfile gen --clean-hmap
103
+ $ hmapfile gen --project-directory=<project path> --clean-hmap
127
104
 
128
- hmapfile reader --hmap-path=../cat.hmap
105
+ $ hmapfile writer --json-path=../cat.json --output-path=../cat.hmap
106
+
107
+ $ hmapfile reader --hmap-path=../cat.hmap
108
+ ```
109
+
110
+ ## For Cocoapods
111
+
112
+ Add this line in your podfile:
113
+
114
+ ```rb
115
+ plugin 'cocoapods-mapfile'
129
116
  ```
130
117
 
118
+ This was equl:
119
+
120
+ ```rb
121
+ $ hmapfile gen --project-directory=<project path>
122
+ ```
123
+ or, you can set some value:
124
+
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`
131
+
131
132
  ## Contributing
132
133
 
133
134
  Bug reports and pull requests are welcome on GitHub at [cocoapods-hmap](https://github.com/Cat1237/cocoapods-hmap). This project is intended to be a safe, welcoming space for collaboration.
@@ -1,27 +1,27 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'hmap/command/hmap_gen'
3
+ require 'hmap'
4
4
 
5
5
  module Pod
6
6
  # hook
7
7
  module CocoaPodsHMapHook
8
8
  @HooksManager = HooksManager
9
9
  @HooksManager.register('cocoapods-mapfile', :post_install) do |_, options|
10
- args = ["--project-directory=#{Config.instance.installation_root}"]
11
- allow_targets = options['allow_targets']
12
- unless allow_targets.nil?
13
- if allow_targets.is_a?(Array)
14
- args << "--allow-targets=#{allow_targets.join(', ')}" unless allow_targets.empty?
15
- else
16
- print 'waring:'.yellow, \
17
- 'plugin cocoapods-mapfile args allow_targets must be a array, like ## allow_targets: [target1, targte2] ##'
18
- end
19
- end
20
- save_origin = options['save_oripodgin'].nil? ? true : options['save_origin']
21
- use_origin_headermap = options['use_origin_headermap'].nil? ? true : options['use_origin_headermap']
22
- args << '--fno-save-origin' unless save_origin
23
- args << '--fno-use-origin-headermap' unless use_origin_headermap
24
- Command::HMapGen.run(args)
10
+ args = ["gen", "--project-directory=#{Config.instance.installation_root}"]
11
+ # allow_targets = options['allow_targets']
12
+ # unless allow_targets.nil?
13
+ # if allow_targets.is_a?(Array)
14
+ # args << "--allow-targets=#{allow_targets.join(', ')}" unless allow_targets.empty?
15
+ # else
16
+ # print 'waring:'.yellow, \
17
+ # 'plugin cocoapods-mapfile args allow_targets must be a array, like ## allow_targets: [target1, targte2] ##'
18
+ # end
19
+ # end
20
+ # save_origin = options['save_oripodgin'].nil? ? true : options['save_origin']
21
+ # use_origin_headermap = options['use_origin_headermap'].nil? ? true : options['use_origin_headermap']
22
+ # args << '--fno-save-origin' unless save_origin
23
+ # args << '--fno-use-origin-headermap' unless use_origin_headermap
24
+ HMap::Command.run(args)
25
25
  end
26
26
  end
27
27
  end
@@ -1,60 +1,52 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'hmap'
4
-
5
- module Pod
3
+ module HMap
6
4
  class Command
7
5
  # hmap file gen cmd
8
- class HMapGen < Command
6
+ class Gen < Command
9
7
  # summary
10
- self.summary = 'Analyzes the dependencies and gen each dependencie mapfile.'
8
+ self.summary = 'Analyzes the dependencies and gen each dependencie hmap file.'
11
9
 
12
10
  self.description = <<-DESC
13
- Analyzes the dependencies of any cocoapods projects and gen each dependencie mapfile.
11
+ Analyzes the dependencies of any projects and gen each dependencie hmap file.
14
12
  DESC
15
13
 
14
+ self.arguments = [
15
+ CLAide::Argument.new('--project-directory', false),
16
+ CLAide::Argument.new('--clean-hmap', false)
17
+ ]
18
+
16
19
  def initialize(argv)
17
20
  super
18
21
  project_directory = argv.option('project-directory')
19
- targets = argv.option('allow-targets') || ''
20
- @allow_targets = targets.split(%r{,\s*})
21
- @no_use_build_in_headermap = !argv.flag?('fno-use-origin-headermap', false)
22
- @save_origin_build_setting = !argv.flag?('fno-save-origin', false)
23
22
  @clean_hmap = argv.flag?('clean-hmap', false)
24
- return if project_directory.nil?
25
-
23
+ project_directory = Dir.pwd if project_directory.nil?
26
24
  @project_directory = Pathname.new(project_directory).expand_path
27
- config.installation_root = @project_directory
28
25
  end
29
26
 
30
27
  def validate!
31
28
  super
32
- verify_podfile_exists!
29
+ if @project_directory.nil?
30
+ help! 'error: no input project directory which to use with the `--project-directory` option.'
31
+ end
33
32
  end
34
33
 
35
34
  # help
36
35
  def self.options
37
36
  [
38
37
  ['--project-directory=/project/dir/', 'The path to the root of the project directory'],
39
- ['--allow-targets=target, target1, target2', 'If we set --fno-use-origin-headermap and ' \
40
- '--fno-save-origin, we can use this option to decide which targets to use hmap file while keeping the initial settings'],
41
- ['--fno-save-origin',
42
- 'This option will not save xcconfig origin [HEADER_SEARCH_PATHS] and put hmap file first'],
43
- ['--fno-use-origin-headermap',
44
- 'This option will use Xcode built-in options Use Header Maps and not use this code gen hmap file'],
45
38
  ['--clean-hmap', 'This option will clean up all hmap-gen setup for hmap.']
46
39
  ].concat(super)
47
40
  end
48
41
 
49
42
  def run
50
- UI.section "\n[hmap-gen] start.............." do
51
- HMap::MapFileWriter.new(@save_origin_build_setting,
52
- @clean_hmap,
53
- @allow_targets,
54
- use_build_in_headermap: @no_use_build_in_headermap)
55
- end
56
- UI.puts('[hmap-gen] finish..............')
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..............")
57
48
  end
58
49
  end
59
50
  end
60
51
  end
52
+
@@ -1,7 +1,5 @@
1
1
  # frozen_string_literal: false
2
2
 
3
- require 'hmap'
4
-
5
3
  module HMap
6
4
  class Command
7
5
  # hmap file reader cmd
@@ -20,7 +18,9 @@ module HMap
20
18
  def initialize(argv)
21
19
  super
22
20
  mapfile_path = argv.option('hmap-path')
23
- @mapfile_path = Pathname.new(mapfile_path).expand_path unless mapfile_path.nil?
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
24
24
  end
25
25
 
26
26
  def validate!
@@ -36,9 +36,9 @@ module HMap
36
36
  end
37
37
 
38
38
  def run
39
- puts "\n[hmap-reader] start..............\n".yellow
39
+ UserInterface.puts "\n[hmapfile] Reader start..............\n".yellow
40
40
  HMap::MapFileReader.new(@mapfile_path)
41
- puts "\n[hmap-reader] finish..............\n".yellow
41
+ UserInterface.puts "\n[hmapfile] Reader finish..............\n".yellow
42
42
  end
43
43
  end
44
44
  end
@@ -40,13 +40,15 @@ module HMap
40
40
  end
41
41
 
42
42
  def run
43
- puts "\n[hmap-gen-from-json] start..............".yellow
43
+ require 'json'
44
+ UserInterface.puts "\n[hmapfile-from-json] start..............".yellow
44
45
  json_file = File.read(@json_path)
45
46
  json = JSON.parse(json_file)
47
+ strs = json.map { |e| HMap::BucketStr.new(*e) }
46
48
  path = @output_path
47
49
  path = path.join("#{File.basename(@json_path, '.*')}.hmap") if path.directory?
48
- HMapSaver.new_from_buckets(json).write_to(path)
49
- puts '[hmap-gen-from-json] finish..............'.yellow
50
+ HMapSaver.new_from_buckets(strs).write_to(path)
51
+ UserInterface.puts '[hmapfile-from-json] finish..............'.yellow
50
52
  end
51
53
  end
52
54
  end
data/lib/hmap/command.rb CHANGED
@@ -8,12 +8,14 @@ module HMap
8
8
  class Command < CLAide::Command
9
9
  require 'hmap/command/hmap_writer'
10
10
  require 'hmap/command/hmap_reader'
11
+ require 'hmap/command/hmap_gen'
12
+
11
13
 
12
14
  self.abstract_command = false
13
15
  self.command = 'hmapfile'
14
16
  self.version = VERSION
15
17
  self.description = 'Read or write header map file.'
16
- self.plugin_prefixes = %w[claide writer reader]
18
+ self.plugin_prefixes = %w[claide writer reader gen]
17
19
 
18
20
  def initialize(argv)
19
21
  super
@@ -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
@@ -44,10 +44,10 @@ module HMap
44
44
  end
45
45
  full_command = "#{bin} #{command.join(' ')}"
46
46
 
47
- if Pod::Config.instance.verbose?
47
+ if Resolver.instance.verbose?
48
48
  p("$ #{full_command}")
49
- stdout = Indenter.new(STDOUT)
50
- stderr = Indenter.new(STDERR)
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 EOFError, IOError
189
- output << (buf << $/) unless buf.empty?
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