Java Code Examples for org.gradle.StartParameter

The following examples show how to use org.gradle.StartParameter. 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
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 2
public void configure(BuildExecutionContext context) {
    StartParameter startParameter = context.getGradle().getStartParameter();

    if (!startParameter.getTaskNames().isEmpty()) {
        context.proceed();
        return;
    }

    // Gather the default tasks from this first group project
    ProjectInternal project = context.getGradle().getDefaultProject();
    List<String> defaultTasks = project.getDefaultTasks();
    if (defaultTasks.size() == 0) {
        defaultTasks = Arrays.asList(ImplicitTasksConfigurer.HELP_TASK);
        LOGGER.info("No tasks specified. Using default task {}", GUtil.toString(defaultTasks));
    } else {
        LOGGER.info("No tasks specified. Using project default tasks {}", GUtil.toString(defaultTasks));
    }

    startParameter.setTaskNames(defaultTasks);
    context.proceed();
}
 
Example 3
private Runnable runBuildInSingleUseDaemon(StartParameter startParameter, DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    //(SF) this is a workaround until this story is completed. I'm hardcoding setting the idle timeout to be max X mins.
    //this way we avoid potential runaway daemons that steal resources on linux and break builds on windows.
    //We might leave that in if we decide it's a good idea for an extra safety net.
    int maxTimeout = 2 * 60 * 1000;
    if (daemonParameters.getIdleTimeout() > maxTimeout) {
        daemonParameters.setIdleTimeout(maxTimeout);
    }
    //end of workaround.

    // Create a client that will not match any existing daemons, so it will always startup a new one
    ServiceRegistry clientSharedServices = createGlobalClientServices();
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createSingleUseDaemonClientServices(loggingServices.get(OutputEventListener.class), daemonParameters, System.in);
    DaemonClient client = clientServices.get(DaemonClient.class);
    return daemonBuildAction(startParameter, daemonParameters, client);
}
 
Example 4
ClassPath createBuildSourceClasspath(StartParameter startParameter) {
    assert startParameter.getCurrentDir() != null && startParameter.getBuildFile() == null;

    LOGGER.debug("Starting to build the build sources.");
    if (!startParameter.getCurrentDir().isDirectory()) {
        LOGGER.debug("Gradle source dir does not exist. We leave.");
        return new DefaultClassPath();
    }
    LOGGER.info("================================================" + " Start building buildSrc");

    // If we were not the most recent version of Gradle to build the buildSrc dir, then do a clean build
    // Otherwise, just to a regular build
    final PersistentCache buildSrcCache = createCache(startParameter);
    try {
        GradleLauncher gradleLauncher = buildGradleLauncher(startParameter);
        try {
            return buildSrcCache.useCache("rebuild buildSrc", new BuildSrcUpdateFactory(buildSrcCache, gradleLauncher, new BuildSrcBuildListenerFactory()));
        } finally {
            gradleLauncher.stop();
        }
    } finally {
        // This isn't quite right. We should not unlock the classes until we're finished with them, and the classes may be used across multiple builds
        buildSrcCache.close();
    }
}
 
Example 5
ResolveIvyFactory createResolveIvyFactory(StartParameter startParameter, ModuleVersionsCache moduleVersionsCache, ModuleMetaDataCache moduleMetaDataCache, ModuleArtifactsCache moduleArtifactsCache,
                                          ArtifactAtRepositoryCachedArtifactIndex artifactAtRepositoryCachedArtifactIndex, CacheLockingManager cacheLockingManager,
                                          BuildCommencedTimeProvider buildCommencedTimeProvider, InMemoryDependencyMetadataCache inMemoryDependencyMetadataCache,
                                          VersionMatcher versionMatcher, LatestStrategy latestStrategy) {
    StartParameterResolutionOverride startParameterResolutionOverride = new StartParameterResolutionOverride(startParameter);
    return new ResolveIvyFactory(
            moduleVersionsCache,
            moduleMetaDataCache,
            moduleArtifactsCache,
            artifactAtRepositoryCachedArtifactIndex,
            cacheLockingManager,
            startParameterResolutionOverride,
            buildCommencedTimeProvider,
            inMemoryDependencyMetadataCache,
            versionMatcher,
            latestStrategy);
}
 
