3 #############################################################################
4 # Xestia Address Book: Version Updater #
5 # (c) 2017 Xestia Address Book #
6 #############################################################################
7 # This file is part of Xestia Address Book. #
9 # Xestia Address Book is free software: you can redistribute it and/or #
10 # modify it under the terms of the GNU General Public License as published #
11 # by the Free Software Foundation, version 3 of the license. #
13 # Xestia Address Book is distributed in the hope that it will be useful, #
14 # but WITHOUT ANY WARRANTY; without even the implied warranty of #
15 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the #
16 # GNU General Public License for more details. #
18 # You should have received a copy of the GNU General Public License along #
19 # with Xestia Address Book. If not, see <http://www.gnu.org/licenses/> #
20 #############################################################################
26 # Get the version number.
29 print "Error: No version specified!\n";
33 my $version = $ARGV[0];
39 # Split the version information down.
41 my @version_split = split(/(\.)/, $version);
43 my $version_major = $version_split[0];
44 my $version_minor = $version_split[2];
46 # Update source/version.h
48 $filename = "../version.h";
50 tie(@file_data, 'Tie::File', $filename);
51 foreach my $file_data_line(@file_data) {
53 # Look for XSDCAL_VERSION
55 if ($file_data_line =~ /^\#define\ XSDCAL_VERSION/){
56 my $line_output = "#define XSDCAL_VERSION \"";
57 $line_output .= $version;
59 $file_data_line = $line_output;
62 # Look for XSDCAL_USERAGENT
64 if ($file_data_line =~ /^\#define\ XSDCAL_USERAGENT/){
65 my $line_output = "#define XSDCAL_USERAGENT \"XestiaCalendar/";
66 $line_output .= $version;
68 $file_data_line = $line_output;
73 # Update projects/msw/xestiacalendar.rc
75 #$filename = "../../projects/msw/xestiacalendar.rc";
76 #tie(@file_data, 'Tie::File', $filename);
77 #foreach my $file_data_line(@file_data) {
79 # # Look for FILEVERSION
81 # if ($file_data_line =~ /^ FILEVERSION/){
82 # my $line_output = " FILEVERSION ";
83 # $line_output .= $version_major;
84 # $line_output .= ",";
85 # $line_output .= $version_minor;
86 # $line_output .= ",0,0";
87 # $file_data_line = $line_output;
90 # # Look for PRODUCTVERSION
92 # if ($file_data_line =~ /^ PRODUCTVERSION/){
93 # my $line_output = " PRODUCTVERSION ";
94 # $line_output .= $version_major;
95 # $line_output .= ",";
96 # $line_output .= $version_minor;
97 # $line_output .= ",0,0";
98 # $file_data_line = $line_output;
103 # Update projects/osx/XestiaCalendar.xcodeproj/project.pbxproj
105 $filename = "../../projects/osx/XestiaCalendar.xcodeproj/project.pbxproj";
106 tie(@file_data, 'Tie::File', $filename);
107 foreach my $file_data_line(@file_data) {
109 # Look for PRODUCT_VERSION
111 if ($file_data_line =~ /^\t\t\t\tPRODUCT_VERSION/){
112 my $line_output = "\t\t\t\tPRODUCT_VERSION = ";
113 $line_output .= $version;
115 $file_data_line = $line_output;