Bug 1403519 - only build docs when necessary r=gps
authorDustin J. Mitchell <dustin@mozilla.com>
Mon, 02 Oct 2017 18:22:56 +0000
changeset 399750 0f0395687d36597098e4248457ed69f092c39f8f
parent 399749 50a5f0a088995c5e5fce91aab24306148491bec9
child 399751 ce4e64aa7ea0452877bfbd597a5db413e476c1c2
push id99021
push userdluca@mozilla.com
push dateThu, 18 Jan 2018 09:49:46 +0000
treeherdermozilla-inbound@7bc2219779f7 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersgps
bugs1403519
milestone59.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1403519 - only build docs when necessary r=gps This marks **/docs/** as exclusively docs, and code that is autodoc'd as inclusively docs. That means that a change that purely modifies documentation files will *only* run `docs` tasks, while a change that modifies autodoc'd source code will *additionaly* run `docs` tasks. The tasks do not run by default. MozReview-Commit-ID: G9tOK0AwtrI
browser/base/moz.build
browser/experiments/moz.build
browser/moz.build
build/moz.build
dom/bindings/moz.build
gfx/moz.build
mobile/android/moz.build
moz.build
python/moz.build
python/mozbuild/mozbuild/schedules.py
taskcluster/ci/source-test/doc.yml
taskcluster/moz.build
testing/geckodriver/moz.build
testing/marionette/moz.build
testing/mozbase/moz.build
toolkit/components/crashes/moz.build
toolkit/components/extensions/moz.build
toolkit/components/payments/moz.build
toolkit/components/telemetry/moz.build
toolkit/components/url-classifier/moz.build
toolkit/crashreporter/moz.build
toolkit/modules/moz.build
toolkit/modules/subprocess/moz.build
toolkit/mozapps/extensions/moz.build
tools/moz.build
--- a/browser/base/moz.build
+++ b/browser/base/moz.build
@@ -4,16 +4,19 @@
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files("**"):
     BUG_COMPONENT = ("Firefox", "General")
 
 SPHINX_TREES['sslerrorreport'] = 'content/docs/sslerrorreport'
 
+with Files('content/docs/sslerrorreport/**'):
+    SCHEDULES.exclusive = ['docs']
+
 MOCHITEST_MANIFESTS += [
     'content/test/general/mochitest.ini',
 ]
 
 MOCHITEST_CHROME_MANIFESTS += [
     'content/test/chrome/chrome.ini',
 ]
 
--- a/browser/experiments/moz.build
+++ b/browser/experiments/moz.build
@@ -14,8 +14,11 @@ EXTRA_COMPONENTS += [
 
 EXTRA_JS_MODULES.experiments += [
   'Experiments.jsm',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 SPHINX_TREES['experiments'] = 'docs'
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/browser/moz.build
+++ b/browser/moz.build
@@ -3,16 +3,19 @@
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 CONFIGURE_SUBST_FILES += ['installer/Makefile']
 
 SPHINX_TREES['browser'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 DIRS += [
     'base',
     'components',
     'experiments',
     'fonts',
     'locales',
     'modules',
     'themes',
--- a/build/moz.build
+++ b/build/moz.build
@@ -5,16 +5,19 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 with Files('**'):
     BUG_COMPONENT = ('Core', 'Build Config')
 
 # This cannot be named "build" because of bug 922191.
 SPHINX_TREES['buildsystem'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 if CONFIG['OS_ARCH'] == 'WINNT':
     DIRS += ['win32']
     if CONFIG['WIN64_CARGO_LINKER']:
         CONFIGURE_SUBST_FILES += ['win64/cargo-linker.bat']
 else:
     DIRS += ['unix']
 
 CRAMTEST_MANIFESTS += [
--- a/dom/bindings/moz.build
+++ b/dom/bindings/moz.build
@@ -144,18 +144,25 @@ if CONFIG['MOZ_DEBUG']:
         "test/TestInterfaceSetlikeNode.cpp",
         ]
 
 include('/ipc/chromium/chromium-config.mozbuild')
 
 FINAL_LIBRARY = 'xul'
 
 SPHINX_TREES['webidl'] = 'docs'
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 SPHINX_PYTHON_PACKAGE_DIRS += ['mozwebidlcodegen']
 
+with Files('mozwebidlcodegen/**.py'):
+    SCHEDULES.inclusive += ['docs']
+
 if CONFIG['MOZ_BUILD_APP'] in ['browser', 'mobile/android', 'xulrunner']:
     # This is needed for Window.webidl
     DEFINES['HAVE_SIDEBAR'] = True
 
 
 PYTHON_UNITTEST_MANIFESTS += [
     'mozwebidlcodegen/test/python.ini',
 ]
--- a/gfx/moz.build
+++ b/gfx/moz.build
@@ -35,8 +35,11 @@ if CONFIG['MOZ_ENABLE_SKIA_PDF_SFNTLY']:
      DIRS += ['sfntly/cpp/src']
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['tests/gtest']
 
 TEST_DIRS += ['tests']
 
 SPHINX_TREES['gfx'] = 'docs'
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/mobile/android/moz.build
+++ b/mobile/android/moz.build
@@ -62,8 +62,11 @@ DIRS += [
     'fonts',
 ]
 
 TEST_DIRS += [
     'tests',
 ]
 
 SPHINX_TREES['fennec'] = 'docs'
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/moz.build
+++ b/moz.build
@@ -51,17 +51,26 @@ with Files('README.txt'):
 with Files("nsprpub/**"):
     BUG_COMPONENT = ("NSPR", "NSPR")
 
 with Files('**/Makefile.in'):
     BUG_COMPONENT = ('Core', 'Build Config')
     FINAL = True
 
 with Files("**/*.js"):
