예제 #1
0
def main():
	parser = OptionParser()
	
	parser.add_option("-d", "--dependencies", dest="print_dependencies",
	                  help="Print dependencies for the given modules",
	                  action="store_true")
	
	parser.add_option("-v", "--verbose", dest="verbose",
	                  help="Display verbose output",
	                  action="store_true")

	parser.add_option("-p", "--project", dest="projects",
	                  help="Add the given modules to this project", action="append")

	parser.add_option("--xcode-version", dest="xcode_version",
	                  help="Set the xcode version you plan to open this project in. By default uses xcodebuild to determine your latest Xcode version.")
	
	parser.add_option("-c", "--config", dest="configs",
	                  help="Explicit configurations to add LLAdditions settings to (example: Debug). By default, ttmodule will add configuration settings to every configuration for the given target", action="append")

	(options, args) = parser.parse_args()

	if options.verbose:
		log_level = logging.INFO
	else:
		log_level = logging.WARNING

	logging.basicConfig(level=log_level)

	did_anything = False

	if options.print_dependencies:
		[print_dependencies(x) for x in args]
		did_anything = True

	if options.projects is not None:
		did_anything = True
		
		if not options.xcode_version:
			f=os.popen("xcodebuild -version")
			xcodebuild_version = f.readlines()[0]
			match = re.search('Xcode ([a-zA-Z0-9.]+)', xcodebuild_version)
			if match:
				(options.xcode_version, ) = match.groups()
		
		for name in options.projects:
			project = Pbxproj.get_pbxproj_by_name(name, xcode_version = options.xcode_version)
			add_modules_to_project(args, project, options.configs)

	if not did_anything:
		parser.print_help()
예제 #2
0
def get_dependency_modules(dependency_names):
    dependency_modules = {}
    if not dependency_names:
        return dependency_modules

    for name in dependency_names:
        project = Pbxproj.get_pbxproj_by_name(name)
        dependency_modules[project.uniqueid()] = project

        dependencies = project.dependencies()
        if dependencies is None:
            print "Failed to get dependencies; it's possible that the given target doesn't exist."
            sys.exit(0)

        submodules = get_dependency_modules(dependencies)
        for guid, submodule in submodules.items():
            dependency_modules[guid] = submodule

    return dependency_modules
예제 #3
0
def get_dependency_modules(dependency_names):
	dependency_modules = {}
	if not dependency_names:
		return dependency_modules

	for name in dependency_names:
		project = Pbxproj.get_pbxproj_by_name(name)
		dependency_modules[project.uniqueid()] = project

		dependencies = project.dependencies()
		if dependencies is None:
			print "Failed to get dependencies; it's possible that the given target doesn't exist."
			sys.exit(0)

		submodules = get_dependency_modules(dependencies)
		for guid, submodule in submodules.items():
			dependency_modules[guid] = submodule

	return dependency_modules
예제 #4
0
def print_dependencies(name):
    pbxproj = Pbxproj.get_pbxproj_by_name(name)
    print str(pbxproj) + "..."
    if pbxproj.dependencies():
        [sys.stdout.write("\t" + x + "\n") for x in pbxproj.dependencies()]
