Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit 33d74c5

Browse files
committed
Make the includes field an array in MSVC build scripts
Previously the 'includes' field was a string. It's slightly nicer to manage this when it's defined as an array instead. This allows us to more easily detect and eliminate duplicates. Reviewed-by: Álvaro Herrera, Andrew Dunstan, Dagfinn Ilmari Mannsåker Discussion: https://postgr.es/m/CAApHDvpo6g5csCTjc_0C7DMvgFPomVb0Rh-AcW5afd=Ya=LRuw@mail.gmail.com
1 parent a00c138 commit 33d74c5

File tree

3 files changed

+11
-12
lines changed

3 files changed

+11
-12
lines changed

src/tools/msvc/MSBuildProject.pm

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -313,11 +313,8 @@ sub WriteItemDefinitionGroup
313313
my $targetmachine =
314314
$self->{platform} eq 'Win32' ? 'MachineX86' : 'MachineX64';
315315

316-
my $includes = $self->{includes};
317-
unless ($includes eq '' or $includes =~ /;$/)
318-
{
319-
$includes .= ';';
320-
}
316+
my $includes = join ';', @{$self->{includes}}, "";
317+
321318
print $f <<EOF;
322319
<ItemDefinitionGroup Condition="'\$(Configuration)|\$(Platform)'=='$cfgname|$self->{platform}'">
323320
<ClCompile>

src/tools/msvc/Mkvcbuild.pm

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -937,7 +937,7 @@ sub AddTransformModule
937937
# Add PL dependencies
938938
$p->AddIncludeDir($pl_src);
939939
$p->AddReference($pl_proj);
940-
$p->AddIncludeDir($pl_proj->{includes});
940+
$p->AddIncludeDir($_) for @{$pl_proj->{includes}};
941941
foreach my $pl_lib (@{ $pl_proj->{libraries} })
942942
{
943943
$p->AddLibrary($pl_lib);
@@ -947,7 +947,7 @@ sub AddTransformModule
947947
if ($type_proj)
948948
{
949949
$p->AddIncludeDir($type_src);
950-
$p->AddIncludeDir($type_proj->{includes});
950+
$p->AddIncludeDir($_) for @{$type_proj->{includes}};
951951
foreach my $type_lib (@{ $type_proj->{libraries} })
952952
{
953953
$p->AddLibrary($type_lib);

src/tools/msvc/Project.pm

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ sub _new
3030
references => [],
3131
libraries => [],
3232
suffixlib => [],
33-
includes => '',
33+
includes => [],
3434
prefixincludes => '',
3535
defines => ';',
3636
solution => $solution,
@@ -151,13 +151,15 @@ sub AddLibrary
151151

152152
sub AddIncludeDir
153153
{
154-
my ($self, $inc) = @_;
154+
my ($self, $incstr) = @_;
155155

156-
if ($self->{includes} ne '')
156+
foreach my $inc (split(/;/, $incstr))
157157
{
158-
$self->{includes} .= ';';
158+
if (! grep { $_ eq $inc} @{ $self->{includes} })
159+
{
160+
push @{ $self->{includes} }, $inc;
161+
}
159162
}
160-
$self->{includes} .= $inc;
161163
return;
162164
}
163165

0 commit comments

Comments
 (0)