#-------------------------------------------------------------------------------------------------- # 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 $debugDemosScript = 0; # First the exceptions. ensureDir("qtdeclarative/demos"); run("git mv demos/declarative qtdeclarative/demos"); ensureDir("qtmultimedia/demos"); run("git mv demos/spectrum qtmultimedia/demos"); ensureDir("qtbase/demos"); run("git mv demos/symbianpkgrules.pri qtbase/demos"); ensureDir("qtdoc/demos"); run("git mv demos/qtdemo qtdoc/demos/"); run("git rm -r demos/mobile"); # These demos do not belong in Qt, they are Qt Mobility demos! ensureDir("qttools/demos"); run("git mv demos/arthurplugin/ qttools/demos"); fsCopy("-r", "demos/shared", "qttools/demos"); run("git add qttools/demos"); ensureDir("qtsvg/demos/embedded"); run("git mv demos/embedded/desktopservices qtsvg/demos/embedded"); # Then the rest that we haven't handled. my @demos = findFiles("demos", ".*", 1); foreach (@demos) { next if (!-d $_); my $demo = "$_"; my $dir = findDirectoryForApplication($demo); if ($dir) { $dir =~ s,qtwebkit$,qtwebkit-examples-and-demos,; print("$demo -> $dir/$demo\n") if ($debugDemosScript); my $containingDir = dirname("$dir/$demo"); ensureDir($containingDir); run("git mv $demo $dir/$demo"); } } run("git mv demos/README qtbase/demos/"); run("git mv demos/demos.pro qtbase/demos/"); run("git mv demos/embedded/embedded.pro qtbase/demos/embedded"); # Everything must have been moved fsRm("demos/.gitignore"); fsRmdirWithParents("demos/embedded"); # Create profiles createSubdirProfile("qtdeclarative/demos"); createSubdirProfile("qtdeclarative/demos/embedded"); createSubdirProfile("qtmultimedia/demos"); createSubdirProfile("qtdoc/demos"); createSubdirProfile("qtwebkit-examples-and-demos/demos/embedded"); createSubdirProfile("qtwebkit-examples-and-demos/demos"); createSubdirProfile("qtwebkit-examples-and-demos"); createSubdirProfile("qtsvg/demos/embedded"); createSubdirProfile("qtsvg/demos/embedded"); createSubdirProfile("qtsvg/demos"); foreach (@repos) { my $module = $_; #printf("Module %s\n", $module); #next if ($_ eq "qtactiveqt" || $_ eq "qtphonon"); my @pros = findFiles("$module/demos/", "\\.pr[io]", 1); if ($OStype == WINDOWS) { run('perl -pi.org -e "s,\$\$\[QT_INSTALL_DEMOS\]\/,\$\$\[QT_INSTALL_DEMOS\]/' . $module .'/,g" ' . join(" ", @pros)) if (@pros); } else { run("perl -pi.org -e 's,\\\$\\\$\\[QT_INSTALL_DEMOS\\]\\/,\\\$\\\$\\[QT_INSTALL_DEMOS\\]/$module/,g' " . join(" ", @pros)) if (@pros); } foreach my $pro (@pros) { fsRm("${pro}.org"); } } return 1;