示例#1
0
  /**
   * There are two things we need to check
   *
   * <ul>
   *   <li>files created or modified since last build time, we only need to check the source folder
   *   <li>file deleted since last build time, we have to compare source and destination folder
   * </ul>
   */
  @Override
  public boolean pollChanges(
      AbstractProject project, Launcher launcher, FilePath workspace, TaskListener listener)
      throws IOException, InterruptedException {

    long start = System.currentTimeMillis();

    PrintStream log = launcher.getListener().getLogger();
    log.println("FSSCM.pollChange: " + path);

    AllowDeleteList allowDeleteList = new AllowDeleteList(project.getRootDir());
    // we will only delete a file if it is listed in the allowDeleteList
    // ie. we will only delete a file if it is copied by us
    if (allowDeleteList.fileExists()) {
      allowDeleteList.load();
    } else {
      // watch list save file doesn't exist
      // we will assuem all existing files are under watch
      // ie. everything can be deleted
      Set<String> existingFiles = workspace.act(new RemoteListDir());
      allowDeleteList.setList(existingFiles);
    }

    RemoteFolderDiff.PollChange callable = new RemoteFolderDiff.PollChange();
    setupRemoteFolderDiff(callable, project, allowDeleteList.getList());

    boolean changed = workspace.act(callable);
    String str = callable.getLog();
    if (str.length() > 0) log.println(str);
    log.println("FSSCM.pollChange return " + changed);

    log.println(
        "FSSCM.poolChange completed in " + formatDurration(System.currentTimeMillis() - start));
    return changed;
  }
示例#2
0
  @SuppressWarnings("rawtypes")
  public Toolset(AbstractBuild build, Launcher launcher, ToolsetSettings properties)
      throws ToolsetException {
    try {
      // initialize globals
      this.settings = properties;
      this.envVars = build.getEnvironment(launcher.getListener());
      // initialize commands
      this.candle = new Candle(launcher, this.settings, this.envVars);
      this.light = new Light(launcher, this.settings, this.envVars);
      usedOnSlave = properties.get(Wix.USED_ON_SLAVE, false);

      this.candle.addWorkspace(build.getWorkspace());
      this.light.addWorkspace(build.getWorkspace());

      // check
      if (usedOnSlave) {
        lg.log("Wix Toolset plugin is running in slave mode.");
        lg.log("Do not test if toolset is installed.");
      } else {
        lg.log(
            this.candle.exists()
                ? messages.getString("COMPILER_FOUND")
                : messages.getString("COMPILER_NOT_FOUND"));
        lg.log(
            this.light.exists()
                ? messages.getString("LINKER_FOUND")
                : messages.getString("LINKER_NOT_FOUND"));
      }
    } catch (IOException e) {
      lg.severe(e);
    } catch (InterruptedException e) {
      lg.severe(e);
    }
  }
示例#3
0
  @Override
  public boolean checkout(
      AbstractBuild build,
      Launcher launcher,
      FilePath workspace,
      BuildListener listener,
      File changelogFile)
      throws IOException, InterruptedException {

    long start = System.currentTimeMillis();
    PrintStream log = launcher.getListener().getLogger();
    log.println("FSSCM.checkout " + path + " to " + workspace);
    Boolean b = Boolean.TRUE;

    AllowDeleteList allowDeleteList = new AllowDeleteList(build.getProject().getRootDir());

    if (clearWorkspace) {
      log.println("FSSCM.clearWorkspace...");
      workspace.deleteRecursive();
    }

    // we will only delete a file if it is listed in the allowDeleteList
    // ie. we will only delete a file if it is copied by us
    if (allowDeleteList.fileExists()) {
      allowDeleteList.load();
    } else {
      // watch list save file doesn't exist
      // we will assuem all existing files are under watch
      // ie. everything can be deleted
      Set<String> existingFiles = workspace.act(new RemoteListDir());
      allowDeleteList.setList(existingFiles);
    }

    RemoteFolderDiff.CheckOut callable = new RemoteFolderDiff.CheckOut();
    setupRemoteFolderDiff(callable, build.getProject(), allowDeleteList.getList());
    List<FolderDiff.Entry> list = workspace.act(callable);

    // maintain the watch list
    for (FolderDiff.Entry entry : list) {
      if (FolderDiff.Entry.Type.DELETED.equals(entry.getType())) {
        allowDeleteList.remove(entry.getFilename());
      } else {
        // added or modified
        allowDeleteList.add(entry.getFilename());
      }
    }
    allowDeleteList.save();

    // raw log
    String str = callable.getLog();
    if (str.length() > 0) log.println(str);

    ChangelogSet.XMLSerializer handler = new ChangelogSet.XMLSerializer();
    ChangelogSet changeLogSet = new ChangelogSet(build, list);
    handler.save(changeLogSet, changelogFile);

    log.println("FSSCM.check completed in " + formatDurration(System.currentTimeMillis() - start));
    return b;
  }
  /**
   * Determines whether a snapshot image has already been created for this emulator.
   *
   * @throws IOException If execution of the emulator command fails.
   * @throws InterruptedException If execution of the emulator command is interrupted.
   */
  public boolean hasExistingSnapshot(Launcher launcher, AndroidSdk androidSdk)
      throws IOException, InterruptedException {
    final PrintStream logger = launcher.getListener().getLogger();

    // List available snapshots for this emulator
    ByteArrayOutputStream listOutput = new ByteArrayOutputStream();
    String args = String.format("-snapshot-list -no-window -avd %s", getAvdName());
    Utils.runAndroidTool(launcher, listOutput, logger, androidSdk, Tool.EMULATOR, args, null);

    // Check whether a Jenkins snapshot was listed in the output
    return Pattern.compile(Constants.REGEX_SNAPSHOT).matcher(listOutput.toString()).find();
  }
示例#5
0
 @Override
 public TaskListener getListener() {
     return inner.getListener();
 }