예제 #5
0
def main():
    usage = '''%prog [options] module(s)

The Three20 Module Script.
Easily add Three20 modules to your projects.

Modules may take the form <module-name>(:<module-target>)

module-target defaults to module-name if it is not specified
module-name may be a path to a .pbxproj file.

Examples:
  Most common use case:
  > %prog -p path/to/myApp/myApp.xcodeproj Three20

  Print all dependencies for the Three20UI module
  > %prog -d Three20UI

  Print all dependencies for the Three20 module's Three20-Xcode3.2.5 target.
  > %prog -d Three20:Three20-Xcode3.2.5

  Add the Three20 project settings specifically to the Debug and Release configurations.
  By default, all Three20 settings are added to all project configurations.
  This includes adding the header search path and linker flags.
  > %prog -p path/to/myApp.xcodeproj -c Debug -c Release

  Add the extThree20XML module and all of its dependencies to the myApp project.
  > %prog -p path/to/myApp.xcodeproj extThree20XML

  Add a specific target of a module to a project.
  > %prog -p path/to/myApp.xcodeproj extThree20JSON:extThree20JSON+SBJSON'''
    parser = OptionParser(usage=usage)
    parser.add_option("-d",
                      "--dependencies",
                      dest="print_dependencies",
                      help="Print dependencies for the given modules",
                      action="store_true")
    parser.add_option("-v",
                      "--verbose",
                      dest="verbose",
                      help="Display verbose output",
                      action="store_true")
    parser.add_option("-p",
                      "--project",
                      dest="projects",
                      help="Add the given modules to this project",
                      action="append")
    parser.add_option(
        "-c",
        "--config",
        dest="configs",
        help=
        "Explicit configurations to add Three20 settings to (example: Debug). By default, ttmodule will add configuration settings to every configuration for the given target",
        action="append")

    (options, args) = parser.parse_args()

    if options.verbose:
        log_level = logging.INFO
    else:
        log_level = logging.WARNING

    logging.basicConfig(level=log_level)

    did_anything = False

    if options.print_dependencies:
        [print_dependencies(x) for x in args]
        did_anything = True

    if options.projects is not None:
        did_anything = True
        for name in options.projects:
            project = Pbxproj.get_pbxproj_by_name(name)
            add_modules_to_project(args, project, options.configs)

    if not did_anything:
        parser.print_help()
예제 #6
0
def print_dependencies(name):
	pbxproj = Pbxproj.get_pbxproj_by_name(name)
	print str(pbxproj)+"..."
	if pbxproj.dependencies():
		[sys.stdout.write("\t"+x+"\n") for x in pbxproj.dependencies()]
예제 #7
0
def main():
	usage = '''%prog [options] module(s)

The Three20 Module Script.
Easily add Three20 modules to your projects.

MODULES:

    Modules may take the form <module-name>(:<module-target>)
    <module-target> defaults to <module-name> if it is not specified
    <module-name> may be a path to a .pbxproj file.

EXAMPLES:

    Most common use case:
    > %prog -p path/to/myApp/myApp.xcodeproj Three20
    
    For adding Xcode 4 support to an Xcode 3.2.# project:
    > %prog -p path/to/myApp/myApp.xcodeproj Three20 --xcode-version=4
    
    Print all dependencies for the Three20UI module
    > %prog -d Three20UI
    
    Print all dependencies for the extThree20JSON module's extThree20JSON+SBJSON target.
    > %prog -d extThree20JSON:extThree20JSON+SBJSON
    
    Add the Three20 project settings specifically to the Debug and Release configurations.
    By default, all Three20 settings are added to all project configurations.
    This includes adding the header search path and linker flags.
    > %prog -p path/to/myApp.xcodeproj -c Debug -c Release
    
    Add the extThree20XML module and all of its dependencies to the myApp project.
    > %prog -p path/to/myApp.xcodeproj extThree20XML
    
    Add a specific target of a module to a project.
    > %prog -p path/to/myApp.xcodeproj extThree20JSON:extThree20JSON+SBJSON'''
	parser = OptionParser(usage = usage)
	
	parser.add_option("-d", "--dependencies", dest="print_dependencies",
	                  help="Print dependencies for the given modules",
	                  action="store_true")
	
	parser.add_option("-v", "--verbose", dest="verbose",
	                  help="Display verbose output",
	                  action="store_true")

	parser.add_option("-p", "--project", dest="projects",
	                  help="Add the given modules to this project", action="append")

	parser.add_option("--xcode-version", dest="xcode_version",
	                  help="Set the xcode version you plan to open this project in. By default uses xcodebuild to determine your latest Xcode version.")
	
	parser.add_option("-c", "--config", dest="configs",
	                  help="Explicit configurations to add Three20 settings to (example: Debug). By default, ttmodule will add configuration settings to every configuration for the given target", action="append")

	(options, args) = parser.parse_args()

	if options.verbose:
		log_level = logging.INFO
	else:
		log_level = logging.WARNING

	logging.basicConfig(level=log_level)

	did_anything = False

	if options.print_dependencies:
		[print_dependencies(x) for x in args]
		did_anything = True

	if options.projects is not None:
		did_anything = True
		
		if not options.xcode_version:
			f=os.popen("xcodebuild -version")
			xcodebuild_version = f.readlines()[0]
			match = re.search('Xcode ([a-zA-Z0-9.]+)', xcodebuild_version)
			if match:
				(options.xcode_version, ) = match.groups()
		
		for name in options.projects:
			project = Pbxproj.get_pbxproj_by_name(name, xcode_version = options.xcode_version)
			add_modules_to_project(args, project, options.configs)

	if not did_anything:
		parser.print_help()
