Java Code Examples for org.gradle.api.DefaultTask#dependsOn()

The following examples show how to use org.gradle.api.DefaultTask#dependsOn() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void configureBuildNeeded(Project project) {
    DefaultTask buildTask = project.getTasks().create(BUILD_NEEDED_TASK_NAME, DefaultTask.class);
    buildTask.setDescription("Assembles and tests this project and all projects it depends on.");
    buildTask.setGroup(BasePlugin.BUILD_GROUP);
    buildTask.dependsOn(BUILD_TASK_NAME);
}
 
Example 2
private void configureBuildDependents(Project project) {
    DefaultTask buildTask = project.getTasks().create(BUILD_DEPENDENTS_TASK_NAME, DefaultTask.class);
    buildTask.setDescription("Assembles and tests this project and all projects that depend on it.");
    buildTask.setGroup(BasePlugin.BUILD_GROUP);
    buildTask.dependsOn(BUILD_TASK_NAME);
}
 
Example 3
Source Project: gradle-plugins   File: HelmPlugin.java    License: Apache License 2.0 4 votes vote down vote up
public void apply(Project project) {
	project.getPlugins().apply(CliExecPlugin.class);

	HelmExtension extension = project.getExtensions().create("helm", HelmExtension.class);
	extension.setProject(project);
	// extension.setKubeConfig(KubernetesUtils.getDefaultKubeConfig(project));

	HelmBootstrap helmBootstrap = project.getTasks().create("helmBootstrap", HelmBootstrap.class);

	DefaultTask helmPackages = project.getTasks().create("helmPackage", DefaultTask.class);
	HelmPublish helmPublish = project.getTasks().create("helmPublish", HelmPublish.class);
	Task helmUpdateRepository = project.getTasks().create("helmUpdateRepository", HelmUpdateRepository.class);
	DefaultTask helmPackagePrepare = project.getTasks().create("helmPackagePrepare", DefaultTask.class);
	helmPackagePrepare.dependsOn(helmBootstrap);

	helmUpdateRepository.dependsOn(helmBootstrap);
	helmPublish.dependsOn(helmUpdateRepository);
	helmPublish.dependsOn(helmPackages);

	CliExecExtension cliExec = project.getExtensions().getByType(CliExecExtension.class);
	cliExec.register("helm", extension.getCli());

	Set<String> packageNames = extension.getPackageNames();
	for (String packageName : packageNames) {
		HelmPackage helmPackage = project.getTasks().create("helmPackage" + toCamelCase(packageName), HelmPackage.class);
		helmPackage.setPackageName(packageName);
		helmPackage.dependsOn(helmPackagePrepare);
		helmPackages.dependsOn(helmPackage);
	}

	project.afterEvaluate(project1 -> {
		Cli cli = extension.getCli();

		if (cli.isDockerized()) {
			helmBootstrap.setEnabled(false);
		} else if (cli.getDownload()) {
			helmBootstrap.src(cli.getDownloadUrl());
			File downloadDir = cli.getDownloadDir();
			downloadDir.mkdirs();
			helmBootstrap.dest(downloadDir);
		} else {
			helmBootstrap.setEnabled(false);
		}
	});
}