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()); } }); } });
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()); } }); } });
public void execute(final Exec t) { t.setDescription("Removes last commit, using 'reset --soft HEAD~'"); t.commandLine("git", "reset", "--soft", "HEAD~"); } });
public void execute(final Exec t) { t.setDescription("Stashes current changes"); t.commandLine("git", "stash"); t.mustRunAfter(SOFT_RESET_COMMIT_TASK); } });
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)); } }); } });
@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"); } }
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); } });
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."); } } }); } });
}); 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 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 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);