Java Code Examples for org.gradle.api.plugins.ExtensionContainer#create()

The following examples show how to use org.gradle.api.plugins.ExtensionContainer#create() . These examples are extracted from open source projects. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
private void configureModularity(Project project, String moduleName) {
    ExtensionContainer extensions = project.getExtensions();
    extensions.add("moduleName", moduleName);
    extensions.create("patchModules", PatchModuleExtension.class);
    extensions.create(ModularityExtension.class, "modularity", DefaultModularityExtension.class, project);

    new CompileTask(project).configureCompileJava();
    new CompileModuleInfoTask(project).configureCompileModuleInfoJava();
    new MergeClassesTask(project).configureMergeClasses();
    new CompileTestTask(project).configureCompileTestJava();
    new TestTask(project).configureTestJava();
    new RunTask(project).configureRun();
    new JavadocTask(project).configureJavaDoc();
    ModularJavaExec.configure(project);
    ModularCreateStartScripts.configure(project);
    PatchModuleContainer.configure(project);
}
 
Example 2
@Override
public void apply(Project project) {
    final ConfigurationContainer configurations = project.getConfigurations();
    configurations.maybeCreate("test");
    configurations.maybeCreate("build");
    configurations.maybeCreate("tool");

    final ExtensionContainer extensions = project.getExtensions();
    final ExtensionAware golang = (ExtensionAware) extensions.create("golang", GolangSettings.class, true, project);
    golang.getExtensions().create("build", BuildSettings.class, true, project);
    golang.getExtensions().create("toolchain", ToolchainSettings.class, true, project);
    golang.getExtensions().create("dependencies", DependenciesSettings.class, true, project);
    golang.getExtensions().create("testing", TestingSettings.class, true, project);

    extensions.create(INSTANCE_PROPERTY_NAME, Reference.class, this);

    final TaskContainer tasks = project.getTasks();
    addTasks(tasks);
}
 
Example 3
Source Project: jig   File: JigGradlePlugin.java    License: Apache License 2.0 5 votes vote down vote up
@Override
public void apply(Project project) {
    ExtensionContainer extensions = project.getExtensions();
    extensions.create("jig", JigConfig.class);
    TaskContainer tasks = project.getTasks();

    JigReportsTask jigReports = tasks.create("jigReports", JigReportsTask.class);
    jigReports.setGroup("JIG");
    jigReports.setDescription("Generates JIG documentation for the main source code.");

    VerifyJigEnvironmentTask verifyTask = tasks.create("verifyJigEnvironment", VerifyJigEnvironmentTask.class);
    verifyTask.setGroup("JIG");
    verifyTask.setDescription("Verify JIG environment.");
}
 
Example 4
public Settings(@Nonnull Project project, @Nonnull ExtensionContainer container, boolean init) {
    _project = project;
    _golang = container.create("golang", GolangSettings.class, init, project);
    final ExtensionContainer taskExtensions = ((ExtensionAware) _golang).getExtensions();
    _build = taskExtensions.create("build", BuildSettings.class, init, project);
    _toolchain = taskExtensions.create("toolchain", ToolchainSettings.class, init, project);
    _dependencies = taskExtensions.create("dependencies", DependenciesSettings.class, init, project);
    _testing = taskExtensions.create("testing", TestingSettings.class, init, project);
}
 
Example 5
Source Project: pygradle   File: ExtensionUtils.java    License: Apache License 2.0 5 votes vote down vote up
public static <T> T maybeCreate(PythonExtension extension, String name, Class<T> type, Object... args) {
    ExtensionContainer extensionContainer = ((ExtensionAware) extension).getExtensions();
    T maybeExtension = extensionContainer.findByType(type);
    if (maybeExtension == null) {
        maybeExtension = extensionContainer.create(name, type, args);
    }
    return maybeExtension;
}