Java Code Examples for org.gradle.platform.base.BinaryContainer#registerFactory()
The following examples show how to use
org.gradle.platform.base.BinaryContainer#registerFactory() .
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: LegacyJavaComponentPlugin.java From pushfish-android with BSD 2-Clause "Simplified" License | 6 votes |
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 File: LegacyJavaComponentPlugin.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 6 votes |
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 3
Source File: BinaryTypeRuleDefinitionHandler.java From pushfish-android with BSD 2-Clause "Simplified" License | 5 votes |
private <T extends BinarySpec, U extends BaseBinarySpec> void doRegister(BinaryContainer binaries, ModelType<T> type, final ModelType<U> implementation) { binaries.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() { public T create(String name) { BinaryNamingScheme binaryNamingScheme = new DefaultBinaryNamingSchemeBuilder() .withComponentName(name) .build(); // safe because we implicitly know that U extends V, but can't express this in the type system @SuppressWarnings("unchecked") T created = (T) BaseBinarySpec.create(implementation.getConcreteClass(), binaryNamingScheme, instantiator); return created; } }); }
Example 4
Source File: BinaryTypeRuleDefinitionHandler.java From Pushjet-Android with BSD 2-Clause "Simplified" License | 5 votes |
private <T extends BinarySpec, U extends BaseBinarySpec> void doRegister(BinaryContainer binaries, ModelType<T> type, final ModelType<U> implementation) { binaries.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() { public T create(String name) { BinaryNamingScheme binaryNamingScheme = new DefaultBinaryNamingSchemeBuilder() .withComponentName(name) .build(); // safe because we implicitly know that U extends V, but can't express this in the type system @SuppressWarnings("unchecked") T created = (T) BaseBinarySpec.create(implementation.getConcreteClass(), binaryNamingScheme, instantiator); return created; } }); }