-    SCHEDULES.inclusive += ['test-verify']
+    SCHEDULES.inclusive += ['test-verify', 'docs']
+
+with Files("**/*.jsm"):
+    SCHEDULES.inclusive += ['docs']
+
+with Files("**/*.rst"):
+    SCHEDULES.inclusive += ['docs']
+
+with Files("**/*.md"):
+    SCHEDULES.inclusive += ['docs']
 
 with Files("**/*.html"):
     SCHEDULES.inclusive += ['test-verify']
 
 with Files("**/*.xhtml"):
     SCHEDULES.inclusive += ['test-verify']
 
 with Files("**/*.xul"):
--- a/python/moz.build
+++ b/python/moz.build
@@ -32,18 +32,24 @@ with Files('l10n/**'):
 SPHINX_PYTHON_PACKAGE_DIRS += [
     'mach',
     'mozbuild/mozbuild',
     'mozbuild/mozpack',
     'mozlint/mozlint',
     'mozversioncontrol/mozversioncontrol',
 ]
 
+with Files('**.py'):
+    SCHEDULES.inclusive += ['docs']
+
 SPHINX_TREES['mach'] = 'mach/docs'
 
+with Files('mach/docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 PYTHON_UNITTEST_MANIFESTS += [
     'mach/mach/test/python.ini',
     'mozbuild/dumbmake/test/python.ini',
     'mozlint/test/python.ini',
     'mozterm/test/python.ini',
     'mozversioncontrol/test/python.ini',
 ]
 
