Index: build.py |
=================================================================== |
--- a/build.py |
+++ b/build.py |
@@ -7,17 +7,18 @@ import re |
import shutil |
import string |
import subprocess |
import sys |
import tempfile |
_BASE_DIR = os.path.dirname(os.path.abspath(__file__)) |
_ENSURE_DEPENDENCIES_PATH = os.path.join(_BASE_DIR, "ensure_dependencies.py") |
-_GENERATED_MOZCONFIG_PATH = os.path.join(_BASE_DIR, "generated", "mozconfig") |
+_GENERATED_PATH = os.path.join(_BASE_DIR, "generated") |
+_GENERATED_MOZCONFIG_PATH = os.path.join(_GENERATED_PATH, "mozconfig") |
_MOZCONFIG_COMMON_PATH = os.path.join(_BASE_DIR, "mozconfig-common") |
_MOZCONFIG_ARM_PATH = os.path.join(_BASE_DIR, "mozconfig-arm") |
_MOZCONFIG_X86_PATH = os.path.join(_BASE_DIR, "mozconfig-x86") |
_MOZCONFIG_STORE_PATH = os.path.join(_BASE_DIR, "mozconfig-store") |
_MOZCONFIG_RELEASE_PATH = os.path.join(_BASE_DIR, "mozconfig-release") |
_MOZCONFIG_CUSTOM_PATH = os.path.join(_BASE_DIR, "mozconfig-custom") |
_MULTI_L10N_PATH = os.path.join(_BASE_DIR, "mozharness", "scripts", |
"multil10n.py") |
@@ -44,29 +45,30 @@ def print_usage(): |
Usage: $name %s |
$name %s APK_PATH |
$name %s\ |
""" % (_CMD_BUILD, _CMD_SIGN, |
_CMD_BUILD_SIGN)).substitute({"name": os.path.basename(sys.argv[0])}) |
def _generate_mozconfig(architecture, distribution_mode, build_mode): |
- mozconfig_path = _GENERATED_MOZCONFIG_PATH |
- with open(mozconfig_path, "w+") as mozconfig: |
+ if not os.path.exists(_GENERATED_PATH): |
+ os.makedirs(_GENERATED_PATH) |
+ with open(_GENERATED_MOZCONFIG_PATH, "w+") as mozconfig: |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_COMMON_PATH) |
if architecture == _ARCH_X86: |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_X86_PATH) |
else: |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_ARM_PATH) |
if distribution_mode == _DIST_STORE: |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_STORE_PATH) |
if build_mode == _BUILD_RELEASE: |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_RELEASE_PATH) |
mozconfig.write(". \"%s\"\n" % _MOZCONFIG_CUSTOM_PATH) |
- return mozconfig_path |
+ return _GENERATED_MOZCONFIG_PATH |
def _build(architecture, distribution_mode, build_mode, sdk_path, ndk_path): |
build_environment = os.environ.copy() |
build_environment["ANDROID_SDK_PATH"] = sdk_path |
build_environment["ANDROID_NDK_PATH"] = ndk_path |
build_environment["MOZCONFIG"] = _generate_mozconfig( |
architecture, distribution_mode, build_mode) |