Package com.google.devtools.moe.client.Ui

Examples of com.google.devtools.moe.client.Ui.Task


    Codebase refTo = forwardTranslationStack.peek();
    Codebase inverseTranslated = toTranslate;

    for (InverseTranslatorStep inverseStep : inverseSteps) {
      Task task = AppContext.RUN.ui.pushTask("inverseEdit", String.format(
          "Inverse-translating step %s by merging codebase %s onto %s",
          inverseStep.getName(), refTo, refFrom));

      inverseTranslated = inverseStep.getInverseEditor().inverseEdit(
          inverseTranslated, refFrom, refTo, context, options);
View Full Code Here


      Map<String, String> options, ProjectContext context) throws CodebaseCreationError {
    Deque<Codebase> forwardTransStack = new ArrayDeque<Codebase>(forwardSteps.size() + 1);

    Codebase refTo;
    try {
      Task task = AppContext.RUN.ui.pushTask(
          "refTo", "Pushing to forward-translation stack: " + options.get("referenceToCodebase"));
      refTo = Parser.parseExpression(options.get("referenceToCodebase")).createCodebase(context);
      forwardTransStack.push(refTo);
      AppContext.RUN.ui.popTaskAndPersist(task, refTo.getPath());
    } catch (ParseError e) {
      throw new CodebaseCreationError("Couldn't parse in translation: " + e);
    }

    // This Expression is used only for informative output.
    Expression forwardEditExp = refTo.getExpression();
    for (TranslatorStep forwardStep : forwardSteps) {
      forwardEditExp = forwardEditExp.editWith(forwardStep.name, ImmutableMap.<String, String>of());
      Task task = AppContext.RUN.ui.pushTask(
          "edit", "Pushing to forward-translation stack: " + forwardEditExp);
      refTo = forwardStep.editor.edit(refTo, context, options).copyWithExpression(forwardEditExp);
      forwardTransStack.push(refTo);
      AppContext.RUN.ui.popTaskAndPersist(task, refTo.getPath());
    }
View Full Code Here

    } catch (InvalidProject e) {
      AppContext.RUN.ui.error(e, "Error creating project");
      return 1;
    }

    Task createCodebaseTask =
        AppContext.RUN.ui.pushTask("create_codebase", "Creating codebase " + options.codebase);
    Codebase c;
    try {
      c = Parser.parseExpression(options.codebase).createCodebase(context);
    } catch (ParseError e) {
View Full Code Here

    AppContext.RUN.fileSystem = fs;

    File taskless = fs.getTemporaryDirectory("taskless", Lifetimes.moeExecution());
    Files.touch(taskless);

    Task outer = AppContext.RUN.ui.pushTask("outer", "outer");
    File outer1 = touchTempDir("outer1", fs);
    File outer2 = touchTempDir("outer2", fs);

    Task inner = AppContext.RUN.ui.pushTask("inner", "inner");
    File inner1 = touchTempDir("inner1", fs);
    File inner2 = touchTempDir("inner2", fs);
    File innerPersist = fs.getTemporaryDirectory("innerPersist", Lifetimes.moeExecution());
    Files.touch(innerPersist);

    AppContext.RUN.ui.popTask(inner, "popping inner, persisting nothing");
    assertFalse("inner1", inner1.exists());
    assertFalse("inner2", inner2.exists());
    assertTrue("innerPersist", innerPersist.exists());
    assertTrue("taskless", taskless.exists());
    assertTrue("outer1", outer1.exists());
    assertTrue("outer2", outer2.exists());

    AppContext.RUN.ui.popTask(outer, "popping outer, persisting nothing");
    assertFalse("outer1", outer1.exists());
    assertFalse("outer2", outer2.exists());
    assertTrue("innerPersist", innerPersist.exists());
    assertTrue("taskless", taskless.exists());

    Task moeTermination =
        AppContext.RUN.ui.pushTask(Ui.MOE_TERMINATION_TASK_NAME, "Final clean-up");
    fs.cleanUpTempDirs();
    AppContext.RUN.ui.popTask(moeTermination, "Finished clean-up");
    assertFalse("innerPersist", innerPersist.exists());
    assertFalse("taskless", taskless.exists());
View Full Code Here

  public void testMarkAsPersistentWithTasks() throws Exception {
    AppContextForTesting.initForTest();
    FileSystem fs = new SystemFileSystem();
    AppContext.RUN.fileSystem = fs;

    Task outer = AppContext.RUN.ui.pushTask("outer", "outer");
    File outer1 = touchTempDir("outer1", fs);
    File outer2 = touchTempDir("outer2", fs);

    Task inner = AppContext.RUN.ui.pushTask("inner", "inner");
    File inner1 = touchTempDir("inner1", fs);
    File inner2 = touchTempDir("inner2", fs);

    AppContext.RUN.ui.popTaskAndPersist(inner, inner1);
    assertTrue("inner1", inner1.exists());
    assertFalse("inner2", inner2.exists());
    assertTrue("outer1", outer1.exists());
    assertTrue("outer2", outer2.exists());

    AppContext.RUN.ui.popTaskAndPersist(outer, outer1);
    assertFalse("inner1", inner1.exists());
    assertTrue("outer1", outer1.exists());
    assertFalse("outer2", outer2.exists());

    Task moeTermination =
        AppContext.RUN.ui.pushTask(Ui.MOE_TERMINATION_TASK_NAME, "Final clean-up");
    fs.cleanUpTempDirs();
    AppContext.RUN.ui.popTask(moeTermination, "Finished clean-up");
    // outer1 was persisted from a top-level task, so it shouldn't be cleaned up at all.
    assertTrue("outer1", outer1.exists());
View Full Code Here

    } catch (InvalidProject e) {
      AppContext.RUN.ui.error(e, "Error creating project");
      return 1;
    }

    Task changeTask = AppContext.RUN.ui.pushTask(
        "create_change",
        String.format("Creating a change in \"%s\" with contents \"%s\"",
                      options.destination, options.codebase));

    Codebase c;
View Full Code Here

TOP

Related Classes of com.google.devtools.moe.client.Ui.Task

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.