commit:     b4b960aa7c929ff7884195dd077698b965605e99
Author:     Benda Xu <heroxbd <AT> gentoo <DOT> org>
AuthorDate: Thu Oct  6 03:01:27 2016 +0000
Commit:     Michał Górny <mgorny <AT> gentoo <DOT> org>
CommitDate: Thu Oct  6 03:03:54 2016 +0000
URL:        https://gitweb.gentoo.org/proj/java-ebuilder.git/commit/?id=b4b960aa

add an option --cache-file to specify cache file.

 src/main/java/org/gentoo/java/ebuilder/Config.java | 11 ++++++++++-
 src/main/java/org/gentoo/java/ebuilder/Main.java   |  7 ++++++-
 src/main/resources/usage.txt                       |  3 ++-
 3 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/main/java/org/gentoo/java/ebuilder/Config.java 
b/src/main/java/org/gentoo/java/ebuilder/Config.java
index 557117a..4127266 100644
--- a/src/main/java/org/gentoo/java/ebuilder/Config.java
+++ b/src/main/java/org/gentoo/java/ebuilder/Config.java
@@ -18,7 +18,7 @@ public class Config {
     /**
      * Path to portage ebuild cache.
      */
-    private final Path cacheFile = Paths.get(System.getProperty("user.home"),
+    private Path cacheFile = Paths.get(System.getProperty("user.home"),
             ".java-ebuilder/cache");
     /**
      * URI that goes to SRC_URI.
@@ -99,6 +99,15 @@ public class Config {
         return cacheFile;
     }
 
+    /**
+     * Setter for {@link #cacheFile}.
+     *
+     * @param cacheFile {@link #cacheFile}
+     */
+    public void setCacheFile(final Path cacheFile) {
+        this.cacheFile = cacheFile;
+    }
+
     /**
      * Getter for {@link #downloadUri}.
      *

diff --git a/src/main/java/org/gentoo/java/ebuilder/Main.java 
b/src/main/java/org/gentoo/java/ebuilder/Main.java
index 5bf1490..0a69442 100644
--- a/src/main/java/org/gentoo/java/ebuilder/Main.java
+++ b/src/main/java/org/gentoo/java/ebuilder/Main.java
@@ -220,12 +220,17 @@ public class Main {
                     i++;
                     config.addPomFile(Paths.get(args[i]));
                     break;
-                case "-portage-tree":
+                case "--portage-tree":
                 case "-t":
                     i++;
                     config.setPortageTree(Paths.get(args[i]).toAbsolutePath().
                             normalize());
                     break;
+                case "--cache-file":
+                    i++;
+                    config.setCacheFile(Paths.get(args[i]).toAbsolutePath().
+                            normalize());
+                    break;
                 case "--refresh-cache":
                 case "-c":
                     config.setRefreshCache(true);

diff --git a/src/main/resources/usage.txt b/src/main/resources/usage.txt
index a728607..40e1914 100644
--- a/src/main/resources/usage.txt
+++ b/src/main/resources/usage.txt
@@ -9,6 +9,7 @@ Usage: jar <args>
                             times)
 --portage-tree|-t           path to portage tree that should be parsed when
                             refreshing cache (default is /usr/portage)
+--cache-file               location of output cache file (default is 
~/.java-ebuilder/cache)
 --refresh-cache|-c          refreshes java ebuild cache
 --slot|-s  <slot>           SLOT number
---workdir|-w <dir>          path to workdir (default is current directory)
\ No newline at end of file
+--workdir|-w <dir>          path to workdir (default is current directory)

Reply via email to