예제 #8
0
def main():
	usage = '''%prog [options] module(s)

The Three20 Module Script.
Easily add Three20 modules to your projects.

Modules may take the form <module-name>(:<module-target>)

module-target defaults to module-name if it is not specified
module-name may be a path to a .pbxproj file.

Examples:
  Most common use case:
  > %prog -p path/to/myApp/myApp.xcodeproj Three20

  Print all dependencies for the Three20UI module
  > %prog -d Three20UI

  Print all dependencies for the Three20 module's Three20-Xcode3.2.5 target.
  > %prog -d Three20:Three20-Xcode3.2.5

  Add the Three20 project settings specifically to the Debug and Release configurations.
  By default, all Three20 settings are added to all project configurations.
  This includes adding the header search path and linker flags.
  > %prog -p path/to/myApp.xcodeproj -c Debug -c Release

  Add the extThree20XML module and all of its dependencies to the myApp project.
  > %prog -p path/to/myApp.xcodeproj extThree20XML

  Add a specific target of a module to a project.
  > %prog -p path/to/myApp.xcodeproj extThree20JSON:extThree20JSON+SBJSON'''
	parser = OptionParser(usage = usage)
	parser.add_option("-d", "--dependencies", dest="print_dependencies",
	                  help="Print dependencies for the given modules",
	                  action="store_true")
	parser.add_option("-v", "--verbose", dest="verbose",
	                  help="Display verbose output",
	                  action="store_true")
	parser.add_option("-p", "--project", dest="projects",
	                  help="Add the given modules to this project", action="append")
	parser.add_option("-c", "--config", dest="configs",
	                  help="Explicit configurations to add Three20 settings to (example: Debug). By default, ttmodule will add configuration settings to every configuration for the given target", action="append")

	(options, args) = parser.parse_args()

	if options.verbose:
		log_level = logging.INFO
	else:
		log_level = logging.WARNING

	logging.basicConfig(level=log_level)

	did_anything = False

	if options.print_dependencies:
		[print_dependencies(x) for x in args]
		did_anything = True

	if options.projects is not None:
		did_anything = True
		for name in options.projects:
			project = Pbxproj.get_pbxproj_by_name(name)
			add_modules_to_project(args, project, options.configs)

	if not did_anything:
		parser.print_help()
예제 #9
0
def main():
	usage = ''''''
	parser = OptionParser(usage = usage)
	
	parser.add_option("-p", "--project", dest="projects",
	      help="Add the given modules to this project", action="append")
	parser.add_option("-v", "--version", dest="version", help="Unity Versions");
	parser.add_option("-t", "--trackInstalls",
                  action="store_true", dest="shouldLinkInstallTracking", default=False,
                  help="Add InstallTracking Library to the child Xcode project")
	parser.add_option("-f", "--facebook", dest="facebookJSON")
	parser.add_option("--bundleID", dest="bundleID")
	parser.add_option("-a", "--appID", dest="appID")
	parser.add_option("-e", dest="plistExtrasJSON")
	(options, args) = parser.parse_args()
	
	logging.basicConfig(level=logging.DEBUG)
			
	systemFrameworks = ["CoreTelephony","StoreKit","Security","MessageUI","Twitter"]
	systemFrameworksWeak = ["AdSupport","Social","Accounts"] # ["Twitter"]
	
	logging.info(options.projects);
	logging.info(args)
	if options.projects is not None:
