org.gradle.internal.reflect.Instantiator Java Examples

The following examples show how to use org.gradle.internal.reflect.Instantiator. 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: PluginResolvers.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
public static PluginResolver jcenterGradleOfficial(Instantiator instantiator, DependencyResolutionServices dependencyResolutionServices, final CacheRepository cacheRepository) {
    Supplier<PersistentIndexedCache<PluginRequest, String>> cacheSupplier = Suppliers.wrap(
            Suppliers.ofQuietlyClosed(new Factory<PersistentCache>() {
                public PersistentCache create() {
                    return cacheRepository.cache("plugins").withLockOptions(LockOptionsBuilder.mode(FileLockManager.LockMode.Exclusive)).open();
                }
            }),
            new Transformer<PersistentIndexedCache<PluginRequest, String>, PersistentCache>() {
                public PersistentIndexedCache<PluginRequest, String> transform(PersistentCache original) {
                    PersistentIndexedCacheParameters<PluginRequest, String> cacheParams = new PersistentIndexedCacheParameters<PluginRequest, String>("jcenter", new PluginRequestSerializer(), BaseSerializerFactory.STRING_SERIALIZER);
                    return original.createCache(cacheParams);
                }
            });

    final JCenterPluginMapper mapper = new JCenterPluginMapper(cacheSupplier);

    return new ModuleMappingPluginResolver("jcenter plugin resolver", dependencyResolutionServices, instantiator, mapper, new JCenterRepositoryConfigurer()) {
        @Override
        public String getDescriptionForNotFoundMessage() {
            return String.format("Gradle Bintray Plugin Repository (listing: %s)", mapper.getBintrayRepoUrl());
        }
    };
}
 
Example #2
Source File: MicrosoftVisualCppPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
@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 File: TaskExecutionServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
TaskArtifactStateRepository createTaskArtifactStateRepository(Instantiator instantiator, TaskArtifactStateCacheAccess cacheAccess, StartParameter startParameter, FileSnapshotter fileSnapshotter) {
    FileCollectionSnapshotter fileCollectionSnapshotter = new DefaultFileCollectionSnapshotter(fileSnapshotter, cacheAccess);

    FileCollectionSnapshotter outputFilesSnapshotter = new OutputFilesCollectionSnapshotter(fileCollectionSnapshotter, new RandomLongIdGenerator(), cacheAccess);

    SerializerRegistry<FileCollectionSnapshot> serializerRegistry = new DefaultSerializerRegistry<FileCollectionSnapshot>();
    fileCollectionSnapshotter.registerSerializers(serializerRegistry);
    outputFilesSnapshotter.registerSerializers(serializerRegistry);

    TaskHistoryRepository taskHistoryRepository = new CacheBackedTaskHistoryRepository(cacheAccess,
            new CacheBackedFileSnapshotRepository(cacheAccess,
                    serializerRegistry.build(),
                    new RandomLongIdGenerator()));

    return new ShortCircuitTaskArtifactStateRepository(
                    startParameter,
                    instantiator,
                    new DefaultTaskArtifactStateRepository(
                            taskHistoryRepository,
                            instantiator,
                            outputFilesSnapshotter,
                            fileCollectionSnapshotter
                    )
    );
}
 
Example #4
Source File: OsgiPluginConvention.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
private OsgiManifest createDefaultOsgiManifest(final ProjectInternal project) {
    OsgiManifest osgiManifest = project.getServices().get(Instantiator.class).newInstance(DefaultOsgiManifest.class, project.getFileResolver());
    ConventionMapping mapping = ((IConventionAware) osgiManifest).getConventionMapping();
    final OsgiHelper osgiHelper = new OsgiHelper();

    mapping.map("version", new Callable<Object>() {
        public Object call() throws Exception {
            return osgiHelper.getVersion(project.getVersion().toString());
        }
    });
    mapping.map("name", new Callable<Object>() {
        public Object call() throws Exception {
            return project.getConvention().getPlugin(BasePluginConvention.class).getArchivesBaseName();
        }
    });
    mapping.map("symbolicName", new Callable<Object>() {
        public Object call() throws Exception {
            return osgiHelper.getBundleSymbolicName(project);
        }
    });

    return osgiManifest;
}
 
