From 6d408941774f60d79c8d1e3fd1131c5572de51c3 Mon Sep 17 00:00:00 2001 From: Miikka Heikkinen Date: Fri, 9 Sep 2011 17:44:31 +0300 Subject: Fix "sbs -c tools2 --what" output for Qt. Doing "sbs -c tools2" exports Qt headers under epocroot, but didn't list the exported headers with "--what". Added "-what" parameter support to headerexport perl script and utilized that in qtconfig.flm to generate list of exported files for "sbs -c tools2 --what". Task-number: QTBUG-21155 Reviewed-by: Sami Merila --- config.profiles/symbian/headerexport | 131 ++++++++++++++++++++++++----------- config.profiles/symbian/qtconfig.flm | 13 ++++ 2 files changed, 102 insertions(+), 42 deletions(-) diff --git a/config.profiles/symbian/headerexport b/config.profiles/symbian/headerexport index e59979ca8d..d252b26286 100644 --- a/config.profiles/symbian/headerexport +++ b/config.profiles/symbian/headerexport @@ -60,6 +60,8 @@ my %moduleheaders = ( # restrict the module headers to those found in relative p #$modules{"QtCore"} .= ";$basedir/mkspecs/" . $ENV{"MKSPEC"} if defined $ENV{"MKSPEC"}; # global variables (modified by options) +my $what = 0; +my @whatArray; my $force_win = 0; my $check_includes = 0; my $create_uic_class_map = 1; @@ -81,6 +83,7 @@ sub showUsage print "$0 usage:\n"; print " -windows Force platform to Windows (default: " . ($force_win ? "yes" : "no") . ")\n"; print " -outdir Specify output directory for sync (default: $out_basedir)\n"; + print " -what Output what files would be synced (default: " . ($what ? "yes" : "no") . ")\n"; print " -help This help\n"; exit 0; } @@ -307,6 +310,12 @@ sub syncHeader { my ($header, $iheader, $copy) = @_; $iheader =~ s=\\=/=g; $header =~ s=\\=/=g; + + if ($what) { + push(@whatArray, $header); + return 1; + } + return copyFile($iheader, $header) if($copy); unless(-e $header) { @@ -504,7 +513,7 @@ while ( @ARGV ) { $var = "output"; $val = shift @ARGV; } elsif($arg eq "-showonly" || $arg eq "-remove-stale" || $arg eq "-windows" || - $arg eq "-relative" || $arg eq "-check-includes") { + $arg eq "-relative" || $arg eq "-check-includes" || $arg eq "-what") { $var = substr($arg, 1); $val = "yes"; } elsif($arg =~ /^-no-(.*)$/) { @@ -524,6 +533,12 @@ while ( @ARGV ) { if(!$var || $var eq "show_help") { print "Unknown option: $arg\n\n" if(!$var); showUsage(); + } elsif ($var eq "what") { + if ($val eq "yes") { + $what++; + } elsif ($what) { + $what--; + } } elsif ($var eq "check-includes") { if($val eq "yes") { $check_includes++; @@ -553,9 +568,11 @@ while ( @ARGV ) { $isunix = checkUnix; #cache checkUnix -# create path -mkpath "$out_basedir/include"; -mkpath "$out_basedir/mw/Qt"; +if (!$what) { + # create path + mkpath "$out_basedir/include"; + mkpath "$out_basedir/mw/Qt"; +} my @ignore_headers = (); my $class_lib_map_contents = ""; @@ -699,25 +716,29 @@ foreach my $lib (@modules_to_sync) { # write forwarding headers to include/Qt if ($lib ne "phonon" && $subdir =~ /^$basedir\/src/) { my $file_name = "$out_basedir/mw/Qt/$header"; - my $file_op = '>'; - my $header_content = ''; - if (exists $colliding_headers{$file_name}) { - $file_op = '>>'; + if ($what) { + push(@whatArray, $file_name); } else { - $colliding_headers{$file_name} = 1; - my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.'; - $header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" . - " #if defined(__GNUC__)\n" . - " #warning \"$warning_msg\"\n" . - " #elif defined(_MSC_VER)\n" . - " #pragma message(\"WARNING: $warning_msg\")\n" . - " #endif\n". - "#endif\n\n"; + my $file_op = '>'; + my $header_content = ''; + if (exists $colliding_headers{$file_name}) { + $file_op = '>>'; + } else { + $colliding_headers{$file_name} = 1; + my $warning_msg = 'Inclusion of header files from include/Qt is deprecated.'; + $header_content = "#ifndef QT_NO_QT_INCLUDE_WARN\n" . + " #if defined(__GNUC__)\n" . + " #warning \"$warning_msg\"\n" . + " #elif defined(_MSC_VER)\n" . + " #pragma message(\"WARNING: $warning_msg\")\n" . + " #endif\n". + "#endif\n\n"; + } + $header_content .= '#include "' . "../$lib/$header" . "\"\n"; + open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n"; + print HEADERFILE $header_content; + close HEADERFILE; } - $header_content .= '#include "' . "../$lib/$header" . "\"\n"; - open HEADERFILE, $file_op, $file_name or die "unable to open '$file_name' : $!\n"; - print HEADERFILE $header_content; - close HEADERFILE; } foreach my $full_class (@classes) { @@ -768,7 +789,7 @@ foreach my $lib (@modules_to_sync) { my $pri_install_iheader = fixPaths($iheader, $current_dir); $pri_install_pfiles.= "$pri_install_iheader ";; } - print "header created for $iheader ($header_copies)\n" if($header_copies > 0); + print "header created for $iheader ($header_copies)\n" if($header_copies > 0 && !$what); } } } @@ -791,15 +812,19 @@ foreach my $lib (@modules_to_sync) { my $oldmaster = ; close MASTERINCLUDE; $oldmaster =~ s/\r//g; # remove \r's , so comparison is ok on all platforms - $master_include = 0 if($oldmaster eq $master_contents); + $master_include = 0 if($oldmaster eq $master_contents && !$what); } if($master_include && $master_contents) { - my $master_dir = dirname($master_include); - mkpath $master_dir; - print "header (master) created for $lib\n"; - open MASTERINCLUDE, ">$master_include"; - print MASTERINCLUDE $master_contents; - close MASTERINCLUDE; + if ($what) { + push(@whatArray, $master_include); + } else { + my $master_dir = dirname($master_include); + mkpath $master_dir; + print "header (master) created for $lib\n"; + open MASTERINCLUDE, ">$master_include"; + print MASTERINCLUDE $master_contents; + close MASTERINCLUDE; + } } } @@ -816,15 +841,19 @@ foreach my $lib (@modules_to_sync) { my $old_headers_pri_contents = ; close HEADERS_PRI_FILE; $old_headers_pri_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms - $headers_pri_file = 0 if($old_headers_pri_contents eq $headers_pri_contents); + $headers_pri_file = 0 if($old_headers_pri_contents eq $headers_pri_contents && !$what); } if($headers_pri_file && $master_contents) { - my $headers_pri_dir = dirname($headers_pri_file); - mkpath $headers_pri_dir; - print "headers.pri file created for $lib\n"; - open HEADERS_PRI_FILE, ">$headers_pri_file"; - print HEADERS_PRI_FILE $headers_pri_contents; - close HEADERS_PRI_FILE; + if ($what) { + push(@whatArray, $headers_pri_file); + } else { + my $headers_pri_dir = dirname($headers_pri_file); + mkpath $headers_pri_dir; + print "headers.pri file created for $lib\n"; + open HEADERS_PRI_FILE, ">$headers_pri_file"; + print HEADERS_PRI_FILE $headers_pri_contents; + close HEADERS_PRI_FILE; + } } } unless(!$create_uic_class_map) { @@ -836,14 +865,18 @@ unless(!$create_uic_class_map) { my $old_class_lib_map_contents = ; close CLASS_LIB_MAP; $old_class_lib_map_contents =~ s/\r//g; # remove \r's , so comparison is ok on all platforms - $class_lib_map = 0 if($old_class_lib_map_contents eq $class_lib_map_contents); + $class_lib_map = 0 if($old_class_lib_map_contents eq $class_lib_map_contents && !$what); } if($class_lib_map) { - my $class_lib_map_dir = dirname($class_lib_map); - mkpath $class_lib_map_dir; - open CLASS_LIB_MAP, ">$class_lib_map"; - print CLASS_LIB_MAP $class_lib_map_contents; - close CLASS_LIB_MAP; + if ($what) { + push(@whatArray, $class_lib_map); + } else { + my $class_lib_map_dir = dirname($class_lib_map); + mkpath $class_lib_map_dir; + open CLASS_LIB_MAP, ">$class_lib_map"; + print CLASS_LIB_MAP $class_lib_map_contents; + close CLASS_LIB_MAP; + } } } @@ -974,4 +1007,18 @@ if($check_includes) { } } +if ($what) { + # Print contents of the what-array, removing duplicates + my @sortedWhat = sort(@whatArray); + my $whatItem; + my $previousWhatItem = ""; + foreach $whatItem (@sortedWhat) { + if ($previousWhatItem ne $whatItem) { + $previousWhatItem = $whatItem; + $whatItem =~ s=//=/=g; + print "$whatItem\n" ; + } + } +} + exit 0; diff --git a/config.profiles/symbian/qtconfig.flm b/config.profiles/symbian/qtconfig.flm index 93410f09cd..56c3d6bc72 100644 --- a/config.profiles/symbian/qtconfig.flm +++ b/config.profiles/symbian/qtconfig.flm @@ -65,6 +65,19 @@ $(SOURCEDIR)/qmake$(DOTEXE): $(EXTENSION_ROOT)/$(QT_ROOT)/$(CONFIGURE_APP) $(call startrule,mkspecexport) \ $(GNUCP) -R $(EXTENSION_ROOT)/$(QT_ROOT)/mkspecs $(MKSPECDIR) $(call endrule,mkspecexport) + +WHAT:: + $(call startrawoutput) \ + echo "$(call whatLogOpen)"; \ + perl headerexport -base-dir $(EXTENSION_ROOT)/$(QT_ROOT) -outdir $(EPOCROOT)/epoc32/include/ -what | \ + (read -r LINE; \ + while [ $$$$? -eq 0 ]; do \ + echo "$(call whatLogItem,,$$$$LINE)"; \ + read -r LINE; \ + done; \ + ); \ + echo "$(call whatLogClose)" \ + $(call endrawoutput) endef # Here a variable named "done_" gets created -- cgit v1.2.3