move module dependencies from qt.pro to .gitmodules
authorOswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Fri, 18 Dec 2015 17:50:54 +0000 (18:50 +0100)
committerJani Heikkinen <jani.heikkinen@theqtcompany.com>
Fri, 22 Jan 2016 04:26:12 +0000 (04:26 +0000)
this removes the last redundant module list.

the module build order which is not determined by dependencies is pretty
random now. this is avoided for a few heavy and "less relevant" modules
by setting a priority to built them as late as possible.

Change-Id: Ie8ef9777d050a4915cd2282dc9ccb48fcdbc02d2
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@theqtcompany.com>
Reviewed-by: Simon Hausmann <simon.hausmann@theqtcompany.com>
.gitattributes
.gitmodules
qt.pro

index df15048..084cdfd 100644 (file)
@@ -1,7 +1,6 @@
 .tag                    export-subst
 .gitignore              export-ignore
 .gitattributes          export-ignore
-.gitmodules             export-ignore
 .commit-template        export-ignore
 init-repository         export-ignore
 README.git              export-ignore
index 211c331..49c27df 100644 (file)
        branch = 5.6
        initrepo = true
 [submodule "qtsvg"]
+       depends = qtbase
        path = qtsvg
        url = ../qtsvg.git
        branch = 5.6
        initrepo = true
 [submodule "qtdeclarative"]
+       depends = qtbase
+       recommends = qtsvg qtxmlpatterns
        path = qtdeclarative
        url = ../qtdeclarative.git
        branch = 5.6
        initrepo = true
 [submodule "qtactiveqt"]
+       depends = qtbase
        path = qtactiveqt
        url = ../qtactiveqt.git
        branch = 5.6
        initrepo = true
 [submodule "qtscript"]