Example #5
Source File: TestNGTestFramework.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public TestNGTestFramework(Test testTask, DefaultTestFilter filter, Instantiator instantiator) {
    this.testTask = testTask;
    this.filter = filter;
    options = instantiator.newInstance(TestNGOptions.class, testTask.getProject().getProjectDir());
    options.setAnnotationsOnSourceCompatibility(JavaVersion.toVersion(testTask.getProject().property("sourceCompatibility")));
    conventionMapOutputDirectory(options, testTask.getReports().getHtml());
    detector = new TestNGDetector(new ClassFileExtractionManager(testTask.getTemporaryDirFactory()));
}
 
Example #6
Source File: Copy.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Override
protected CopySpecInternal createRootSpec() {
    Instantiator instantiator = getInstantiator();
    FileResolver fileResolver = getFileResolver();

    return instantiator.newInstance(DestinationRootCopySpec.class, fileResolver, super.createRootSpec());
}
 
Example #7
Source File: NativeComponentModelPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
@Mutate
public void registerNativePlatformFactory(PlatformContainer platforms, ServiceRegistry serviceRegistry) {
    final Instantiator instantiator = serviceRegistry.get(Instantiator.class);
    NamedDomainObjectFactory<NativePlatform> nativePlatformFactory = new NamedDomainObjectFactory<NativePlatform>() {
        public NativePlatform create(String name) {
            return instantiator.newInstance(DefaultNativePlatform.class, name);
        }
    };

    //TODO freekh: remove cast/this comment when registerDefault exists on interface
    ((DefaultPlatformContainer) platforms).registerDefaultFactory(nativePlatformFactory);
    platforms.registerFactory(NativePlatform.class, nativePlatformFactory);
}
 
Example #8
Source File: BuildScopeServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected PluginResolverFactory createPluginResolverFactory() {
    return new PluginResolverFactory(
            get(PluginRegistry.class),
            get(Instantiator.class),
            get(DependencyManagementServices.class),
            get(FileResolver.class),
            new DependencyMetaDataProviderImpl(),
            get(DocumentationRegistry.class),
            get(CacheRepository.class)
    );
}
 
Example #9
Source File: DefaultDependencyManagementServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
ConfigurationContainerInternal createConfigurationContainer(Instantiator instantiator, ConfigurationResolver configurationResolver, DomainObjectContext domainObjectContext,
                                                            ListenerManager listenerManager, DependencyMetaDataProvider metaDataProvider) {
    return instantiator.newInstance(DefaultConfigurationContainer.class,
            configurationResolver,
            instantiator,
            domainObjectContext,
            listenerManager,
            metaDataProvider);
}
 
Example #10
Source File: PrebuiltLibraryInitializer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public PrebuiltLibraryInitializer(Instantiator instantiator,
                                  Collection<? extends Platform> allPlatforms, Collection<? extends BuildType> allBuildTypes, Collection<? extends Flavor> allFlavors) {
    this.instantiator = instantiator;
    this.allPlatforms.addAll(allPlatforms);
    this.allBuildTypes.addAll(allBuildTypes);
    this.allFlavors.addAll(allFlavors);
}
 
Example #11
Source File: DefaultTaskArtifactStateRepository.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultTaskArtifactStateRepository(TaskHistoryRepository taskHistoryRepository, Instantiator instantiator,
                                          FileCollectionSnapshotter outputFilesSnapshotter, FileCollectionSnapshotter inputFilesSnapshotter) {
    this.taskHistoryRepository = taskHistoryRepository;
    this.instantiator = instantiator;
    this.outputFilesSnapshotter = outputFilesSnapshotter;
    this.inputFilesSnapshotter = inputFilesSnapshotter;
}
 
Example #12
Source File: DefaultDependencyManagementServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
BaseRepositoryFactory createBaseRepositoryFactory(LocalMavenRepositoryLocator localMavenRepositoryLocator, Instantiator instantiator, FileResolver fileResolver,
                                                  RepositoryTransportFactory repositoryTransportFactory, LocallyAvailableResourceFinder<ModuleComponentArtifactMetaData> locallyAvailableResourceFinder,
                                                  ResolverStrategy resolverStrategy, ArtifactIdentifierFileStore artifactIdentifierFileStore) {
    return new DefaultBaseRepositoryFactory(
            localMavenRepositoryLocator,
            fileResolver,
            instantiator,
            repositoryTransportFactory,
            locallyAvailableResourceFinder,
            resolverStrategy,
            artifactIdentifierFileStore
    );
}
 
