use of org.gradle.api.Project in project build-info by JFrogDev.
the class ArtifactoryTask method projectEvaluated.
public void projectEvaluated() {
Project project = getProject();
if (isSkip()) {
log.debug("artifactoryPublish task '{}' skipped for project '{}'.", this.getPath(), project.getName());
} else {
ArtifactoryPluginConvention convention = ArtifactoryPluginUtil.getPublisherConvention(project);
if (convention != null) {
ArtifactoryClientConfiguration acc = convention.getClientConfig();
artifactSpecs.clear();
artifactSpecs.addAll(acc.publisher.getArtifactSpecs());
// Configure the task using the "defaults" closure (delegate to the task)
PublisherConfig config = convention.getPublisherConfig();
if (config != null) {
Closure defaultsClosure = config.getDefaultsClosure();
ConfigureUtil.configure(defaultsClosure, this);
}
}
Task deployTask = project.getRootProject().getTasks().findByName(DEPLOY_TASK_NAME);
if (deployTask == null) {
throw new IllegalStateException(String.format("Could not find %s in the root project", DEPLOY_TASK_NAME));
}
finalizedBy(deployTask);
// Depend on buildInfo task in sub-projects
for (Project sub : project.getSubprojects()) {
Task subArtifactoryTask = sub.getTasks().findByName(ARTIFACTORY_PUBLISH_TASK_NAME);
if (subArtifactoryTask != null) {
dependsOn(subArtifactoryTask);
}
}
checkDependsOnArtifactsToPublish();
}
}
use of org.gradle.api.Project in project build-info by JFrogDev.
the class ArtifactoryTask method properties.
public void properties(Closure closure) {
Project project = getProject();
PropertiesConfig propertiesConfig = new PropertiesConfig(project);
ConfigureUtil.configure(closure, propertiesConfig);
artifactSpecs.clear();
artifactSpecs.addAll(propertiesConfig.getArtifactSpecs());
}
use of org.gradle.api.Project in project shipkit by mockito.
the class CloneGitRepositoryTaskFactory method createCloneTask.
/**
* Creates an instance of CloneGitRepositoryTask for given {@param #consumerRepository} in the root project
* or returns already existing one.
*/
public static CloneGitRepositoryTask createCloneTask(final Project project, final String gitHubUrl, final String consumerRepository) {
String taskName = "clone" + repositoryNameToCapitalizedCamelCase(consumerRepository);
Project taskProject = project.getRootProject();
CloneGitRepositoryTask alreadyExistingTask = (CloneGitRepositoryTask) taskProject.getTasks().findByName(taskName);
if (alreadyExistingTask != null) {
return alreadyExistingTask;
}
return TaskMaker.task(taskProject, taskName, CloneGitRepositoryTask.class, new Action<CloneGitRepositoryTask>() {
@Override
public void execute(final CloneGitRepositoryTask task) {
task.setDescription("Clones consumer repo " + consumerRepository + " into a temporary directory.");
task.setRepositoryUrl(gitHubUrl + "/" + consumerRepository);
task.setTargetDir(getConsumerRepoCloneDir(project, consumerRepository));
}
});
}
use of org.gradle.api.Project in project component-runtime by Talend.
the class TaCoKitPlugin method apply.
@Override
public void apply(final Project project) {
// setup the global config
project.getExtensions().add("talendComponentKit", TaCoKitExtension.class);
// ensure we can find our dependencies
project.afterEvaluate(actionProject -> actionProject.getRepositories().mavenCentral());
// create the configuration for our task execution
final Configuration configuration = project.getConfigurations().maybeCreate("talendComponentKit");
configuration.getIncoming().beforeResolve(resolvableDependencies -> {
TaCoKitExtension extension = TaCoKitExtension.class.cast(project.getExtensions().findByName("talendComponentKit"));
if (extension == null) {
extension = new TaCoKitExtension();
}
final DependencyHandler dependencyHandler = project.getDependencies();
final DependencySet dependencies = configuration.getDependencies();
dependencies.add(dependencyHandler.create("org.talend.sdk.component:component-api:" + extension.getApiVersion()));
dependencies.add(dependencyHandler.create("org.talend.sdk.component:component-tools:" + extension.getSdkVersion()));
dependencies.add(dependencyHandler.create("org.talend.sdk.component:component-runtime-design-extension:" + extension.getSdkVersion()));
});
// create the web configuration for our web task
final Configuration webConfiguration = project.getConfigurations().maybeCreate("talendComponentKitWeb");
webConfiguration.getIncoming().beforeResolve(resolvableDependencies -> {
TaCoKitExtension extension = TaCoKitExtension.class.cast(project.getExtensions().findByName("talendComponentKitWeb"));
if (extension == null) {
extension = new TaCoKitExtension();
}
final DependencyHandler dependencyHandler = project.getDependencies();
final DependencySet dependencies = configuration.getDependencies();
dependencies.add(dependencyHandler.create("org.talend.sdk.component:component-tools-webapp:" + extension.getSdkVersion()));
});
// tasks
final String group = "Talend Component Kit";
// TALEND-INF/dependencies.txt
project.task(new HashMap<String, Object>() {
{
put("type", DependenciesTask.class);
put("group", group);
put("description", "Creates the Talend Component Kit dependencies file used by the runtime to build the component classloader");
}
}, "talendComponentKitDependencies");
project.afterEvaluate(p -> p.getTasksByName("compileJava", false).stream().findFirst().ifPresent(compileJava -> compileJava.setFinalizedBy(singleton("talendComponentKitDependencies"))));
// validation
project.task(new HashMap<String, Object>() {
{
put("type", ValidateTask.class);
put("group", group);
put("description", "Validates that the module components are respecting the component standards.");
}
}, "talendComponentKitValidation");
project.afterEvaluate(p -> p.getTasksByName("classes", false).stream().findFirst().ifPresent(compileJava -> compileJava.setFinalizedBy(singleton("talendComponentKitValidation"))));
// documentation
project.task(new HashMap<String, Object>() {
{
put("type", DocumentationTask.class);
put("group", group);
put("description", "Generates an asciidoc file with the documentation of the components.");
}
}, "talendComponentKitDocumentation");
project.afterEvaluate(p -> p.getTasksByName("classes", false).stream().findFirst().ifPresent(compileJava -> compileJava.setFinalizedBy(singleton("talendComponentKitDocumentation"))));
// web
project.task(new HashMap<String, Object>() {
{
put("type", WebTask.class);
put("group", group);
put("description", "Starts a web server allowing you to browse your components (requires the component to be installed before).");
}
}, "talendComponentKitWebServer");
// car
project.task(new HashMap<String, Object>() {
{
put("type", CarTask.class);
put("group", group);
put("description", "Creates a Component ARchive (.car) based on current project.");
}
}, "talendComponentKitComponentArchive");
}
use of org.gradle.api.Project in project spring-security by spring-projects.
the class CopyPropertiesPlugin method copyPropertyFromRootProjectTo.
private void copyPropertyFromRootProjectTo(String propertyName, Project project) {
Project rootProject = project.getRootProject();
Object property = rootProject.findProperty(propertyName);
if (property != null) {
project.setProperty(propertyName, property);
}
}
Aggregations