#-------------------------------------------------------------------------------------------------- # Standard modularization template # -------------------------------- # # The script will start execution from . # # Available variables: # $qtdir = or where you started the modularize script from # $basepath = path for the modularize script, and basepath for the modularization repo # $OStype = where is one of 0 = Windows, 1 = Unix, 2 = Mac # # To execute a command: # run("git mv foo bar") # runs command, reports error possition and dies # runNotDie("git mv foo bar") # runs command, reports error possition, returns error code # and continues. Use ($? >> 8) to get the real exit code. # ensureDir("qtbase") # Ensures that qtbase exists and is a directory. Will create # it if it does not exist. #-------------------------------------------------------------------------------------------------- require("non-module-helpers"); use File::Basename; my $debugScript = 0; # Move the data files of bic from global to modules our @bicRepos = ('qtbase' , 'qtsvg', 'qtdeclarative', 'qt3support', 'qtscript', 'qtphonon', 'qtmultimedia', 'qttools', 'qtxmlpatterns'); foreach (@bicRepos) { my $module = $_; ensureDir("$module/tests/auto/bic/data"); fsCopy("$basepath/files/tests/auto/bic/.gitignore", "$module/tests/auto/bic/"); run("git add $module/tests/auto/bic/.gitignore"); ensureDir("$module/tests/global"); fsCopy("$basepath/files/tests/global/.gitignore", "$module/tests/global/"); run("git add $module/tests/global/.gitignore"); } run("git mv tests/auto/bic/data/QtXmlPatterns* qtxmlpatterns/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtCore* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtGui* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtOpenGL* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtNetwork* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtSql* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtXml* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtTest* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtDBus* qtbase/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtSvg* qtsvg/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtDeclarative* qtdeclarative/tests/auto/bic/data"); run("git mv tests/auto/bic/data/Qt3Support* qt3support/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtScriptTools* qtscript/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtScript* qtscript/tests/auto/bic/data"); run("git mv tests/auto/bic/data/phonon* qtphonon/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtMultimedia* qtmultimedia/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtDesigner* qttools/tests/auto/bic/data"); run("git mv tests/auto/bic/data/QtHelp* qttools/tests/auto/bic/data"); # Todo: tests/auto/bic/data/QtWebKit* # global tests our @globalTests = ('bic' , 'headers', 'compilerwarnings', 'symbols', 'guiapplauncher'); ensureDir("qtqa/tests/auto"); foreach my $test (@globalTests) { run("git mv tests/auto/$test qtqa/tests/auto/"); } ensureDir("qttools/tests/auto"); run("git mv tests/auto/linguist qttools/tests/auto"); sub processProfile { my $profile = $_[0]; $profile = "tests/auto/$profile"; my $module = $_[1]; ensureDir("$module/tests/auto") if ($module); my @stat = stat($profile); open($readFd, "< $profile") or die("Could not open $profile"); open($writeFd, "> $profile.tmp") or die("Could not open $profile.tmp"); while (<$readFd>) { $skip = 0; if (/([\.a-z0-9_]+)/) { $candidate = $1; if (-d "tests/auto/$candidate") { if (!$module) { run ("git rm -rfq tests/auto/$candidate"); } else { run ("git mv tests/auto/$candidate $module/tests/auto/"); } } else { foreach my $test (@globalTests) { if($candidate eq $test) { $skip = 1; } } } } if ($skip == 0) { print($writeFd $_); } } close($readFd); close($writeFd); unlink($profile); rename("$profile.tmp", $profile) or die("Could not rename $profile.tmp -> $profile"); if (!$module) { run("git rm -fq $profile"); } else { run("git mv $profile $module/tests/auto/"); } } #process each .pro file processProfile("corelib.pro", "qtbase"); processProfile("gui.pro", "qtbase"); processProfile("network.pro", "qtbase"); processProfile("sql.pro", "qtbase"); processProfile("xml.pro", "qtbase"); processProfile("other.pro", "qtbase"); processProfile("host.pro", "qtbase"); processProfile("opengl.pro", "qtbase"); processProfile("dbus.pro", "qtbase"); processProfile("qt3support.pro", "qt3support"); processProfile("xmlpatterns.pro", "qtxmlpatterns"); processProfile("script.pro", "qtscript"); processProfile("phonon.pro", "qtphonon"); processProfile("svg.pro", "qtsvg"); processProfile("multimedia.pro", "qtmultimedia"); processProfile("webkit.pro", ""); processProfile("help.pro", "qttools"); ensureDir("qtdeclarative/tests/auto"); run("git mv tests/auto/declarative qtdeclarative/tests/auto/"); run("git mv tests/auto/declarative.pro qtdeclarative/tests/auto/auto.pro"); #they are in other.pro, but on the same line run("git mv tests/auto/qzip qtbase/tests/auto/"); run("git mv tests/auto/qtextodfwriter qtbase/tests/auto/"); run("git mv tests/auto/uic3 qt3support/tests/auto/"); # benchmarks ensureDir("qtdeclarative/tests/benchmarks"); ensureDir("qtsvg/tests/benchmarks"); ensureDir("qtscript/tests/benchmarks"); run("git mv tests/benchmarks/declarative qtdeclarative/tests/benchmarks"); run("git mv tests/benchmarks/svg qtsvg/tests/benchmarks"); run("git mv tests/benchmarks/script qtscript/tests/benchmarks"); run("git mv tests/benchmarks qtbase/tests/"); #shared run("git mv tests/shared qtbase/tests"); run("git mv tests/auto/*.h qtbase/tests/auto"); ensureDir("qtdeclarative/tests/shared"); fsCopy("qtbase/tests/shared/util.h", "qtdeclarative/tests/shared/"); ensureDir("qt3support/tests/shared"); fsCopy("qtbase/tests/shared/util.h", "qt3support/tests/shared/"); ensureDir("qtscript/tests/shared"); fsCopy("qtbase/tests/shared/util.h", "qtscript/tests/shared/"); run("git add qtdeclarative/tests/shared/util.h qt3support/tests/shared/util.h qtscript/tests/shared/util.h"); fsCopy("qtbase/tests/auto/network-settings.h", "qt3support/tests/auto/"); fsCopy("qtbase/tests/auto/network-settings.h", "qtxmlpatterns/tests/auto/"); run("git add qt3support/tests/auto/network-settings.h qtxmlpatterns/tests/auto/network-settings.h"); # There is patch corresponding to this which changes the include path fsCopy("qt3support/src/qt3support/tools/q3tl.h", "qtbase/tests/auto/qalgorithms/"); run("git add qtbase/tests/auto/qalgorithms/q3tl.h"); #residues run("git mv tests/auto/xmlpatterns.pri qtxmlpatterns/tests/auto/"); run("git mv tests/auto/solutions.pri qtbase/tests/auto/"); run("git mv tests/auto/qtextbrowser.html qtbase/tests/auto/"); run("git mv tests/auto/test.pl qtbase/tests/auto/"); #i don't know if it belongs there. run("git mv tests/auto/qsslsocket_onDemandCertificates_member qtbase/tests/auto/"); run("git mv tests/auto/qsslsocket_onDemandCertificates_static qtbase/tests/auto/"); run("git mv tests/arthur qtbase/tests/"); #profiles run("git mv tests/auto/auto.pro qtbase/tests/auto/"); run("git mv qtmultimedia/tests/auto/multimedia.pro qtmultimedia/tests/auto/auto.pro"); run("git mv qtscript/tests/auto/script.pro qtscript/tests/auto/auto.pro"); run("git mv qtsvg/tests/auto/svg.pro qtsvg/tests/auto/auto.pro"); run("git mv qtxmlpatterns/tests/auto/xmlpatterns.pro qtxmlpatterns/tests/auto/auto.pro"); run("git mv qt3support/tests/auto/qt3support.pro qt3support/tests/auto/auto.pro"); run("git mv qttools/tests/auto/help.pro qttools/tests/auto/auto.pro"); run("echo !cross_compile:SUBDIRS += uic3 >> qt3support/tests/auto/auto.pro"); run("echo SUBDIRS += linguist >> qttools/tests/auto/auto.pro"); run("git mv tests/tests.pro qtbase/tests/"); createSubdirProfile("qtdeclarative/tests"); createSubdirProfile("qt3support/tests"); createSubdirProfile("qtsvg/tests"); createSubdirProfile("qtscript/tests"); createSubdirProfile("qtmultimedia/tests"); createSubdirProfile("qtxmlpatterns/tests"); createSubdirProfile("qttools/tests"); createSubdirProfile("qtqa/tests/auto"); createSubdirProfile("qtqa/tests"); createSubdirProfile("qtqa"); # Move manual tests, they all depend only on qtbase run("git mv tests/manual qtbase/tests/manual/"); # Add the test directory's README to every module with a test directory foreach (@repos) { my $module = $_; if (-d "$module/tests") { fsCopy("tests/README", "$module/tests/"); run("git add $module/tests/README"); } } # clean up, for completeness (will fail on remaining files) run("git rm tests/README"); fsRmdir("tests/auto/"); fsRmdir("tests/"); return 1;