Sha256: 2578f5dc2ca4a2f23ba61451796c31448a0263f6ded1621e1f09cc7f8923e4a6

Contents?: true

Size: 1.98 KB

Versions: 6

Compression:

Stored size: 1.98 KB

Contents

#!/usr/bin/python

# Created by Egor Zubkov on 22/12/14.
# Copyright 2014 NIX. All rights reserved.

import os
import sys
import re
import shutil
import UnityBuildEnvVars


def main():
    build_env_vars = UnityBuildEnvVars
    configuration, build_number, build_path = build_env_vars.env_vars()
    build_name, build_version = build_data(build_path)

    print "BUNDLE_ID = %s" % build_name
    print "APP_VERSION = %s" % build_version
    print "BUILD_VERSION = %s" % build_number

    upload_build(configuration, build_name, build_version, build_number, build_path)


def build_data(build_path):
    regex_template = "^package:.*\s%s='([a-zA-Z0-9._]*)'.*"
    build_name_regex = regex_template % "name"
    build_version_regex = regex_template % "versionName"

    aapt_path = os.path.join(os.path.dirname(__file__), "Utils/aapt")
    output = os.popen("'%s' dump badging '%s'" % (aapt_path, build_path)).read()

    build_name = re.match(build_name_regex, output).groups()[0]
    build_version = re.match(build_version_regex, output).groups()[0]

    return build_name, build_version


def upload_build(configuration, build_name, build_version, build_number, build_path):
    deploy_host = os.environ['DEPLOY_HOST']
    deploy_dir = os.environ['ANDROID_DEPLOY_PATH']
    deploy_user = os.environ['ANDROID_DEPLOY_USERNAME']
    deploy_password = os.environ['ANDROID_DEPLOY_PASSWORD']

    deploy_file_path = os.path.join(os.path.dirname(__file__), "Deploy.sh")
    build_version_path = "v.%s_%s" % (build_version, build_number)
    temp_build_dir = os.path.join(os.path.dirname(build_path), build_name)
    temp_build_path = os.path.join(temp_build_dir, build_version_path, configuration)

    if os.path.exists(temp_build_dir):
        shutil.rmtree(temp_build_dir)

    os.makedirs(temp_build_path)
    shutil.copy(build_path, temp_build_path)
    os.system("'%s' %s %s %s %s '%s'" % (deploy_file_path, deploy_host, deploy_dir, deploy_user, deploy_password, temp_build_dir))

if __name__ == '__main__':
    sys.exit(main())

Version data entries

6 entries across 6 versions & 1 rubygems

Version Path
nixenvironment-0.0.65 legacy/DeployAPK.py
nixenvironment-0.0.64 legacy/DeployAPK.py
nixenvironment-0.0.63 legacy/DeployAPK.py
nixenvironment-0.0.62 legacy/DeployAPK.py
nixenvironment-0.0.61 legacy/DeployAPK.py
nixenvironment-0.0.60 legacy/DeployAPK.py