org.gradle.StartParameter Java Examples

The following examples show how to use org.gradle.StartParameter. 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: 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 #2
Source File: BuildSourceBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #3
Source File: DependencyManagementBuildScopeServices.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #4
Source File: ProjectBuilderImpl.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #5
Source File: SettingsHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #6
Source File: DefaultGradle.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #7
Source File: BaseSettings.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #8
Source File: BuildActionsFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #9
Source File: DefaultTasksBuildExecutionAction.java    From pushfish-android with BSD 2-Clause "Simplified" License 6 votes vote down vote up
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 #10
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 #11
Source File: GradleParameters.java    From gradle-metrics-plugin with 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
Source File: TaskExecutionServices.java    From Pushjet-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 #13
Source File: BuildActionsFactory.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #14
Source File: ProjectEvaluatingAction.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #15
Source File: BuildSourceBuilder.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #16
Source File: BuildSourceBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #17
Source File: ScriptEvaluatingSettingsProcessor.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #18
Source File: SettingsHandler.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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 #19
Source File: PluginUsePluginServiceRegistry.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #20
Source File: PropertiesToStartParameterConverter.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #21
Source File: PropertiesToStartParameterConverter.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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 #22
Source File: DefaultGradlePropertiesLoader.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
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());
}
 
Example #23
Source File: SettingsHandler.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
/**
 * 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 loadSettings(gradle, settingsLocation, buildSourceClassLoader.createRebasedChild(), startParameter);
}
 
Example #24
Source File: SettingsFactory.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public SettingsInternal createSettings(GradleInternal gradle, File settingsDir, ScriptSource settingsScript,
                                       Map<String, String> gradleProperties, StartParameter startParameter,
                                       ClassLoaderScope rootClassLoaderScope) {

    DefaultSettings settings = instantiator.newInstance(DefaultSettings.class,
            serviceRegistryFactory, gradle, rootClassLoaderScope.createChild(), rootClassLoaderScope, settingsDir, settingsScript, startParameter
    );

    DynamicObject dynamicObject = ((DynamicObjectAware) settings).getAsDynamicObject();
    ((ExtensibleDynamicObject) dynamicObject).addProperties(gradleProperties);
    return settings;
}
 
Example #25
Source File: BuildSourceBuilder.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public ClassLoaderScope buildAndCreateClassLoader(StartParameter startParameter) {
    ClassPath classpath = createBuildSourceClasspath(startParameter);
    if (classpath.isEmpty()) {
        return classLoaderScope;
    } else {
        ClassLoaderScope childScope = classLoaderScope.createChild();
        childScope.export(classpath);
        childScope.lock();
        return childScope;
    }
}
 
Example #26
Source File: DependencyManagementBuildScopeServices.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
DependencyFactory createDependencyFactory(Instantiator instantiator,
                                          ProjectAccessListener projectAccessListener,
                                          StartParameter startParameter,
                                          ClassPathRegistry classPathRegistry,
                                          FileLookup fileLookup) {
    DefaultProjectDependencyFactory factory = new DefaultProjectDependencyFactory(
            projectAccessListener, instantiator, startParameter.isBuildProjectDependencies());

    ProjectDependencyFactory projectDependencyFactory = new ProjectDependencyFactory(factory);
    DependencyProjectNotationParser projParser = new DependencyProjectNotationParser(factory);

    NotationParser<Object, ? extends Dependency> moduleMapParser = new DependencyMapNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> moduleStringParser = new DependencyStringNotationParser<DefaultExternalModuleDependency>(instantiator, DefaultExternalModuleDependency.class);
    NotationParser<Object, ? extends Dependency> selfResolvingDependencyFactory = new DependencyFilesNotationParser(instantiator);

    List<NotationParser<Object, ? extends Dependency>> notationParsers = Arrays.asList(
            moduleStringParser,
            moduleMapParser,
            selfResolvingDependencyFactory,
            projParser,
            new DependencyClassPathNotationParser(instantiator, classPathRegistry, fileLookup.getFileResolver()));

    return new DefaultDependencyFactory(
            new DependencyNotationParser(notationParsers),
            new ClientModuleNotationParserFactory(instantiator).create(),
            projectDependencyFactory);
}
 
Example #27
Source File: RunBuildAction.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
public RunBuildAction(BuildActionExecuter<BuildActionParameters> executer, StartParameter startParameter, File currentDir, BuildClientMetaData clientMetaData, long startTime, Map<?, ?> systemProperties, Map<String, String> envVariables) {
    this.executer = executer;
    this.startParameter = startParameter;
    this.currentDir = currentDir;
    this.clientMetaData = clientMetaData;
    this.startTime = startTime;
    this.systemProperties = new HashMap<String, String>();
    GUtil.addToMap(this.systemProperties, systemProperties);
    this.envVariables = envVariables;
}
 
Example #28
Source File: BuildScopeServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected CacheRepository createCacheRepository() {
    CacheFactory factory = get(CacheFactory.class);
    StartParameter startParameter = get(StartParameter.class);
    DefaultCacheScopeMapping scopeMapping = new DefaultCacheScopeMapping(startParameter.getGradleUserHomeDir(), startParameter.getProjectCacheDir(), GradleVersion.current());
    return new DefaultCacheRepository(
            scopeMapping,
            factory);
}
 
Example #29
Source File: BuildScopeServices.java    From pushfish-android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
protected Factory<WorkerProcessBuilder> createWorkerProcessFactory(StartParameter startParameter, MessagingServer messagingServer, ClassPathRegistry classPathRegistry,
                                                                   FileResolver fileResolver) {
    return new DefaultWorkerProcessFactory(
            startParameter.getLogLevel(),
            messagingServer,
            classPathRegistry,
            fileResolver,
            new LongIdGenerator());
}
 
Example #30
Source File: DefaultBuildConfigurer.java    From Pushjet-Android with BSD 2-Clause "Simplified" License 5 votes vote down vote up
private void maybeInformAboutIncubatingMode(StartParameter startParameter) {
    if (startParameter.getParallelThreadCount() != 0 && startParameter.isConfigureOnDemand()) {
        SingleMessageLogger.incubatingFeatureUsed("Parallel execution with configuration on demand");
    } else if (startParameter.getParallelThreadCount() != 0) {
        SingleMessageLogger.incubatingFeatureUsed("Parallel execution");
    } else if (startParameter.isConfigureOnDemand()) {
        SingleMessageLogger.incubatingFeatureUsed("Configuration on demand");
    }
}