buildframework/helium/tools/common/java/src/com/nokia/ant/taskdefs/RebaselineTask.java
author wbernard
Wed, 23 Dec 2009 19:29:07 +0200
changeset 179 d8ac696cc51f
parent 1 be27ed110b50
permissions -rw-r--r--
helium_7.0-r14027
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
     1
/*
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     2
 * Copyright (c) 2007-2008 Nokia Corporation and/or its subsidiary(-ies).
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     3
 * All rights reserved.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     4
 * This component and the accompanying materials are made available
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     5
 * under the terms of the License "Eclipse Public License v1.0"
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     6
 * which accompanies this distribution, and is available
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     7
 * at the URL "http://www.eclipse.org/legal/epl-v10.html".
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     8
 *
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
     9
 * Initial Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    10
 * Nokia Corporation - initial contribution.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    11
 *
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    12
 * Contributors:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    13
 *
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    14
 * Description: 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    15
 *
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    16
 */
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    17
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    18
package com.nokia.ant.taskdefs;
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    19
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    20
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    21
/**
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    22
 * ANT wrapper task for the GSCM rebaseline.pl script.
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    23
 * 
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    24
 * @ant.task category="SCM"
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    25
 */
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    26
public class RebaselineTask extends RBTTask {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    27
  // The attributes of this task
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    28
  private Boolean disableTaskRebadging;
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    29
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    30
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    31
   * Return disableTaskRebadging
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    32
   * 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    33
   * @return the disableTaskRebadging.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    34
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    35
  public Boolean getDisableTaskRebadging() {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    36
    return disableTaskRebadging;
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    37
  }
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    38
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    39
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    40
   * Set whether to disable task rebadging (incompatible with
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    41
   * 'rebadgeObjectVersions' attribute) in the rebaseline.pl script.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    42
   * 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    43
   * @param disableTaskRebadging
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    44
   * @ant.not-required Default is no.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    45
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    46
  public void setdisableTaskRebadging(Boolean disableTaskRebadging) {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    47
    this.disableTaskRebadging = disableTaskRebadging;
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    48
    log("Set disableTaskRebadging to " + disableTaskRebadging);
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    49
  }
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    50
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    51
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    52
   * Set the execution script.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    53
   * 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    54
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    55
  protected void setExecutionScript() {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    56
    append2CommandString("rebaseline.pl");
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    57
  }
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    58
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    59
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    60
   * Build a command list consisting of all the required and optional command
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    61
   * arguments of the current task.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    62
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    63
  protected void buildCommandList() {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    64
    addCommandArg("database", "-d", true, getDatabase());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    65
    addCommandArg("password", "-P", true, getPassword());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    66
    addCommandArg("ccmProject", "-p", true, getCcmProject());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    67
    addCommandArg("release", "-r", getRelease());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    68
    addCommandArg("baseline", "-B", getBaseline());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    69
    addCommandArg("version", "-v", getVersion());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    70
    addCommandArg("newBaselineName", "-n", getNewBaselineName());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    71
    addCommandArg("releaseBaseline", "-R", getReleaseBaseline());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    72
    addCommandArg("leaveFolderswritable", "-w", getLeaveFoldersWritable());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    73
    addCommandArg("disableTaskRebadging", "-x", getDisableTaskRebadging());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    74
    addCommandArg("rebadgeObjectVersions", "-a", getRebadgeObjectVersions());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    75
    addCommandArg("useBranchReleaseMethodology", "-b", getUseBranchReleaseMethodology());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    76
    addCommandArg("createBaselineForRollingReleaseTag", "-i", getCreateBaselineForRollingReleaseTag());
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    77
  }
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
    78
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    79
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    80
   * Method returns the correct verbosity level for the input choice.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    81
   * 
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    82
   * @param choice
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    83
   *            is the verbosity choice set by user.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    84
   * @return the verbosity level to set.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    85
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    86
  protected String getVerbosity(int choice) {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    87
    String cmd = "";
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    88
    switch (choice) {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    89
    case 0:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    90
      cmd = "-q ";
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    91
      break;
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    92
    case 1:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    93
      cmd = "-V ";
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    94
      break;
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    95
    default:
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    96
      raiseError("Verbosity level is not recognised. "
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    97
          + "Legal values are: 0 - quiet, 1 - verbose.");
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    98
    }
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
    99
    return cmd;
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   100
  }
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   101
179
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   102
  /**
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   103
   * Method validates the given arguments.
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   104
   */
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   105
  protected void validateArguments() {
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   106
    // Do nothing
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   107
  }
d8ac696cc51f helium_7.0-r14027
wbernard
parents: 1
diff changeset
   108
  
1
be27ed110b50 Bringing in Helium, imaker and cmaker
Alex Gilkes <alex.gilkes@nokia.com>
parents:
diff changeset
   109
}