+       depends = qtbase
+       recommends = qttools
        path = qtscript
        url = ../qtscript.git
        branch = 5.6
        initrepo = true
 [submodule "qtmultimedia"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtmultimedia
        url = ../qtmultimedia.git
        branch = 5.6
        initrepo = true
 [submodule "qttools"]
+       depends = qtbase
+       recommends = qtdeclarative qtactiveqt qtwebkit
        path = qttools
        url = ../qttools.git
        branch = 5.6
        initrepo = true
 [submodule "qtxmlpatterns"]
+       depends = qtbase
        path = qtxmlpatterns
        url = ../qtxmlpatterns.git
        branch = 5.6
        initrepo = true
 [submodule "qttranslations"]
+       depends = qttools
        path = qttranslations
        url = ../qttranslations.git
        branch = 5.6
        initrepo = true
+       priority = 30
 [submodule "qtdoc"]
+       depends = qtdeclarative
        path = qtdoc
        url = ../qtdoc.git
        branch = 5.6
        initrepo = true
+       priority = 40
 [submodule "qtrepotools"]
        path = qtrepotools
        url = ../qtrepotools.git
        branch = master
        initrepo = true
+       qt = false
 [submodule "qtwebkit"]
+       depends = qtbase
+       recommends = qtdeclarative qtlocation qtmultimedia qtsensors qtwebchannel qtxmlpatterns
        path = qtwebkit
        url = ../qtwebkit.git
        branch = 5.6
+       project = WebKit.pro
+       priority = 20
 [submodule "qtwebkit-examples"]
+       depends = qtwebkit qttools
        path = qtwebkit-examples
        url = ../qtwebkit-examples.git
        branch = 5.6
 [submodule "qtqa"]
+       depends = qtbase
        path = qtqa
        url = ../qtqa.git
        branch = master
        initrepo = true
+       priority = 50
 [submodule "qtlocation"]
+       depends = qtbase
+       recommends = qtdeclarative qtquickcontrols qtserialport qtsystems
        path = qtlocation
        url = ../qtlocation.git
        branch = 5.6
        initrepo = true
 [submodule "qtsensors"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtsensors
        url = ../qtsensors.git
        branch = 5.6
        initrepo = true
 [submodule "qtsystems"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtsystems
        url = ../qtsystems.git
        branch = dev
 [submodule "qtfeedback"]
+       depends = qtdeclarative
+       recommends = qtmultimedia
        path = qtfeedback
        url = ../qtfeedback.git
        branch = master
 [submodule "qtdocgallery"]
+       depends = qtdeclarative
        path = qtdocgallery
        url = ../qtdocgallery.git
        branch = master
 [submodule "qtpim"]
+       depends = qtdeclarative
        path = qtpim
        url = ../qtpim.git
        branch = dev
 [submodule "qtconnectivity"]
+       depends = qtbase
+       recommends = qtdeclarative qtandroidextras
        path = qtconnectivity
        url = ../qtconnectivity.git
        branch = 5.6
        initrepo = true
 [submodule "qtwayland"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtwayland
        url = ../qtwayland.git
        branch = 5.6
        initrepo = true
 [submodule "qt3d"]
+       depends = qtdeclarative qtimageformats
        path = qt3d
        url = ../qt3d.git
        branch = 5.6
        initrepo = true
 [submodule "qtimageformats"]
+       depends = qtbase
        path = qtimageformats
        url = ../qtimageformats.git
        branch = 5.6
        initrepo = true
 [submodule "qtquick1"]
+       depends = qtscript
+       recommends = qtsvg qtxmlpatterns
        path = qtquick1
        url = ../qtquick1.git
        branch = 5.6
 [submodule "qtgraphicaleffects"]
+       depends = qtdeclarative
        path = qtgraphicaleffects
        url = ../qtgraphicaleffects.git
        branch = 5.6
        initrepo = true
 [submodule "qtquickcontrols"]
+       depends = qtdeclarative
+       recommends = qtgraphicaleffects
        path = qtquickcontrols
        url = ../qtquickcontrols.git
        branch = 5.6
        initrepo = true
 [submodule "qtserialbus"]
+       depends = qtserialport
        path = qtserialbus
        url = ../qtserialbus.git
        branch = 5.6
 [submodule "qtserialport"]
+       depends = qtbase
        path = qtserialport
        url = ../qtserialport.git
        branch = 5.6
        initrepo = true
 [submodule "qtx11extras"]
+       depends = qtbase
        path = qtx11extras
        url = ../qtx11extras.git
        branch = 5.6
        initrepo = true
 [submodule "qtmacextras"]
+       depends = qtbase
        path = qtmacextras
        url = ../qtmacextras.git
        branch = 5.6
        initrepo = true
 [submodule "qtwinextras"]
+       depends = qtbase
+       recommends = qtdeclarative qtmultimedia
        path = qtwinextras
        url = ../qtwinextras.git
        branch = 5.6
        initrepo = true
 [submodule "qtandroidextras"]
+       depends = qtbase
        path = qtandroidextras
        url = ../qtandroidextras.git
        branch = 5.6
        initrepo = true
 [submodule "qtenginio"]
+       depends = qtdeclarative
        path = qtenginio
        url = ../qtenginio.git
        branch = 5.6
        initrepo = true
 [submodule "qtwebsockets"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtwebsockets
        url = ../qtwebsockets.git
        branch = 5.6
        initrepo = true
 [submodule "qtwebchannel"]
+       depends = qtbase
+       recommends = qtdeclarative qtwebsockets
        path = qtwebchannel
        url = ../qtwebchannel.git
        branch = 5.6
        initrepo = true
 [submodule "qtwebengine"]
+       depends = qtquickcontrols qtwebchannel
+       recommends = qtlocation
        path = qtwebengine
        url = ../qtwebengine.git
        branch = 5.6
        initrepo = true
+       priority = 10
 [submodule "qtcanvas3d"]
+       depends = qtdeclarative
        path = qtcanvas3d
        url = ../qtcanvas3d.git
        branch = 5.6
        initrepo = true
 [submodule "qtwebview"]
+       depends = qtdeclarative
+       recommends = qtwebengine
        path = qtwebview
        url = ../qtwebview.git
        branch = 5.6
        initrepo = true
 [submodule "qtquickcontrols2"]
+       depends = qtquickcontrols
        path = qtquickcontrols2
        url = ../qtquickcontrols2.git
        branch = 5.6
        initrepo = true
 [submodule "qtpurchasing"]
+       depends = qtbase
+       recommends = qtdeclarative
        path = qtpurchasing
        url = ../qtpurchasing.git
        branch = 5.6
diff --git a/qt.pro b/qt.pro
index 5e168fa..f8d3d4d 100644 (file)
--- a/qt.pro
+++ b/qt.pro
@@ -7,97 +7,68 @@ CONFIG -= build_pass   # unhack, as it confuses Qt Creator
 
 TEMPLATE      = subdirs
 
-defineReplace(moduleName) {
-    return(module_$$replace(1, -, _))
+# Extract submodules from .gitmodules.
+lines = $$cat(.gitmodules, lines)
+for (line, lines) {
+    mod = $$replace(line, "^\\[submodule \"([^\"]+)\"\\]$", \\1)
+    !equals(mod, $$line) {
+        module = $$mod
+        modules += $$mod
+    } else {
+        prop = $$replace(line, "^$$escape_expand(\\t)([^ =]+) *=.*$", \\1)
+        !equals(prop, $$line) {
+            val = $$replace(line, "^[^=]+= *", )
+            module.$${module}.$$prop = $$split(val)
+        } else {
+            error("Malformed line in .gitmodules: $$line")
+        }
+    }
 }
+QMAKE_INTERNAL_INCLUDED_FILES += $$PWD/.gitmodules
+
+modules = $$sort_depends(modules, module., .depends .recommends)
+modules = $$reverse(modules)
+for (mod, modules) {
+    equals(module.$${mod}.qt, false): \
+        next()
 
-# Arguments: module name, [mandatory deps], [optional deps], [project file]
-defineTest(addModule) {
-    for(d, $$list($$2 $$3)): \
-        !contains(MODULES, $$d): \
-            error("'$$1' depends on not (yet) declared '$$d'.")
-    MODULES += $$1
-    export(MODULES)
+    deps = $$eval(module.$${mod}.depends)
+    recs = $$eval(module.$${mod}.recommends)
+    for (d, $$list($$deps $$recs)): \
+        !contains(modules, $$d): \
+            error("'$$mod' depends on undeclared '$$d'.")
 
-    contains(QT_SKIP_MODULES, $$1): return(false)
-    !isEmpty(QT_BUILD_MODULES):!contains(QT_BUILD_MODULES, $$1): return(false)
-    mod = $$moduleName($$1)
+    contains(QT_SKIP_MODULES, $$mod): \
+        next()
+    !isEmpty(QT_BUILD_MODULES):!contains(QT_BUILD_MODULES, $$mod): \
+        next()
 
-    isEmpty(4) {
-        !exists($$1/$${1}.pro): return(false)
-        $${mod}.subdir = $$1
-        export($${mod}.subdir)
+    project = $$eval(module.$${mod}.project)
+    isEmpty(project) {
+        !exists($$mod/$${mod}.pro): \
+            next()
+        $${mod}.subdir = $$mod
     } else {
-        !exists($$1/$${4}): return(false)
-        $${mod}.file = $$1/$$4
+        !exists($$mod/$$project): \
+            next()
+        $${mod}.file = $$mod/$$project
         $${mod}.makefile = Makefile
-        export($${mod}.file)
-        export($${mod}.makefile)
     }
+    $${mod}.target = module-$$mod
 
-    for(d, 2) {
-        dn = $$moduleName($$d)
-        !contains(SUBDIRS, $$dn): \
-            return(false)
-        $${mod}.depends += $$dn
+    for (d, deps) {
+        !contains(SUBDIRS, $$d) {
+            $${mod}.target =
+            break()
+        }
+        $${mod}.depends += $$d
     }
-    for(d, 3) {
-        dn = $$moduleName($$d)
-        contains(SUBDIRS, $$dn): \
-            $${mod}.depends += $$dn
+    isEmpty($${mod}.target): \
+        next()
+    for (d, recs) {
+        contains(SUBDIRS, $$d): \
+            $${mod}.depends += $$d
     }
-    !isEmpty($${mod}.depends): \
-        export($${mod}.depends)
-
-    $${mod}.target = module-$$1
-    export($${mod}.target)
 
     SUBDIRS += $$mod
-    export(SUBDIRS)
-    return(true)
 }
-
-# only qtbase is required to exist. The others may not - but it is the
-# users responsibility to ensure that all needed dependencies exist, or
-# it may not build.
-
-addModule(qtbase)
-addModule(qtandroidextras, qtbase)
-addModule(qtmacextras, qtbase)
-addModule(qtx11extras, qtbase)
-addModule(qtsvg, qtbase)
-addModule(qtxmlpatterns, qtbase)
-addModule(qtdeclarative, qtbase, qtsvg qtxmlpatterns)
-addModule(qtgraphicaleffects, qtdeclarative)
-addModule(qtquickcontrols, qtdeclarative, qtgraphicaleffects)
-addModule(qtquickcontrols2, qtquickcontrols)
-addModule(qtmultimedia, qtbase, qtdeclarative)
-addModule(qtwinextras, qtbase, qtdeclarative qtmultimedia)
-addModule(qtactiveqt, qtbase)
-addModule(qtsystems, qtbase, qtdeclarative)
-addModule(qtsensors, qtbase, qtdeclarative)
-addModule(qtconnectivity, qtbase, qtdeclarative qtandroidextras)
-addModule(qtfeedback, qtdeclarative, qtmultimedia)
-addModule(qtpim, qtdeclarative)
-addModule(qtwebsockets, qtbase, qtdeclarative)
-addModule(qtwebchannel, qtbase, qtdeclarative qtwebsockets)
-addModule(qtserialport, qtbase)
-addModule(qtlocation, qtbase, qtdeclarative qtquickcontrols qtserialport qtsystems)
-addModule(qtwebkit, qtbase, qtdeclarative qtlocation qtmultimedia qtsensors qtwebchannel qtxmlpatterns, WebKit.pro)
-addModule(qttools, qtbase, qtdeclarative qtactiveqt qtwebkit)
-addModule(qtwebkit-examples, qtwebkit qttools)
-addModule(qtimageformats, qtbase)
-addModule(qt3d, qtdeclarative qtimageformats)
-addModule(qtcanvas3d, qtdeclarative)
-addModule(qtscript, qtbase, qttools)
-addModule(qtquick1, qtscript, qtsvg qtxmlpatterns)
-addModule(qtdocgallery, qtdeclarative)
-addModule(qtwayland, qtbase, qtdeclarative)
-addModule(qtserialbus, qtserialport)
-addModule(qtenginio, qtdeclarative)
-addModule(qtwebengine, qtquickcontrols qtwebchannel, qtlocation)
-addModule(qtwebview, qtdeclarative, qtwebengine)
-addModule(qtpurchasing, qtbase, qtdeclarative)
-addModule(qttranslations, qttools)
-addModule(qtdoc, qtdeclarative)
-addModule(qtqa, qtbase)