cocoapods-BDTransform 3.1.0 → 4.0.1
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 +103 -3
- data/lib/cocoapods-BDTransform/command/BDTransform.rb +1 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb +57 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/develop/GetDerivedDataUUID +0 -0
- data/lib/cocoapods-BDTransform/command/BDTransform/develop/dev.rb +448 -0
- data/lib/cocoapods-BDTransform/gem_version.rb +1 -1
- metadata +6 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1bee594ef3841463524203c69928f27219d2ebae
|
4
|
+
data.tar.gz: 46b883814b175207e98908069fa8be0574816fcb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: be20ef56d3312b2d6f6a2a356cde7aeb58e7ca2ec928853da1c65df9c68a89a9d6adab7b845bec7082290dbab34f32d5f65588b8ecc144c2347b7e887c2f8894
|
7
|
+
data.tar.gz: 83e46cbad27d7ba83f37ef37e8b60fbd2cd996b54887e4bbb1f088a4af3d3e3a866248bd8569d7fc1ebc40282128819d68f0693d8ac833d32cf71e83f72b138c
|
data/README.md
CHANGED
@@ -1,11 +1,111 @@
|
|
1
|
+

|
1
2
|
# cocoapods-BDTransform
|
2
3
|
|
3
|
-
|
4
|
+
cocoapods-BDTransform 是一款由组件化平台的提供的Pods辅助开发工具,可以方便地将二进制、源码、开发模式状态下的Pods进行转化。
|
5
|
+
|
6
|
+
##Feature
|
7
|
+
- [x] 一键切换
|
8
|
+
- [x] 无需重复pod install
|
9
|
+
- [x] 增量编译
|
10
|
+
|
4
11
|
|
5
12
|
## Installation
|
6
13
|
|
7
|
-
$ gem install cocoapods-BDTransform
|
14
|
+
$ sudo gem install cocoapods-BDTransform
|
8
15
|
|
9
16
|
## Usage
|
10
17
|
|
11
|
-
|
18
|
+
cocoapods-BDTransform是一款CocoaPods的插件,可以直接嵌入到pod指令中,同时也提供了详细的使用说明
|
19
|
+
|
20
|
+
```
|
21
|
+
|
22
|
+
➜ pod bdtransform
|
23
|
+
Usage:
|
24
|
+
|
25
|
+
$ pod bdtransform COMMAND
|
26
|
+
|
27
|
+
An awesome tool for transforming Pods from source to binary or binary to
|
28
|
+
source without pod install && re-complier.Note: only support for .a
|
29
|
+
currently .Warning: You should use 👉 bd_pod_extentions (~>5.1.0) 👈 to
|
30
|
+
install your Project
|
31
|
+
|
32
|
+
Commands:
|
33
|
+
|
34
|
+
+ to-binary Transform Pods from source to Binary Note: only support for
|
35
|
+
`.a` currently
|
36
|
+
+ to-dev Transform Pods from normal to Developer Pods Note: maybe not
|
37
|
+
stable,connect with wusizhen by any problems
|
38
|
+
+ to-source Transform Pods from binary to source Note: only support for
|
39
|
+
`.a` currently
|
40
|
+
|
41
|
+
Options:
|
42
|
+
|
43
|
+
--silent Show nothing
|
44
|
+
--verbose Show more debugging information
|
45
|
+
--no-ansi Show output without ANSI codes
|
46
|
+
--help Show help banner of specified command
|
47
|
+
|
48
|
+
```
|
49
|
+
|
50
|
+
##Example
|
51
|
+
由于头条的组件化进度比较快,因此以头条业务为例。目前头条业务中几乎所有的Pods都是以二进制状态存在,在日常开发迭代中经常会碰到下面的几种场景
|
52
|
+
####To-source
|
53
|
+
当RD开完后一个Feature进行打包测试时,发现CI产出的包有异常的边界Case。通常的做法是切换到CI打包的时候的commitID,将认为有问题的Pods改成源码进行Debug。但是在Debug过程中,发现需要调试其他Pods的源码,这时又需要把另外一个Pods切换到 **pod_source**状态,重新进行 **pod install、rebuild**等,如果又遇到新的Pods可能还要重复上述操作「**当然还有同学为了避免这种问题,直接从开始就用源码编译。。。**」
|
54
|
+
|
55
|
+
cocoapods-BDTransform插件可以避免上述的低效操作,比如Debug过程中发现**BDWebImage**需要进行调试,只需要在**Podfile同级目录下**运行下面指令,就可以进行Debug,而且是增量编译.
|
56
|
+
|
57
|
+
```
|
58
|
+
pod bdtransform to-source BDWebImage
|
59
|
+
```
|
60
|
+
####To-bianry
|
61
|
+
切换源码到二进制过程的场景相对比较少。比如有业务同学想要调试二进制包问题,可以随意的进行二进制和源码切换。
|
62
|
+
####To-dev
|
63
|
+
任意模式切换到Development Pods模式。在日常的组件化开发中,待开发的组件经常会以
|
64
|
+
|
65
|
+
```
|
66
|
+
pod 'xxx',:path => 'xxx'
|
67
|
+
```
|
68
|
+
的方式集成到主工程进行开发,但是如果遇到需要调试并且开发的的Pods时,常常需要再次修改Podfile,重新**pod install、rebuild**等。
|
69
|
+
|
70
|
+
基于此,cocoapods-BDTransform提供了一件切换**Dev**模式的功能。
|
71
|
+
|
72
|
+
```
|
73
|
+
➜ pod bdtransform to-dev
|
74
|
+
[!] A Podspec path is required.
|
75
|
+
|
76
|
+
Usage:
|
77
|
+
|
78
|
+
$ pod bdtransform to-dev
|
79
|
+
|
80
|
+
Transform Pods from normal to Developer Pods Note: maybe not
|
81
|
+
stable,connect with bupterambition@gmail.com by any problems. Warning: You
|
82
|
+
should use `bd_pod_extentions (~>5.0.0)` to install your Project
|
83
|
+
|
84
|
+
Options:
|
85
|
+
|
86
|
+
--podspec= the absolute path of your podspec to dev. i.e
|
87
|
+
--podspec=xxx/xxx.podspec
|
88
|
+
--subspecs= build with given subspecs. i.e --subspecs=Core,Monitor
|
89
|
+
--targets= the effected target of this operation. Default action effects
|
90
|
+
all your target of Project
|
91
|
+
```
|
92
|
+
|
93
|
+
以头条项目中的**TTUIWidget**为例,在全部使用二进制编译完成后,如果RD想要进行**TTUIWidget**功能的修改,可以使用下面命令
|
94
|
+
|
95
|
+
```
|
96
|
+
pod bdtransform to-dev --podspec=/Users/bob/Git/ios/tt_pods_ui/TTUIWidget.podspec --targets=NewsInHouse
|
97
|
+
```
|
98
|
+
**--podspec**指令表示待开发的**podspec绝对路径**,与**:path**用法相同;
|
99
|
+
**--targets**的作用与哪个Target生效,比如头条中有 **NewsInHouse、NewsSocialTodayExtenstion** 等Target
|
100
|
+
|
101
|
+
修改完成后使用Xcode自带的**Source Control**功能可以自动关联到tt_pods_ui这个仓库,解决了以往的需要两处提交的问题
|
102
|
+
|
103
|
+

