M
Matthew
I was wondering what methods people used to track build versions of
software once it's been distributed to the world. I'm basically
thinking about what happens when someone emails me with a bug, and I
want to know which specific version of my software they are using.
I tossed together a perl script that I was thinking of just putting
into my ant scripts, but before I put more time into this script, I
was wondering if there was a saner/more standard way to do this native
to ant or some other java based tool. If there isn't any better way
to do this, does anyone have any suggestions of other things to
include in the version string?
Here is the script I wrote, it creates a small java class that I was
thinking about having my code call to get the version string when the
user did a `java -jar foo.jar --version` or something of that manner.
#!/usr/bin/perl
my %svn_info;
open(my $fh_svn, "svn info|") or die "unable to open svn";
while (<$fh_svn>){
/(.+):\s+(.+)/;
$svn_info{$1} = $2;
}
close ($fh_svn);
my $date = localtime();
print <<EOS;
public class VersionInfo {
private String svnVer = "$svn_info{Revision}";
private String buildDate = "$date";
public String getSvnVer(){
return svnVer;
}
public String getBuildDate(){
return buildDate;
}
public String getVersionLine(){
return "SVN_Ver:" + svnVer + "|
Build_Date:" + buildDate;
}
}
EOS
#####################################################################################
it outputs java code similar to:
public class VersionInfo {
private String svnVer = "807";
private String buildDate = "Fri Oct 10 11:02:41 2008";
public String getSvnVer(){
return svnVer;
}
public String getBuildDate(){
return buildDate;
}
public String getVersionLine(){
return "SVN_Ver:" + svnVer + "|
Build_Date:" + buildDate;
}
}
software once it's been distributed to the world. I'm basically
thinking about what happens when someone emails me with a bug, and I
want to know which specific version of my software they are using.
I tossed together a perl script that I was thinking of just putting
into my ant scripts, but before I put more time into this script, I
was wondering if there was a saner/more standard way to do this native
to ant or some other java based tool. If there isn't any better way
to do this, does anyone have any suggestions of other things to
include in the version string?
Here is the script I wrote, it creates a small java class that I was
thinking about having my code call to get the version string when the
user did a `java -jar foo.jar --version` or something of that manner.
#!/usr/bin/perl
my %svn_info;
open(my $fh_svn, "svn info|") or die "unable to open svn";
while (<$fh_svn>){
/(.+):\s+(.+)/;
$svn_info{$1} = $2;
}
close ($fh_svn);
my $date = localtime();
print <<EOS;
public class VersionInfo {
private String svnVer = "$svn_info{Revision}";
private String buildDate = "$date";
public String getSvnVer(){
return svnVer;
}
public String getBuildDate(){
return buildDate;
}
public String getVersionLine(){
return "SVN_Ver:" + svnVer + "|
Build_Date:" + buildDate;
}
}
EOS
#####################################################################################
it outputs java code similar to:
public class VersionInfo {
private String svnVer = "807";
private String buildDate = "Fri Oct 10 11:02:41 2008";
public String getSvnVer(){
return svnVer;
}
public String getBuildDate(){
return buildDate;
}
public String getVersionLine(){
return "SVN_Ver:" + svnVer + "|
Build_Date:" + buildDate;
}
}