--- a/python/mozbuild/mozbuild/schedules.py
+++ b/python/mozbuild/mozbuild/schedules.py
@@ -6,28 +6,37 @@
 Constants for SCHEDULES configuration in moz.build files and for
 skip-unless-schedules optimizations in task-graph generation.
 """
 
 from __future__ import absolute_import, unicode_literals, print_function
 
 # TODO: ideally these lists could be specified in moz.build itself
 
+# Inclusive components are those which are scheduled when certain files are
+# changed, but do not run by default.  These are generally added to
+# `SCHEDULES.inclusive` using `+=`, but can also be used as exclusive
+# components for files which *only* affect the named component.
 INCLUSIVE_COMPONENTS = [
+    'docs',
     'py-lint',
     'js-lint',
     'yaml-lint',
     # inclusive test suites -- these *only* run when certain files have changed
     'jittest',
     'test-verify',
     'test-verify-wpt',
     'jsreftest',
 ]
 INCLUSIVE_COMPONENTS = sorted(INCLUSIVE_COMPONENTS)
 
+# Exclusive components are those which are scheduled by default, but for which
+# some files *only* affect that component.  For example, most files affect all
+# platforms, but platform-specific files exclusively affect a single platform.
+# These components are assigned to `SCHEDULES.exclusive` with `=`.
 EXCLUSIVE_COMPONENTS = [
     # os families
     'android',
     'linux',
     'macosx',
     'windows',
     # test suites
     'awsy',
--- a/taskcluster/ci/source-test/doc.yml
+++ b/taskcluster/ci/source-test/doc.yml
@@ -14,24 +14,18 @@ generate:
               name: public/docs.tar.gz
               path: /builds/worker/checkouts/gecko/docs-out/main.tar.gz
     run:
         using: run-task
         command: >
             cd /builds/worker/checkouts/gecko &&
             ./mach doc --outdir docs-out --no-open --archive
         sparse-profile: sphinx-docs
-    when:
-        files-changed:
-            - '**/*.py'
-            - '**/*.rst'
-            - '**/*.md'
-            - 'tools/docs/**'
-            - '**/*.js'
-            - '**/*.jsm'
+    optimization:
+        skip-unless-schedules: [docs]
 
 upload:
     description: Generate and upload the Sphinx documentation
     platform: lint/opt
     treeherder:
         symbol: tc(DocUp)
         kind: test
         tier: 3
@@ -42,13 +36,10 @@ upload:
         max-run-time: 1800
         taskcluster-proxy: true
     run:
         using: run-task
         command: cd /builds/worker/checkouts/gecko && ./mach doc --upload --no-open
         sparse-profile: sphinx-docs
     scopes:
         - secrets:get:project/releng/gecko/build/level-{level}/gecko-docs-upload
-    when:
-        files-changed:
-            - '**/*.py'
-            - '**/*.rst'
-            - 'tools/docs/**'
+    optimization:
+        skip-unless-schedules: [docs]
--- a/taskcluster/moz.build
+++ b/taskcluster/moz.build
@@ -23,8 +23,11 @@ with Files('scripts/**'):
 with Files('taskgraph/**'):
     BUG_COMPONENT = ('Taskcluster', 'Task Configuration')
 
 PYTHON_UNITTEST_MANIFESTS += [
     'taskgraph/test/python.ini',
 ]
 SPHINX_TREES['taskcluster'] = 'docs'
 SPHINX_PYTHON_PACKAGE_DIRS += ['taskgraph']
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/testing/geckodriver/moz.build
+++ b/testing/geckodriver/moz.build
@@ -7,8 +7,11 @@ RUST_PROGRAMS += ["geckodriver"]
 # https://bugzil.la/1425365
 if CONFIG["OS_ARCH"] != "WINNT":
     RustTest("geckodriver")
 
 with Files("**"):
     BUG_COMPONENT = ("Testing", "Marionette")
 
 SPHINX_TREES["geckodriver"] = "doc"
+
+with Files('doc/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/testing/marionette/moz.build
+++ b/testing/marionette/moz.build
@@ -13,8 +13,11 @@ XPCSHELL_TESTS_MANIFESTS += ["unit.ini"]
 
 with Files("**"):
     BUG_COMPONENT = ("Testing", "Marionette")
 
 with Files("harness/**"):
     SCHEDULES.exclusive = ["marionette", "firefox-ui"]
 
 SPHINX_TREES["marionette"] = "doc"
+
+with Files('doc/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/testing/mozbase/moz.build
+++ b/testing/mozbase/moz.build
@@ -45,10 +45,13 @@ python_modules = [
 TEST_HARNESS_FILES.mozbase += [m + '/**' for m in python_modules]
 
 TEST_HARNESS_FILES.mozbase += [
     'setup_development.py',
 ]
 
 SPHINX_TREES['/mozbase'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 with Files('**'):
     BUG_COMPONENT = ('Testing', 'Mozbase')
--- a/toolkit/components/crashes/moz.build
+++ b/toolkit/components/crashes/moz.build
@@ -1,16 +1,19 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SPHINX_TREES['crash-manager'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 XPIDL_MODULE = 'toolkit_crashservice'
 
 XPIDL_SOURCES += [
     'nsICrashService.idl',
 ]
 
 if CONFIG['MOZ_CRASHREPORTER']:
     EXTRA_COMPONENTS += [
--- a/toolkit/components/extensions/moz.build
+++ b/toolkit/components/extensions/moz.build
@@ -87,9 +87,12 @@ XPCSHELL_TESTS_MANIFESTS += [
     'test/xpcshell/native_messaging.ini',
     'test/xpcshell/xpcshell-e10s.ini',
     'test/xpcshell/xpcshell-remote.ini',
     'test/xpcshell/xpcshell.ini',
 ]
 
 SPHINX_TREES['webextensions'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/toolkit/components/payments/moz.build
+++ b/toolkit/components/payments/moz.build
@@ -15,13 +15,16 @@ EXTRA_COMPONENTS += [
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
 MOCHITEST_MANIFESTS += ['test/mochitest/mochitest.ini']
 
 SPHINX_TREES['docs'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 TESTING_JS_MODULES += [
     'test/PaymentTestUtils.jsm',
 ]
 
 XPCSHELL_TESTS_MANIFESTS += ['test/unit/xpcshell.ini']
--- a/toolkit/components/telemetry/moz.build
+++ b/toolkit/components/telemetry/moz.build
@@ -19,16 +19,19 @@ DEFINES['MOZ_APP_VERSION'] = '"%s"' % CO
 
 LOCAL_INCLUDES += [
     '/xpcom/build',
     '/xpcom/threads',
 ]
 
 SPHINX_TREES['telemetry'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 if CONFIG['CC_TYPE'] in ('clang', 'gcc'):
     CXXFLAGS += ['-Wno-error=shadow']
 
 if CONFIG['ENABLE_TESTS']:
     DIRS += ['tests/gtest']
 
 TEST_DIRS += ['tests']
 
--- a/toolkit/components/url-classifier/moz.build
+++ b/toolkit/components/url-classifier/moz.build
@@ -88,9 +88,12 @@ if CONFIG['CC_TYPE'] in ('clang', 'gcc')
         '-Wno-maybe-uninitialized',
     ]
 
 if CONFIG['NIGHTLY_BUILD'] or CONFIG['MOZ_DEBUG']:
     DEFINES['MOZ_SAFEBROWSING_DUMP_FAILED_UPDATES'] = True
 
 SPHINX_TREES['url-classifier'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 include('/ipc/chromium/chromium-config.mozbuild')
--- a/toolkit/crashreporter/moz.build
+++ b/toolkit/crashreporter/moz.build
@@ -1,16 +1,19 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SPHINX_TREES['crashreporter'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 EXPORTS += [
     'nsExceptionHandler.h',
 ]
 
 JAR_MANIFESTS += ['jar.mn']
 
 UNIFIED_SOURCES = [
     'nsExceptionHandlerUtils.cpp',
--- a/toolkit/modules/moz.build
+++ b/toolkit/modules/moz.build
@@ -160,16 +160,19 @@ TESTING_JS_MODULES += [
     'HiddenFrame.jsm',
     'tests/modules/MockDocument.jsm',
     'tests/modules/PromiseTestUtils.jsm',
     'tests/xpcshell/TestIntegration.jsm',
 ]
 
 SPHINX_TREES['toolkit_modules'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 EXTRA_JS_MODULES += [
     'addons/MatchURLFilters.jsm',
     'addons/WebNavigation.jsm',
     'addons/WebNavigationContent.js',
     'addons/WebNavigationFrames.jsm',
     'addons/WebRequest.jsm',
     'addons/WebRequestCommon.jsm',
     'addons/WebRequestContent.js',
--- a/toolkit/modules/subprocess/moz.build
+++ b/toolkit/modules/subprocess/moz.build
@@ -25,8 +25,11 @@ else:
         'subprocess_shared_unix.js',
         'subprocess_unix.jsm',
         'subprocess_worker_unix.js',
     ]
 
 XPCSHELL_TESTS_MANIFESTS += ['test/xpcshell/xpcshell.ini']
 
 SPHINX_TREES['toolkit_modules/subprocess'] = ['docs']
+
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
--- a/toolkit/mozapps/extensions/moz.build
+++ b/toolkit/mozapps/extensions/moz.build
@@ -1,16 +1,19 @@
 # -*- Mode: python; indent-tabs-mode: nil; tab-width: 40 -*-
 # vim: set filetype=python:
 # This Source Code Form is subject to the terms of the Mozilla Public
 # License, v. 2.0. If a copy of the MPL was not distributed with this
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 
 SPHINX_TREES['addon-manager'] = 'docs'
 
+with Files('docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 if CONFIG['MOZ_BUILD_APP'] == 'mobile/android':
     DEFINES['MOZ_FENNEC'] = True
 
 DIRS += ['internal']
 TEST_DIRS += ['test']
 
 XPIDL_SOURCES += [
     'amIAddonManager.idl',
--- a/tools/moz.build
+++ b/tools/moz.build
@@ -16,16 +16,17 @@ with Files("compare-locales/docs/**"):
 with Files("compare-locales/mach_commands.py"):
     BUG_COMPONENT = ("Localization Infrastructure and Tools", "compare-locales")
 
 with Files("coverity/**"):
     BUG_COMPONENT = ("Core", "Rewriting and Analysis")
 
 with Files("docs/**"):
     BUG_COMPONENT = ("Core", "Build Config")
+    SCHEDULES.exclusive = ['docs']
 
 with Files("lint/**"):
     BUG_COMPONENT = ("Testing", "Lint")
 
 with Files("mercurial/**"):
     BUG_COMPONENT = ("Core", "Build Config")
 
 with Files("profiler/**"):
@@ -42,18 +43,29 @@ with Files("rewriting/**"):
 
 with Files("tryselect/**"):
     BUG_COMPONENT = ("Testing", "General")
 
 with Files("update-packaging/**"):
     BUG_COMPONENT = ("Release Engineering", "Other")
 
 SPHINX_TREES['lint'] = 'lint/docs'
+
+with Files('lint/docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 SPHINX_TREES['compare-locales'] = 'compare-locales/docs'
+
+with Files('compare-locales/docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 SPHINX_TREES['try'] = 'tryselect/docs'
 
+with Files('tryselect/docs/**'):
+    SCHEDULES.exclusive = ['docs']
+
 CRAMTEST_MANIFESTS += [
     'tryselect/test/cram.ini',
 ]
 
 PYTHON_UNITTEST_MANIFESTS += [
     'tryselect/test/python.ini',
 ]