org.gradle.language.base.plugins.ComponentModelBasePlugin Java Examples

The following examples show how to use org.gradle.language.base.plugins.ComponentModelBasePlugin. 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
Source File: ComponentBinariesRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private <R, S extends BinarySpec> void doRegister(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        RuleMethodDataCollector dataCollector = new RuleMethodDataCollector();
        visitAndVerifyMethodSignature(dataCollector, ruleDefinition);

        final Class<S> binaryType = dataCollector.getParameterType(BinarySpec.class);
        final Class<? extends ComponentSpec> componentType = dataCollector.getParameterType(ComponentSpec.class);
        dependencies.add(ComponentModelBasePlugin.class);
        final ModelReference<BinaryContainer> subject = ModelReference.of(ModelPath.path("binaries"), new ModelType<BinaryContainer>() {
        });

        configureMutationRule(modelRegistry, subject, componentType, binaryType, ruleDefinition);
    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #2
Source File: BinaryTasksRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private <R, S extends BinarySpec> void doRegister(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        RuleMethodDataCollector dataCollector = new RuleMethodDataCollector();
        verifyMethodSignature(dataCollector, ruleDefinition);

        Class<S> binaryType =  dataCollector.getParameterType(BinarySpec.class);
        dependencies.add(ComponentModelBasePlugin.class);

        final ModelReference<TaskContainer> tasks = ModelReference.of(ModelPath.path("tasks"), new ModelType<TaskContainer>() {
        });

        modelRegistry.mutate(new BinaryTaskRule<R, S>(tasks, binaryType, ruleDefinition, modelRegistry));

    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #3
Source File: BinaryTasksRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private <R, S extends BinarySpec> void doRegister(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        RuleMethodDataCollector dataCollector = new RuleMethodDataCollector();
        verifyMethodSignature(dataCollector, ruleDefinition);

        Class<S> binaryType =  dataCollector.getParameterType(BinarySpec.class);
        dependencies.add(ComponentModelBasePlugin.class);

        final ModelReference<TaskContainer> tasks = ModelReference.of(ModelPath.path("tasks"), new ModelType<TaskContainer>() {
        });

        modelRegistry.mutate(new BinaryTaskRule<R, S>(tasks, binaryType, ruleDefinition, modelRegistry));

    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #4
Source File: NativeComponentModelPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);

    ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
    ComponentSpecContainer components = project.getExtensions().getByType(ComponentSpecContainer.class);
    components.registerFactory(NativeExecutableSpec.class, new NativeExecutableSpecFactory(instantiator, sources, project));
    NamedDomainObjectContainer<NativeExecutableSpec> nativeExecutables = components.containerWithType(NativeExecutableSpec.class);

    components.registerFactory(NativeLibrarySpec.class, new NativeLibrarySpecFactory(instantiator, sources, project));
    NamedDomainObjectContainer<NativeLibrarySpec> nativeLibraries = components.containerWithType(NativeLibrarySpec.class);

    project.getExtensions().create("nativeRuntime", DefaultNativeComponentExtension.class, nativeExecutables, nativeLibraries);

    // TODO:DAZ Remove these: should not pollute the global namespace
    project.getExtensions().add("nativeComponents", components.withType(NativeComponentSpec.class));
    project.getExtensions().add("executables", nativeExecutables);
    project.getExtensions().add("libraries", nativeLibraries);
}
 
Example #5
Source File: JvmComponentPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);

    ComponentSpecContainer componentSpecs = project.getExtensions().getByType(ComponentSpecContainer.class);

    final ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
    componentSpecs.registerFactory(JvmLibrarySpec.class, new NamedDomainObjectFactory<JvmLibrarySpec>() {
        public JvmLibrarySpec create(String name) {
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(project.getPath(), name);
            return new DefaultJvmLibrarySpec(id, sources.maybeCreate(name));
        }
    });

    final NamedDomainObjectContainer<JvmLibrarySpec> jvmLibraries = componentSpecs.containerWithType(JvmLibrarySpec.class);
    project.getExtensions().create("jvm", DefaultJvmComponentExtension.class, jvmLibraries);
}
 
Example #6
Source File: ComponentBinariesRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private <R, S extends BinarySpec> void doRegister(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        RuleMethodDataCollector dataCollector = new RuleMethodDataCollector();
        visitAndVerifyMethodSignature(dataCollector, ruleDefinition);

        final Class<S> binaryType = dataCollector.getParameterType(BinarySpec.class);
        final Class<? extends ComponentSpec> componentType = dataCollector.getParameterType(ComponentSpec.class);
        dependencies.add(ComponentModelBasePlugin.class);
        final ModelReference<BinaryContainer> subject = ModelReference.of(ModelPath.path("binaries"), new ModelType<BinaryContainer>() {
        });

        configureMutationRule(modelRegistry, subject, componentType, binaryType, ruleDefinition);
    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #7
Source File: JvmComponentPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);

    ComponentSpecContainer componentSpecs = project.getExtensions().getByType(ComponentSpecContainer.class);

    final ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
    componentSpecs.registerFactory(JvmLibrarySpec.class, new NamedDomainObjectFactory<JvmLibrarySpec>() {
        public JvmLibrarySpec create(String name) {
            ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(project.getPath(), name);
            return new DefaultJvmLibrarySpec(id, sources.maybeCreate(name));
        }
    });

    final NamedDomainObjectContainer<JvmLibrarySpec> jvmLibraries = componentSpecs.containerWithType(JvmLibrarySpec.class);
    project.getExtensions().create("jvm", DefaultJvmComponentExtension.class, jvmLibraries);
}
 