#		if options.version[0].startswith('4'): 
		#	For Unity 4 they removed the Unity-iPhone-simulator targets
#			targets = ["Unity-iPhone"]	
#		else :
		#	For Unity 3	
#			targets = ["Unity-iPhone","Unity-iPhone-simulator"]
			
			
		logging.info(options)
		logging.info(options.appID)
		logging.info(options.bundleID)
		prepatchProject(options.projects[0],options.facebookJSON,options.appID,options.bundleID,options.plistExtrasJSON)
		
		baseProj = Pbxproj.get_pbxproj_by_name(options.projects[0],xcode_version = None)
		targets = getTargets(baseProj)
		logging.info("Targets: ")
		logging.info(targets)
		logging.info("End Targets")
		baseProj.add_group('Mobage')
		
		# Framework
		framework = "MobageNDK.framework"
		fhash_base = baseProj.get_hash_base(framework)
		ffileref_hash = baseProj.add_filereference(framework, 'frameworks', fhash_base+'0', framework, 'SOURCE_ROOT')
		baseProj.add_file_to_group(framework, ffileref_hash, "Mobage")
		
#		Facebook Framework being removed for 2.5
#		if  options.facebookJSON is not None:
			# Facebook Framework
#			facebookFramework = "FacebookSDK.framework"
#			facebookhash_base = baseProj.get_hash_base(facebookFramework)
#			facebookfileref_hash = baseProj.add_filereference(facebookFramework, 'frameworks', facebookhash_base+'0', facebookFramework, 'SOURCE_ROOT')
#			baseProj.add_file_to_group(facebookFramework, facebookfileref_hash, "Mobage")
		
		# Install Tracking (optional) Framework
		adTrackingFramework = "MobageAdTracking.framework"
		adTrackingPath = os.path.join(os.path.dirname(options.projects[0]),adTrackingFramework)
		adTrackingPlist = "MBAdTracking.plist"
		adTrackingPlistPath = os.path.join(os.path.dirname(options.projects[0]),adTrackingPlist)
		installTrackingFramework = "MobageInstallTracking.framework"
		installTrackingPath = os.path.join(os.path.dirname(options.projects[0]),installTrackingFramework)
		installTrackingPlist = "MBInstallTracking.plist"
		installTrackingPlistPath = os.path.join(os.path.dirname(options.projects[0]),installTrackingPlist)
		needsInstallTracking = options.shouldLinkInstallTracking
		ihash_base = None
		ifileref_hash = None
		isettingshash_base = None
		isettingsfileref_hash = None
		logging.info(adTrackingPath)
		logging.info(adTrackingPlistPath)
		logging.info(installTrackingPath)
		logging.info(installTrackingPlistPath)
		logging.info(needsInstallTracking)
		
		if needsInstallTracking:
			if os.path.exists(adTrackingPath):
				patchMainForAdTracking(options.projects[0])
				ihash_base = baseProj.get_hash_base(adTrackingFramework)
				ifileref_hash = baseProj.add_filereference(adTrackingFramework,'frameworks',ihash_base+'0',adTrackingFramework,'SOURCE_ROOT')
				baseProj.add_file_to_group(adTrackingFramework,ifileref_hash, "Mobage")
				isettingshash_base = baseProj.get_hash_base(adTrackingPlist)
				isettingsfileref_hash = baseProj.add_filereference(adTrackingPlist,"text.plist.xml",isettingshash_base+'0',adTrackingPlist,'SOURCE_ROOT')
				baseProj.add_file_to_group(adTrackingPlist,isettingsfileref_hash, "Mobage")
			elif os.path.exists(installTrackingPath):	
				patchMainForInstallTracking(options.projects[0])
				ihash_base = baseProj.get_hash_base(installTrackingFramework)
				ifileref_hash = baseProj.add_filereference(installTrackingFramework,'frameworks',ihash_base+'0',installTrackingFramework,'SOURCE_ROOT')
				baseProj.add_file_to_group(installTrackingFramework,ifileref_hash, "Mobage")
				isettingshash_base = baseProj.get_hash_base(installTrackingPlist)
				isettingsfileref_hash = baseProj.add_filereference(installTrackingPlist,"text.plist.xml",isettingshash_base+'0',installTrackingPlist,'SOURCE_ROOT')
				baseProj.add_file_to_group(installTrackingPlist,isettingsfileref_hash, "Mobage")
			else:
				logging.info("AdTracking library not found")
				
		# Bundle
		resourceBundle = "NDKResources.bundle"
		rhash_base = baseProj.get_hash_base(resourceBundle)
		rfileref_hash = baseProj.add_filereference(resourceBundle, 'plug-in', rhash_base+'0', framework+"/Versions/A/Resources/"+resourceBundle, 'SOURCE_ROOT')
		
		baseProj.add_file_to_group(framework, rfileref_hash, "Mobage")
		
		settingsBundle = "Settings.bundle"
		shash_base = baseProj.get_hash_base(settingsBundle)
		sfileref_hash = baseProj.add_filereference(settingsBundle, 'plug-in', shash_base+'0', "Resources/"+settingsBundle,'SOURCE_ROOT')
		baseProj.add_file_to_group(settingsBundle, sfileref_hash, "Mobage")
		
		# Entitlements
		
		mobageNDKEntitlements = "MobageNDK.entitlements"
		mNDKEnthash_base = baseProj.get_hash_base(mobageNDKEntitlements)
		mNDKEntref_hash = baseProj.add_filereference(mobageNDKEntitlements, 'plug-in', mNDKEnthash_base+'0', "Resources/"+mobageNDKEntitlements,'SOURCE_ROOT')
		baseProj.add_file_to_group(mobageNDKEntitlements, mNDKEntref_hash, "Mobage")
		
		for target in targets:
			#print "Modifying Target: "+target
			name = options.projects[0]+":"+target
			project = Pbxproj.get_pbxproj_by_name(name, xcode_version = None)
			
			libfile_hash = project.add_buildfile(framework, ffileref_hash, fhash_base+'1')
			resources_hash = project.add_buildfile(resourceBundle, rfileref_hash, rhash_base+'1')
			settings_hash = project.add_buildfile(settingsBundle, sfileref_hash, shash_base+'1')	
			mNDKEnt_hash = project.add_buildfile(mobageNDKEntitlements, mNDKEntref_hash, mNDKEnthash_base+'1')
				
				
			project.add_file_to_phase(framework,libfile_hash,project._frameworks_guid, "Frameworks")
			project.add_file_to_phase(resourceBundle,resources_hash,project._resources_guid,"Resources")
			project.add_file_to_phase(settingsBundle,settings_hash,project._resources_guid,"Resources")
			project.add_file_to_phase(mobageNDKEntitlements, mNDKEnt_hash,project._resources_guid,"Resources")
			