Example 6
public BaseSettings(ServiceRegistryFactory serviceRegistryFactory, GradleInternal gradle,
                    ClassLoaderScope classLoaderScope, ClassLoaderScope rootClassLoaderScope, File settingsDir,
                    ScriptSource settingsScript, StartParameter startParameter) {
    this.gradle = gradle;
    this.rootClassLoaderScope = rootClassLoaderScope;
    this.settingsDir = settingsDir;
    this.settingsScript = settingsScript;
    this.startParameter = startParameter;
    this.classLoaderScope = classLoaderScope;
    ServiceRegistry services = serviceRegistryFactory.createFor(this);
    this.plugins = services.get(PluginContainer.class);
    this.fileResolver = services.get(FileResolver.class);
    this.scriptPluginFactory = services.get(ScriptPluginFactory.class);
    this.scriptHandlerFactory = services.get(ScriptHandlerFactory.class);
    this.projectDescriptorRegistry = services.get(ProjectDescriptorRegistry.class);
    rootProjectDescriptor = createProjectDescriptor(null, settingsDir.getName(), settingsDir);
}
 
Example 7
public SettingsInternal findAndLoadSettings(GradleInternal gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    SettingsInternal settings = findSettingsAndLoadIfAppropriate(gradle, startParameter);

    ProjectSpec spec = ProjectSpecs.forStartParameter(startParameter, settings);

    if (spec.containsProject(settings.getProjectRegistry())) {
        setDefaultProject(spec, settings);
        return settings;
    }

    // Try again with empty settings
    StartParameter noSearchParameter = startParameter.newInstance();
    noSearchParameter.useEmptySettings();
    settings = findSettingsAndLoadIfAppropriate(gradle, noSearchParameter);

    // Set explicit build file, if required
    if (noSearchParameter.getBuildFile() != null) {
        ProjectDescriptor rootProject = settings.getRootProject();
        rootProject.setBuildFileName(noSearchParameter.getBuildFile().getName());
    }
    setDefaultProject(spec, settings);

    return settings;
}
 
Example 8
public Project createProject(String name, File inputProjectDir) {
    File projectDir = prepareProjectDir(inputProjectDir);

    final File homeDir = new File(projectDir, "gradleHome");

    StartParameter startParameter = new StartParameter();
    startParameter.setGradleUserHomeDir(new File(projectDir, "userHome"));

    ServiceRegistry topLevelRegistry = new TestBuildScopeServices(GLOBAL_SERVICES, startParameter, homeDir);
    GradleInternal gradle = new DefaultGradle(null, startParameter, topLevelRegistry.get(ServiceRegistryFactory.class));

    DefaultProjectDescriptor projectDescriptor = new DefaultProjectDescriptor(null, name, projectDir, new DefaultProjectDescriptorRegistry(),
            topLevelRegistry.get(FileResolver.class));
    ClassLoaderScope baseScope = gradle.getClassLoaderScope();
    ClassLoaderScope rootProjectScope = baseScope.createChild();
    ProjectInternal project = topLevelRegistry.get(IProjectFactory.class).createProject(projectDescriptor, null, gradle, rootProjectScope, baseScope);

    gradle.setRootProject(project);
    gradle.setDefaultProject(project);

    return project;
}
 
Example 9
public DefaultGradle(Gradle parent, StartParameter startParameter, ServiceRegistryFactory parentRegistry) {
    this.parent = parent;
    this.startParameter = startParameter;
    this.services = parentRegistry.createFor(this);
    this.listenerManager = services.get(ListenerManager.class);
    taskGraph = services.get(TaskGraphExecuter.class);
    distributionLocator = services.get(GradleDistributionLocator.class);
    classLoaderScope = services.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope();
    pluginContainer = services.get(PluginContainer.class);
    fileResolver = services.get(FileResolver.class);
    scriptPluginFactory = services.get(ScriptPluginFactory.class);
    scriptHandlerFactory = services.get(ScriptHandlerFactory.class);
    buildListenerBroadcast = listenerManager.createAnonymousBroadcaster(BuildListener.class);
    projectEvaluationListenerBroadcast = listenerManager.createAnonymousBroadcaster(ProjectEvaluationListener.class);
    buildListenerBroadcast.add(new BuildAdapter() {
        @Override
        public void projectsLoaded(Gradle gradle) {
            rootProjectActions.execute(rootProject);
            rootProjectActions = null;
        }
    });
}
 
