Create Wristivo iPhone and Apple Watch foundation
This commit is contained in:
Executable
+95
@@ -0,0 +1,95 @@
|
||||
#!/usr/bin/env ruby
|
||||
# Development-only dependency: xcodeproj 1.27.0. Generated project is committed.
|
||||
require 'xcodeproj'
|
||||
require 'fileutils'
|
||||
|
||||
# Seed object IDs deterministically before xcodeproj normalizes them. Otherwise
|
||||
# a target proxy's raw remoteGlobalIDString can leak a random ID into its hash.
|
||||
class WristivoProject < Xcodeproj::Project
|
||||
def generate_uuid
|
||||
@object_serial = (@object_serial || 0) + 1
|
||||
format('%024X', @object_serial)
|
||||
end
|
||||
end
|
||||
|
||||
root = File.expand_path('..', __dir__)
|
||||
Dir.chdir(root)
|
||||
project = WristivoProject.new('Wristivo.xcodeproj')
|
||||
project.root_object.attributes['LastUpgradeCheck'] = '2700'
|
||||
config = project.main_group.new_file('Config/Base.xcconfig')
|
||||
project.build_configurations.each do |c|
|
||||
c.base_configuration_reference = config
|
||||
end
|
||||
|
||||
package = project.new(Xcodeproj::Project::Object::XCLocalSwiftPackageReference)
|
||||
package.relative_path = 'Packages/WristivoKit'
|
||||
project.root_object.package_references << package
|
||||
|
||||
def add_sources(project, target, pattern)
|
||||
Dir.glob(pattern).sort.each do |path|
|
||||
ref = project.main_group.find_file_by_path(path) || project.main_group.new_file(path)
|
||||
target.source_build_phase.add_file_reference(ref)
|
||||
end
|
||||
end
|
||||
|
||||
def link_product(project, target, package, name)
|
||||
product = project.new(Xcodeproj::Project::Object::XCSwiftPackageProductDependency)
|
||||
product.package = package
|
||||
product.product_name = name
|
||||
target.package_product_dependencies << product
|
||||
build_file = project.new(Xcodeproj::Project::Object::PBXBuildFile)
|
||||
build_file.product_ref = product
|
||||
target.frameworks_build_phase.files << build_file
|
||||
end
|
||||
|
||||
phone = project.new_target(:application, 'Wristivo', :ios, '17.0')
|
||||
watch = project.new_target(:application, 'WristivoWatch', :watchos, '10.0')
|
||||
[phone, watch].each do |target|
|
||||
target.build_configurations.each do |c|
|
||||
c.build_settings['GENERATE_INFOPLIST_FILE'] = 'YES'
|
||||
c.build_settings['INFOPLIST_KEY_CFBundleDisplayName'] = 'Wristivo'
|
||||
c.build_settings['SWIFT_VERSION'] = '6.0'
|
||||
c.build_settings['SWIFT_STRICT_CONCURRENCY'] = 'complete'
|
||||
c.build_settings['CODE_SIGN_STYLE'] = 'Automatic'
|
||||
c.build_settings['ENABLE_USER_SCRIPT_SANDBOXING'] = 'YES'
|
||||
c.build_settings['LD_RUNPATH_SEARCH_PATHS'] = ['$(inherited)', '@executable_path/Frameworks']
|
||||
end
|
||||
add_sources(project, target, 'Apps/Shared/*.swift')
|
||||
link_product(project, target, package, 'RemoteCore')
|
||||
privacy = project.main_group.find_file_by_path('Resources/PrivacyInfo.xcprivacy') || project.main_group.new_file('Resources/PrivacyInfo.xcprivacy')
|
||||
target.resources_build_phase.add_file_reference(privacy)
|
||||
end
|
||||
add_sources(project, phone, 'Apps/iPhone/*.swift')
|
||||
add_sources(project, watch, 'Apps/Watch/*.swift')
|
||||
link_product(project, phone, package, 'SamsungProtocol')
|
||||
link_product(project, watch, package, 'GestureCore')
|
||||
phone.build_configurations.each do |c|
|
||||
c.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = '$(WRISTIVO_BUNDLE_PREFIX)'
|
||||
c.build_settings['TARGETED_DEVICE_FAMILY'] = '1,2'
|
||||
c.build_settings['INFOPLIST_KEY_UILaunchScreen_Generation'] = 'YES'
|
||||
c.build_settings['INFOPLIST_KEY_UIApplicationSceneManifest_Generation'] = 'YES'
|
||||
c.build_settings['SUPPORTS_MACCATALYST'] = 'NO'
|
||||
end
|
||||
watch.build_configurations.each do |c|
|
||||
c.build_settings['PRODUCT_BUNDLE_IDENTIFIER'] = '$(WRISTIVO_BUNDLE_PREFIX).watchkitapp'
|
||||
c.build_settings['TARGETED_DEVICE_FAMILY'] = '4'
|
||||
c.build_settings['INFOPLIST_KEY_WKApplication'] = 'YES'
|
||||
c.build_settings['INFOPLIST_KEY_WKCompanionAppBundleIdentifier'] = '$(WRISTIVO_BUNDLE_PREFIX)'
|
||||
c.build_settings['INFOPLIST_KEY_WKRunsIndependentlyOfCompanionApp'] = 'NO'
|
||||
c.build_settings['SKIP_INSTALL'] = 'YES'
|
||||
end
|
||||
phone.add_dependency(watch)
|
||||
embed = phone.new_copy_files_build_phase('Embed Watch Content')
|
||||
embed.dst_path = '$(CONTENTS_FOLDER_PATH)/Watch'
|
||||
embed.dst_subfolder_spec = '16'
|
||||
embedded = embed.add_file_reference(watch.product_reference)
|
||||
embedded.settings = { 'ATTRIBUTES' => ['RemoveHeadersOnCopy'] }
|
||||
project.predictabilize_uuids
|
||||
project.save
|
||||
[phone, watch].each do |target|
|
||||
scheme = Xcodeproj::XCScheme.new
|
||||
scheme.add_build_target(target)
|
||||
scheme.set_launch_target(target)
|
||||
scheme.save_as(project.path, target.name, true)
|
||||
end
|
||||
puts 'Generated Wristivo.xcodeproj; review the diff before committing.'
|
||||
Reference in New Issue
Block a user