Example #8
Source File: NativeComponentModelPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);

    ProjectSourceSet sources = project.getExtensions().getByType(ProjectSourceSet.class);
    ComponentSpecContainer components = project.getExtensions().getByType(ComponentSpecContainer.class);
    components.registerFactory(NativeExecutableSpec.class, new NativeExecutableSpecFactory(instantiator, sources, project));
    NamedDomainObjectContainer<NativeExecutableSpec> nativeExecutables = components.containerWithType(NativeExecutableSpec.class);

    components.registerFactory(NativeLibrarySpec.class, new NativeLibrarySpecFactory(instantiator, sources, project));
    NamedDomainObjectContainer<NativeLibrarySpec> nativeLibraries = components.containerWithType(NativeLibrarySpec.class);

    project.getExtensions().create("nativeRuntime", DefaultNativeComponentExtension.class, nativeExecutables, nativeLibraries);

    // TODO:DAZ Remove these: should not pollute the global namespace
    project.getExtensions().add("nativeComponents", components.withType(NativeComponentSpec.class));
    project.getExtensions().add("executables", nativeExecutables);
    project.getExtensions().add("libraries", nativeLibraries);
}
 
Example #9
Source File: ComponentModelRuleDefinitionHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <R> void register(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        ModelType<? extends T> type = readType(ruleDefinition);
        ModelType<? extends U> implementation = determineImplementationType(ruleDefinition, type);

        dependencies.add(ComponentModelBasePlugin.class);
        if (implementation != null) {
            ModelMutator<?> mutator = new RegisterTypeRule<T, U>(type, implementation, ruleDefinition.getDescriptor(), registerer);
            modelRegistry.mutate(mutator);
        }
    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #10
Source File: ComponentModelRuleDefinitionHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public <R> void register(MethodRuleDefinition<R> ruleDefinition, ModelRegistry modelRegistry, RuleSourceDependencies dependencies) {
    try {
        ModelType<? extends T> type = readType(ruleDefinition);
        ModelType<? extends U> implementation = determineImplementationType(ruleDefinition, type);

        dependencies.add(ComponentModelBasePlugin.class);
        if (implementation != null) {
            ModelMutator<?> mutator = new RegisterTypeRule<T, U>(type, implementation, ruleDefinition.getDescriptor(), registerer);
            modelRegistry.mutate(mutator);
        }
    } catch (InvalidComponentModelException e) {
        invalidModelRule(ruleDefinition, e);
    }
}
 
Example #11
Source File: WindowsResourceScriptPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new WindowsResources());
}
 
Example #12
Source File: ObjectiveCLangPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new ObjectiveC());
    }
 
Example #13
Source File: JavaLanguagePlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getPlugins().apply(JvmResourcesPlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new Java());
}
 
Example #14
Source File: JvmResourcesPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new JvmResources());
}
 
Example #15
Source File: CppLangPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new Cpp());
   }
 
Example #16
Source File: CLangPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new C());
    }
 
Example #17
Source File: AssemblerLangPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new Assembler());
}
 
Example #18
Source File: ObjectiveCppLangPlugin.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new ObjectiveCpp());
    }
 
Example #19
Source File: AndroidComponentModelPlugin.java    From javaide with GNU General Public License v3.0 4 votes vote down vote up
@Override
public void apply(Project project) {
    checkGradleVersion(project);
    project.getPlugins().apply(ComponentModelBasePlugin.class);
}
 
Example #20
Source File: ObjectiveCppLangPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new ObjectiveCpp());
    }
 
Example #21
Source File: AssemblerLangPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new Assembler());
}
 
Example #22
Source File: CLangPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new C());
    }
 
Example #23
Source File: CppLangPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new Cpp());
   }
 
Example #24
Source File: WindowsResourceScriptPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new WindowsResources());
}
 
Example #25
Source File: ObjectiveCLangPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final ProjectInternal project) {

        project.getPlugins().apply(ComponentModelBasePlugin.class);
        project.getExtensions().getByType(LanguageRegistry.class).add(new ObjectiveC());
    }
 
Example #26
Source File: JavaLanguagePlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(ProjectInternal project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getPlugins().apply(JvmResourcesPlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new Java());
}
 
Example #27
Source File: JvmResourcesPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public void apply(final Project project) {
    project.getPlugins().apply(ComponentModelBasePlugin.class);
    project.getExtensions().getByType(LanguageRegistry.class).add(new JvmResources());
}