Skip to content

Commit 65f5f5a

Browse files
committed
build: Add Perl script to help decode the version file.
The build configuration needs to parse the `version` file to generate some version-dependent parameters. Unfortunately passing literal regular expressions on the perl command line was difficult to escape properly on Windows. This moves the parsing into a helper script.
1 parent 44890bf commit 65f5f5a

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

config/version.gypi

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
11
{
22
'variables':
33
{
4-
'version_major': "<!(perl -n -e '/^BUILD_MAJOR_VERSION[[:blank:]]*=[[:blank:]]*(.*)$/ && print $1' <(DEPTH)/version)",
5-
'version_minor': "<!(perl -n -e '/^BUILD_MINOR_VERSION[[:blank:]]*=[[:blank:]]*(.*)$/ && print $1' <(DEPTH)/version)",
6-
'version_point': "<!(perl -n -e '/^BUILD_POINT_VERSION[[:blank:]]*=[[:blank:]]*(.*)$/ && print $1' <(DEPTH)/version)",
7-
'version_build': "<!(perl -n -e '/^BUILD_REVISION[[:blank:]]*=[[:blank:]]*(.*)$/ && print $1' <(DEPTH)/version)",
8-
9-
'version_string': "<!(perl -n -e '/^BUILD_SHORT_VERSION[[:blank:]]*=[[:blank:]]*(.*)$/ && print $1' <(DEPTH)/version)",
4+
'version_major': "<!(perl <(DEPTH)/util/decode_version.pl BUILD_MAJOR_VERSION <(DEPTH)/version)",
5+
'version_minor': "<!(perl <(DEPTH)/util/decode_version.pl BUILD_MINOR_VERSION <(DEPTH)/version)",
6+
'version_point': "<!(perl <(DEPTH)/util/decode_version.pl BUILD_POINT_VERSION <(DEPTH)/version)",
7+
'version_build': "<!(perl <(DEPTH)/util/decode_version.pl BUILD_REVISION <(DEPTH)/version)",
8+
'version_string': "<!(perl <(DEPTH)/util/decode_version.pl BUILD_SHORT_VERSION <(DEPTH)/version)",
109

1110
'git_revision': '<!(git rev-parse HEAD)',
1211
},

util/decode_version.pl

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/usr/bin/env perl
2+
3+
open(FILE, $ARGV[1]) || die "Can't open input file";
4+
5+
my $expr = "^${ARGV[0]}[[:blank:]]*=[[:blank:]]*(.*)\$";
6+
7+
while (<FILE>) {
8+
if (/$expr/) { print $1 }
9+
}

0 commit comments

Comments
 (0)