#			Facebook framework removed from 2.5
#			if  options.facebookJSON is not None:
#				libfacebook_hash = project.add_buildfile(facebookFramework,facebookfileref_hash, facebookhash_base+'1')
#				project.add_file_to_phase(facebookFramework,libfacebook_hash,project._frameworks_guid, "Frameworks")
			
			
			if needsInstallTracking:
				ilibfile_hash = project.add_buildfile(installTrackingFramework, ifileref_hash, ihash_base+'1')
				project.add_file_to_phase(installTrackingFramework,ilibfile_hash,project._frameworks_guid, "Frameworks")
				isettings_hash = project.add_buildfile(installTrackingPlist, isettingsfileref_hash, isettingshash_base+'1')
				project.add_file_to_phase(installTrackingPlist,isettings_hash,project._resources_guid,"Resources")
			
			project.add_lib('libsqlite3.dylib')
			for fname in systemFrameworks:
				project.add_framework(fname+".framework")
			for fname in systemFrameworksWeak:
				project.add_framework(fname+".framework", True)
				
			for configuration in project.configurations:
				subconfig = configuration[1]
				#print(str(subconfig))
				project.add_build_setting(subconfig, 'OTHER_LDFLAGS', '-ObjC')
				project.add_build_setting(subconfig, 'OTHER_LDFLAGS', '"-fobjc-arc"')
				project.add_build_setting(subconfig, 'OTHER_LDFLAGS', '-all_load')
				project.add_build_setting(subconfig, 'CODE_SIGN_ENTITLEMENTS', 'Resources/MobageNDK.entitlements')
	else:
		return "Expecting a project to modify!"
