syncqt: Make sure to update forwarding headers if they are stale
Previously syncqt did not write content to forwarding headers if they already existed in the target location, regardless of the contents of the forwarding header. This is different from syncqt's behavior when it actually copies the headers to the target location, instead of creating a forwarding header that includes another header. Fix syncqt to read existing forwarding header content, and update the content in case if it's different from the newly generated content. This should fix the following non-prefix build case: running syncqt from a different source + build directory would not update the forwarding headers in the qtbase build dir. Change-Id: Ia0a1665a36ce54f1c487101d9a7532fc0aa40c89 Reviewed-by: Brett Stottlemyer <bstottle@ford.com> Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
18eb51b813
commit
108fb2f197
@ -423,14 +423,31 @@ sub syncHeader {
|
||||
normalizePath(\$header);
|
||||
return copyFile($lib, $iheader, $header) if($copy);
|
||||
|
||||
unless(-e $header) {
|
||||
my $header_dir = dirname($header);
|
||||
my $header_dir = dirname($header);
|
||||
my $iheader_out = fixPaths($iheader, $header_dir);
|
||||
my $new_forwarding_header_content = "#include \"$iheader_out\"\n";
|
||||
|
||||
# By default, create / update the forwarding header if it does
|
||||
# not exist.
|
||||
my $forwarding_header_exists = (-e $header ? 1 : 0);
|
||||
my $update_forwarding_header = !$forwarding_header_exists;
|
||||
|
||||
# If remove_stale option is on, make sure to overwrite the
|
||||
# forwarding header contents if the file already exists and its
|
||||
# content is different from what we will generate.
|
||||
if ($remove_stale) {
|
||||
my $existing_forwarding_header_content = fileContents($header);
|
||||
my $header_content_is_different =
|
||||
$new_forwarding_header_content ne $existing_forwarding_header_content;
|
||||
$update_forwarding_header ||= $header_content_is_different;
|
||||
}
|
||||
|
||||
if ($update_forwarding_header) {
|
||||
make_path($header_dir, $lib, $verbose_level);
|
||||
|
||||
#write it
|
||||
my $iheader_out = fixPaths($iheader, $header_dir);
|
||||
open(HEADER, ">$header") || die "Could not open $header for writing: $!\n";
|
||||
print HEADER "#include \"$iheader_out\"\n";
|
||||
print HEADER "$new_forwarding_header_content";
|
||||
close HEADER;
|
||||
if(defined($ts)) {
|
||||
utime(time, $ts, $header) or die "$iheader, $header";
|
||||
|
Loading…
Reference in New Issue
Block a user