Bug 1256966 - Move NIGHTLY_BUILD and RELEASE_BUILD to Python configure. r=glandium
authorChris Manchester <cmanchester@mozilla.com>
Fri, 18 Mar 2016 11:24:11 -0700
changeset 289447 a8bf532690746eae8ef90b9e4a9bcf8cdf30f091
parent 289446 25a721c6c7b7d0e89b0f3c5964cdf3f2384cb537
child 289448 61933d3dbe1c112564d5203a8536fbc3f0f0cfef
push id19656
push usergwagner@mozilla.com
push dateMon, 04 Apr 2016 13:43:23 +0000
treeherderb2g-inbound@e99061fde28a [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersglandium
bugs1256966
milestone48.0a1
Bug 1256966 - Move NIGHTLY_BUILD and RELEASE_BUILD to Python configure. r=glandium MozReview-Commit-ID: 2Z3XMO2n681
build/moz.configure/init.configure
js/src/old-configure.in
moz.configure
old-configure.in
--- a/build/moz.configure/init.configure
+++ b/build/moz.configure/init.configure
@@ -558,16 +558,49 @@ def include_project_configure(project, e
 @depends(include_project_configure, check_build_environment, '--help')
 def build_project(include_project_configure, build_env, help):
     ret = os.path.dirname(os.path.relpath(include_project_configure,
                                           build_env['TOPSRCDIR']))
     add_old_configure_assignment('MOZ_BUILD_APP', ret)
     return ret
 
 
+# set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
+# The logic works like this:
+# - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
+# - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
+# - otherwise, we're building Release/Beta (define RELEASE_BUILD)
+@depends(check_build_environment)
+@advanced
+def milestone(build_env):
+    milestone_path = os.path.join(build_env['TOPSRCDIR'],
+                                  'config',
+                                  'milestone.txt')
+    with open(milestone_path, 'r') as fh:
+        milestone = fh.read().splitlines()[-1]
+
+    set_config('GRE_MILESTONE', milestone)
+
+    is_nightly = is_release = False
+
+    if 'a1' in milestone:
+        set_config('NIGHTLY_BUILD', '1')
+        set_define('NIGHTLY_BUILD', '1')
+        add_old_configure_assignment('NIGHTLY_BUILD', '1')
+        is_nightly = True
+    elif 'a' not in milestone:
+        set_config('RELEASE_BUILD', '1')
+        set_define('RELEASE_BUILD', '1')
+        add_old_configure_assignment('RELEASE_BUILD', '1')
+        is_release = True
+
+    return namespace(version=milestone,
+                     is_nightly=is_nightly,
+                     is_release=is_release)
+
 # This is temporary until js/src/configure and configure are merged.
 # Use instead of option() in js/moz.configure
 @template
 def js_option(*args, **kwargs):
     opt = option(*args, **kwargs)
 
     @depends(opt.option, build_project)
     def js_option(value, build_project):
--- a/js/src/old-configure.in
+++ b/js/src/old-configure.in
@@ -1892,42 +1892,16 @@ MOZ_ARG_ENABLE_STRING([update-channel],
     MOZ_UPDATE_CHANNEL=`echo $enableval | tr A-Z a-z`)
 
 if test -z "$MOZ_UPDATE_CHANNEL"; then
     MOZ_UPDATE_CHANNEL=default
 fi
 AC_DEFINE_UNQUOTED(MOZ_UPDATE_CHANNEL, $MOZ_UPDATE_CHANNEL)
 AC_SUBST(MOZ_UPDATE_CHANNEL)
 
-
-dnl set GRE_MILESTONE
-dnl ========================================================
-GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
-AC_SUBST(GRE_MILESTONE)
-
-dnl set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
-dnl The logic works like this:
-dnl - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
-dnl - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
-dnl - otherwise, we're building Release/Beta (define RELEASE_BUILD)
-case "$GRE_MILESTONE" in
-  *a1*)
-      NIGHTLY_BUILD=1
-      AC_DEFINE(NIGHTLY_BUILD)
-      ;;
-  *a*)
-      ;;
-  *)
-      RELEASE_BUILD=1
-      AC_DEFINE(RELEASE_BUILD)
-      ;;
-esac
-AC_SUBST(NIGHTLY_BUILD)
-AC_SUBST(RELEASE_BUILD)
-
 dnl ========================================================
 dnl =
 dnl = Check for external package dependencies
 dnl =
 dnl ========================================================
 MOZ_ARG_HEADER(External Packages)
 
 MOZ_CONFIG_NSPR(js)