예제 #10
0
def main():
	usage = '''%prog [options] module(s)

The OpenFeint Module Script.
Easily add OpenFeint modules to your projects.

MODULES:

    Modules may take the form <module-name>(:<module-target>)
    <module-target> defaults to <module-name> if it is not specified
    <module-name> may be a path to a .pbxproj file.

EXAMPLES:

    Most common use case:
    > %prog -p path/to/myApp/myApp.xcodeproj Unity-iPhone -n MyAppName
    
    For adding Xcode 4 support to an Xcode 3.2.# project:
    > %prog -p path/to/myApp/myApp.xcodeproj Unity-iPhone --xcode-version=4
    
    Print all dependencies for the OpenFeint module
    > %prog -d Unity-iPhone
        
    Add the OpenFeint project settings specifically to the Debug and Release configurations.
    By default, all OpenFeint settings are added to all project configurations.
    This includes adding the header search path and linker flags.
    > %prog -p path/to/myApp.xcodeproj -c Debug -c Release'''
	parser = OptionParser(usage = usage)
	
	parser.add_option("-d", "--dependencies", dest="print_dependencies",
	                  help="Print dependencies for the given modules",
	                  action="store_true")
	
	parser.add_option("-v", "--verbose", dest="verbose",
	                  help="Display verbose output",
	                  action="store_true")

	parser.add_option("-p", "--project", dest="projects",
	                  help="Add the given modules to this project", 
	                  action="append")

	parser.add_option("--xcode-version", dest="xcode_version",
	                  help="Set the xcode version you plan to open this project in. By default uses xcodebuild to determine your latest Xcode version.")
	
	parser.add_option("-c", "--config", dest="configs",
	                  help="Explicit configurations to add OpenFeint settings to (example: Debug). By default, ttmodule will add configuration settings to every configuration for the given target", 
	                  action="append")

	parser.add_option("-n", "--appname", dest="appname",
	                  help="Add the given appname to this project", 
	                  action="append")

	parser.add_option("-f", "--frameworks", dest="frameworks",
	                  help="The name of the OF framework to use. If not provided then use the source code.",
	                  action="append")

	parser.add_option("-s", "--search_paths", dest="search_paths",
	                  help="Add frameworks, libraries and search_paths. Do not add classes",
	                  action="store_true")

	parser.add_option("-a", "--all_sdks", dest="all_sdks",
	                  help="Include all the sdks.",
	                  action="store_true")

	parser.add_option("-t", "--target", dest="target",
	                  help="Set the target", 
	                  action="append")
	
	(options, args) = parser.parse_args()

	if options.verbose:
		log_level = logging.INFO
	else:
		log_level = logging.WARNING

	logging.basicConfig(level=log_level)

	did_anything = False

	if options.print_dependencies:
		[print_dependencies(x) for x in args]
		did_anything = True

	if options.projects is not None:
		did_anything = True
		
		if not options.xcode_version:
			f=os.popen("xcodebuild -version")
			xcodebuild_version = f.readlines()[0]
			match = re.search('Xcode ([a-zA-Z0-9.]+)', xcodebuild_version)
			if match:
				(options.xcode_version, ) = match.groups()
		
		for name in options.projects:
			project = Pbxproj.get_pbxproj_by_name(name, xcode_version = options.xcode_version)
			app_name=None
			framework=None
			if options.appname:
				app_name=options.appname[0]
			if options.frameworks:
				framework=options.frameworks[0]
			add_modules_to_project(options.target, project, app_name, options.configs, not options.search_paths, framework, options.all_sdks)

	if not did_anything:
		parser.print_help()
예제 #11
0
def get_project(name):
    path = os.path.join(workdir, name, name + '.xcodeproj')
    return Pbxproj.get_pbxproj_by_name(path, xcode_version=get_xcode_version())