Class: Flutter::Produce
- Inherits:
-
Object
- Object
- Flutter::Produce
- Defined in:
- lib/produce.rb
Instance Method Summary collapse
Instance Method Details
#build ⇒ Object
101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 |
# File 'lib/produce.rb', line 101 def build # 创建framework存放目录 framework_path = Flutter::Config.instance.framework_path FileUtils.mkdir_p(framework_path) unless Dir.exist?(framework_path) config = Config.instance.config flutter_cmd = File.(File.join(flutter_root, "bin", "flutter")) if config if config.casecmp("debug").zero? system("#{flutter_cmd} build ios-framework --xcframework --no-universal --no-tree-shake-icons --debug --no-profile --no-release --output=#{Flutter::Config.instance.framework_path}") elsif config.casecmp("profile").zero? system("#{flutter_cmd} build ios-framework --xcframework --no-universal --no-tree-shake-icons --profile --no-debug --no-release --output=#{Flutter::Config.instance.framework_path}") elsif config.casecmp("release").zero? system("#{flutter_cmd} build ios-framework --xcframework --no-universal --no-tree-shake-icons --release --no-debug --no-profile --output=#{Flutter::Config.instance.framework_path}") else raise "请指定正确的构建类型(debug/profile/release)".red end else # 构建所有环境的包(debug、profile、release) system("#{flutter_cmd} build ios-framework --xcframework --no-universal --no-tree-shake-icons --output=#{Flutter::Config.instance.framework_path}") end end |
#log ⇒ Object
123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 |
# File 'lib/produce.rb', line 123 def log # 产物类型 product_type = if !Flutter::Config.instance.config "所有类型(debug/profile/release)" else Flutter::Config.instance.config end # 产物路径 product_path = if !Flutter::Config.instance.config File.(Flutter::Config.instance.framework_path, Dir.pwd) else File.(File.join(Flutter::Config.instance.framework_path, "#{product_type}"), Dir.pwd) end # 产物数量 product_num = if !Flutter::Config.instance.config Dir.glob("#{File.join(product_path, "Debug")}/*").size else Dir.glob("#{product_path}/*").size end Flutter::Print.print_product_info(product_type, product_num, product_path) # 产物 products = Dir.glob(File.join(product_path, "*.xcframework")).map do |file| File.basename(file) end Flutter::Config.instance.new_products = products puts "\n" pro_str = "" products.each do |ele| pro_str = pro_str + ele + "\n" end pro_str = pro_str.rstrip return if pro_str.empty? Flutter::Print.print_all_products(pro_str) end |