Sha256: 863eea5fb0e448186301aefaba1afb12910d4064a9c6350cfb7bfb763a4dd0cd
Contents?: true
Size: 1.68 KB
Versions: 4
Compression:
Stored size: 1.68 KB
Contents
##Copyright 2023 ByteDance Ltd. and/or its affiliates ##SPDX-License-Identifier: MIT require 'xcodeproj' require 'yaml' module PM # lock文件读写 # class Lockfile def initialize(hash) @internal_data = hash end # 读取lock文件 # @requrn lock的json内容 # @param 文件路径 def self.read_from_path(path) if File.exist?(path) return true, YAML.load_file(path) end return false, nil end # 写入lock文件 def write_to_disk(path) begin is_exist, existing = Lockfile.read_from_path(path) return if existing == @internal_data rescue Exception end File.open(path, 'w+') do |f| YAML.dump(@internal_data,f) end end end class MProject def self.get_package_name project_path = Pod::Config.instance.project_root # pattern = File.join(project_path, '*.xcodeproj') # 匹配所有子目录下的 .xcodeproj 文件 # xcodeproj_path = Dir.glob(pattern).first xcodeprojs = project_path.children.select { |e| e.fnmatch('*.xcodeproj') } if xcodeprojs.size == 1 package_name_list = Array.new project = Xcodeproj::Project.open(xcodeprojs.first) project.targets.map(&:build_configuration_list).map(&:build_configurations).each do |item| package_name_list << item[1].simple_attributes_hash['buildSettings']['PRODUCT_BUNDLE_IDENTIFIER'] end package_name_list.uniq.compact else raise Informative, 'Could not automatically select an Xcode project. ' \ "Specify one in your Podfile like so:\n\n" \ " project 'path/to/Project.xcodeproj'\n" end end end end
Version data entries
4 entries across 4 versions & 1 rubygems