Example #13
Source File: NativeComponentModelPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #14
Source File: BuildScopeServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected SettingsProcessor createSettingsProcessor() {
    return new PropertiesLoadingSettingsProcessor(
            new ScriptEvaluatingSettingsProcessor(
                    get(ScriptPluginFactory.class),
                    get(ScriptHandlerFactory.class),
                    new SettingsFactory(
                            get(Instantiator.class),
                            get(ServiceRegistryFactory.class)
                    ),
                    get(IGradlePropertiesLoader.class)),
            get(IGradlePropertiesLoader.class));
}
 
Example #15
Source File: DependencyClassPathNotationParser.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DependencyClassPathNotationParser(Instantiator instantiator, ClassPathRegistry classPathRegistry,
                                         FileResolver fileResolver) {
    super(DependencyFactory.ClassPathNotation.class);

    this.instantiator = instantiator;
    this.classPathRegistry = classPathRegistry;
    this.fileResolver = fileResolver;
}
 
Example #16
Source File: DefaultIvyPublication.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultIvyPublication(
        String name, Instantiator instantiator, IvyPublicationIdentity publicationIdentity, NotationParser<Object, IvyArtifact> ivyArtifactNotationParser,
        ProjectDependencyPublicationResolver projectDependencyResolver
) {
    this.name = name;
    this.publicationIdentity = publicationIdentity;
    this.projectDependencyResolver = projectDependencyResolver;
    configurations = instantiator.newInstance(DefaultIvyConfigurationContainer.class, instantiator);
    ivyArtifacts = instantiator.newInstance(DefaultIvyArtifactSet.class, name, ivyArtifactNotationParser);
    ivyDependencies = instantiator.newInstance(DefaultIvyDependencySet.class);
    descriptor = instantiator.newInstance(DefaultIvyModuleDescriptor.class, this);
}
 
Example #17
Source File: AbstractGccCompatibleToolChain.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
AbstractGccCompatibleToolChain(String name, OperatingSystem operatingSystem, FileResolver fileResolver, ExecActionFactory execActionFactory, ToolSearchPath tools, CompilerMetaDataProvider metaDataProvider, Instantiator instantiator) {
    super(name, operatingSystem, fileResolver);
    this.execActionFactory = execActionFactory;
    this.toolSearchPath = tools;
    this.metaDataProvider = metaDataProvider;
    this.instantiator = instantiator;

    target(new ToolChainDefaultArchitecture());
    target(new Intel32Architecture());
    target(new Intel64Architecture());
    configInsertLocation = 0;
}
 
Example #18
Source File: DefaultDependencyManagementServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
ConfigurationContainerInternal createConfigurationContainer(Instantiator instantiator, ConfigurationResolver configurationResolver, DomainObjectContext domainObjectContext,
                                                            ListenerManager listenerManager, DependencyMetaDataProvider metaDataProvider) {
    return instantiator.newInstance(DefaultConfigurationContainer.class,
            configurationResolver,
            instantiator,
            domainObjectContext,
            listenerManager,
            metaDataProvider);
}
 
Example #19
Source File: ModuleMappingPluginResolver.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ModuleMappingPluginResolver(String name, DependencyResolutionServices dependencyResolutionServices, Instantiator instantiator, Mapper mapper, Action<? super RepositoryHandler> repositoriesConfigurer) {
    this.name = name;
    this.dependencyResolutionServices = dependencyResolutionServices;
    this.instantiator = instantiator;
    this.mapper = mapper;
    this.repositoriesConfigurer = repositoriesConfigurer;
}
 
Example #20
Source File: DefaultConfigurationContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultConfigurationContainer(ConfigurationResolver resolver,
                                     Instantiator instantiator, DomainObjectContext context, ListenerManager listenerManager,
                                     DependencyMetaDataProvider dependencyMetaDataProvider) {
    super(Configuration.class, instantiator, new Configuration.Namer());
    this.resolver = resolver;
    this.instantiator = instantiator;
    this.context = context;
    this.listenerManager = listenerManager;
    this.dependencyMetaDataProvider = dependencyMetaDataProvider;
}
 
