From 451f53999cb78cec2c57156945d2be630bf9bfd3 Mon Sep 17 00:00:00 2001
From: Brian Carrier <carrier@sleuthkit.org>
Date: Sun, 12 Jan 2020 11:22:30 -0500
Subject: [PATCH] Updated release script to update Doxygen version

---
 bindings/java/doxygen/Doxyfile |  2 ++
 release/release-unix.pl        | 38 ++++++++++++++++++++++++++++++++++
 2 files changed, 40 insertions(+)

diff --git a/bindings/java/doxygen/Doxyfile b/bindings/java/doxygen/Doxyfile
index 0d5fabc1a..b6843f043 100644
--- a/bindings/java/doxygen/Doxyfile
+++ b/bindings/java/doxygen/Doxyfile
@@ -38,6 +38,7 @@ PROJECT_NAME           = "Sleuth Kit Java Bindings (JNI)"
 # could be handy for archiving the generated documentation or if some version
 # control system is used.
 
+# NOTE: This is updated by the release-unix.pl script
 PROJECT_NUMBER         = 4.8.0 
 
 # Using the PROJECT_BRIEF tag one can provide an optional one line description
@@ -1048,6 +1049,7 @@ GENERATE_HTML          = YES
 # The default directory is: html.
 # This tag requires that the tag GENERATE_HTML is set to YES.
 
+# NOTE: This is updated by the release-unix.pl script
 HTML_OUTPUT            = jni-docs/4.8.0/
 
 # The HTML_FILE_EXTENSION tag can be used to specify the file extension for each
diff --git a/release/release-unix.pl b/release/release-unix.pl
index 088ba4ade..ccaa302b9 100755
--- a/release/release-unix.pl
+++ b/release/release-unix.pl
@@ -417,6 +417,43 @@ sub update_buildxml {
     rename ($OFILE, $IFILE) or die "Error renaming $OFILE";
 }
 
+sub update_doxygen {
+
+    print "Updating the version in Doxyfile file\n";
+    
+    my $IFILE = "bindings/java/doxygen/Doxyfile";
+    my $OFILE = "bindings/java/doxygen/Doxyfile2";
+
+    open (CONF_IN, "<${IFILE}") or 
+        die "Cannot open $IFILE";
+    open (CONF_OUT, ">${OFILE}") or 
+        die "Cannot open $OFILE";
+
+    my $found = 0;
+    while (<CONF_IN>) {
+        if (/^PROJECT_NUMBER\s*=/) {
+            print CONF_OUT "PROJECT_NUMBER = ${VER}\n";
+            $found++;
+        }
+        elsif (/^HTML_OUTPUT\s*=/) {
+            print CONF_OUT "HTML_OUTPUT = jni-docs/${VER}/\n";
+            $found++;
+        }
+        else {
+            print CONF_OUT $_;
+        }
+    }
+    close (CONF_IN);
+    close (CONF_OUT);
+
+    if ($found != 2) {
+        die "Error: Found $found (instead of 2) occurrences of Version: in Doxyfile";
+    }
+
+    unlink ($IFILE) or die "Error deleting $IFILE";
+    rename ($OFILE, $IFILE) or die "Error renaming $OFILE";
+}
+
 sub update_debian_changelog {
 
     print "Updating the version in Debian changelog file\n";
@@ -681,6 +718,7 @@ ()
 update_buildxml();
 update_debian_changelog();
 update_debian_install();
+update_doxygen();
 
 bootstrap();
 checkin_vers();
-- 
GitLab