Example 10
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 11
Source Project: gradle-metrics-plugin   Source File: GradleParameters.java    License: Apache License 2.0 6 votes vote down vote up
public static GradleParameters fromGradle(org.gradle.api.invocation.Gradle gradle) {
    StartParameter start = gradle.getStartParameter();
    List<KeyValue> projectProperties = KeyValue.mapToKeyValueList(start.getProjectProperties());
    return new GradleParameters(start.getTaskRequests(),
            start.getExcludedTaskNames(),
            start.isBuildProjectDependencies(),
            start.getCurrentDir(),
            start.getProjectDir(),
            projectProperties,
            start.getGradleUserHomeDir(),
            start.getSettingsFile(),
            start.getBuildFile(),
            start.getInitScripts(),
            start.isDryRun(),
            start.isRerunTasks(),
            start.isProfile(),
            start.isContinueOnFailure(),
            start.isOffline(),
            start.getProjectCacheDir(),
            start.isRefreshDependencies(),
            start.getMaxWorkerCount(),
            start.isConfigureOnDemand()
    );
}
 
Example 12
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 13
public StartParameter convert(Map<String, String> properties, StartParameter startParameter) {
    startParameter.setConfigureOnDemand(isTrue(properties.get(GradleProperties.CONFIGURE_ON_DEMAND_PROPERTY)));

    String parallel = properties.get(GradleProperties.PARALLEL_PROPERTY);
    if (isTrue(parallel)) {
        startParameter.setParallelThreadCount(-1);
    }
    return startParameter;
}
 
Example 14
public Runnable createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
    BuildLayoutParameters layout = new BuildLayoutParameters();
    layoutConverter.convert(commandLine, layout);

    Map<String, String> properties = new HashMap<String, String>();
    layoutToPropertiesConverter.convert(layout, properties);
    propertiesConverter.convert(commandLine, properties);

    StartParameter startParameter = new StartParameter();
    propertiesToStartParameterConverter.convert(properties, startParameter);
    commandLineConverter.convert(commandLine, startParameter);

    DaemonParameters daemonParameters = new DaemonParameters(layout, startParameter.getSystemPropertiesArgs());
    propertiesToDaemonParametersConverter.convert(properties, daemonParameters);
    daemonConverter.convert(commandLine, daemonParameters);

    if (commandLine.hasOption(STOP)) {
        return stopAllDaemons(daemonParameters, loggingServices);
    }
    if (commandLine.hasOption(FOREGROUND)) {
        ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
                daemonParameters.getUid(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout());
        return new ForegroundDaemonAction(loggingServices, conf);
    }
    if (daemonParameters.isEnabled()) {
        return runBuildWithDaemon(startParameter, daemonParameters, loggingServices);
    }
    if (canUseCurrentProcess(daemonParameters)) {
        return runBuildInProcess(startParameter, daemonParameters, loggingServices);
    }
    return runBuildInSingleUseDaemon(startParameter, daemonParameters, loggingServices);
}
 
Example 15
private Runnable runBuildWithDaemon(StartParameter startParameter, DaemonParameters daemonParameters, ServiceRegistry loggingServices) {
    // Create a client that will match based on the daemon startup parameters.
    ServiceRegistry clientSharedServices = createGlobalClientServices();
    ServiceRegistry clientServices = clientSharedServices.get(DaemonClientFactory.class).createBuildClientServices(loggingServices.get(OutputEventListener.class), daemonParameters, System.in);
    DaemonClient client = clientServices.get(DaemonClient.class);
    return daemonBuildAction(startParameter, daemonParameters, client);
}
 
Example 16
public DefaultGradleLauncher newInstance(StartParameter startParameter, BuildCancellationToken cancellationToken) {
    BuildRequestMetaData requestMetaData;
    if (tracker.getCurrentBuild() != null) {
        requestMetaData = new DefaultBuildRequestMetaData(tracker.getCurrentBuild().getServices().get(BuildClientMetaData.class), System.currentTimeMillis());
    } else {
        requestMetaData = new DefaultBuildRequestMetaData(System.currentTimeMillis());
    }
    return doNewInstance(startParameter, cancellationToken, requestMetaData);
}
 
Example 17
public PluginResolutionServiceResolver(
        PluginResolutionServiceClient portalClient,
        Instantiator instantiator,
        VersionMatcher versionMatcher, StartParameter startParameter,
        ClassLoaderScope parentScope, Factory<DependencyResolutionServices> dependencyResolutionServicesFactory
) {
    this.portalClient = portalClient;
    this.instantiator = instantiator;
    this.versionMatcher = versionMatcher;
    this.startParameter = startParameter;
    this.parentScope = parentScope;
    this.dependencyResolutionServicesFactory = dependencyResolutionServicesFactory;
}
 
