Exemple #1
0
# Remove all code for starting up the Javascript debugger.
if application_java:
	lines = open(application_java, 'r').readlines()
	lines = [l for l in lines if "debug" not in l.lower()]
	open(application_java, "w").write("".join(lines))

# if bin/assets/app.json is there, copy it to assets/app.json
if os.path.exists(os.path.join(bin_assets_folder, "app.json")):
	shutil.copyfile(os.path.join(bin_assets_folder, "app.json"), os.path.join(assets_folder, "app.json"))

# if bin/assets/index.json is there, copy it to assets/index.json
if os.path.exists(os.path.join(bin_assets_folder, "index.json")):
	shutil.copyfile(os.path.join(bin_assets_folder, "index.json"), os.path.join(assets_folder, "index.json"))

if ticommon.is_windows():
	log.info("Copying Resources and tiapp.xml to assets folder because you're running Windows and therefore we're not going to make symlinks")
	shutil.copytree(resources_folder, os.path.join(assets_folder, 'Resources'))
	shutil.copy(os.path.join('.', 'tiapp.xml'), assets_folder)
else:
	resources_dest = os.path.abspath(os.path.join(assets_folder, 'Resources'))
	tiapp_dest = os.path.abspath(os.path.join(assets_folder, 'tiapp.xml'))
	if not os.path.exists(resources_dest):
		os.symlink(os.path.abspath(resources_folder), resources_dest)
	if not os.path.exists(tiapp_dest):
		os.symlink(os.path.abspath(os.path.join('.', 'tiapp.xml')), tiapp_dest)
	if os.path.exists(resources_android_folder):
		res_android_files = os.listdir(resources_android_folder)
		if res_android_files:
			for one_res_android_file in res_android_files:
				one_res_android_file_dest = os.path.join(resources_dest, one_res_android_file)
if os.path.exists(os.path.join(this_path, 'tidevtools_settings.py')):
	execfile(os.path.join(this_path, 'tidevtools_settings.py'))

if not PROJECT_ID_PREFIX or not PROJECT_FOLDER or not PUBLISHER or not PUBLISHER_URL:
	print 'You need to fill in PROJECT_ID_PREFIX and all that.  Use a file named tidevtools_settings.py'
	sys.exit(1)

project_name = sys.argv[1]
project_folder = os.path.join(PROJECT_FOLDER, project_name)
resources_folder = os.path.join(project_folder, 'Resources')
if os.path.exists(project_folder):
	print "%s already exists." % project_folder
	sys.exit(1)

isWindows = ticommon.is_windows()

# Find the Titanium SDK
tisdk_path, sdkver = ticommon.find_ti_sdk()
if len(tisdk_path) == 0 or not os.path.exists(tisdk_path):
	print "I couldn't find the Titanium Mobile SDK"
	sys.exit(1)

print "Found Titanium SDK at %s" % tisdk_path

android_sdk = ticommon.find_android_sdk()
if len(android_sdk) == 0 or not os.path.exists(android_sdk):
	print "Could not find your android sdk folder.  Avoid this in the future by making an ANDROID_SDK env var"
	sys.exit(1)

print "Using Android sdk found at %s" % android_sdk