use of org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl in project gradle by gradle.
the class InitBuild method setupProjectLayout.
@TaskAction
public void setupProjectLayout() {
final String type = getType();
BuildInitDsl dsl = BuildInitDsl.fromName(getDsl());
BuildInitTestFramework testFramework = BuildInitTestFramework.fromName(getTestFramework());
final ProjectLayoutSetupRegistry projectLayoutRegistry = getProjectLayoutRegistry();
if (!projectLayoutRegistry.supports(type)) {
String supportedTypes = Joiner.on(", ").join(Iterables.transform(projectLayoutRegistry.getSupportedTypes(), new Function<String, String>() {
@Override
public String apply(String input) {
return "'" + input + "'";
}
}));
throw new GradleException("The requested build setup type '" + type + "' is not supported. Supported types: " + supportedTypes + ".");
}
ProjectInitDescriptor initDescriptor = projectLayoutRegistry.get(type);
if (!testFramework.equals(BuildInitTestFramework.NONE) && !initDescriptor.supports(testFramework)) {
throw new GradleException("The requested test framework '" + testFramework.getId() + "' is not supported in '" + type + "' setup type");
}
initDescriptor.generate(dsl, testFramework);
}
use of org.gradle.buildinit.plugins.internal.modifiers.BuildInitDsl in project gradle by gradle.
the class TaskConfiguration method reasonToSkip.
private static String reasonToSkip(Project project) {
for (BuildInitDsl dsl : BuildInitDsl.values()) {
String buildFileName = dsl.fileNameFor("build");
if (project.file(buildFileName).exists()) {
return "The build file '" + buildFileName + "' already exists. Skipping build initialization.";
}
String settingsFileName = dsl.fileNameFor("settings");
if (project.file(settingsFileName).exists()) {
return "The settings file '" + settingsFileName + "' 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.getSubprojects().size() > 0) {
return "This Gradle project appears to be part of an existing multi-project Gradle build. Skipping build initialization.";
}
return null;
}
Aggregations