update_version-ios.py (5558B)
1 #!/usr/bin/env python3 2 3 # this script will create/update info plist files based on config.h 4 5 import plistlib, os, sys, shutil 6 7 IPLUG2_ROOT = "../../iPlug2" 8 9 scriptpath = os.path.dirname(os.path.realpath(__file__)) 10 projectpath = os.path.abspath(os.path.join(scriptpath, os.pardir)) 11 12 kAudioUnitType_MusicDevice = "aumu" 13 kAudioUnitType_MusicEffect = "aumf" 14 kAudioUnitType_Effect = "aufx" 15 kAudioUnitType_MIDIProcessor = "aumi" 16 17 sys.path.insert(0, os.path.join(os.getcwd(), IPLUG2_ROOT + "/Scripts")) 18 19 from parse_config import parse_config, parse_xcconfig 20 21 22 def main(): 23 config = parse_config(projectpath) 24 xcconfig = parse_xcconfig( 25 os.path.join(os.getcwd(), IPLUG2_ROOT + "/../common-ios.xcconfig") 26 ) 27 28 CFBundleGetInfoString = ( 29 config["BUNDLE_NAME"] 30 + " v" 31 + config["FULL_VER_STR"] 32 + " " 33 + config["PLUG_COPYRIGHT_STR"] 34 ) 35 CFBundleVersion = config["FULL_VER_STR"] 36 CFBundlePackageType = "BNDL" 37 CSResourcesFileMapped = True 38 LSMinimumSystemVersion = xcconfig["DEPLOYMENT_TARGET"] 39 40 print("Processing Info.plist files...") 41 42 # AUDIOUNIT v3 43 44 if config["PLUG_TYPE"] == 0: 45 if config["PLUG_DOES_MIDI_IN"]: 46 COMPONENT_TYPE = kAudioUnitType_MusicEffect 47 else: 48 COMPONENT_TYPE = kAudioUnitType_Effect 49 elif config["PLUG_TYPE"] == 1: 50 COMPONENT_TYPE = kAudioUnitType_MusicDevice 51 elif config["PLUG_TYPE"] == 2: 52 COMPONENT_TYPE = kAudioUnitType_MIDIProcessor 53 54 if config["PLUG_HAS_UI"] == 1: 55 NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit-UI" 56 else: 57 NSEXTENSIONPOINTIDENTIFIER = "com.apple.AudioUnit" 58 59 plistpath = ( 60 projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-AUv3-Info.plist" 61 ) 62 63 NSEXTENSIONATTRDICT = dict( 64 NSExtensionAttributes=dict(AudioComponents=[{}]), 65 NSExtensionPointIdentifier=NSEXTENSIONPOINTIDENTIFIER, 66 ) 67 68 with open(plistpath, "rb") as f: 69 auv3 = plistlib.load(f) 70 auv3["CFBundleExecutable"] = config["BUNDLE_NAME"] + "AppExtension" 71 auv3["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" 72 auv3["CFBundleName"] = config["BUNDLE_NAME"] + "AppExtension" 73 auv3["CFBundleDisplayName"] = config["BUNDLE_NAME"] + "AppExtension" 74 auv3["CFBundleVersion"] = CFBundleVersion 75 auv3["CFBundleShortVersionString"] = CFBundleVersion 76 auv3["CFBundlePackageType"] = "XPC!" 77 auv3["NSExtension"] = NSEXTENSIONATTRDICT 78 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"] = [{}] 79 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 80 "description" 81 ] = config["PLUG_NAME"] 82 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 83 "manufacturer" 84 ] = config["PLUG_MFR_ID"] 85 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["name"] = ( 86 config["PLUG_MFR"] + ": " + config["PLUG_NAME"] 87 ) 88 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 89 "subtype" 90 ] = config["PLUG_UNIQUE_ID"] 91 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 92 "type" 93 ] = COMPONENT_TYPE 94 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 95 "version" 96 ] = config["PLUG_VERSION_INT"] 97 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 98 "sandboxSafe" 99 ] = True 100 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"] = [ 101 "", 102 "", 103 ] 104 105 if config["PLUG_TYPE"] == 1: 106 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ 107 0 108 ] = "Synth" 109 else: 110 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ 111 0 112 ] = "Effects" 113 114 if config["PLUG_HAS_UI"] == 1: 115 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0]["tags"][ 116 1 117 ] = ( 118 "size:{" 119 + str(config["PLUG_WIDTH"]) 120 + "," 121 + str(config["PLUG_HEIGHT"]) 122 + "}" 123 ) 124 auv3["NSExtension"]["NSExtensionAttributes"]["AudioComponents"][0][ 125 "factoryFunction" 126 ] = "IPlugAUViewController_vNeuralAmpModeler" 127 auv3["NSExtension"]["NSExtensionMainStoryboard"] = ( 128 config["BUNDLE_NAME"] + "-iOS-MainInterface" 129 ) 130 else: 131 auv3["NSExtension"][ 132 "NSExtensionPrincipalClass" 133 ] = "IPlugAUViewController_vNeuralAmpModeler" 134 135 with open(plistpath, "wb") as f2: 136 plistlib.dump(auv3, f2) 137 138 # Standalone APP 139 140 plistpath = projectpath + "/resources/" + config["BUNDLE_NAME"] + "-iOS-Info.plist" 141 with open(plistpath, "rb") as f: 142 iOSapp = plistlib.load(f) 143 iOSapp["CFBundleExecutable"] = config["BUNDLE_NAME"] 144 iOSapp["CFBundleIdentifier"] = "$(PRODUCT_BUNDLE_IDENTIFIER)" 145 iOSapp["CFBundleName"] = config["BUNDLE_NAME"] 146 iOSapp["CFBundleVersion"] = CFBundleVersion 147 iOSapp["CFBundleShortVersionString"] = CFBundleVersion 148 iOSapp["CFBundlePackageType"] = "APPL" 149 iOSapp["LSApplicationCategoryType"] = "public.app-category.music" 150 151 with open(plistpath, "wb") as f2: 152 plistlib.dump(iOSapp, f2) 153 154 155 if __name__ == "__main__": 156 main()