Java 类org.gradle.api.invocation.Gradle 实例源码

项目:Reer    文件:EclipsePlugin.java   
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates all Eclipse files.");
    getCleanTask().setDescription("Cleans all Eclipse files.");

    EclipseModel model = project.getExtensions().create("eclipse", EclipseModel.class);

    configureEclipseProject(project, model);
    configureEclipseJdt(project, model);
    configureEclipseClasspath(project, model);

    postProcess("eclipse", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });

    applyEclipseWtpPluginOnWebProjects(project);
}
项目:Reer    文件:GradleBuildBuilder.java   
private DefaultGradleBuild convert(Gradle gradle) {
    DefaultGradleBuild model = new DefaultGradleBuild();
    Map<Project, BasicGradleProject> convertedProjects = new LinkedHashMap<Project, BasicGradleProject>();

    Project rootProject = gradle.getRootProject();
    BasicGradleProject convertedRootProject = convert(rootProject, convertedProjects);
    model.setRootProject(convertedRootProject);

    for (Project project : rootProject.getAllprojects()) {
        model.addProject(convertedProjects.get(project));
    }

    for (IncludedBuild includedBuild : gradle.getIncludedBuilds()) {
        Gradle includedGradle = ((IncludedBuildInternal) includedBuild).getConfiguredBuild();
        DefaultGradleBuild convertedIncludedBuild = convert(includedGradle);
        model.addIncludedBuild(convertedIncludedBuild);
    }
    return model;
}
项目:Reer    文件:IdeaPlugin.java   
@Override
protected void onApply(Project project) {
    getLifecycleTask().setDescription("Generates IDEA project files (IML, IPR, IWS)");
    getCleanTask().setDescription("Cleans IDEA project files (IML, IPR)");

    ideaModel = project.getExtensions().create("idea", IdeaModel.class);

    configureIdeaWorkspace(project);
    configureIdeaProject(project);
    configureIdeaModule(project);
    configureForJavaPlugin(project);
    configureForScalaPlugin();
    postProcess("idea", new Action<Gradle>() {
        @Override
        public void execute(Gradle gradle) {
            performPostEvaluationActions();
        }
    });
}
项目:Reer    文件:DefaultCacheScopeMapping.java   
@Override
public File getRootDirectory(@Nullable Object scope) {
    if (scope == null) {
        return globalCacheDir;
    }
    if (scope instanceof Gradle) {
        Gradle gradle = (Gradle) scope;
        return getBuildCacheDir(gradle.getRootProject());
    }
    if (scope instanceof Project) {
        Project project = (Project) scope;
        return getBuildCacheDir(project.getRootProject());
    }
    if (scope instanceof Task) {
        Task task = (Task) scope;
        return getBuildCacheDir(task.getProject().getRootProject());
    }
    throw new IllegalArgumentException(String.format("Don't know how to determine the cache directory for scope of type %s.", scope.getClass().getSimpleName()));
}
项目:gradle-project-config    文件:AbstractProjectConfigPlugin.java   
/**
 * @see org.gradle.api.Plugin#apply(java.lang.Object)
 */