Example 18
PluginResolutionServiceResolver createPluginResolutionServiceResolver(PluginResolutionServiceClient pluginResolutionServiceClient, Instantiator instantiator, VersionMatcher versionMatcher, StartParameter startParameter, final DependencyManagementServices dependencyManagementServices, final FileResolver fileResolver, final DependencyMetaDataProvider dependencyMetaDataProvider, ClassLoaderScopeRegistry classLoaderScopeRegistry) {
    final ProjectFinder projectFinder = new ProjectFinder() {
        public ProjectInternal getProject(String path) {
            throw new UnknownProjectException("Cannot use project dependencies in a plugin resolution definition.");
        }
    };

    return new PluginResolutionServiceResolver(pluginResolutionServiceClient, instantiator, versionMatcher, startParameter, classLoaderScopeRegistry.getCoreScope(), new Factory<DependencyResolutionServices>() {
        public DependencyResolutionServices create() {
            return dependencyManagementServices.create(fileResolver, dependencyMetaDataProvider, projectFinder, new BasicDomainObjectContext());
        }
    });
}
 
Example 19
public StartParameter convert(Map<String, String> properties, StartParameter startParameter) {
    startParameter.setConfigureOnDemand(isTrue(properties.get(GradleProperties.CONFIGURE_ON_DEMAND_PROPERTY)));

    String parallel = properties.get(GradleProperties.PARALLEL_PROPERTY);
    if (isTrue(parallel)) {
        startParameter.setParallelThreadCount(-1);
    }
    return startParameter;
}
 
Example 20
protected Factory<WorkerProcessBuilder> createWorkerProcessFactory(StartParameter startParameter, MessagingServer messagingServer, ClassPathRegistry classPathRegistry,
                                                                   FileResolver fileResolver) {
    return new DefaultWorkerProcessFactory(
            startParameter.getLogLevel(),
            messagingServer,
            classPathRegistry,
            fileResolver,
            new LongIdGenerator());
}
 
Example 21
public Action<? super ExecutionListener> createAction(CommandLineParser parser, ParsedCommandLine commandLine) {
    BuildLayoutParameters layout = new BuildLayoutParameters();
    layoutConverter.convert(commandLine, layout);

    Map<String, String> properties = new HashMap<String, String>();
    layoutToPropertiesConverter.convert(layout, properties);
    propertiesConverter.convert(commandLine, properties);

    StartParameter startParameter = new StartParameter();
    propertiesToStartParameterConverter.convert(properties, startParameter);
    commandLineConverter.convert(commandLine, startParameter);

    DaemonParameters daemonParameters = new DaemonParameters(layout);
    propertiesToDaemonParametersConverter.convert(properties, daemonParameters);
    daemonConverter.convert(commandLine, daemonParameters);

    if (commandLine.hasOption(STOP)) {
        return stopAllDaemons(daemonParameters, loggingServices);
    }
    if (commandLine.hasOption(FOREGROUND)) {
        ForegroundDaemonConfiguration conf = new ForegroundDaemonConfiguration(
                daemonParameters.getUid(), daemonParameters.getBaseDir(), daemonParameters.getIdleTimeout());
        return Actions.toAction(new ForegroundDaemonMain(conf));
    }
    if (daemonParameters.isEnabled()) {
        return runBuildWithDaemon(startParameter, daemonParameters, loggingServices);
    }
    if (canUseCurrentProcess(daemonParameters)) {
        return runBuildInProcess(startParameter, daemonParameters, loggingServices);
    }
    return runBuildInSingleUseDaemon(startParameter, daemonParameters, loggingServices);
}
 
Example 22
protected Factory<WorkerProcessBuilder> createWorkerProcessFactory(StartParameter startParameter, MessagingServer messagingServer, ClassPathRegistry classPathRegistry,
                                                                   FileResolver fileResolver) {
    return new DefaultWorkerProcessFactory(
            startParameter.getLogLevel(),
            messagingServer,
            classPathRegistry,
            fileResolver,
            new LongIdGenerator());
}
 
Example 23
public void configure(BuildExecutionContext context) {
    StartParameter param = context.getGradle().getStartParameter();
    List<String> taskNames = param.getTaskNames();
    ProjectInternal project = context.getGradle().getDefaultProject();

    if (param.getTaskNames().isEmpty()) {
        //so that we don't miss out default tasks
        project.evaluate();
    }

    for (String path : taskNames) {
        evaluator.evaluateByPath(project, path);
    }
    context.proceed();
}
 
Example 24
PersistentCache createCache(StartParameter startParameter) {
    return cacheRepository
            .cache(new File(startParameter.getCurrentDir(), ".gradle/noVersion/buildSrc"))
            .withCrossVersionCache()
            .withDisplayName("buildSrc state cache")
            .withLockOptions(mode(FileLockManager.LockMode.None).useCrossVersionImplementation())
            .withProperties(Collections.singletonMap("gradle.version", GradleVersion.current().getVersion()))
            .open();
}
 
