Skip to content

Commit

Permalink
Set the revision long hash in the Info.plist so we can send it to our…
Browse files Browse the repository at this point in the history
… crash report system.
  • Loading branch information
stuconnolly committed Jan 20, 2014
1 parent 0d1e518 commit e3a4e45
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
2 changes: 2 additions & 0 deletions Resources/Plists/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -178,6 +178,8 @@
<string></string>
<key>SPVersionShortHash</key>
<string></string>
<key>SPVersionLongHash</key>
<string></string>
<key>FRFeedbackReporter.maxConsoleLogSize</key>
<integer>10000</integer>
<key>FRFeedbackReporter.targetURL</key>
Expand Down
23 changes: 18 additions & 5 deletions Scripts/build-version.pl
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,14 @@ sub _get_revision_number
return `git log --oneline | wc -l` + $svn2git_migration_compensation;
}

#
# Get the rveision long hash from Git.
#
sub _get_revision_long_hash
{
return `git log -n 1 --pretty=format:%H`;
}

#
# Get the revision short hash from Git.
#
Expand Down Expand Up @@ -89,21 +97,26 @@ sub _save_plist
}

my $version = _get_revision_number();
my $version_hash = _get_revision_short_hash();
my $version_long_hash = _get_revision_long_hash();
my $version_short_hash = _get_revision_short_hash();

$version_hash =~ s/\n//;
$version_long_hash =~ s/\n//;
$version_short_hash =~ s/\n//;

croak "$0: Unable to determine Git revision. Exiting..." unless $version;
croak "$0: Unable to determine Git revision hash. Exiting..." unless $version_hash;
croak "$0: Unable to determine Git revision hash. Exiting..." unless $version_long_hash;
croak "$0: Unable to determine Git revision short hash. Exiting..." unless $version_short_hash;

my $info = _get_plist_content($plist_path);

$info =~ s/([\t ]+<key>CFBundleVersion<\/key>\n[\t ]+<string>).*?(<\/string>)/$1$version$2/;
$info =~ s/([\t ]+<key>SPVersionShortHash<\/key>\n[\t ]+<string>).*?(<\/string>)/$1$version_hash$2/;
$info =~ s/([\t ]+<key>SPVersionLongHash<\/key>\n[\t ]+<string>).*?(<\/string>)/$1$version_long_hash$2/;
$info =~ s/([\t ]+<key>SPVersionShortHash<\/key>\n[\t ]+<string>).*?(<\/string>)/$1$version_short_hash$2/;

_save_plist($info, $plist_path);

printf("CFBunderVersion set to $version\n");
printf("VersionShortHash set to $version_hash");
printf("SPVersionLongHash set to $version_long_hash\n");
printf("SPVersionShortHash set to $version_short_hash\n");

exit 0

0 comments on commit e3a4e45

Please sign in to comment.