Tabnine Logo
Exec
Code IndexAdd Tabnine to your IDE (free)

How to use
Exec
in
org.gradle.api.tasks

Best Java code snippets using org.gradle.api.tasks.Exec (Showing top 18 results out of 315)

origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    //Travis default clone is shallow which will prevent correct release notes generation for repos with lots of commits
    t.commandLine("git", "fetch", "--unshallow");
    t.setDescription("Ensures good chunk of recent commits is available for release notes automation. Runs: " + t.getCommandLine());
    t.setIgnoreExitValue(true);
    t.doLast(new Action<Task>() {
      public void execute(Task task) {
        if (t.getExecResult().getExitValue() != 0) {
          LOG.lifecycle("  Following git command failed and will be ignored:" +
              "\n    " + StringUtil.join(t.getCommandLine(), " ") +
              "\n  Most likely the repository already contains all history.");
        }
      }
    });
  }
});
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.setDescription("Overwrites local git 'user.email' with a generic email. Intended for CI.");
    t.doFirst(new Action<Task>() {
      public void execute(Task task) {
        //using doFirst() so that we request and validate presence of env var only during execution time
        //TODO consider adding 'lazyExec' task or method that automatically uses do first
        t.commandLine("git", "config", "--local", "user.email", conf.getGit().getEmail());
      }
    });
  }
});
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.setDescription("Stashes current changes");
    t.commandLine("git", "stash");
    t.mustRunAfter(SOFT_RESET_COMMIT_TASK);
  }
});
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.setDescription("Removes last commit, using 'reset --soft HEAD~'");
    t.commandLine("git", "reset", "--soft", "HEAD~");
  }
});
origin: com.palantir.gradle.conjure/gradle-conjure

      task.commandLine("npm", "install", "--no-package-lock");
      task.workingDir(srcDirectory);
      task.dependsOn(compileConjureTypeScript);
      task.getInputs().file(new File(srcDirectory, "package.json"));
      task.getOutputs().dir(new File(srcDirectory, "node_modules"));
    });
Task compileTypeScript = project.getTasks().create("compileTypeScript", Exec.class, task -> {
  task.setDescription(
      "Runs `npm tsc` to compile generated TypeScript files into JavaScript files.");
  task.setGroup(TASK_GROUP);
  task.commandLine("npm", "run-script", "build");
  task.workingDir(srcDirectory);
  task.dependsOn(installTypeScriptDependencies);
});
Task publishTypeScript = project.getTasks().create("publishTypeScript", Exec.class, task -> {
  task.setDescription("Runs `npm publish` to publish a TypeScript package "
      + "generated from your Conjure definitions.");
  task.setGroup(TASK_GROUP);
  task.commandLine("npm", "publish");
  task.workingDir(srcDirectory);
  task.dependsOn(compileConjureTypeScript);
  task.dependsOn(compileTypeScript);
});
subproj.afterEvaluate(p -> subproj.getTasks().maybeCreate("publish").dependsOn(publishTypeScript));
origin: com.palantir.gradle.conjure/gradle-conjure

    });
project.getTasks().create("buildWheel", Exec.class, task -> {
  task.setDescription("Runs `python setup.py sdist bdist_wheel --universal` to build a python wheel "
      + "generated from your Conjure definitions.");
  task.setGroup(TASK_GROUP);
  task.commandLine("python", "setup.py", "build", "--build-base", buildDir, "egg_info", "--egg-base",
      buildDir, "sdist", "--dist-dir", distDir, "bdist_wheel", "--universal", "--dist-dir",
      distDir);
  task.workingDir(subproj.file("python"));
  task.dependsOn(compileConjurePython);
  Task cleanTask = project.getTasks().findByName(TASK_CLEAN);
  cleanTask.dependsOn(project.getTasks().findByName("cleanCompileConjurePython"));
origin: io.github.rwinch.antora/antora-gradle-plugin

  @Override
  public void apply(Project project) {
    project.getPlugins().apply(NodePlugin.class);

    NodeExtension node = project.getExtensions().getByType(NodeExtension.class);
    node.setDownload(true);
    node.setVersion("8.11.4");
    node.setNodeModulesDir(project.file(new File(project.getBuildDir(), "/modules")));

    NpmTask downloadAntoraCli = project.getTasks()
        .create("downloadAntoraCli", NpmTask.class);
    downloadAntoraCli.setArgs(Arrays.asList("install", "@antora/cli"));

    NpmTask downloadAntoraSiteGenerator = project.getTasks()
        .create("downloadAntoraSiteGenerator", NpmTask.class);
    downloadAntoraSiteGenerator.setArgs(Arrays.asList("install", "@antora/site-generator-default"));

    Task downloadAntora = project.getTasks().create("downloadAntora");
    downloadAntora.dependsOn(downloadAntoraCli, downloadAntoraSiteGenerator);

    Exec antora = project.getTasks().create("antora", Exec.class);
    antora.setGroup("Docs");
    antora.setDescription("Installs and runs antora site.yml");
    antora.dependsOn(downloadAntora);
    antora.setCommandLine("build/modules/node_modules/@antora/cli/bin/antora", "site.yml");
  }
}
origin: gradle.plugin.com.shopify.rocky/rocky-plugin

private Exec createExecuteModelsGeneratorTask(Project project, Task dependencyTask) {
  return project.getTasks().create("executeModelGeneratorScript", Exec.class, exec -> {
    exec.dependsOn(dependencyTask);
    exec.workingDir(createFileFromPath(generatorScriptDir.get()));
    exec.commandLine(createFileFromPath(generatorScriptFile.get())).setArgs(getScriptArguments());
    exec.execute();
  });
}
origin: dsyer/spring-boot-thin-launcher

exec.dependsOn(prepareTask);
exec.doFirst(new Action<Task>() {
  @SuppressWarnings("unchecked")
  @Override
origin: gradle.plugin.io.apioo.versioning/versioning-plugin

  @Override
  protected void exec() {
    setCommandLine("git", "push", "origin", version.get());
    super.exec();
  }
}
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.mustRunAfter(GIT_COMMIT_TASK);
    final String tag = GitUtil.getTag(conf, project);
    t.setDescription("Creates new version tag '" + tag + "'");
    deferredConfiguration(project, new Runnable() {
      @Override
      public void run() {
        t.commandLine("git", "tag", "-a", tag, "-m",
            GitUtil.getCommitMessage(conf, "Created new tag " + tag));
      }
    });
  }
});
origin: gradle.plugin.org.shipkit/shipkit