Example 25
private GradleLauncher buildGradleLauncher(StartParameter startParameter) {
    final StartParameter startParameterArg = startParameter.newInstance();
    startParameterArg.setProjectProperties(startParameter.getProjectProperties());
    startParameterArg.setSearchUpwards(false);
    startParameterArg.setProfile(startParameter.isProfile());
    return gradleLauncherFactory.newInstance(startParameterArg, cancellationToken);
}
 
Example 26
public SettingsInternal process(GradleInternal gradle,
                                SettingsLocation settingsLocation,
                                ClassLoaderScope baseClassLoaderScope,
                                StartParameter startParameter) {
    Clock settingsProcessingClock = new Clock();
    Map<String, String> properties = propertiesLoader.mergeProperties(Collections.<String, String>emptyMap());
    SettingsInternal settings = settingsFactory.createSettings(gradle, settingsLocation.getSettingsDir(),
            settingsLocation.getSettingsScriptSource(), properties, startParameter, baseClassLoaderScope);
    applySettingsScript(settingsLocation, settings);
    logger.debug("Timing: Processing settings took: {}", settingsProcessingClock.getTime());
    return settings;
}
 
Example 27
/**
 * Finds the settings.gradle for the given startParameter, and loads it if contains the project selected by the
 * startParameter, or if the startParameter explicitly specifies a settings script.  If the settings file is not
 * loaded (executed), then a null is returned.
 */
private SettingsInternal findSettingsAndLoadIfAppropriate(GradleInternal gradle,
                                                          StartParameter startParameter) {
    SettingsLocation settingsLocation = findSettings(startParameter);

    // We found the desired settings file, now build the associated buildSrc before loading settings.  This allows
    // the settings script to reference classes in the buildSrc.
    StartParameter buildSrcStartParameter = startParameter.newBuild();
    buildSrcStartParameter.setCurrentDir(new File(settingsLocation.getSettingsDir(), BaseSettings.DEFAULT_BUILD_SRC_DIR));
    ClassLoaderScope buildSourceClassLoader = buildSourceBuilder.buildAndCreateClassLoader(buildSrcStartParameter);

    return settingsProcessor.process(gradle, settingsLocation, buildSourceClassLoader, startParameter);
}
 
Example 28
PluginResolutionServiceResolver createPluginResolutionServiceResolver(PluginResolutionServiceClient pluginResolutionServiceClient, Instantiator instantiator, VersionMatcher versionMatcher, StartParameter startParameter, final DependencyManagementServices dependencyManagementServices, final FileResolver fileResolver, final DependencyMetaDataProvider dependencyMetaDataProvider, ClassLoaderScopeRegistry classLoaderScopeRegistry) {
    final ProjectFinder projectFinder = new ProjectFinder() {
        public ProjectInternal getProject(String path) {
            throw new UnknownProjectException("Cannot use project dependencies in a plugin resolution definition.");
        }
    };

    return new PluginResolutionServiceResolver(pluginResolutionServiceClient, instantiator, versionMatcher, startParameter, classLoaderScopeRegistry.getCoreScope(), new Factory<DependencyResolutionServices>() {
        public DependencyResolutionServices create() {
            return dependencyManagementServices.create(fileResolver, dependencyMetaDataProvider, projectFinder, new BasicDomainObjectContext());
        }
    });
}
 
Example 29
public StartParameter convert(Map<String, String> properties, StartParameter startParameter) {
    startParameter.setConfigureOnDemand(isTrue(properties.get(GradleProperties.CONFIGURE_ON_DEMAND_PROPERTY)));

    String parallel = properties.get(GradleProperties.PARALLEL_PROPERTY);
    if (isTrue(parallel)) {
        startParameter.setParallelThreadCount(-1);
    }
    return startParameter;
}
 
Example 30
void loadProperties(File settingsDir, StartParameter startParameter, Map<String, String> systemProperties, Map<String, String> envProperties) {
    defaultProperties.clear();
    overrideProperties.clear();
    addGradleProperties(defaultProperties, new File(settingsDir, Project.GRADLE_PROPERTIES));
    addGradleProperties(overrideProperties, new File(startParameter.getGradleUserHomeDir(), Project.GRADLE_PROPERTIES));
    setSystemProperties(startParameter.getSystemPropertiesArgs());
    overrideProperties.putAll(getEnvProjectProperties(envProperties));
    overrideProperties.putAll(getSystemProjectProperties(systemProperties));
    overrideProperties.putAll(startParameter.getProjectProperties());
}