|
105
|
+
|
106
|
+
#####Warn:
|
107
|
+
**目前对于xib以及bundle语法支持有限,因此在待开发的Pods的版本差别很大时,会出现小概率的编译缓存问题**
|
108
|
+
##Note
|
109
|
+
|
110
|
+
BDTransform中的**to-binary**、**to-source** 是与组件化平台的策略强相关的,由于影响面巨大,前期在头条业务线经过了一个月的灰度阶段,目前已经比较稳定。如果其他业务线接入的话,请联系wusizhen.arch
|
111
|
+
|
@@ -5,6 +5,7 @@ module Pod
|
|
5
5
|
self.summary = 'Transform Pods from source to binary or binary to source without pod install && re-complier .Note: only support for .a currently'
|
6
6
|
require 'cocoapods-BDTransform/command/BDTransform/ToBinary'
|
7
7
|
require 'cocoapods-BDTransform/command/BDTransform/ToSource'
|
8
|
+
require 'cocoapods-BDTransform/command/BDTransform/ToDev'
|
8
9
|
self.description = <<-DESC
|
9
10
|
An awesome tool for transforming Pods from source to binary or binary to source without pod install && re-complier.Note: only support for .a currently .Warning: You should use 👉 bd_pod_extentions (2.0.0) 👈 to install your Project
|
10
11
|
DESC
|
@@ -0,0 +1,57 @@
|
|
1
|
+
require 'cocoapods-BDTransform/command/BDTransform/develop/dev.rb'
|
2
|
+
module Pod
|
3
|
+
class Command
|
4
|
+
class Bdtransform
|
5
|
+
class ToDev < Bdtransform
|
6
|
+
self.summary = 'Transform Pods from normal to Developer Pods Note: maybe not stable,connect with bupterambition@gmail.com by any problems'
|
7
|
+
|
8
|
+
self.description = <<-DESC
|
9
|
+
Transform Pods from normal to Developer Pods Note: maybe not stable,connect with bupterambition@gmail.com by any problems. Warning: You should use `bd_pod_extentions (~>5.0.0)` to install your Project
|
10
|
+
DESC
|
11
|
+
|
12
|
+
def self.options
|
13
|
+
[
|
14
|
+
['--podspec=', 'the absolute path of your podspec to dev. i.e --podspec=xxx/xxx.podspec'],
|
15
|
+
['--subspecs=', 'build with given subspecs. i.e --subspecs=Core,Monitor'],
|
16
|
+
['--targets=', 'the effected target of this operation. Default action effects all your target of Project']
|
17
|
+
]
|
18
|
+
end
|
19
|
+
|
20
|
+
def initialize(argv)
|
21
|
+
super
|
22
|
+
@podspec = argv.option('podspec')
|
23
|
+
subspecs = argv.option('subspecs')
|
24
|
+
targets = argv.option('targets')
|
25
|
+
@subspecs = subspecs.split(',') unless subspecs.nil?
|
26
|
+
@targets = targets.split(',') unless targets.nil?
|
27
|
+
if @podspec
|
28
|
+
@podspecName = File.basename(@podspec, ".*")
|
29
|
+
else
|
30
|
+
@podspec = 'no support'
|
31
|
+
end
|
32
|
+
@podProjectPath = Dir::pwd + "/" + "Pods/Pods.xcodeproj"
|
33
|
+
|
34
|
+
end
|
35
|
+
|
36
|
+
def validate!
|
37
|
+
help! 'A Podspec path is required.' unless File::exist?(@podspec)
|
38
|
+
help! 'Did not find your Pods Dir in current Dir' unless File::directory?(@podProjectPath)
|
39
|
+
end
|
40
|
+
|
41
|
+
def run
|
42
|
+
accessor
|
43
|
+
BDAwesomeTransmit::BDPodsTrans.transmit(@podspec,@subspecs,@sandboxPath,@podProjectPath,@podspecName,@workspacePath,@workspaceName,@targets)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
|
49
|
+
def accessor
|
50
|
+
@sandboxPath = Dir::pwd + "/Pods"
|
51
|
+
@workspaceName = File.basename(Dir["*.xcworkspace"][0], ".*")
|
52
|
+
@workspacePath = Dir::pwd + "/" + File.basename(Dir["*.xcworkspace"][0])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
end
|
@@ -0,0 +1,448 @@
|
|
1
|
+
require 'cocoapods-core'
|
2
|
+
require 'cocoapods-core/specification/json'
|
3
|
+
require 'cocoapods'
|
4
|
+
require 'cocoapods/sandbox/path_list'
|
5
|
+
require 'cocoapods/project'
|
6
|
+
|
7
|
+
module BDAwesomeTransmit
|
8
|
+
class BDPodsTrans
|
9
|
+
def self.transmit(podspec,subspecs,sandboxPath,podProjectPath,podspecName,workspacePath,workspaceName,effectedTargets)
|
10
|
+
self.accessor(podspec,subspecs,sandboxPath,podProjectPath,podspecName,workspacePath,workspaceName,effectedTargets)
|
11
|
+
self.add_pod_to_Dev(podspecName)
|
12
|
+
@@project.save
|
13
|
+
end
|
14
|
+
|
15
|
+
def self.accessor(podspec,subspecs,sandboxPath,podProjectPath,podspecName,workspacePath,workspaceName,effectedTargets)
|
16
|
+
@@library_to_build = Array.new()
|
17
|
+
@@framework_to_build = Array.new()
|
18
|
+
@@effectedTargets = effectedTargets
|
19
|
+
@@podDirPath = sandboxPath
|
20
|
+
@@subspecs_build = subspecs
|
21
|
+
@@handlePodName = podspecName
|
22
|
+
@@workspacePath = workspacePath
|
23
|
+
@@workspaceName = workspaceName
|
24
|
+
@@devPodPath = File.dirname(podspec)
|
25
|
+
@@sandbox = Pod::Sandbox.new(sandboxPath)
|
26
|
+
@@sandbox.store_podspec(podspecName,File.open(podspec, 'r:utf-8', &:read))
|
27
|
+
@@path = Pod::Sandbox::PathList.new(@@devPodPath)
|
28
|
+
@@spec = Pod::Specification.from_file(podspec)
|
29
|
+
@@project = Xcodeproj::Project.open(podProjectPath)
|
30
|
+
@@file_to_added = Array.new()
|
31
|
+
@@file_to_resource = Array.new()
|
32
|
+
@@bunlde_resource = Hash.new()
|
33
|
+
@@resourceTarget = Array.new()
|
34
|
+
end
|
35
|
+
|
36
|
+
def self.add_pod_to_Dev(pod_name)
|
37
|
+
|
38
|
+
@@project.main_group.new_group('Development Pods') unless self.isContainDevPod
|
39
|
+
|
40
|
+
self.generatorTargetIfNeeded
|
41
|
+
|
42
|
+
self.generatorNewGroup(pod_name)
|
43
|
+
|
44
|
+
targetGroup = self.development_pod.new_group(pod_name)
|
45
|
+
|
46
|
+
raise "Group of #{@@handlePodName} create fail,please retry" unless targetGroup
|
47
|
+
|
48
|
+
buildFiles,headerFiles = self.sourceToAdded(targetGroup)
|
49
|
+
|
50
|
+
self.addToTarget(buildFiles,pod_name)
|
51
|
+
|
52
|
+
self.addResource
|
53
|
+
|
54
|
+
self.addSupportFiles(pod_name)
|
55
|
+
|
56
|
+
self.generatorSearchHeader(headerFiles,pod_name)
|
57
|
+
|
58
|
+
self.rectifyconfig
|
59
|
+
|
60
|
+
self.removeDepressedProductAndOfiles
|
61
|
+
|
62
|
+
@@project.save
|
63
|
+
|
64
|
+
end
|
65
|
+
|
66
|
+
private
|
67
|
+
|
68
|
+
|
69
|
+
def self.generatorNewGroup(pod_name)
|
70
|
+
if self.isInDevPod(pod_name) || self.isInNormalPods(pod_name)
|
71
|
+
self.saveSupport(self.pod_group(pod_name))
|
72
|
+
self.pod_group(pod_name).clear
|
73
|
+
self.pod_group(pod_name).remove_from_project
|
74
|
+
else
|
75
|
+
self.saveSupport(@@project.main_group)
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
def self.generatorTargetIfNeeded
|
80
|
+
purePods = self.isPurePods
|
81
|
+
if purePods
|
82
|
+
@@current_target = Xcodeproj::Project::ProjectHelper::new_target(@@project,:static_library,@@handlePodName,:ios,"8.0",self.isInGroup(@@project.main_group,'Products'),:objc)
|
83
|
+
self.mainPodTarget.each do |target|
|
84
|
+
target.add_dependency(@@current_target)
|
85
|
+
end
|
86
|
+
@@project.save
|
87
|
+
else
|
88
|
+
@@project.targets.find { |target| target.name == @@handlePodName}.build_configurations.each do |c|
|
89
|
+
c.base_configuration_reference = nil
|
90
|
+
end
|
91
|
+
end
|
92
|
+
end
|
93
|
+
|
94
|
+
def self.isPurePods
|
95
|
+
targets = @@project.targets.find { |target| target.name == @@handlePodName}
|
96
|
+
if targets
|
97
|
+
return false
|
98
|
+
end
|
99
|
+
return true
|
100
|
+
end
|
101
|
+
|
102
|
+
def self.addResource
|
103
|
+
@@resourceTarget.each do |target|
|
104
|
+
target.resources_build_phase.clear
|
105
|
+
targetName = target.name.split("-").last
|
106
|
+
if @@bunlde_resource[targetName]
|
107
|
+
@@bunlde_resource[targetName].each do |file|
|
108
|
+
target.resources_build_phase.add_file_reference(file,true)
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
def self.removeDepressedProductAndOfiles
|
115
|
+
cdir = File.dirname(__FILE__)
|
116
|
+
system("uuid=`#{cdir}/GetDerivedDataUUID #{@@workspacePath}`;domin=`pwd|awk -F '/' '{printf $3}'`;cd /Users/$domin/Library/Developer/Xcode/DerivedData/#{@@workspaceName}-$uuid/Build;target=BDWebImage;IFS=$'\n';find ./ -type d -name \"$target\" -depth 3 |xargs rm -rf >> /dev/null ;find ./ -type d -name \"$target.build\" -depth 4 |xargs rm -rf>> /dev/null")
|
117
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -exec chmod 777 {} \\;")
|
118
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.m\" -exec rm {} \\;")
|
119
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.a\" -exec rm {} \\;")
|
120
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type d -name \"*.framework\" -exec rm {} \\;")
|
121
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.h\" -exec rm {} \\;")
|
122
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.mm\" -exec rm {} \\;")
|
123
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.hpp\" -exec rm {} \\;")
|
124
|
+
system("cd #{@@podDirPath}/#{@@handlePodName};find ./ -type f -name \"*.cpp\" -exec rm {} \\;")
|
125
|
+
end
|
126
|
+
|
127
|
+
def self.correctionGroup
|
128
|
+
recovered = @@project.groups.find { |group| group.name == 'Recovered References' }
|
129
|
+
if recovered
|
130
|
+
recovered.remove_from_project
|
131
|
+
end
|
132
|
+
@@project.save
|
133
|
+
end
|
134
|
+
|
135
|
+
def self.rectifyconfig
|
136
|
+
@@current_target_config_path = @@podDirPath + "/Target Support Files/#{@@handlePodName}/#{@@handlePodName}.xcconfig"
|
137
|
+
raise 'did not find useable xcconfig' unless @@current_target_config_path
|
138
|
+
(self.findxcconfig << @@current_target_config_path).each do |configPath|
|
139
|
+
if !configPath.include?(".origin")
|
140
|
+
config = nil;
|
141
|
+
if File::exist?(configPath)
|
142
|
+
config = Xcodeproj::Config.new(configPath)
|
143
|
+
else
|
144
|
+
if !File::exist?(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
145
|
+
Dir::mkdir(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
146
|
+
end
|
147
|
+
File.new(configPath, "a+")
|
148
|
+
config = Xcodeproj::Config.new()
|
149
|
+
end
|
150
|
+
if configPath.include?("#{@@handlePodName}.xcconfig")
|
151
|
+
config.merge!('CONFIGURATION_BUILD_DIR' => "${PODS_CONFIGURATION_BUILD_DIR}/#{@@handlePodName}",'PODS_BUILD_DIR' =>'${BUILD_DIR}','SKIP_INSTALL' => 'YES','PODS_CONFIGURATION_BUILD_DIR'=>'${PODS_BUILD_DIR}/$(CONFIGURATION)$(EFFECTIVE_PLATFORM_NAME)')
|
152
|
+
else
|
153
|
+
config.merge!('LIBRARY_SEARCH_PATHS' => "\"${PODS_CONFIGURATION_BUILD_DIR}/#{@@handlePodName}\"")
|
154
|
+
end
|
155
|
+
config.merge!('LIBRARY_SEARCH_PATHS' => "#{@@devPodPath}/**")
|
156
|
+
awesomePods = Array.new()
|
157
|
+
config.other_linker_flags[:libraries].each do |lib|
|
158
|
+
if lib.include?("#{@@handlePodName}") && (lib.include?("_Awesome_") || lib.include?("_awesome"))
|
159
|
+
awesomePods << lib
|
160
|
+
end
|
161
|
+
end
|
162
|
+
target = configPath.split("/Pods-").last.split(".")[0]
|
163
|
+
if !@@effectedTargets
|
164
|
+
config.other_linker_flags[:libraries] = config.other_linker_flags[:libraries] | @@library_to_build
|
165
|
+
elsif @@effectedTargets.include?(target)
|
166
|
+
config.other_linker_flags[:libraries] = config.other_linker_flags[:libraries] | @@library_to_build
|
167
|
+
end
|
168
|
+
|
169
|
+
config.other_linker_flags[:libraries] = config.other_linker_flags[:libraries] - awesomePods
|
170
|
+
config.other_linker_flags[:frameworks] = config.other_linker_flags[:frameworks] | @@framework_to_build
|
171
|
+
pn = Pathname.new(configPath)
|
172
|
+
config.save_as(pn)
|
173
|
+
end
|
174
|
+
|
175
|
+
end
|
176
|
+
|
177
|
+
end
|
178
|
+
|
179
|
+
def self.findxcconfig
|
180
|
+
@@project_path = Dir::pwd + "/Pods/Target Support Files"
|
181
|
+
allConfigFiles = Array.new
|
182
|
+
Dir::foreach(@@project_path) { |file|
|
183
|
+
if file.include?("Pods-")
|
184
|
+
Dir::foreach("#{@@project_path}/#{file}") { |config|
|
185
|
+
if config.include?(".xcconfig")
|
186
|
+
allConfigFiles << "#{@@project_path}/#{file}/#{config}"
|
187
|
+
end
|
188
|
+
}
|
189
|
+
end
|
190
|
+
}
|
191
|
+
return allConfigFiles
|
192
|
+
end
|
193
|
+
|
194
|
+
def self.saveSupport(group)
|
195
|
+
|
196
|
+
dummyPath = @@podDirPath + "/Target Support Files/#{@@handlePodName}/#{@@handlePodName}-dummy.m"
|
197
|
+
if !File::exist?(dummyPath)
|
198
|
+
if !File::exist?(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
199
|
+
Dir::mkdir(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
200
|
+
end
|
201
|
+
File.new(dummyPath, "a+")
|
202
|
+
pn = Pathname.new(dummyPath)
|
203
|
+
Pod::Generator::DummySource.new(@@handlePodName).save_as(pn)
|
204
|
+
end
|
205
|
+
|
206
|
+
prefixPath = @@podDirPath + "/Target Support Files/#{@@handlePodName}/#{@@handlePodName}-prefix.pch"
|
207
|
+
if !File::exist?(prefixPath)
|
208
|
+
if !File::exist?(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
209
|
+
Dir::mkdir(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
210
|
+
end
|
211
|
+
File.new(prefixPath, "a+")
|
212
|
+
pn = Pathname.new(prefixPath)
|
213
|
+
platform = Pod::Platform.new(:ios)
|
214
|
+
Pod::Generator::Header.new(platform).save_as(pn)
|
215
|
+
end
|
216
|
+
|
217
|
+
config = nil
|
218
|
+
configPath = @@podDirPath + "/Target Support Files/#{@@handlePodName}/#{@@handlePodName}.xcconfig"
|
219
|
+
if !File::exist?(configPath)
|
220
|
+
if !File::exist?(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
221
|
+
Dir::mkdir(@@podDirPath + "/Target Support Files/#{@@handlePodName}")
|
222
|
+
end
|
223
|
+
File.new(configPath, "a+")
|
224
|
+
config = Xcodeproj::Config.new()
|
225
|
+
else
|
226
|
+
config = Xcodeproj::Config.new(configPath)
|
227
|
+
end
|
228
|
+
raise "config did not find" unless config
|
229
|
+
|
230
|
+
config.merge!('HEADER_SEARCH_PATHS' => "\"#{@@podDirPath}/Headers/Public/**\"",'GCC_PREFIX_HEADER' => "Target Support Files/#{@@handlePodName}/#{@@handlePodName}-prefix.pch")
|
231
|
+
pn = Pathname.new(configPath)
|
232
|
+
config.save_as(pn)
|
233
|
+
@@project.save
|
234
|
+
end
|
235
|
+
|
236
|
+
def self.generatorSearchHeader(header_files,pod_name)
|
237
|
+
headerStore = Pod::Sandbox::HeadersStore.new(@@sandbox,'Public')
|
238
|
+
headerStore.add_files(pod_name,header_files.map { |file| Pathname.new(file.path) })
|
239
|
+
@@current_target.headers_build_phase.clear
|
240
|
+
header_files.each do |headerFile|
|
241
|
+
@@current_target.headers_build_phase.add_file_reference(headerFile,true)
|
242
|
+
end
|
243
|
+
end
|
244
|
+
|
245
|
+
def self.addSupportFiles(pod_name)
|
246
|
+
tempGroup = self.pod_group(pod_name).new_group('Support Files')
|
247
|
+
current_suport_dir = "#{@@podDirPath}/Target Support Files/#{@@handlePodName}"
|
248
|
+
Dir.foreach(current_suport_dir) do |file|
|
249
|
+
if File::file?("#{current_suport_dir}/#{file}")
|
250
|
+
fileref = Xcodeproj::Project::Object::FileReferencesFactory.new_reference(tempGroup,"#{current_suport_dir}/#{file}",:group)
|
251
|
+
if file.to_s.include?(".xcconfig")
|
252
|
+
@@current_target.build_configurations.each do |c|
|
253
|
+
c.base_configuration_reference = fileref
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
257
|
+
end
|
258
|
+
|
259
|
+
@@project.save
|
260
|
+
end
|
261
|
+
|
262
|
+
|
263
|
+
def self.sourceToAdded(group)
|
264
|
+
buildFiles = Array.new()
|
265
|
+
headerFiles = Array.new()
|
266
|
+
self.parseDependency
|
267
|
+
self.recursiveHandleSpec(group,@@spec,buildFiles,headerFiles,false)
|
268
|
+
@@project.save
|
269
|
+
[buildFiles,headerFiles]
|
270
|
+
end
|
271
|
+
|
272
|
+
def self.parseDependency
|
273
|
+
return unless @@subspecs_build
|
274
|
+
@@spec.subspecs.each do |spec|
|
275
|
+
if @@subspecs_build.include?(spec.module_name)
|
276
|
+
spec.dependencies.each do |dependency|
|
277
|
+
if dependency.name.include?("#{@@handlePodName}/")
|
278
|
+
@@subspecs_build << dependency.name.split("/").last
|
279
|
+
end
|
280
|
+
end
|
281
|
+
end
|
282
|
+
end
|
283
|
+
@@subspecs_build = @@subspecs_build.uniq
|
284
|
+
end
|
285
|
+
|
286
|
+
def self.recursiveHandleSpec(group,spec,buildFiles,headerFiles,needCreateNewGroup = true,superSubspecName = nil)
|
287
|
+
if self.isInGroup(group,spec.module_name)
|
288
|
+
self.isInGroup(group,spec.module_name).remove_from_project
|
289
|
+
end
|
290
|
+
subgroup = group
|
291
|
+
if needCreateNewGroup
|
292
|
+
subgroup = group.new_group(spec.module_name)
|
293
|
+
end
|
294
|
+
|
295
|
+
platform = Pod::Platform.new(:ios)
|
296
|
+
consumer = spec.consumer(platform)
|
297
|
+
fileaccessor = Pod::Sandbox::FileAccessor.new(@@path,consumer)
|
298
|
+
|
299
|
+
fileaccessor.source_files.each do |filePath|
|
300
|
+
if !@@file_to_added.include?(filePath)
|
301
|
+
@@file_to_added << filePath
|
302
|
+
fileRefense,xcversion = Xcodeproj::Project::Object::FileReferencesFactory.new_reference(subgroup,filePath,:group)
|
303
|
+
if fileRefense
|
304
|
+
if fileRefense.path.end_with?(".m", ".mm", ".swift",".c",".cpp") && !buildFiles.include?(fileRefense)
|
305
|
+
buildFiles << fileRefense
|
306
|
+
elsif fileRefense.path.end_with?(".h",".hpp") && !buildFiles.include?(fileRefense)
|
307
|
+
headerFiles << fileRefense
|
308
|
+
end
|
309
|
+
end
|
310
|
+
end
|
311
|
+
|
312
|
+
end
|
313
|
+
fileaccessor.vendored_static_frameworks.each do |filePath|
|
314
|
+
if !self.isInGroup(subgroup,'frameworks')
|
315
|
+
subgroup.new_group('frameworks')
|
316
|
+
end
|
317
|
+
libBasename = File.basename(filePath.to_s)
|
318
|
+
if !@@framework_to_build.include?(libBasename)
|
319
|
+
@@framework_to_build << libBasename
|
320
|
+
Xcodeproj::Project::Object::FileReferencesFactory.new_reference(self.isInGroup(subgroup,'frameworks'),filePath,:group)
|
321
|
+
end
|
322
|
+
|
323
|
+
end
|
324
|
+
fileaccessor.vendored_libraries.each do |filePath|
|
325
|
+
if !self.isInGroup(subgroup,'frameworks')
|
326
|
+
subgroup.new_group('frameworks')
|
327
|
+
end
|
328
|
+
libBasename = File.basename(filePath.to_s,".*").gsub("lib","")
|
329
|
+
if !@@library_to_build.include?(libBasename)
|
330
|
+
@@library_to_build << libBasename
|
331
|
+
Xcodeproj::Project::Object::FileReferencesFactory.new_reference(self.isInGroup(subgroup,'frameworks'),filePath,:group)
|
332
|
+
end
|
333
|
+
end
|
334
|
+
|
335
|
+
fileaccessor.resource_bundles.each do |bundleName,filePaths|
|
336
|
+
if !self.isInGroup(subgroup,'Resources')
|
337
|
+
subgroup.new_group('Resources')
|
338
|
+
end
|
339
|
+
resources = Array.new
|
340
|
+
filePaths.each do |filePath|
|
341
|
+
libBasename = File.basename(filePath.to_s)
|
342
|
+
if !@@file_to_resource.include?(libBasename)
|
343
|
+
@@file_to_resource << libBasename
|
344
|
+
fileRefense,xcversion = Xcodeproj::Project::Object::FileReferencesFactory.new_reference(self.isInGroup(subgroup,'Resources'),filePath,:group)
|
345
|
+
if fileRefense
|
346
|
+
resources << fileRefense
|
347
|
+
end
|
348
|
+
end
|
349
|
+
end
|
350
|
+
@@bunlde_resource = @@bunlde_resource.merge({bundleName => resources})
|
351
|
+
end
|
352
|
+
|
353
|
+
|
354
|
+
|
355
|
+
if !@@library_to_build.include?(@@handlePodName)
|
356
|
+
@@library_to_build << @@handlePodName
|
357
|
+
end
|
358
|
+
|
359
|
+
if spec.subspecs.count
|
360
|
+
spec.subspecs.each do |sub|
|
361
|
+
if !@@subspecs_build || @@subspecs_build.include?(sub.module_name) || @@subspecs_build.include?(superSubspecName)
|
362
|
+
self.recursiveHandleSpec(subgroup,sub,buildFiles,headerFiles,true,spec.module_name)
|
363
|
+
end
|
364
|
+
end
|
365
|
+
end
|
366
|
+
|
367
|
+
end
|
368
|
+
|
369
|
+
def self.mainPodTarget
|
370
|
+
@@project.targets.select { |target|
|
371
|
+
target.name.include?("Pods-")
|
372
|
+
}
|
373
|
+
end
|
374
|
+
|
375
|
+
def self.addToTarget(files,pod_name)
|
376
|
+
@@current_target = nil
|
377
|
+
@@project.targets.each do |target|
|
378
|
+
targetName = target.name
|
379
|
+
if target.name.include?"-"
|
380
|
+
targetName = target.name.split("-")[0]
|
381
|
+
end
|
382
|
+
if targetName == pod_name
|
383
|
+
if !@@current_target
|
384
|
+
if target.symbol_type.to_s == 'static_library'
|
385
|
+
@@current_target = target
|
386
|
+
target.source_build_phase.clear
|
387
|
+
end
|
388
|
+
end
|
389
|
+
if target.symbol_type.to_s == 'bundle'
|
390
|
+
@@resourceTarget << target
|
391
|
+
end
|
392
|
+
end
|
393
|
+
end
|
394
|
+
raise "Don't find Any Target named #{pod_name}" unless @@current_target
|
395
|
+
files.each do |file|
|
396
|
+
@@current_target.source_build_phase.add_file_reference(file,true)
|
397
|
+
end
|
398
|
+
@@resourceTarget
|
399
|
+
end
|
400
|
+
|
401
|
+
def self.isInGroup(targetGroup,subName)
|
402
|
+
targetGroup.children.find { |group| group.name == subName || group.path == subName }
|
403
|
+
end
|
404
|
+
|
405
|
+
def self.isContainDevPod
|
406
|
+
find = @@project.groups.find { |group| group.name == 'Development Pods' }
|
407
|
+
find.class != NilClass
|
408
|
+
end
|
409
|
+
|
410
|
+
def self.isInDevPod(pod_name)
|
411
|
+
self.development_pods.find { |group| group.name == pod_name || group.path == pod_name }.class != NilClass
|
412
|
+
end
|
413
|
+
|
414
|
+
def self.isInNormalPods(pod_name)
|
415
|
+
self.pods.find { |group| group.name == pod_name || group.path == pod_name }
|
416
|
+
end
|
417
|
+
|
418
|
+
def self.pod_group(pod_name)
|
419
|
+
self.pod_groups.find { |group| group.name == pod_name || group.path == pod_name }
|
420
|
+
end
|
421
|
+
|
422
|
+
def self.pod_groups
|
423
|
+
if self.development_pods
|
424
|
+
return self.pods + self.development_pods
|
425
|
+
end
|
426
|
+
return self.pods
|
427
|
+
end
|
428
|
+
|
429
|
+
def self.development_pod
|
430
|
+
if self.isContainDevPod
|
431
|
+
return @@project.groups.find { |group| group.name == 'Development Pods' }
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
|
436
|
+
def self.pods
|
437
|
+
find = @@project.groups.find { |group| group.name == 'Pods' }
|
438
|
+
find.children.objects
|
439
|
+
end
|
440
|
+
|
441
|
+
def self.development_pods
|
442
|
+
if self.isContainDevPod
|
443
|
+
return @@project.groups.find { |group| group.name == 'Development Pods' }.children.objects
|
444
|
+
end
|
445
|
+
end
|
446
|
+
|
447
|
+
end
|
448
|
+
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cocoapods-BDTransform
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 4.0.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- bupterambition
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-09-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bd_pod_extentions
|
@@ -81,7 +81,10 @@ files:
|
|
81
81
|
- lib/cocoapods-BDTransform/command/BDTransform/AweToBinary
|
82
82
|
- lib/cocoapods-BDTransform/command/BDTransform/AweToSource
|
83
83
|
- lib/cocoapods-BDTransform/command/BDTransform/ToBinary.rb
|
84
|
+
- lib/cocoapods-BDTransform/command/BDTransform/ToDev.rb
|
84
85
|
- lib/cocoapods-BDTransform/command/BDTransform/ToSource.rb
|
86
|
+
- lib/cocoapods-BDTransform/command/BDTransform/develop/GetDerivedDataUUID
|
87
|
+
- lib/cocoapods-BDTransform/command/BDTransform/develop/dev.rb
|
85
88
|
- lib/cocoapods-BDTransform/gem_version.rb
|
86
89
|
- lib/cocoapods_plugin.rb
|
87
90
|
homepage: https://github.com/Bupterambition/BDAwesomeTransmit
|
@@ -104,7 +107,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
104
107
|
version: '0'
|
105
108
|
requirements: []
|
106
109
|
rubyforge_project:
|
107
|
-
rubygems_version: 2.5.2
|
110
|
+
rubygems_version: 2.5.2
|
108
111
|
signing_key:
|
109
112
|
specification_version: 4
|
110
113
|
summary: A longer description of cocoapods-BDTransform.
|