Java Code Examples for org.gradle.internal.reflect.Instantiator

The following examples show how to use org.gradle.internal.reflect.Instantiator. 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 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
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 3
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
@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 5
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 6
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 7
public DefaultTaskArtifactStateRepository(TaskHistoryRepository taskHistoryRepository, Instantiator instantiator,
                                          FileCollectionSnapshotter outputFilesSnapshotter, FileCollectionSnapshotter inputFilesSnapshotter) {
    this.taskHistoryRepository = taskHistoryRepository;
    this.instantiator = instantiator;
    this.outputFilesSnapshotter = outputFilesSnapshotter;
    this.inputFilesSnapshotter = inputFilesSnapshotter;
}
 
Example 8
Source Project: pushfish-android   Source File: Copy.java    License: 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 9
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 10
@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 11
public DependencyClassPathNotationParser(Instantiator instantiator, ClassPathRegistry classPathRegistry,
                                         FileResolver fileResolver) {
    super(DependencyFactory.ClassPathNotation.class);

    this.instantiator = instantiator;
    this.classPathRegistry = classPathRegistry;
    this.fileResolver = fileResolver;
}
 
Example 12
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 13
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 14
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 15
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 16
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 17
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 18
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 19
ConfigurationContainerInternal createConfigurationContainer(Instantiator instantiator, ConfigurationResolver configurationResolver, DomainObjectContext domainObjectContext,
                                                            ListenerManager listenerManager, DependencyMetaDataProvider metaDataProvider) {
    return instantiator.newInstance(DefaultConfigurationContainer.class,
            configurationResolver,
            instantiator,
            domainObjectContext,
            listenerManager,
            metaDataProvider);
}
 
Example 20
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 21
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 22
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 23
ConfigurationContainerInternal createConfigurationContainer(Instantiator instantiator, ConfigurationResolver configurationResolver, DomainObjectContext domainObjectContext,
                                                            ListenerManager listenerManager, DependencyMetaDataProvider metaDataProvider) {
    return instantiator.newInstance(DefaultConfigurationContainer.class,
            configurationResolver,
            instantiator,
            domainObjectContext,
            listenerManager,
            metaDataProvider);
}
 
Example 24
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 25
public ReflectiveNamedDomainObjectFactory(Class<? extends T> type, Instantiator instantiator, Object... extraArgs) {
    this.type = type;
    this.instantiator = instantiator;
    this.extraArgs = extraArgs;
}
 
Example 26
public static Instantiator get() {
    Stack<Instantiator> stack = getStack();
    return stack.empty() ? null : stack.peek(); 
}
 
Example 27
@Inject
protected Instantiator getInstantiator() {
    throw new UnsupportedOperationException();
}
 
Example 28
public NativeExecutableSpecFactory(Instantiator instantiator, ProjectSourceSet sources, Project project) {
    this.instantiator = instantiator;
    this.sources = sources;
    this.project = project;
}
 
Example 29
public DefaultFlavorContainer(Instantiator instantiator) {
    super(Flavor.class, instantiator);
}
 
Example 30
protected AbstractNamedDomainObjectContainer(Class<? extends T> type, Instantiator instantiator) {
    super(type, instantiator, Named.Namer.forType(type));
}