Java Code Examples for org.gradle.language.base.plugins.LanguageBasePlugin

The following examples show how to use org.gradle.language.base.plugins.LanguageBasePlugin. 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
public void apply(final Project target) {

        target.getPlugins().apply(LanguageBasePlugin.class);
        BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class);
        binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() {
            public ClassDirectoryBinarySpec create(String name) {
                return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current()));
            }
        });

        binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() {
            public void execute(ClassDirectoryBinarySpecInternal binary) {
                createBinaryLifecycleTask(binary, target);
                setClassesDirConvention(binary, target);
                createProcessResourcesTaskForBinary(binary, target);
                createCompileJavaTaskForBinary(binary, target);
            }
        });
    }
 
Example 2
Source Project: javaide   Source File: JavaBasePlugin.java    License: GNU General Public License v3.0 6 votes vote down vote up
public void apply(ProjectInternal project) {
    project.getPluginManager().apply(BasePlugin.class);
    project.getPluginManager().apply(ReportingBasePlugin.class);
    project.getPluginManager().apply(LanguageBasePlugin.class);
    project.getPluginManager().apply(BinaryBasePlugin.class);

    JavaPluginConvention javaConvention = new JavaPluginConvention(project, instantiator);
    project.getConvention().getPlugins().put("java", javaConvention);

    configureCompileDefaults(project, javaConvention);
    BridgedBinaries binaries = configureSourceSetDefaults(javaConvention);

    modelRegistry.register(ModelRegistrations.bridgedInstance(ModelReference.of("bridgedBinaries", BridgedBinaries.class), binaries)
        .descriptor("JavaBasePlugin.apply()")
        .hidden(true)
        .build());

    configureJavaDoc(project, javaConvention);
    configureTest(project, javaConvention);
    configureBuildNeeded(project);
    configureBuildDependents(project);
}
 
Example 3
public void apply(final Project target) {

        target.getPlugins().apply(LanguageBasePlugin.class);
        BinaryContainer binaryContainer = target.getExtensions().getByType(BinaryContainer.class);
        binaryContainer.registerFactory(ClassDirectoryBinarySpec.class, new NamedDomainObjectFactory<ClassDirectoryBinarySpec>() {
            public ClassDirectoryBinarySpec create(String name) {
                return instantiator.newInstance(DefaultClassDirectoryBinarySpec.class, name, toolChain, new DefaultJavaPlatform(JavaVersion.current()));
            }
        });

        binaryContainer.withType(ClassDirectoryBinarySpecInternal.class).all(new Action<ClassDirectoryBinarySpecInternal>() {
            public void execute(ClassDirectoryBinarySpecInternal binary) {
                createBinaryLifecycleTask(binary, target);
                setClassesDirConvention(binary, target);
                createProcessResourcesTaskForBinary(binary, target);
                createCompileJavaTaskForBinary(binary, target);
            }
        });
    }
 
Example 4
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(BasePlugin.class);
    project.getPlugins().apply(LanguageBasePlugin.class);

    modelRules.register("toolChains", ToolChainRegistryInternal.class, factory(DefaultToolChainRegistry.class));
    modelRules.register("platforms", PlatformContainer.class, factory(DefaultPlatformContainer.class));
    modelRules.register("buildTypes", BuildTypeContainer.class, factory(DefaultBuildTypeContainer.class));
    modelRules.register("flavors", FlavorContainer.class, factory(DefaultFlavorContainer.class));

    project.getModelRegistry().create("repositories", Arrays.asList("flavors", "platforms", "buildTypes"), new RepositoriesFactory(instantiator, fileResolver));

    modelRules.rule(new CreateDefaultPlatform());
    modelRules.rule(new CreateDefaultBuildTypes());
    modelRules.rule(new CreateDefaultFlavors());
    modelRules.rule(new AddDefaultToolChainsIfRequired());
    modelRules.rule(new CreateNativeBinaries(instantiator, project, resolver));
    modelRules.rule(new CloseBinariesForTasks());

    project.getExtensions().create(
            "executables",
            DefaultExecutableContainer.class,
            instantiator,
            project
    );
    project.getExtensions().create(
            "libraries",
            DefaultLibraryContainer.class,
            instantiator,
            project
    );

    // TODO:DAZ Lazy configuration actions: need a better way to accomplish these.
    configurationActions.add(Actions.composite(
            new ConfigureGeneratedSourceSets(),
            new ApplySourceSetConventions()
    ));
}
 
Example 5
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(BasePlugin.class);
    project.getPlugins().apply(LanguageBasePlugin.class);

    modelRules.register("toolChains", ToolChainRegistryInternal.class, factory(DefaultToolChainRegistry.class));
    modelRules.register("platforms", PlatformContainer.class, factory(DefaultPlatformContainer.class));
    modelRules.register("buildTypes", BuildTypeContainer.class, factory(DefaultBuildTypeContainer.class));
    modelRules.register("flavors", FlavorContainer.class, factory(DefaultFlavorContainer.class));

    project.getModelRegistry().create("repositories", Arrays.asList("flavors", "platforms", "buildTypes"), new RepositoriesFactory(instantiator, fileResolver));

    modelRules.rule(new CreateDefaultPlatform());
    modelRules.rule(new CreateDefaultBuildTypes());
    modelRules.rule(new CreateDefaultFlavors());
    modelRules.rule(new AddDefaultToolChainsIfRequired());
    modelRules.rule(new CreateNativeBinaries(instantiator, project, resolver));
    modelRules.rule(new CloseBinariesForTasks());

    project.getExtensions().create(
            "executables",
            DefaultExecutableContainer.class,
            instantiator,
            project
    );
    project.getExtensions().create(
            "libraries",
            DefaultLibraryContainer.class,
            instantiator,
            project
    );

    // TODO:DAZ Lazy configuration actions: need a better way to accomplish these.
    configurationActions.add(Actions.composite(
            new ConfigureGeneratedSourceSets(),
            new ApplySourceSetConventions()
    ));
}
 
Example 6
Source Project: gradle-cpd-plugin   Source File: CpdPluginTest.java    License: Apache License 2.0 5 votes vote down vote up
static Stream<Class<? extends Plugin>> CpdPlugin_shouldAddCpdCheckTaskAsDependencyOfCheckLifecycleTaskIfPluginIsApplied() {
    return Stream.of(
            LifecycleBasePlugin.class,
            BasePlugin.class,
            LanguageBasePlugin.class,
            JavaBasePlugin.class,

            JavaPlugin.class,
            GroovyPlugin.class,
            CppPlugin.class
        );
}