--- a/moz.configure
+++ b/moz.configure
@@ -10,16 +10,25 @@ include('build/moz.configure/checks.conf
 # Note:
 # - Gecko-specific options and rules should go in toolkit/moz.configure.
 # - Firefox-specific options and rules should go in browser/moz.configure.
 # - Fennec-specific options and rules should go in
 #   mobile/android/moz.configure.
 # - Spidermonkey-specific options and rules should go in js/moz.configure.
 # - etc.
 
+# Multiprocess Firefox Testing UI - Nightly and Aurora
+# To be removed in Bug 1003313
+@depends(milestone)
+def e10s_testing_only(milestone):
+    if not milestone.is_release:
+        set_config('E10S_TESTING_ONLY', '1')
+        set_define('E10S_TESTING_ONLY', '1')
+
+
 option('--enable-artifact-builds', env='MOZ_ARTIFACT_BUILDS',
        help='Download and use prebuilt binary artifacts.')
 
 @depends('--enable-artifact-builds')
 def artifact_builds(value):
     if value:
         imply_option('--disable-compile-environment')
         set_config('MOZ_ARTIFACT_BUILDS', '1')
--- a/old-configure.in
+++ b/old-configure.in
@@ -2544,52 +2544,16 @@ WINNT|Darwin|Android)
   ;;
 *)
   MOZ_FOLD_LIBS=
   ;;
 esac
 
 MOZ_CONFIG_NSPR()
 
-dnl set GRE_MILESTONE
-dnl ========================================================
-GRE_MILESTONE=`tail -n 1 "$_topsrcdir"/config/milestone.txt 2>/dev/null || tail -1 "$_topsrcdir"/config/milestone.txt`
-AC_SUBST(GRE_MILESTONE)
-
-# set RELEASE_BUILD and NIGHTLY_BUILD variables depending on the cycle we're in
-# The logic works like this:
-# - if we have "a1" in GRE_MILESTONE, we're building Nightly (define NIGHTLY_BUILD)
-# - otherwise, if we have "a" in GRE_MILESTONE, we're building Nightly or Aurora
-# - otherwise, we're building Release/Beta (define RELEASE_BUILD)
-case "$GRE_MILESTONE" in
-  *a1*)
-      NIGHTLY_BUILD=1
-      AC_DEFINE(NIGHTLY_BUILD)
-      ;;
-  *a*)
-      ;;
-  *)
-      RELEASE_BUILD=1
-      AC_DEFINE(RELEASE_BUILD)
-      ;;
-esac
-AC_SUBST(NIGHTLY_BUILD)
-AC_SUBST(RELEASE_BUILD)
-
-dnl ========================================================
-dnl Multiprocess Firefox Testing UI - Nightly and Aurora
-dnl To be removed in Bug 1003313
-dnl ========================================================
-if test -z "$RELEASE_BUILD"; then
-    E10S_TESTING_ONLY=1
-    AC_DEFINE(E10S_TESTING_ONLY)
-fi
-
-AC_SUBST(E10S_TESTING_ONLY)
-
 dnl ========================================================
 dnl system libevent Support
 dnl ========================================================
 MOZ_ARG_WITH_STRING(system-libevent,
 [  --with-system-libevent[=PFX]
                           Use system libevent [installed at prefix PFX]],
     LIBEVENT_DIR=$withval)