Ejemplo n.º 1
0
def create_project(local_branch):
	project_script = os.path.join(mobilesdk_dir, "project.py")
	project_id = "%s.%s" % (PROJECT_ID_PREFIX.rstrip("."), local_branch)

	android_sdk = ticommon.find_android_sdk()
	project_args = [sys.executable, project_script, local_branch, project_id, PROJECT_FOLDER]

	if platform.system() == "Darwin":
		project_args.append("iphone")

	if os.path.exists(android_sdk):
		project_args.extend(["android", android_sdk])

	p = Popen(project_args)
	p.communicate()
	if p.returncode != 0:
		print >>sys.stderr, "Error creating project %s" % project_id
		sys.exit(p.returncode)

	print "Project '%s' created: %s" % (project_id, os.path.join(PROJECT_FOLDER, local_branch))
Ejemplo n.º 2
0
projectPath = os.path.abspath(os.getcwd())

tiappXML = os.path.join(projectPath, "tiapp.xml")
timoduleXML = os.path.join(projectPath, "timodule.xml")


def error(msg):
    print >> sys.stderr, "Error: " + msg
    sys.exit(1)


if not (os.path.exists(tiappXML) or os.path.exists(timoduleXML)):
    error("No tiapp.xml/timodule.xml found, are you in a Titanium project?")

androidSDK = ticommon.find_android_sdk()

if not os.path.exists(androidSDK):
    error("Android SDK directory doesn't exist: %s" % androidSDK)

if "TI_VERSION" in os.environ:
    tiDevSDK = ticommon.find_ti_sdk(version=os.environ["TI_VERSION"])[0]
else:
    tiDevSDK = ticommon.find_ti_sdk()[0]

if not os.path.exists(tiDevSDK):
    error("Titanium Mobile SDK directory doesn't exist: %s" % tiDevSDK)

builderScript = os.path.join(tiDevSDK, "android", "builder.py")

if not os.path.exists(builderScript):
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
sys.path.append(tisdk_path)
sys.path.append(os.path.join(tisdk_path, 'android'))
import project, run

project_id = PROJECT_ID_PREFIX + project_name.lower()
args = ['python', os.path.join(tisdk_path, 'project.py'), project_name, project_id, PROJECT_FOLDER]
if isWindows:
	args.append('android', 'mobileweb')
else:
	args.extend(('iphone', 'android', 'mobileweb'))