@Override
public void apply(Project project) {
    this.project = project;

    if (VersionNumber.parse(project.getGradle().getGradleVersion()).compareTo(MIN_GRADLE_VERSION) < 0) {
        throw new GradleException(format("Base project plugin requires Gradle %s or higher", MIN_GRADLE_VERSION));
    }

    getLogger().info("Applying plugin {} to {}", this, getProject());

    initialize();

    getProject().afterEvaluate(p -> configure());

    getProject().getGradle().addBuildListener(new BuildAdapter() {
        @Override
        public void projectsEvaluated(@Nullable Gradle gradle) {
            complete();
        }
    });
}
项目:Pushjet-Android    文件:DefaultGradle.java   
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;
        }
    });
}
项目:Pushjet-Android    文件:DefaultCacheScopeMapping.java   
public File getBaseDirectory(Object scope, String key, CacheBuilder.VersionStrategy versionStrategy) {
    if (key.equalsIgnoreCase("projects") || key.equalsIgnoreCase("tasks") || !key.matches("\\p{Alpha}+[-//.\\w]*")) {
        throw new IllegalArgumentException(String.format("Unsupported cache key '%s'.", key));
    }
    if (scope == null) {
        return getCacheDir(globalCacheDir, versionStrategy, key);
    }
    if (scope instanceof Gradle) {
        Gradle gradle = (Gradle) scope;
        return getCacheDir(getBuildCacheDir(gradle.getRootProject()), versionStrategy, key);
    }
    if (scope instanceof Project) {
        Project project = (Project) scope;
        return getCacheDir(getBuildCacheDir(project.getRootProject()), versionStrategy, String.format("projects/%s/%s", project.getPath().replace(':', '_'), key));
    }
    if (scope instanceof Task) {
        Task task = (Task) scope;
        return getCacheDir(getBuildCacheDir(task.getProject().getRootProject()), versionStrategy, String.format("tasks/%s/%s", task.getPath().replace(':', '_'), key));
    }
    throw new IllegalArgumentException(String.format("Don't know how to determine the cache directory for scope of type %s.", scope.getClass().getSimpleName()));
}
项目:Pushjet-Android    文件:DefaultGradle.java   
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(ClassLoaderScope.class);
    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;
        }
    });
}
项目:Pushjet-Android    文件:DefaultCacheScopeMapping.java   
public File getBaseDirectory(Object scope, String key, CacheBuilder.VersionStrategy versionStrategy) {
    if (key.equalsIgnoreCase("projects") || key.equalsIgnoreCase("tasks") || !key.matches("\\p{Alpha}+[-//.\\w]*")) {
        throw new IllegalArgumentException(String.format("Unsupported cache key '%s'.", key));
    }
    if (scope == null) {
        return getCacheDir(globalCacheDir, versionStrategy, key);
    }
    if (scope instanceof Gradle) {
        Gradle gradle = (Gradle) scope;
        return getCacheDir(getBuildCacheDir(gradle.getRootProject()), versionStrategy, key);
    }
    if (scope instanceof Project) {
        Project project = (Project) scope;
        return getCacheDir(getBuildCacheDir(project.getRootProject()), versionStrategy, String.format("projects/%s/%s", project.getPath().replace(':', '_'), key));
    }
    if (scope instanceof Task) {
        Task task = (Task) scope;
        return getCacheDir(getBuildCacheDir(task.getProject().getRootProject()), versionStrategy, String.format("tasks/%s/%s", task.getPath().replace(':', '_'), key));
    }
    throw new IllegalArgumentException(String.format("Don't know how to determine the cache directory for scope of type %s.", scope.getClass().getSimpleName()));
}
项目:Reer    文件:ScalaBasePlugin.java   
private static void configureScalaCompile(final Project project, JavaBasePlugin javaPlugin, final SourceSet sourceSet) {
    String taskName = sourceSet.getCompileTaskName("scala");
    final ScalaCompile scalaCompile = project.getTasks().create(taskName, ScalaCompile.class);
    scalaCompile.dependsOn(sourceSet.getCompileJavaTaskName());
    javaPlugin.configureForSourceSet(sourceSet, scalaCompile);
    Convention scalaConvention = (Convention) InvokerHelper.getProperty(sourceSet, "convention");
    ScalaSourceSet scalaSourceSet = scalaConvention.findPlugin(ScalaSourceSet.class);
    scalaCompile.setDescription("Compiles the " + scalaSourceSet.getScala() + ".");
    scalaCompile.setSource(scalaSourceSet.getScala());
    project.getTasks().getByName(sourceSet.getClassesTaskName()).dependsOn(taskName);

    // cannot use convention mapping because the resulting object won't be serializable
    // cannot compute at task execution time because we need association with source set
    project.getGradle().addBuildListener(new BuildAdapter() {
        @Override
        public void projectsEvaluated(Gradle gradle) {
            IncrementalCompileOptions incrementalOptions = scalaCompile.getScalaCompileOptions().getIncrementalOptions();
            if (incrementalOptions.getAnalysisFile() == null) {
                String analysisFilePath = project.getBuildDir().getPath() + "/tmp/scala/compilerAnalysis/" + scalaCompile.getName() + ".analysis";
                incrementalOptions.setAnalysisFile(new File(analysisFilePath));
            }

            if (incrementalOptions.getPublishedCode() == null) {
                Jar jarTask = (Jar) project.getTasks().findByName(sourceSet.getJarTaskName());
                incrementalOptions.setPublishedCode(jarTask == null ? null : jarTask.getArchivePath());
            }
        }
    });
}
项目:Reer    文件:IPCUtilities.java   
/**
 * This starts a gradle client for doing regular execution of a command. It expects the port number to set as a system property. Note: this is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle object.
 */
