Class: Pod::Type

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

Class Method Summary collapse

Class Method Details

.adjust_dynamic_static_change_pod(pod_root_path) ⇒ Object

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



121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/cocoapods-zjbinary/Main.rb', line 121

def self.adjust_dynamic_static_change_pod(pod_root_path)
    pod_type_path = pod_root_path+Pod::Type.pod_flag_file
    if not File.exist?(pod_type_path)
        FileUtils.remove_dir(pod_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.equal?(content)
                FileUtils.remove_dir(pod_root_path)
            end
        end

    end

end

.adjust_dynamic_static_change_pod_finish(pod_root_path) ⇒ Object

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



140
141
142
143
144
145
146
147
148
149
150
151
# File 'lib/cocoapods-zjbinary/Main.rb', line 140

def self.adjust_dynamic_static_change_pod_finish(pod_root_path)
    # 标记状态
    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



114
115
116
117
118
# File 'lib/cocoapods-zjbinary/Main.rb', line 114

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