Changeset 128966 in webkit


Ignore:
Timestamp:
Sep 18, 2012 10:41:20 PM (12 years ago)
Author:
commit-queue@webkit.org
Message:

[WK2][WTR] CodeGeneratorTestRunner could keep original copyright.
https://bugs.webkit.org/show_bug.cgi?id=96181

Patch by Kangil Han <kangil.han@samsung.com> on 2012-09-18
Reviewed by Daniel Bates.

This patch enabled derived files, in DerivedSources/InjectedBundle, to keep original copyright.

  • WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:

(new):
(_parseLicenseBlock):
(_parseLicenseBlockFromFile):
(_defaultLicenseBlock):
(_licenseBlock):
(_generateHeaderFile):
(_generateImplementationFile):

Location:
trunk/Tools
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/Tools/ChangeLog

    r128943 r128966  
     12012-09-18  Kangil Han  <kangil.han@samsung.com>
     2
     3        [WK2][WTR] CodeGeneratorTestRunner could keep original copyright.
     4        https://bugs.webkit.org/show_bug.cgi?id=96181
     5
     6        Reviewed by Daniel Bates.
     7
     8        This patch enabled derived files, in DerivedSources/InjectedBundle, to keep original copyright.
     9
     10        * WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm:
     11        (new):
     12        (_parseLicenseBlock):
     13        (_parseLicenseBlockFromFile):
     14        (_defaultLicenseBlock):
     15        (_licenseBlock):
     16        (_generateHeaderFile):
     17        (_generateImplementationFile):
     18
    1192012-09-18  Byungwoo Lee  <bw80.lee@samsung.com>
    220
  • trunk/Tools/WebKitTestRunner/InjectedBundle/Bindings/CodeGeneratorTestRunner.pm

    r128108 r128966  
    11# Copyright (C) 2010 Apple Inc. All rights reserved.
     2# Copyright (C) 2012 Samsung Electronics
    23#
    34# Redistribution and use in source and binary forms, with or without
     
    3031sub new
    3132{
    32     my ($class, $codeGenerator, $outputDir) = @_;
     33    my ($class, $codeGenerator, $outputDir, $outputHeaderDir, $layerOnTop, $preprocessor, $writeDependencies, $verbose, $idlFilePath) = @_;
    3334
    3435    my $reference = {
    3536        codeGenerator => $codeGenerator,
    3637        outputDir => $outputDir,
     38        idlFilePath => $idlFilePath,
    3739    };
    3840
     
    7375}
    7476
    75 sub _fileHeaderString
    76 {
    77     my ($filename) = @_;
    78 
    79     # FIXME: We should pull header out of the IDL file to get the copyright
    80     # year(s) right.
     77sub _parseLicenseBlock
     78{
     79    my ($fileHandle) = @_;
     80
     81    my ($copyright, $readCount, $buffer, $currentCharacter, $previousCharacter);
     82    my $startSentinel = "/*";
     83    my $lengthOfStartSentinel = length($startSentinel);
     84    $readCount = read($fileHandle, $buffer, $lengthOfStartSentinel);
     85    return "" if ($readCount < $lengthOfStartSentinel || $buffer ne $startSentinel);
     86    $copyright = $buffer;
     87
     88    while ($readCount = read($fileHandle, $currentCharacter, 1)) {
     89        $copyright .= $currentCharacter;
     90        return $copyright if $currentCharacter eq "/" && $previousCharacter eq "*";
     91        $previousCharacter = $currentCharacter;
     92    }
     93
     94    return "";
     95}
     96
     97sub _parseLicenseBlockFromFile
     98{
     99    my ($path) = @_;
     100    open my $fileHandle, "<", $path or die "Failed to open $path for reading: $!";
     101    my $licenseBlock = _parseLicenseBlock($fileHandle);
     102    close($fileHandle);
     103    return $licenseBlock;
     104}
     105
     106sub _defaultLicenseBlock
     107{
    81108    return <<EOF;
    82109/*
     
    107134}
    108135
     136sub _licenseBlock
     137{
     138    my ($self) = @_;
     139    return $self->{licenseBlock} if $self->{licenseBlock};
     140
     141    my $licenseBlock = _parseLicenseBlockFromFile($self->{idlFilePath}) || _defaultLicenseBlock();
     142    $self->{licenseBlock} = $licenseBlock;
     143    return $licenseBlock;
     144}
     145
    109146sub _generateHeaderFile
    110147{
     
    118155    my $filename = $className . ".h";
    119156
    120     push(@contents, _fileHeaderString($filename));
     157    push(@contents, $self->_licenseBlock());
    121158
    122159    my $parentClassName = _parentClassName($interface);
     
    185222    my $filename = $className . ".cpp";
    186223
    187     push(@contentsPrefix, _fileHeaderString($filename));
     224    push(@contentsPrefix, $self->_licenseBlock());
    188225
    189226    my $classRefGetter = $self->_classRefGetter($idlType);
Note: See TracChangeset for help on using the changeset viewer.