/**
 * Creates exec task with preconfigured defaults
 */
public static Exec execTask(Project project, String name, Action<Exec> configure) {
  final Exec exec = project.getTasks().create(name, Exec.class);
  exec.doFirst(new Action<Task>() {
    public void execute(Task task) {
      LOG.lifecycle("  Running:\n    {}", join(exec.getCommandLine(), " "));
    }
  });
  return configure(configure, exec);
}
origin: cesarferreira/android-rocket-launcher

@Override
public void apply(Project project) {
  if (!project.getPlugins().hasPlugin(AppPlugin.class)) {
    throw new RuntimeException("should be declared after 'com.android.application'");
  }
  AppExtension ext = project.getExtensions().getByType(AppExtension.class);
  ext.getApplicationVariants().all(v -> {
    String taskName = "open"+capitalize(v.getName());
    DefaultTask parentTask = v.getInstall();
    File adb = ext.getAdbExe();
    if (v.isSigningReady()) {
      String packageId = v.getApplicationId();
      HashMap variantAction = new HashMap();
      variantAction.put("dependsOn", parentTask);
      variantAction.put("description", "Installs and opens " + v.getDescription());
      variantAction.put("type", Exec.class);
      variantAction.put("group", "Open");
      Exec t = (Exec) project.task(variantAction, taskName);
      t.setCommandLine(adb, "shell", "monkey", "-p", packageId, "-c", "android.intent.category.LAUNCHER", "1");
    }
  });
}
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.setDescription("Deletes version tag '" + getTag(conf, project) + "'");
    t.commandLine("git", "tag", "-d", getTag(conf, project));
    t.mustRunAfter(performPush);
  }
});
origin: gradle.plugin.ds2.gradle.plugins.golang/gradle-go-plugin

  super.exec();
} finally {
  LOG.info("Done with exec");
origin: gradle.plugin.org.shipkit/shipkit

  public void execute(final Exec t) {
    t.setDescription("Overwrites local git 'user.name' with a generic name. Intended for CI.");
    //TODO replace all doFirst in this class with LazyConfiguration
    t.doFirst(new Action<Task>() {
      public void execute(Task task) {
        //using doFirst() so that we request and validate presence of env var only during execution time
        t.commandLine("git", "config", "--local", "user.name", conf.getGit().getUser());
      }
    });
  }
});
origin: gradle.plugin.net.tribe7.gradle/gradle-swig

super.exec();
origin: gradle.plugin.io.apioo.versioning/versioning-plugin

@Override
protected void exec() {
  if (keyId.isPresent() && keyId.get().length() > 0) {
    setCommandLine("git", "tag", "--local-user=" + keyId.get(), "-m " + COMMIT_MESSAGE, version.get());
  } else {
    getLogger().info("No gpg key has been specified, not signing tag.");
    setCommandLine("git", "tag", "-m " + COMMIT_MESSAGE, version.get());
  }
  super.exec();
}
org.gradle.api.tasksExec

Javadoc

Executes a command line process. Example:
 
task stopTomcat(type:Exec) { 
workingDir '../tomcat/bin' 
//on windows: 
commandLine 'cmd', '/c', 'stop.bat' 
//on linux 
commandLine './stop.sh' 
//store the output instead of printing to the console: 
standardOutput = new ByteArrayOutputStream() 
//extension method stopTomcat.output() can be used to obtain the output: 
ext.output = { 
return standardOutput.toString() 
} 
} 

Most used methods

  • dependsOn
  • commandLine
  • exec
  • setDescription
  • doFirst
  • setCommandLine
  • setGroup
  • workingDir
  • configure
  • doLast
  • execute
  • getCommandLine
  • execute,
  • getCommandLine,
  • getInputs,
  • getOutputs,
  • mustRunAfter,
  • setIgnoreExitValue

Popular in Java

  • Reactive rest calls using spring rest template
  • getResourceAsStream (ClassLoader)
  • setContentView (Activity)
  • getOriginalFilename (MultipartFile)
    Return the original filename in the client's filesystem.This may contain path information depending
  • BufferedImage (java.awt.image)
    The BufferedImage subclass describes an java.awt.Image with an accessible buffer of image data. All
  • BufferedWriter (java.io)
    Wraps an existing Writer and buffers the output. Expensive interaction with the underlying reader is
  • InputStream (java.io)
    A readable source of bytes.Most clients will use input streams that read data from the file system (
  • NumberFormat (java.text)
    The abstract base class for all number formats. This class provides the interface for formatting and
  • IOUtils (org.apache.commons.io)
    General IO stream manipulation utilities. This class provides static utility methods for input/outpu
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • From CI to AI: The AI layer in your organization
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now