本文整理匯總了Java中org.gradle.api.Project.getBuildFile方法的典型用法代碼示例。如果您正苦於以下問題:Java Project.getBuildFile方法的具體用法?Java Project.getBuildFile怎麽用?Java Project.getBuildFile使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類org.gradle.api.Project
的用法示例。
在下文中一共展示了Project.getBuildFile方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: addSubProjects
import org.gradle.api.Project; //導入方法依賴的package包/類
/**
* Adds all sub projects of the specified GradleProject.
*
* @param parentProject the source parent project. Where we get the sub projects from.
* @param parentProjectView the destination of the sub projects from parentProject.
*/
private void addSubProjects(Project parentProject, ProjectView parentProjectView) {
Collection<Project> subProjects = parentProject.getChildProjects().values();
for (Project subProject : subProjects) {
ProjectView projectView = new ProjectView(parentProjectView, subProject.getName(), subProject.getBuildFile(), subProject.getDescription());
addTasks(subProject, projectView);
projectView.sortSubProjectsAndTasks();
addSubProjects(subProject, projectView);
}
}
示例2: configureInit
import org.gradle.api.Project; //導入方法依賴的package包/類
public static void configureInit(final InitBuild init) {
init.setGroup(GROUP);
init.setDescription("Initializes a new Gradle build. [incubating]");
final Transformer<String, Project> setupCanBeSkipped = new Transformer<String, Project>() {
@Override
public String transform(Project project) {
if (project.file("build.gradle").exists()) {
return "The build file 'build.gradle' already exists. Skipping build initialization.";
}
File buildFile = project.getBuildFile();
if (buildFile != null && buildFile.exists()) {
return "The build file \'" + buildFile.getName() + "\' already exists. Skipping build initialization.";
}
if (project.file("settings.gradle").exists()) {
return "The settings file 'settings.gradle' already exists. Skipping build initialization.";
}
if (project.getSubprojects().size() > 0) {
return "This Gradle project appears to be part of an existing multi-project Gradle build. Skipping build initialization.";
}
return null;
}
};
init.onlyIf(new Spec<Task>() {
@Override
public boolean isSatisfiedBy(Task element) {
Object skippedMsg = setupCanBeSkipped.transform(element.getProject());
if (skippedMsg != null) {
element.getProject().getLogger().warn((String) skippedMsg);
return false;
}
return true;
}
});
init.dependsOn(new Callable<String>() {
@Override
public String call() throws Exception {
if (setupCanBeSkipped.transform(init.getProject()) == null) {
return "wrapper";
} else {
return null;
}
}
});
}
示例3: addRootLevelProject
import org.gradle.api.Project; //導入方法依賴的package包/類
/**
* This adds the specified project as a root level projects. It then adds all tasks and recursively adds all sub projects.
*
* @param rootLevelProject a root level project.
*/
public void addRootLevelProject(Project rootLevelProject) {
ProjectView rootLevelProjectView = new ProjectView(null, rootLevelProject.getName(), rootLevelProject.getBuildFile(), rootLevelProject.getDescription());
rootLevelResultingProjects.add(rootLevelProjectView);
addSubProjects(rootLevelProject, rootLevelProjectView);
addTasks(rootLevelProject, rootLevelProjectView);
rootLevelProjectView.sortSubProjectsAndTasks();
}