Example #21
Source File: DefaultCopySpec.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultCopySpec(FileResolver resolver, Instantiator instantiator) {
    this.fileResolver = resolver;
    this.instantiator = instantiator;
    sourcePaths = new LinkedHashSet<Object>();
    childSpecs = new ArrayList<CopySpecInternal>();
    patternSet = new PatternSet();
    duplicatesStrategy = null;
}
 
Example #22
Source File: PluginResolverFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public PluginResolverFactory(PluginRegistry pluginRegistry, Instantiator instantiator, DependencyManagementServices dependencyManagementServices, FileResolver fileResolver, DependencyMetaDataProvider dependencyMetaDataProvider, DocumentationRegistry documentationRegistry, CacheRepository cacheRepository) {
    this.pluginRegistry = pluginRegistry;
    this.instantiator = instantiator;
    this.dependencyManagementServices = dependencyManagementServices;
    this.fileResolver = fileResolver;
    this.dependencyMetaDataProvider = dependencyMetaDataProvider;
    this.documentationRegistry = documentationRegistry;
    this.cacheRepository = cacheRepository;
}
 
Example #23
Source File: DefaultTestLoggingContainer.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultTestLoggingContainer(Instantiator instantiator) {
    for (LogLevel level: LogLevel.values()) {
        perLevelTestLogging.put(level, instantiator.newInstance(DefaultTestLogging.class));
    }

    setEvents(EnumSet.of(TestLogEvent.FAILED));
    setExceptionFormat(TestExceptionFormat.SHORT);

    getInfo().setEvents(EnumSet.of(TestLogEvent.FAILED, TestLogEvent.SKIPPED, TestLogEvent.STANDARD_OUT, TestLogEvent.STANDARD_ERROR));
    getInfo().setStackTraceFilters(EnumSet.of(TestStackTraceFilter.TRUNCATE));

    getDebug().setEvents(EnumSet.allOf(TestLogEvent.class));
    getDebug().setMinGranularity(0);
    getDebug().setStackTraceFilters(EnumSet.noneOf(TestStackTraceFilter.class));
}
 
Example #24
Source File: DefaultFileOperations.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public DefaultFileOperations(FileResolver fileResolver, TaskResolver taskResolver, TemporaryFileProvider temporaryFileProvider, Instantiator instantiator, FileLookup fileLookup) {
    this.fileResolver = fileResolver;
    this.taskResolver = taskResolver;
    this.temporaryFileProvider = temporaryFileProvider;
    this.instantiator = instantiator;
    this.deleteAction = new DeleteActionImpl(fileResolver);
    this.resourceHandler = new DefaultResourceHandler(this, temporaryFileProvider);
    fileCopier = new FileCopier(this.instantiator, this.fileResolver, fileLookup);
    fileSystem = fileLookup.getFileSystem();
}
 
Example #25
Source File: DefaultNamedDomainObjectSet.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public DefaultNamedDomainObjectSet(Class<? extends T> type, Instantiator instantiator) {
    this(type, instantiator, Named.Namer.forType(type));
}
 
Example #26
Source File: ClientModuleNotationParserFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public ClientModuleNotationParserFactory(Instantiator instantiator) {
    this.instantiator = instantiator;
}
 
Example #27
Source File: DefaultDependencyManagementServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
DefaultComponentModuleMetadataHandler createComponentModuleMetadataHandler(Instantiator instantiator) {
    return instantiator.newInstance(DefaultComponentModuleMetadataHandler.class);
}
 
Example #28
Source File: DefaultDependencyManagementServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
RepositoryHandler createRepositoryHandler(Instantiator instantiator, BaseRepositoryFactory baseRepositoryFactory) {
    return instantiator.newInstance(DefaultRepositoryHandler.class, baseRepositoryFactory, instantiator);
}
 
Example #29
Source File: EarPlugin.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
@Inject
public EarPlugin(Instantiator instantiator, FileResolver fileResolver) {
    this.instantiator = instantiator;
    this.fileResolver = fileResolver;
}
 
Example #30
Source File: VisualStudioSolutionRegistry.java    From pushfish-android with BSD 2-Clause "Simplified" License 4 votes vote down vote up
public VisualStudioSolutionRegistry(FileResolver fileResolver, VisualStudioProjectResolver projectResolver, Instantiator instantiator) {
    super(DefaultVisualStudioSolution.class, instantiator);
    this.fileResolver = fileResolver;
    this.projectResolver = projectResolver;
}