Record build number when constructing the index
authorJan Lahoda <jlahoda@netbeans.org>
Sat, 07 Jul 2012 23:05:44 +0200
changeset 815ccd7045f1d10
parent 814 69a1df845e0b
child 816 97147b705fbe
Record build number when constructing the index
remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/IndexingBuilder.java
remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java
remoting/server/scripts/index.sh
     1.1 --- a/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/IndexingBuilder.java	Sat Jul 07 23:05:26 2012 +0200
     1.2 +++ b/remoting/server/hudson/src/main/java/org/netbeans/modules/jackpot30/hudson/IndexingBuilder.java	Sat Jul 07 23:05:44 2012 +0200
     1.3 @@ -156,6 +156,7 @@
     1.4  
     1.5          Proc indexer = launcher.launch().pwd(base)
     1.6                                          .cmds(args)
     1.7 +                                        .envs("JPT30_INFO=BUILD_ID=" + build.getNumber())
     1.8                                          .stdout(listener)
     1.9                                          .start();
    1.10  
     2.1 --- a/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java	Sat Jul 07 23:05:26 2012 +0200
     2.2 +++ b/remoting/server/indexer/impl/src/org/netbeans/modules/jackpot30/backend/impl/OptionProcessorImpl.java	Sat Jul 07 23:05:44 2012 +0200
     2.3 @@ -95,7 +95,8 @@
     2.4      private final Option CATEGORY_PROJECTS = Option.additionalArguments(Option.NO_SHORT_NAME, "category-projects");
     2.5      private final Option CATEGORY_ROOT_DIR = Option.requiredArgument(Option.NO_SHORT_NAME, "category-root-dir");
     2.6      private final Option CACHE_TARGET = Option.requiredArgument(Option.NO_SHORT_NAME, "cache-target");
     2.7 -    private final Set<Option> OPTIONS = new HashSet<Option>(Arrays.asList(CATEGORY_ID, CATEGORY_NAME, CATEGORY_PROJECTS, CATEGORY_ROOT_DIR, CACHE_TARGET));
     2.8 +    private final Option INFO = Option.requiredArgument(Option.NO_SHORT_NAME, "info");
     2.9 +    private final Set<Option> OPTIONS = new HashSet<Option>(Arrays.asList(CATEGORY_ID, CATEGORY_NAME, CATEGORY_PROJECTS, CATEGORY_ROOT_DIR, CACHE_TARGET, INFO));
    2.10      
    2.11      @Override
    2.12      protected Set<Option> getOptions() {
    2.13 @@ -208,7 +209,15 @@
    2.14  
    2.15              out.putNextEntry(new ZipEntry(categoryId + "/info"));
    2.16  
    2.17 -            out.write(("{ \"displayName\": \"" + categoryName + "\" }").getBytes("UTF-8"));
    2.18 +            out.write("{\n".getBytes("UTF-8"));
    2.19 +            out.write(("\"displayName\": \"" + categoryName + "\"").getBytes("UTF-8"));
    2.20 +            if (optionValues.containsKey(INFO)) {
    2.21 +                for (String infoValue : optionValues.get(INFO)[0].split(";")) {
    2.22 +                    int eqSign = infoValue.indexOf('=');
    2.23 +                    out.write((",\n\"" + infoValue.substring(0, eqSign) + "\": \"" + infoValue.substring(eqSign + 1) + "\"").getBytes("UTF-8"));
    2.24 +                }
    2.25 +            }
    2.26 +            out.write("\n}\n".getBytes("UTF-8"));
    2.27  
    2.28              for (FileObject s : cacheFolder.getChildren()) {
    2.29                  if (!s.isFolder() || !s.getNameExt().startsWith("s") || s.getChildren().length == 0) continue;
     3.1 --- a/remoting/server/scripts/index.sh	Sat Jul 07 23:05:26 2012 +0200
     3.2 +++ b/remoting/server/scripts/index.sh	Sat Jul 07 23:05:44 2012 +0200
     3.3 @@ -7,6 +7,6 @@
     3.4  TARGET="$1"; shift
     3.5  ROOT_DIR="$1"; shift
     3.6  
     3.7 -$DIR/indexer/bin/indexer --userdir $USERDIR --nosplash --nogui -J-Xmx2048m -J-Dnetbeans.indexing.recursiveListeners=false --category-id "$ID" --category-name "$NAME" --cache-target "$TARGET" --category-root-dir "$ROOT_DIR" --category-projects "$@"
     3.8 +$DIR/indexer/bin/indexer --userdir $USERDIR --nosplash --nogui -J-Xmx2048m -J-Dnetbeans.indexing.recursiveListeners=false --info "$JPT30_INFO" --category-id "$ID" --category-name "$NAME" --cache-target "$TARGET" --category-root-dir "$ROOT_DIR" --category-projects "$@"
     3.9  
    3.10  exit