public static void invokeExecuteGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    ExecuteGradleCommandClientProtocol protocol = new ExecuteGradleCommandClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Reer    文件:IPCUtilities.java   
/**
 * This gets the port out of the start parameters. Why? Because this is meant to be run from the init script and the system properties haven't been set yet. That is due to how gradle is run from
 * the bat file/shell script. It has to manually set the java system properties (-D). I don't this is a desired side-effect.
 *
 * @param gradle the gradle object
 * @return an integer or null if we didn't get the port.
 */
private static Integer getPort(Gradle gradle) {
    String portText = gradle.getStartParameter().getSystemPropertiesArgs().get(ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY);
    if (portText == null) {
        LOGGER.error("Failed to set " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property");
        return null;
    }

    try {
        return Integer.parseInt(portText);
    } catch (NumberFormatException e) {
        LOGGER.error("Invalid " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property", e);
        return null;
    }
}
项目:Reer    文件:IPCUtilities.java   
/**
 * This starts a gradle client that sends a task list back to the server. It expects the port number to set as a system property. You probably should be executing the "tasks" command. Note: this
 * is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle launcher object.
 */
public static void invokeTaskListGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    TaskListClientProtocol protocol = new TaskListClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Reer    文件:GradleBuildComparison.java   
public GradleBuildComparison(
        ComparableGradleBuildExecuter sourceBuildExecuter,
        ComparableGradleBuildExecuter targetBuildExecuter,
        Logger logger,
        ProgressLogger progressLogger,
        Gradle gradle) {
    this.sourceBuildExecuter = sourceBuildExecuter;
    this.targetBuildExecuter = targetBuildExecuter;
    this.logger = logger;
    this.progressLogger = progressLogger;
    this.gradle = gradle;
}
项目:Reer    文件:EclipsePlugin.java   
private static void configureScalaDependencies(final Project project, final GenerateEclipseClasspath task) {
    project.getPlugins().withType(ScalaBasePlugin.class, new Action<ScalaBasePlugin>() {
        @Override
        public void execute(ScalaBasePlugin scalaBasePlugin) {
            task.getClasspath().containers("org.scala-ide.sdt.launching.SCALA_CONTAINER");

            // exclude the dependencies already provided by SCALA_CONTAINER; prevents problems with Eclipse Scala plugin
            project.getGradle().addBuildListener(new BuildAdapter() {
                @Override
                public void projectsEvaluated(Gradle gradle) {
                    final List<String> provided = Lists.newArrayList("scala-library", "scala-swing", "scala-dbc");
                    Predicate<Dependency> dependencyInProvided = new Predicate<Dependency>() {
                        @Override
                        public boolean apply(Dependency dependency) {
                            return provided.contains(dependency.getName());
                        }

                    };
                    List<Dependency> dependencies = Lists.newArrayList(Iterables.filter(Iterables.concat(Iterables.transform(task.getClasspath().getPlusConfigurations(), new Function<Configuration, Iterable<Dependency>>() {
                        @Override
                        public Iterable<Dependency> apply(Configuration config) {
                            return config.getAllDependencies();
                        }

                    })), dependencyInProvided));
                    if (!dependencies.isEmpty()) {
                        task.getClasspath().getMinusConfigurations().add(project.getConfigurations().detachedConfiguration(dependencies.toArray(new Dependency[0])));
                    }
                }
            });
        }

    });
}
项目:Reer    文件:IdePlugin.java   
/**
 * Executes the provided Action after all projects have been evaluated.
 * Action will only be added once per provided key. Any subsequent calls for the same key will be ignored.
 * This permits the plugin to be applied in multiple subprojects, with the postprocess action executed once only.
 */
protected void postProcess(String key, final Action<? super Gradle> action) {
    Project rootProject = project.getRootProject();
    ExtraPropertiesExtension rootExtraProperties = rootProject.getExtensions().getByType(ExtraPropertiesExtension.class);
    String extraPropertyName = "org.gradle." + key + ".postprocess.applied";
    if (!rootExtraProperties.has(extraPropertyName)) {
        project.getGradle().addBuildListener(new BuildAdapter() {
            @Override
            public void projectsEvaluated(Gradle gradle) {
                action.execute(gradle);
            }
        });
        rootExtraProperties.set(extraPropertyName, true);
    }
}
项目:Reer    文件:IdeaScalaConfigurer.java   
public void configure() {
    rootProject.getGradle().addBuildListener(new BuildAdapter() {
        public void projectsEvaluated(Gradle gradle) {
            VersionNumber ideaTargetVersion = findIdeaTargetVersion();
            final boolean useScalaSdk = ideaTargetVersion == null || IDEA_VERSION_WHEN_SCALA_SDK_WAS_INTRODUCED.compareTo(ideaTargetVersion) <= 0;
            final Collection<Project> scalaProjects = findProjectsApplyingIdeaAndScalaPlugins();
            final Map<String, ProjectLibrary> scalaCompilerLibraries = Maps.newHashMap();
            rootProject.getTasks().getByName("ideaProject").doFirst(new Action<Task>() {
                @Override
                public void execute(Task task) {
                    if (scalaProjects.size() > 0) {
                        scalaCompilerLibraries.clear();
                        scalaCompilerLibraries.putAll(resolveScalaCompilerLibraries(scalaProjects, useScalaSdk));
                        declareUniqueProjectLibraries(Sets.newLinkedHashSet(scalaCompilerLibraries.values()));
                    }
                }
            });
            rootProject.configure(scalaProjects, new Action<Project>() {
                @Override
                public void execute(final Project project) {
                    project.getExtensions().getByType(IdeaModel.class).getModule().getIml().withXml(new Action<XmlProvider>() {
                        @Override
                        public void execute(XmlProvider xmlProvider) {
                            if (useScalaSdk) {
                                declareScalaSdk(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
                            } else {
                                declareScalaFacet(scalaCompilerLibraries.get(project.getPath()), xmlProvider.asNode());
                            }
                        }
                    });
                }
            });
        }
    });
}
项目:Reer    文件:DefaultDeploymentRegistry.java   
@Override
public void onNewBuild(Gradle gradle) {
    lock.lock();
    try {
        for (DeploymentHandle handle : handles.values()) {
            handle.onNewBuild(gradle);
        }
    } finally {
        lock.unlock();
    }
}
项目:Reer    文件:DefaultTaskHistoryStore.java   
public DefaultTaskHistoryStore(Gradle gradle, CacheRepository cacheRepository, InMemoryTaskArtifactCache inMemoryTaskArtifactCache) {
    this.inMemoryTaskArtifactCache = inMemoryTaskArtifactCache;
    cache = cacheRepository
            .cache(gradle, "taskArtifacts")
            .withDisplayName("task history cache")
            .withLockOptions(mode(FileLockManager.LockMode.None)) // Lock on demand
            .open();
}
项目:Reer    文件:DefaultGradle.java   
public DefaultGradle(GradleInternal parent, StartParameter startParameter, ServiceRegistryFactory parentRegistry) {
    this.parent = parent;
    this.startParameter = startParameter;
    this.services = parentRegistry.createFor(this);
    classLoaderScope = services.get(ClassLoaderScopeRegistry.class).getCoreAndPluginsScope();
    buildListenerBroadcast = getListenerManager().createAnonymousBroadcaster(BuildListener.class);
    projectEvaluationListenerBroadcast = getListenerManager().createAnonymousBroadcaster(ProjectEvaluationListener.class);
    buildListenerBroadcast.add(new BuildAdapter() {
        @Override
        public void projectsLoaded(Gradle gradle) {
            rootProjectActions.execute(rootProject);
            rootProjectActions = null;
        }
    });
}
项目:Reer    文件:BuildLogger.java   
public void buildStarted(Gradle gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    logger.info("Starting Build");
    logger.debug("Gradle user home: {}", startParameter.getGradleUserHomeDir());
    logger.debug("Current dir: {}", startParameter.getCurrentDir());
    logger.debug("Settings file: {}", startParameter.getSettingsFile());
    logger.debug("Build file: {}", startParameter.getBuildFile());
}
项目:Reer    文件:PlayApplicationDeploymentHandle.java   
@Override
public void onNewBuild(Gradle gradle) {
    gradle.addBuildListener(new BuildAdapter() {
        @Override
        public void buildFinished(BuildResult result) {
            reloadFromResult(result);
        }
    });
}
项目:xmvn    文件:XMvnGradlePlugin.java   
@Override
public void apply( Gradle gradle )
{
    gradle.allprojects( project -> {
        configureRepositories( project.getRepositories() );
        configureRepositories( project.getBuildscript().getRepositories() );

        Task upload = project.getTasks().create( "xmvnInstall", XMvnInstallTask.class );
        upload.setDescription( "Installs all artifacts through XMvn" );
        upload.setGroup( "upload" );
    } );
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This starts a gradle client for doing regular execution of a command. It expects the port number to set as a system property. Note: this is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle object.
 */
public static void invokeExecuteGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    ExecuteGradleCommandClientProtocol protocol = new ExecuteGradleCommandClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This gets the port out of the start parameters. Why? Because this is meant to be run from the init script and the system properties haven't been set yet. That is due to how gradle is run from
 * the bat file/shell script. It has to manually set the java system properties (-D). I don't this is a desired side-effect.
 *
 * @param gradle the gradle object
 * @return an integer or null if we didn't get the port.
 */
private static Integer getPort(Gradle gradle) {
    String portText = gradle.getStartParameter().getSystemPropertiesArgs().get(ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY);
    if (portText == null) {
        LOGGER.error("Failed to set " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property");
        return null;
    }

    try {
        return Integer.parseInt(portText);
    } catch (NumberFormatException e) {
        LOGGER.error("Invalid " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property", e);
        return null;
    }
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This starts a gradle client that sends a task list back to the server. It expects the port number to set as a system property. You probably should be executing the "tasks" command. Note: this
 * is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle launcher object.
 */
public static void invokeTaskListGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    TaskListClientProtocol protocol = new TaskListClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Pushjet-Android    文件:GradleBuildComparison.java   
public GradleBuildComparison(
        ComparableGradleBuildExecuter sourceBuildExecuter,
        ComparableGradleBuildExecuter targetBuildExecuter,
        Logger logger,
        ProgressLogger progressLogger,
        Gradle gradle) {
    this.sourceBuildExecuter = sourceBuildExecuter;
    this.targetBuildExecuter = targetBuildExecuter;
    this.logger = logger;
    this.progressLogger = progressLogger;
    this.gradle = gradle;
}
项目:Pushjet-Android    文件:DefaultTaskArtifactStateCacheAccess.java   
public DefaultTaskArtifactStateCacheAccess(Gradle gradle, CacheRepository cacheRepository, CacheDecorator decorator) {
    this.inMemoryDecorator = decorator;
    cache = cacheRepository
            .cache(gradle, "taskArtifacts")
            .withDisplayName("task history cache")
            .withLockOptions(mode(FileLockManager.LockMode.None)) // Lock on demand
            .open();
}
项目:Pushjet-Android    文件:TaskExecutionLogger.java   
private String getDisplayName(Task task) {
    Gradle build = task.getProject().getGradle();
    if (build.getParent() == null) {
        // The main build, use the task path
        return task.getPath();
    }
    // A nested build, use a discriminator
    return Project.PATH_SEPARATOR + build.getRootProject().getName() + task.getPath();
}
项目:Pushjet-Android    文件:TaskExecutionServices.java   
TaskArtifactStateCacheAccess createCacheAccess(Gradle gradle, CacheRepository cacheRepository, InMemoryTaskArtifactCache inMemoryTaskArtifactCache, GradleBuildEnvironment environment) {
    CacheDecorator decorator;
    if (environment.isLongLivingProcess()) {
        decorator = inMemoryTaskArtifactCache;
    } else {
        decorator = new NoOpDecorator();
    }
    return new DefaultTaskArtifactStateCacheAccess(gradle, cacheRepository, decorator);
}
项目:Pushjet-Android    文件:BuildLogger.java   
public void buildStarted(Gradle gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    logger.info("Starting Build");
    logger.debug("Gradle user home: " + startParameter.getGradleUserHomeDir());
    logger.debug("Current dir: " + startParameter.getCurrentDir());
    logger.debug("Settings file: " + startParameter.getSettingsFile());
    logger.debug("Build file: " + startParameter.getBuildFile());
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This starts a gradle client for doing regular execution of a command. It expects the port number to set as a system property. Note: this is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle object.
 */
public static void invokeExecuteGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    ExecuteGradleCommandClientProtocol protocol = new ExecuteGradleCommandClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This gets the port out of the start parameters. Why? Because this is meant to be run from the init script and the system properties haven't been set yet. That is due to how gradle is run from
 * the bat file/shell script. It has to manually set the java system properties (-D). I don't this is a desired side-effect.
 *
 * @param gradle the gradle object
 * @return an integer or null if we didn't get the port.
 */
private static Integer getPort(Gradle gradle) {
    String portText = gradle.getStartParameter().getSystemPropertiesArgs().get(ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY);
    if (portText == null) {
        LOGGER.error("Failed to set " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property");
        return null;
    }

    try {
        return Integer.parseInt(portText);
    } catch (NumberFormatException e) {
        LOGGER.error("Invalid " + ProtocolConstants.PORT_NUMBER_SYSTEM_PROPERTY + " system property", e);
        return null;
    }
}
项目:Pushjet-Android    文件:IPCUtilities.java   
/**
 * This starts a gradle client that sends a task list back to the server. It expects the port number to set as a system property. You probably should be executing the "tasks" command. Note: this
 * is using gradle to find the port. See getPort().
 *
 * @param gradle the gradle launcher object.
 */
public static void invokeTaskListGradleClient(Gradle gradle) {
    Integer port = getPort(gradle);
    if (port == null) {
        return;
    }

    TaskListClientProtocol protocol = new TaskListClientProtocol(gradle);
    GradleClient client = new GradleClient();
    client.start(protocol, port);
}
项目:Pushjet-Android    文件:GradleBuildComparison.java   
public GradleBuildComparison(
        ComparableGradleBuildExecuter sourceBuildExecuter,
        ComparableGradleBuildExecuter targetBuildExecuter,
        Logger logger,
        ProgressLogger progressLogger,
        Gradle gradle) {
    this.sourceBuildExecuter = sourceBuildExecuter;
    this.targetBuildExecuter = targetBuildExecuter;
    this.logger = logger;
    this.progressLogger = progressLogger;
    this.gradle = gradle;
}
项目:Pushjet-Android    文件:DefaultTaskArtifactStateCacheAccess.java   
public DefaultTaskArtifactStateCacheAccess(Gradle gradle, CacheRepository cacheRepository, CacheDecorator decorator) {
    this.inMemoryDecorator = decorator;
    cache = cacheRepository
            .cache(gradle, "taskArtifacts")
            .withDisplayName("task history cache")
            .withLockOptions(mode(FileLockManager.LockMode.None)) // Lock on demand
            .open();
}
项目:Pushjet-Android    文件:TaskExecutionLogger.java   
private String getDisplayName(Task task) {
    Gradle build = task.getProject().getGradle();
    if (build.getParent() == null) {
        // The main build, use the task path
        return task.getPath();
    }
    // A nested build, use a discriminator
    return Project.PATH_SEPARATOR + build.getRootProject().getName() + task.getPath();
}
项目:Pushjet-Android    文件:TaskExecutionServices.java   
TaskArtifactStateCacheAccess createCacheAccess(Gradle gradle, CacheRepository cacheRepository, InMemoryTaskArtifactCache inMemoryTaskArtifactCache, GradleBuildEnvironment environment) {
    CacheDecorator decorator;
    if (environment.isLongLivingProcess()) {
        decorator = inMemoryTaskArtifactCache;
    } else {
        decorator = new NoOpDecorator();
    }
    return new DefaultTaskArtifactStateCacheAccess(gradle, cacheRepository, decorator);
}
项目:Pushjet-Android    文件:BuildLogger.java   
public void buildStarted(Gradle gradle) {
    StartParameter startParameter = gradle.getStartParameter();
    logger.info("Starting Build");
    logger.debug("Gradle user home: " + startParameter.getGradleUserHomeDir());
    logger.debug("Current dir: " + startParameter.getCurrentDir());
    logger.debug("Settings file: " + startParameter.getSettingsFile());
    logger.debug("Build file: " + startParameter.getBuildFile());
}
项目:gradle-metrics-plugin    文件:MetricsPlugin.java   
private void configureRootProjectCollectors(Project rootProject) {
    Gradle gradle = rootProject.getGradle();
    final GradleCollector gradleCollector = new GradleCollector(dispatcherSupplier);
    gradle.addListener(gradleCollector);
    gradle.buildFinished(new Closure(null) {
        protected Object doCall(Object arguments) {
            gradleCollector.buildFinishedClosure((BuildResult)arguments);
            return null;
        }
    });
}