Class: Pod::Type

Inherits:
Object
  • Object
show all
Defined in:
lib/cocoapods-xlbuild/Main.rb

Class Method Summary collapse

Class Method Details

.adjust_dynamic_static_change_pod(standard_sandbox) ⇒ Object

动静态库切换时候需要重新build(删除Pod目录重新构建)



109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
# File 'lib/cocoapods-xlbuild/Main.rb', line 109

def self.adjust_dynamic_static_change_pod(standard_sandbox)
    # 动|静态库(mach-o type)切换需要重新build(删除Pod/_Prebuild目录)
    _prebuild_sandbox = Pod::PrebuildSandbox.from_standard_sandbox(standard_sandbox)
    _pod_prebuild_root_path = _prebuild_sandbox.root
    is_pod_prebuild_root_path_exist = File.exist?(_pod_prebuild_root_path)

    pod_root_path = standard_sandbox.root
    pod_type_path = pod_root_path+Pod::Type.pod_flag_file
    if not File.exist?(pod_type_path) and is_pod_prebuild_root_path_exist
        FileUtils.remove_dir(_pod_prebuild_root_path)
    else
        frameworks_type = Pod::Type.frameworks_type
        aFile = File.new(pod_type_path, "r")
        if aFile
            content = aFile.readlines[0]
            if not frameworks_type.eql?(content) and is_pod_prebuild_root_path_exist
                FileUtils.remove_dir(_pod_prebuild_root_path)
            end
        end

    end

end

.adjust_dynamic_static_change_pod_finish(standard_sandbox) ⇒ Object

构建结束 标记当前打包的是动|静态库



134
135
136
137
138
139
140
141
142
143
144
145
146
# File 'lib/cocoapods-xlbuild/Main.rb', line 134

def self.adjust_dynamic_static_change_pod_finish(standard_sandbox)
    # 标记状态
    pod_root_path = standard_sandbox.root
    pod_type_path = pod_root_path+Pod::Type.pod_flag_file
    if File.exist?(pod_type_path)
        File.delete(pod_type_path)
    end

    frameworks_type = Pod::Type.frameworks_type
    File.open(pod_type_path, "w+") { |f|
        f.write(frameworks_type)
    }
end

.frameworks_typeObject



102
103
104
105
106
# File 'lib/cocoapods-xlbuild/Main.rb', line 102

def self.frameworks_type
    is_static_binary = Pod::Podfile::DSL.static_binary
    frameworks_type = is_static_binary ? "static" : "dynamic"
    return frameworks_type
end