use of org.gradle.api.Project in project gradle by gradle.
the class GradleBuildBuilder method convert.
private DefaultGradleBuild convert(Gradle gradle) {
DefaultGradleBuild model = new DefaultGradleBuild();
Map<Project, BasicGradleProject> convertedProjects = new LinkedHashMap<Project, BasicGradleProject>();
Project rootProject = gradle.getRootProject();
BasicGradleProject convertedRootProject = convert(rootProject, convertedProjects);
model.setRootProject(convertedRootProject);
for (Project project : rootProject.getAllprojects()) {
model.addProject(convertedProjects.get(project));
}
for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
Gradle includedGradle = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
DefaultGradleBuild convertedIncludedBuild = convert(includedGradle);
model.addIncludedBuild(convertedIncludedBuild);
}
return model;
}
use of org.gradle.api.Project in project gradle by gradle.
the class GradleBuildBuilder method convert.
private BasicGradleProject convert(Project project, Map<Project, BasicGradleProject> convertedProjects) {
DefaultProjectIdentifier id = new DefaultProjectIdentifier(project.getRootDir(), project.getPath());
BasicGradleProject converted = new BasicGradleProject().setName(project.getName()).setProjectIdentifier(id);
converted.setProjectDirectory(project.getProjectDir());
if (project.getParent() != null) {
converted.setParent(convertedProjects.get(project.getParent()));
}
convertedProjects.put(project, converted);
for (Project child : project.getChildProjects().values()) {
converted.addChild(convert(child, convertedProjects));
}
return converted;
}
use of org.gradle.api.Project in project gradle by gradle.
the class IdePlugin method postProcess.
/**
* Executes the provided Action after all projects have been evaluated.
* Action will only be added once per provided key. Any subsequent calls for the same key will be ignored.
* This permits the plugin to be applied in multiple subprojects, with the postprocess action executed once only.
*/
protected void postProcess(String key, final Action<? super Gradle> action) {
Project rootProject = project.getRootProject();
ExtraPropertiesExtension rootExtraProperties = rootProject.getExtensions().getByType(ExtraPropertiesExtension.class);
String extraPropertyName = "org.gradle." + key + ".postprocess.applied";
if (!rootExtraProperties.has(extraPropertyName)) {
project.getGradle().addBuildListener(new BuildAdapter() {
@Override
public void projectsEvaluated(Gradle gradle) {
action.execute(gradle);
}
});
rootExtraProperties.set(extraPropertyName, true);
}
}
use of org.gradle.api.Project in project spring-boot by spring-projects.
the class RepackageTask method repackage.
@TaskAction
public void repackage() {
Project project = getProject();
SpringBootPluginExtension extension = project.getExtensions().getByType(SpringBootPluginExtension.class);
ProjectLibraries libraries = getLibraries();
project.getTasks().withType(Jar.class, new RepackageAction(extension, libraries));
}
use of org.gradle.api.Project in project spring-boot by spring-projects.
the class FindMainClassTask method setMainClassNameProperty.
@TaskAction
public void setMainClassNameProperty() {
Project project = getProject();
if (!project.hasProperty("mainClassName") || project.property("mainClassName") == null) {
String mainClass = findMainClass();
if (project.hasProperty("mainClassName")) {
project.setProperty("mainClassName", mainClass);
} else {
ExtraPropertiesExtension extraProperties = (ExtraPropertiesExtension) project.getExtensions().getByName("ext");
extraProperties.set("mainClassName", mainClass);
}
}
}
Aggregations