Java Code Examples for org.gradle.api.NamedDomainObjectFactory
The following examples show how to use
org.gradle.api.NamedDomainObjectFactory. 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
Source Project: pushfish-android Source File: MicrosoftVisualCppPlugin.java License: BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class); final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class); final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class); toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() { public VisualCpp create(String name) { return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator); } }); toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class); }
Example 2
Source Project: Pushjet-Android Source File: MicrosoftVisualCppPlugin.java License: BSD 2-Clause "Simplified" License | 6 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final OperatingSystem operatingSystem = serviceRegistry.get(OperatingSystem.class); final VisualStudioLocator visualStudioLocator = serviceRegistry.get(VisualStudioLocator.class); final WindowsSdkLocator windowsSdkLocator = serviceRegistry.get(WindowsSdkLocator.class); toolChainRegistry.registerFactory(VisualCpp.class, new NamedDomainObjectFactory<VisualCpp>() { public VisualCpp create(String name) { return instantiator.newInstance(VisualCppToolChain.class, name, operatingSystem, fileResolver, execActionFactory, visualStudioLocator, windowsSdkLocator, instantiator); } }); toolChainRegistry.registerDefaultToolChain(VisualCppToolChain.DEFAULT_NAME, VisualCpp.class); }
Example 3
Source Project: pushfish-android Source File: ComponentTypeRuleDefinitionHandler.java License: BSD 2-Clause "Simplified" License | 5 votes |
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) { componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() { public T create(String name) { FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name); ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name); // safe because we implicitly know that U extends V, but can't express this in the type system @SuppressWarnings("unchecked") T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator); return created; } }); }
Example 4
Source Project: pushfish-android Source File: BinaryTypeRuleDefinitionHandler.java License: 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 5
Source Project: pushfish-android Source File: ClangCompilerPlugin.java License: BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() { public Clang create(String name) { return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator); } }); toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class); }
Example 6
Source Project: pushfish-android Source File: GccCompilerPlugin.java License: BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() { public Gcc create(String name) { return instantiator.newInstance(GccToolChain.class, instantiator, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory); } }); toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class); }
Example 7
Source Project: pushfish-android Source File: RepositoriesFactory.java License: BSD 2-Clause "Simplified" License | 5 votes |
private DefaultRepositories(final Instantiator instantiator, final FileResolver fileResolver, final Action<PrebuiltLibrary> binaryFactory) { super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer()); registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() { public PrebuiltLibraries create(String name) { return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, fileResolver, binaryFactory); } }); }
Example 8
Source Project: Pushjet-Android Source File: ComponentTypeRuleDefinitionHandler.java License: BSD 2-Clause "Simplified" License | 5 votes |
private <T extends ComponentSpec, I extends BaseComponentSpec> void doRegister(final ModelType<T> type, final ModelType<I> implementation, final ProjectSourceSet projectSourceSet, ComponentSpecContainer componentSpecs, final ProjectIdentifier projectIdentifier) { componentSpecs.registerFactory(type.getConcreteClass(), new NamedDomainObjectFactory<T>() { public T create(String name) { FunctionalSourceSet componentSourceSet = projectSourceSet.maybeCreate(name); ComponentSpecIdentifier id = new DefaultComponentSpecIdentifier(projectIdentifier.getPath(), name); // safe because we implicitly know that U extends V, but can't express this in the type system @SuppressWarnings("unchecked") T created = (T) BaseComponentSpec.create(implementation.getConcreteClass(), id, componentSourceSet, instantiator); return created; } }); }
Example 9
Source Project: Pushjet-Android Source File: BinaryTypeRuleDefinitionHandler.java License: 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 10
Source Project: Pushjet-Android Source File: ClangCompilerPlugin.java License: BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Clang.class, new NamedDomainObjectFactory<Clang>() { public Clang create(String name) { return instantiator.newInstance(ClangToolChain.class, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory, instantiator); } }); toolChainRegistry.registerDefaultToolChain(ClangToolChain.DEFAULT_NAME, Clang.class); }
Example 11
Source Project: Pushjet-Android Source File: GccCompilerPlugin.java License: BSD 2-Clause "Simplified" License | 5 votes |
@Mutate public static void addGccToolChain(NativeToolChainRegistryInternal toolChainRegistry, ServiceRegistry serviceRegistry) { final FileResolver fileResolver = serviceRegistry.get(FileResolver.class); final ExecActionFactory execActionFactory = serviceRegistry.get(ExecActionFactory.class); final Instantiator instantiator = serviceRegistry.get(Instantiator.class); final CompilerMetaDataProviderFactory metaDataProviderFactory = serviceRegistry.get(CompilerMetaDataProviderFactory.class); toolChainRegistry.registerFactory(Gcc.class, new NamedDomainObjectFactory<Gcc>() { public Gcc create(String name) { return instantiator.newInstance(GccToolChain.class, instantiator, name, OperatingSystem.current(), fileResolver, execActionFactory, metaDataProviderFactory); } }); toolChainRegistry.registerDefaultToolChain(GccToolChain.DEFAULT_NAME, Gcc.class); }
Example 12
Source Project: Pushjet-Android Source File: RepositoriesFactory.java License: BSD 2-Clause "Simplified" License | 5 votes |
private DefaultRepositories(final Instantiator instantiator, final FileResolver fileResolver, final Action<PrebuiltLibrary> binaryFactory) { super(ArtifactRepository.class, instantiator, new ArtifactRepositoryNamer()); registerFactory(PrebuiltLibraries.class, new NamedDomainObjectFactory<PrebuiltLibraries>() { public PrebuiltLibraries create(String name) { return instantiator.newInstance(DefaultPrebuiltLibraries.class, name, instantiator, fileResolver, binaryFactory); } }); }
Example 13
Source Project: pushfish-android Source File: RuleAwarePolymorphicDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override public <U extends T> void registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory) { checkCanRegister(type); super.registerFactory(type, factory); }
Example 14
Source Project: Pushjet-Android Source File: RuleAwarePolymorphicDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 4 votes |
@Override public <U extends T> void registerFactory(Class<U> type, NamedDomainObjectFactory<? extends U> factory) { checkCanRegister(type); super.registerFactory(type, factory); }
Example 15
Source Project: pushfish-android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example 16
Source Project: pushfish-android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container * @param instantiator The instantiator to use to create any other collections based on this one * @param namer The naming strategy to use * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) { super(type, instantiator, namer); this.factory = factory; }
Example 17
Source Project: pushfish-android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example 18
Source Project: pushfish-android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container * @param instantiator The instantiator to use to create any other collections based on this one * @param namer The naming strategy to use * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) { super(type, instantiator, namer); this.factory = factory; }
Example 19
Source Project: Pushjet-Android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example 20
Source Project: Pushjet-Android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container * @param instantiator The instantiator to use to create any other collections based on this one * @param namer The naming strategy to use * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) { super(type, instantiator, namer); this.factory = factory; }
Example 21
Source Project: Pushjet-Android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container (must implement {@link Named}) * @param instantiator The instantiator to use to create any other collections based on this one * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, NamedDomainObjectFactory<T> factory) { this(type, instantiator, Named.Namer.forType(type), factory); }
Example 22
Source Project: Pushjet-Android Source File: FactoryNamedDomainObjectContainer.java License: BSD 2-Clause "Simplified" License | 2 votes |
/** * <p>Creates a container that instantiates using the given factory.<p> * * @param type The concrete type of element in the container * @param instantiator The instantiator to use to create any other collections based on this one * @param namer The naming strategy to use * @param factory The factory responsible for creating new instances on demand */ public FactoryNamedDomainObjectContainer(Class<T> type, Instantiator instantiator, Namer<? super T> namer, NamedDomainObjectFactory<T> factory) { super(type, instantiator, namer); this.factory = factory; }