use of org.gradle.api.Project in project gradle by gradle.
the class ProfileEventAdapter method afterExecute.
public void afterExecute(Task task, TaskState state) {
long now = clock.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath());
taskExecution.setFinish(now);
taskExecution.completed(state);
}
use of org.gradle.api.Project in project gradle by gradle.
the class ProfileEventAdapter method beforeExecute.
// TaskExecutionListener
public void beforeExecute(Task task) {
long now = clock.getCurrentTime();
Project project = task.getProject();
ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
projectProfile.getTaskProfile(task.getPath()).setStart(now);
}
use of org.gradle.api.Project in project gradle by gradle.
the class TaskConfiguration method configureInit.
public static void configureInit(final InitBuild init) {
init.setGroup(GROUP);
init.setDescription("Initializes a new Gradle build.");
final Project project = init.getProject();
init.onlyIf(new Spec<Task>() {
@Override
public boolean isSatisfiedBy(Task element) {
Object skippedMsg = reasonToSkip(project);
if (skippedMsg != null) {
project.getLogger().warn((String) skippedMsg);
return false;
}
return true;
}
});
init.dependsOn(new Callable<String>() {
@Override
public String call() throws Exception {
if (reasonToSkip(project) == null) {
return "wrapper";
} else {
return null;
}
}
});
project.getGradle().getTaskGraph().whenReady(new Action<TaskExecutionGraph>() {
@Override
public void execute(TaskExecutionGraph taskGraph) {
if (reasonToSkip(project) == null && taskGraph.hasTask(init)) {
wrapperTaskOf(project).setDistributionType(wrapperDistributionTypeFor(init.getDsl()));
}
}
});
}
use of org.gradle.api.Project in project gradle by gradle.
the class IdeaScalaConfigurer method configure.
public void configure() {
rootProject.getGradle().addBuildListener(new BuildAdapter() {
public void projectsEvaluated(Gradle gradle) {
VersionNumber ideaTargetVersion = findIdeaTargetVersion();
final boolean useScalaSdk = ideaTargetVersion == null || IDEA_VERSION_WHEN_SCALA_SDK_WAS_INTRODUCED.compareTo(ideaTargetVersion) <= 0;
final Collection<Project> scalaProjects = findProjectsApplyingIdeaAndScalaPlugins();
final Map<String, ProjectLibrary> scalaCompilerLibraries = Maps.newLinkedHashMap();
rootProject.getTasks().getByName("ideaProject").doFirst(new Action<Task>() {
@Override
public void execute(Task task) {
if (scalaProjects.size() > 0) {
scalaCompilerLibraries.clear();
scalaCompilerLibraries.putAll(resolveScalaCompilerLibraries(scalaProjects, useScalaSdk));
declareUniqueProjectLibraries(Sets.newLinkedHashSet(scalaCompilerLibraries.values()));
}
}
});
rootProject.configure(scalaProjects, new Action<Project>() {
@Override
public void execute(final Project project) {
project.getExtensions().getByType(IdeaModel.class).getModule().getIml().withXml(new Action<XmlProvider>() {
@Override
public void execute(XmlProvider xmlProvider) {
if (useScalaSdk) {
declareScalaSdk(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
} else {
declareScalaFacet(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
}
}
});
}
});
}
});
}
use of org.gradle.api.Project in project gradle by gradle.
the class EclipseModelBuilder method applyEclipsePlugin.
private void applyEclipsePlugin(Project root) {
Set<Project> allProjects = root.getAllprojects();
for (Project p : allProjects) {
p.getPluginManager().apply(EclipsePlugin.class);
}
for (IncludedBuild includedBuild : root.getGradle().getIncludedBuilds()) {
IncludedBuildInternal includedBuildInternal = (IncludedBuildInternal) includedBuild;
applyEclipsePlugin(includedBuildInternal.getConfiguredBuild().getRootProject());
}
}
Aggregations