Java 类org.gradle.api.internal.project.ProjectInternal 实例源码

项目:Reer    文件:JavaBasePlugin.java   
public void apply(ProjectInternal project) {
    project.getPluginManager().apply(BasePlugin.class);
    project.getPluginManager().apply(ReportingBasePlugin.class);
    project.getPluginManager().apply(LanguageBasePlugin.class);
    project.getPluginManager().apply(BinaryBasePlugin.class);

    JavaPluginConvention javaConvention = new JavaPluginConvention(project, instantiator);
    project.getConvention().getPlugins().put("java", javaConvention);

    configureCompileDefaults(project, javaConvention);
    BridgedBinaries binaries = configureSourceSetDefaults(javaConvention);

    modelRegistry.register(ModelRegistrations.bridgedInstance(ModelReference.of("bridgedBinaries", BridgedBinaries.class), binaries)
        .descriptor("JavaBasePlugin.apply()")
        .hidden(true)
        .build());

    configureJavaDoc(project, javaConvention);
    configureTest(project, javaConvention);
    configureBuildNeeded(project);
    configureBuildDependents(project);
}
项目:Reer    文件:OsgiPlugin.java   
public void apply(final Project project) {
    project.getPluginManager().apply(JavaBasePlugin.class);

    final OsgiPluginConvention osgiConvention = new OsgiPluginConvention((ProjectInternal) project);
    project.getConvention().getPlugins().put("osgi", osgiConvention);

    project.getPlugins().withType(JavaPlugin.class, new Action<JavaPlugin>() {
        @Override
        public void execute(JavaPlugin javaPlugin) {
            OsgiManifest osgiManifest = osgiConvention.osgiManifest();
            osgiManifest.setClassesDir(project.getConvention().getPlugin(JavaPluginConvention.class).getSourceSets().getByName("main").getOutput().getClassesDir());
            osgiManifest.setClasspath(project.getConfigurations().getByName("runtime"));
            Jar jarTask = (Jar) project.getTasks().getByName("jar");
            jarTask.setManifest(osgiManifest);
        }
    });
}
项目:Reer    文件:DefaultBuildController.java   
private ProjectInternal getTargetProject(Object target) {
    ProjectInternal project;
    if (target == null) {
        project = gradle.getDefaultProject();
    } else if (target instanceof GradleProjectIdentity) {
        GradleProjectIdentity projectIdentity = (GradleProjectIdentity) target;
        GradleInternal build = findBuild(projectIdentity);
        project = findProject(build, projectIdentity);
    } else if (target instanceof GradleBuildIdentity) {
        GradleBuildIdentity buildIdentity = (GradleBuildIdentity) target;
        project = findBuild(buildIdentity).getDefaultProject();
    } else {
        throw new IllegalArgumentException("Don't know how to build models for " + target);
    }
    return project;
}
项目:Reer    文件:DefaultScriptPluginFactory.java   
private ScriptTarget wrap(Object target, boolean isInitialPass) {
    if (target instanceof ProjectInternal && topLevelScript) {
        // Only use this for top level project scripts
        return new ProjectScriptTarget((ProjectInternal) target);
    }
    if (target instanceof GradleInternal && topLevelScript) {
        // Only use this for top level init scripts
        return new InitScriptTarget((GradleInternal) target);
    }
    if (target instanceof SettingsInternal && topLevelScript) {
        // Only use this for top level settings scripts
        if (isInitialPass) {
            return new InitialPassSettingScriptTarget((SettingsInternal) target);
        } else {
            return new SettingScriptTarget((SettingsInternal) target);
        }
    } else {
        return new DefaultScriptTarget(target);
    }
}
项目:Reer    文件:HelpTasksPlugin.java   
@Override
public void apply(final ProjectInternal project) {
    final TaskContainerInternal tasks = project.getTasks();

    // static classes are used for the actions to avoid implicitly dragging project/tasks into the model registry
    String projectName = project.toString();
    tasks.addPlaceholderAction(ProjectInternal.HELP_TASK, Help.class, new HelpAction());
    tasks.addPlaceholderAction(ProjectInternal.PROJECTS_TASK, ProjectReportTask.class, new ProjectReportTaskAction(projectName));
    tasks.addPlaceholderAction(ProjectInternal.TASKS_TASK, TaskReportTask.class, new TaskReportTaskAction(projectName, project.getChildProjects().isEmpty()));
    tasks.addPlaceholderAction(PROPERTIES_TASK, PropertyReportTask.class, new PropertyReportTaskAction(projectName));
    tasks.addPlaceholderAction(DEPENDENCY_INSIGHT_TASK, DependencyInsightReportTask.class, new DependencyInsightReportTaskAction(projectName));
    tasks.addPlaceholderAction(DEPENDENCIES_TASK, DependencyReportTask.class, new DependencyReportTaskAction(projectName));
    tasks.addPlaceholderAction(BuildEnvironmentReportTask.TASK_NAME, BuildEnvironmentReportTask.class, new BuildEnvironmentReportTaskAction(projectName));
    tasks.addPlaceholderAction(COMPONENTS_TASK, ComponentReport.class, new ComponentReportAction(projectName));
    tasks.addPlaceholderAction(MODEL_TASK, ModelReport.class, new ModelReportAction(projectName));
    tasks.addPlaceholderAction(DEPENDENT_COMPONENTS_TASK, DependentComponentsReport.class, new DependentComponentsReportAction(projectName));
}
项目:Reer    文件:ProjectBuilderImpl.java   
public Project createChildProject(String name, Project parent, File projectDir) {
    ProjectInternal parentProject = (ProjectInternal) parent;
    DefaultProject project = CLASS_GENERATOR.newInstance(
            DefaultProject.class,
            name,
            parentProject,
            (projectDir != null) ? projectDir.getAbsoluteFile() : new File(parentProject.getProjectDir(), name),
            new StringScriptSource("test build file", null),
            parentProject.getGradle(),
            parentProject.getGradle().getServiceRegistryFactory(),
            parentProject.getClassLoaderScope().createChild("project-" + name),
            parentProject.getBaseClassLoaderScope()
    );
    parentProject.addChildProject(project);
    parentProject.getProjectRegistry().addProject(project);
    return project;
}
项目:Reer    文件:ProjectBuilderImpl.java   
public Project createProject(String name, File inputProjectDir, File gradleUserHomeDir) {
    File projectDir = prepareProjectDir(inputProjectDir);

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

    StartParameter startParameter = new StartParameter();

    File userHomeDir = gradleUserHomeDir == null ? new File(projectDir, "userHome") : FileUtils.canonicalize(gradleUserHomeDir);
    startParameter.setGradleUserHomeDir(userHomeDir);
    NativeServices.initialize(userHomeDir);

    ServiceRegistry topLevelRegistry = new TestBuildScopeServices(getUserHomeServices(userHomeDir), startParameter, homeDir);
    GradleInternal gradle = CLASS_GENERATOR.newInstance(DefaultGradle.class, 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("root-project");
    ProjectInternal project = topLevelRegistry.get(IProjectFactory.class).createProject(projectDescriptor, null, gradle, rootProjectScope, baseScope);

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

    return project;
}
项目:Reer    文件:TaskSelector.java   
private TaskSelection getSelection(String path, ProjectInternal project) {
    ResolvedTaskPath taskPath = taskPathResolver.resolvePath(path, project);
    ProjectInternal targetProject = taskPath.getProject();
    if (taskPath.isQualified()) {
        configurer.configure(targetProject);
    } else {
        configurer.configureHierarchy(targetProject);
    }

    TaskSelectionResult tasks = taskNameResolver.selectWithName(taskPath.getTaskName(), taskPath.getProject(), !taskPath.isQualified());
    if (tasks != null) {
        // An exact match
        return new TaskSelection(taskPath.getProject().getPath(), path, tasks);
    }

    Map<String, TaskSelectionResult> tasksByName = taskNameResolver.selectAll(taskPath.getProject(), !taskPath.isQualified());
    NameMatcher matcher = new NameMatcher();
    String actualName = matcher.find(taskPath.getTaskName(), tasksByName.keySet());
    if (actualName != null) {
        return new TaskSelection(taskPath.getProject().getPath(), taskPath.getPrefix() + actualName, tasksByName.get(actualName));
    }

    throw new TaskSelectionException(matcher.formatErrorMessage("task", taskPath.getProject()));
}
项目:Reer    文件:JavaScriptMinify.java   
@Override
public void visitFile(final FileVisitDetails fileDetails) {
    final File outputFileDir = new File(destinationDir, fileDetails.getRelativePath().getParent().getPathString());

    // Copy the raw form
    FileOperations fileOperations = (ProjectInternal) getProject();
    fileOperations.copy(new Action<CopySpec>() {
        @Override
        public void execute(CopySpec copySpec) {
            copySpec.from(fileDetails.getFile()).into(outputFileDir);
        }
    });

    // Capture the relative file
    relativeFiles.add(new RelativeFile(fileDetails.getFile(), fileDetails.getRelativePath()));
}
项目:Reer    文件:TaskSelector.java   
public Spec<Task> getFilter(String path) {
    final ResolvedTaskPath taskPath = taskPathResolver.resolvePath(path, gradle.getDefaultProject());
    if (!taskPath.isQualified()) {
        ProjectInternal targetProject = taskPath.getProject();
        configurer.configure(targetProject);
        if (taskNameResolver.tryFindUnqualifiedTaskCheaply(taskPath.getTaskName(), taskPath.getProject())) {
            // An exact match in the target project - can just filter tasks by path to avoid configuring sub-projects at this point
            return new TaskPathSpec(targetProject, taskPath.getTaskName());
        }
    }

    final Set<Task> selectedTasks = getSelection(path, gradle.getDefaultProject()).getTasks();
    return new Spec<Task>() {
        public boolean isSatisfiedBy(Task element) {
            return !selectedTasks.contains(element);
        }
    };
}
项目:Reer    文件:ProjectFinderByTaskPath.java   
public ProjectInternal findProject(String projectPath, ProjectInternal startFrom) {
    if (projectPath.equals(Project.PATH_SEPARATOR)) {
        return startFrom.getRootProject();
    }
    Project current = startFrom;
    if (projectPath.startsWith(Project.PATH_SEPARATOR)) {
        current = current.getRootProject();
        projectPath = projectPath.substring(1);
    }
    for (String pattern : projectPath.split(Project.PATH_SEPARATOR)) {
        Map<String, Project> children = current.getChildProjects();

        NameMatcher matcher = new NameMatcher();
        Project child = matcher.find(pattern, children);
        if (child != null) {
            current = child;
            continue;
        }

        throw new ProjectLookupException(matcher.formatErrorMessage("project", current));
    }

    return (ProjectInternal) current;
}
项目:Reer    文件:LifecycleBasePlugin.java   
@Override
public void apply(ProjectInternal project) {
    addClean(project);
    addCleanRule(project);
    addAssemble(project);
    addCheck(project);
    addBuild(project);
    addDeprecationWarningsAboutCustomLifecycleTasks(project);
}
项目:Reer    文件:LifecycleBasePlugin.java   
private void addClean(final ProjectInternal project) {
    addPlaceholderAction(project, CLEAN_TASK_NAME, Delete.class, new Action<Delete>() {
        @Override
        public void execute(Delete clean) {
            clean.setDescription("Deletes the build directory.");
            clean.setGroup(BUILD_GROUP);
            clean.delete(new Callable<File>() {
                public File call() throws Exception {
                    return project.getBuildDir();
                }
            });
        }
    });
}
项目:Reer    文件:LifecycleBasePlugin.java   
private void addAssemble(ProjectInternal project) {
    addPlaceholderAction(project, ASSEMBLE_TASK_NAME, DefaultTask.class, new Action<TaskInternal>() {
        @Override
        public void execute(TaskInternal assembleTask) {
            assembleTask.setDescription("Assembles the outputs of this project.");
            assembleTask.setGroup(BUILD_GROUP);
        }
    });
}
项目:Reer    文件:LifecycleBasePlugin.java   
private void addCheck(ProjectInternal project) {
    addPlaceholderAction(project, CHECK_TASK_NAME, DefaultTask.class, new Action<TaskInternal>() {
        @Override
        public void execute(TaskInternal checkTask) {
            checkTask.setDescription("Runs all checks.");
            checkTask.setGroup(VERIFICATION_GROUP);
        }
    });
}
项目:Reer    文件:LifecycleBasePlugin.java   
private void addBuild(final ProjectInternal project) {
    addPlaceholderAction(project, BUILD_TASK_NAME, DefaultTask.class, new Action<DefaultTask>() {
        @Override
        public void execute(DefaultTask buildTask) {
            buildTask.setDescription("Assembles and tests this project.");
            buildTask.setGroup(BUILD_GROUP);
            buildTask.dependsOn(ASSEMBLE_TASK_NAME);
            buildTask.dependsOn(CHECK_TASK_NAME);
        }
    });
}
项目:Reer    文件:LifecycleProjectEvaluator.java   
public void evaluate(final ProjectInternal project, final ProjectStateInternal state) {
    if (state.getExecuted() || state.getExecuting()) {
        return;
    }

    String displayName = "project " + project.getIdentityPath().toString();
    buildOperationExecutor.run(BuildOperationDetails.displayName("Configure " + displayName).name(StringUtils.capitalize(displayName)).build(), new Action<BuildOperationContext>() {
        @Override
        public void execute(BuildOperationContext buildOperationContext) {
            doConfigure(project, state);
            state.rethrowFailure();
        }
    });
}
项目:Reer    文件:AbstractCodeQualityPlugin.java   
@Override
public final void apply(ProjectInternal project) {
    this.project = project;

    beforeApply();
    project.getPluginManager().apply(ReportingBasePlugin.class);
    createConfigurations();
    extension = createExtension();
    configureExtensionRule();
    configureTaskRule();
    configureSourceSetRule();
    configureCheckTask();
}
项目:Reer    文件:MavenPlugin.java   
public void apply(final ProjectInternal project) {
    this.project = project;
    project.getPluginManager().apply(BasePlugin.class);

    MavenFactory mavenFactory = project.getServices().get(MavenFactory.class);
    final MavenPluginConvention pluginConvention = addConventionObject(project, mavenFactory);
    final DefaultDeployerFactory deployerFactory = new DefaultDeployerFactory(
            mavenFactory,
            loggingManagerFactory,
            fileResolver,
            pluginConvention,
            project.getConfigurations(),
            pluginConvention.getConf2ScopeMappings(),
            mavenSettingsProvider,
            mavenRepositoryLocator);

    configureUploadTasks(deployerFactory);
    configureUploadArchivesTask();

    PluginContainer plugins = project.getPlugins();
    plugins.withType(JavaPlugin.class, new Action<JavaPlugin>() {
        public void execute(JavaPlugin javaPlugin) {
            configureJavaScopeMappings(project.getConfigurations(), pluginConvention.getConf2ScopeMappings());
            configureInstall(project);
        }
    });
    plugins.withType(WarPlugin.class, new Action<WarPlugin>() {
        public void execute(WarPlugin warPlugin) {
            configureWarScopeMappings(project.getConfigurations(), pluginConvention.getConf2ScopeMappings());
        }
    });
}
项目:Reer    文件:DefaultBuildController.java   
public BuildResult<?> getModel(Object target, ModelIdentifier modelIdentifier) throws BuildExceptionVersion1, InternalUnsupportedModelException {
    BuildCancellationToken cancellationToken = gradle.getServices().get(BuildCancellationToken.class);
    if (cancellationToken.isCancellationRequested()) {
        throw new BuildCancelledException(String.format("Could not build '%s' model. Build cancelled.", modelIdentifier.getName()));
    }
    ProjectInternal project = getTargetProject(target);
    ToolingModelBuilder builder = getToolingModelBuilder(project, modelIdentifier);
    Object model = builder.buildAll(modelIdentifier.getName(), project);
    return new ProviderBuildResult<Object>(model);
}
项目:Reer    文件:DefaultBuildController.java   
private ToolingModelBuilder getToolingModelBuilder(ProjectInternal project, ModelIdentifier modelIdentifier) {
    ToolingModelBuilderRegistry modelBuilderRegistry = project.getServices().get(ToolingModelBuilderRegistry.class);

    ToolingModelBuilder builder;
    try {
        builder = modelBuilderRegistry.getBuilder(modelIdentifier.getName());
    } catch (UnknownModelException e) {
        throw (InternalUnsupportedModelException) (new InternalUnsupportedModelException()).initCause(e);
    }
    return builder;
}
项目:Reer    文件:TaskPathProjectEvaluator.java   
@Override
public void configureHierarchyFully(ProjectInternal project) {
    configureFully(project);
    for (Project sub : project.getSubprojects()) {
        configureFully((ProjectInternal) sub);
    }
}
项目:Reer    文件:TaskNameResolver.java   
private void collectTaskNames(ProjectInternal project, Set<String> result) {
    discoverTasks(project);
    result.addAll(getTaskNames(project));
    for (Project subProject : project.getChildProjects().values()) {
        collectTaskNames((ProjectInternal) subProject, result);
    }
}
项目:Reer    文件:AntGroovydoc.java   
public void execute(final FileCollection source, File destDir, boolean use, boolean noTimestamp, boolean noVersionStamp,
        String windowTitle, String docTitle, String header, String footer, String overview, boolean includePrivate,
        final Set<Groovydoc.Link> links, final Iterable<File> groovyClasspath, Iterable<File> classpath, Project project) {

    final File tmpDir = new File(project.getBuildDir(), "tmp/groovydoc");
    FileOperations fileOperations = (ProjectInternal) project;
    fileOperations.delete(tmpDir);
    fileOperations.copy(new Action<CopySpec>() {
        public void execute(CopySpec copySpec) {
            copySpec.from(source).into(tmpDir);
        }
    });

    List<File> combinedClasspath = ImmutableList.<File>builder()
        .addAll(classpath)
        .addAll(groovyClasspath)
        .build();

    VersionNumber version = VersionNumber.parse(getGroovyVersion(combinedClasspath));

    final Map<String, Object> args = Maps.newLinkedHashMap();
    args.put("sourcepath", tmpDir.toString());
    args.put("destdir", destDir);
    args.put("use", use);
    if (isAtLeast(version, "2.4.6")) {
        args.put("noTimestamp", noTimestamp);
        args.put("noVersionStamp", noVersionStamp);
    }
    args.put("private", includePrivate);
    putIfNotNull(args, "windowtitle", windowTitle);
    putIfNotNull(args, "doctitle", docTitle);
    putIfNotNull(args, "header", header);
    putIfNotNull(args, "footer", footer);

    if (overview != null) {
        args.put("overview", overview);
    }

    invokeGroovydoc(links, combinedClasspath, args);
}
项目:Reer    文件:GradlePluginLord.java   
/**
 * This will refresh the project/task tree. This version allows you to specify additional arguments to be passed to gradle during the refresh (such as -b to specify a build file)
 *
 * @param additionalCommandLineArguments the arguments to add, or null if none.
 * @return the Request that was created.
 */
public Request addRefreshRequestToQueue(String additionalCommandLineArguments) {
    //we'll request a task list since there is no way to do a no op. We're not really interested
    //in what's being executed, just the ability to get the task list (which must be populated as
    //part of executing anything).
    String fullCommandLine = ProjectInternal.TASKS_TASK;

    if (additionalCommandLineArguments != null) {
        fullCommandLine += ' ' + additionalCommandLineArguments;
    }

    //here we'll give the UI a chance to add things to the command line.
    fullCommandLine = alterCommandLine(fullCommandLine);

    // Don't schedule again if already doing a refresh with the specified arguments
    // TODO - fix this race condition - multiple threads may be requesting a refresh
    List<Request> currentRequests = queueManager.findRequestsOfType(RefreshTaskListRequest.TYPE);
    for (Request currentRequest : currentRequests) {
        if (currentRequest.getFullCommandLine().equals(fullCommandLine)) {
            return currentRequest;
        }
    }

    final RefreshTaskListRequest request = new RefreshTaskListRequest(getNextRequestID(), fullCommandLine, queueManager, this);
    queueManager.addRequestToQueue(request);
    // TODO - fix this race condition - request may already have completed
    requestObserverLord.notifyObservers(new ObserverLord.ObserverNotification<RequestObserver>() {
        public void notify(RequestObserver observer) {
            observer.refreshRequestAdded(request);
        }
    });
    return request;
}
项目:Reer    文件:DefaultProjectLocalComponentProvider.java   
public LocalComponentMetadata getComponent(ProjectComponentIdentifier projectIdentifier) {
    if (!isLocalProject(projectIdentifier)) {
        return null;
    }
    ProjectInternal project = projectRegistry.getProject(projectIdentifier.getProjectPath());
    if (project == null) {
        return null;
    }
    return getLocalComponentMetaData(project);
}
项目:Reer    文件:GradleScopeServices.java   
ServiceRegistryFactory createServiceRegistryFactory(final ServiceRegistry services) {
    final Factory<LoggingManagerInternal> loggingManagerInternalFactory = getFactory(LoggingManagerInternal.class);
    return new ServiceRegistryFactory() {
        public ServiceRegistry createFor(Object domainObject) {
            if (domainObject instanceof ProjectInternal) {
                ProjectScopeServices projectScopeServices = new ProjectScopeServices(services, (ProjectInternal) domainObject, loggingManagerInternalFactory);
                registries.add(projectScopeServices);
                return projectScopeServices;
            }
            throw new UnsupportedOperationException();
        }
    };
}
项目:Reer    文件:DefaultConfiguration.java   
private void markReferencedProjectConfigurationsObserved(final InternalState requestedState) {
    for (ResolvedProjectConfiguration projectResult : cachedResolverResults.getResolvedLocalComponents().getResolvedProjectConfigurations()) {
        if (projectResult.getId().getBuild().isCurrentBuild()) {
            ProjectInternal project = projectFinder.getProject(projectResult.getId().getProjectPath());
            ConfigurationInternal targetConfig = (ConfigurationInternal) project.getConfigurations().getByName(projectResult.getTargetConfiguration());
            targetConfig.markAsObserved(requestedState);
        }
    }
}
项目:Reer    文件:DefaultConfiguration.java   
public ComponentResolveMetadata toRootComponentMetaData() {
    Module module = getModule();
    ComponentIdentifier componentIdentifier = componentIdentifierFactory.createComponentIdentifier(module);
    ModuleVersionIdentifier moduleVersionIdentifier = DefaultModuleVersionIdentifier.newId(module);
    ProjectInternal project = projectFinder.findProject(module.getProjectPath());
    AttributesSchema schema = project == null ? null : project.getAttributesSchema();
    DefaultLocalComponentMetadata metaData = new DefaultLocalComponentMetadata(moduleVersionIdentifier, componentIdentifier, module.getStatus(), schema);
    configurationComponentMetaDataBuilder.addConfigurations(metaData, configurationsProvider.getAll());
    return metaData;
}
项目:Reer    文件:DependencyManagementBuildScopeServices.java   
BuildIdentity createBuildIdentity(ProjectRegistry<ProjectInternal> projectRegistry) {
    ProjectInternal rootProject = projectRegistry.getProject(":");
    if (rootProject == null || rootProject.getGradle().getParent() == null) {
        // BuildIdentity for a top-level build
        return new DefaultBuildIdentity(new DefaultBuildIdentifier(":", true));
    }
    // BuildIdentity for an included build
    // This hard-codes the assumption that buildName == rootProject.name for included builds
    return new DefaultBuildIdentity(new DefaultBuildIdentifier(rootProject.getName(), true));
}
项目:Reer    文件:IncludedBuildDependencySubstitutionsBuilder.java   
private void registerProject(IncludedBuild build, ProjectInternal project) {
    LocalComponentRegistry localComponentRegistry = project.getServices().get(LocalComponentRegistry.class);
    ProjectComponentIdentifier originalIdentifier = newProjectId(project);
    DefaultLocalComponentMetadata originalComponent = (DefaultLocalComponentMetadata) localComponentRegistry.getComponent(originalIdentifier);
    ProjectComponentIdentifier componentIdentifier = newProjectId(build, project.getPath());
    context.registerSubstitution(originalComponent.getId(), componentIdentifier);
}
项目:Reer    文件:IncludedBuildDependencyMetadataBuilder.java   
private void registerProject(IncludedBuild build, ProjectInternal project) {
    LocalComponentRegistry localComponentRegistry = project.getServices().get(LocalComponentRegistry.class);
    ProjectComponentIdentifier originalIdentifier = newProjectId(project);
    DefaultLocalComponentMetadata originalComponent = (DefaultLocalComponentMetadata) localComponentRegistry.getComponent(originalIdentifier);

    ProjectComponentIdentifier componentIdentifier = newProjectId(build, project.getPath());
    LocalComponentMetadata compositeComponent = createCompositeCopy(build, componentIdentifier, originalComponent);

    context.register(componentIdentifier, compositeComponent, project.getProjectDir());
    for (LocalComponentArtifactMetadata artifactMetaData : localComponentRegistry.getAdditionalArtifacts(originalIdentifier)) {
        context.registerAdditionalArtifact(componentIdentifier, createCompositeCopy(componentIdentifier, artifactMetaData));
    }
}
项目:Reer    文件:BuildScriptProcessor.java   
public void execute(ProjectInternal project) {
    LOGGER.info("Evaluating {} using {}.", project, project.getBuildScriptSource().getDisplayName());
    final Timer clock = Timers.startTimer();
    try {
        ScriptPlugin configurer = configurerFactory.create(project.getBuildScriptSource(), project.getBuildscript(), project.getClassLoaderScope(), project.getBaseClassLoaderScope(), true);
        configurer.apply(project);
    } finally {
        LOGGER.debug("Timing: Running the build script took {}", clock.getElapsed());
    }
}
项目:Reer    文件:NativeDependentBinariesResolutionStrategy.java   
public NativeDependentBinariesResolutionStrategy(ProjectRegistry<ProjectInternal> projectRegistry, ProjectModelResolver projectModelResolver) {
    super();
    checkNotNull(projectRegistry, "ProjectRegistry must not be null");
    checkNotNull(projectModelResolver, "ProjectModelResolver must not be null");
    this.projectRegistry = projectRegistry;
    this.projectModelResolver = projectModelResolver;
}
项目:Reer    文件:NativeComponentModelPlugin.java   
@Override
public void apply(final ProjectInternal project) {
    project.getPluginManager().apply(ComponentModelBasePlugin.class);

    project.getExtensions().create("buildTypes", DefaultBuildTypeContainer.class, instantiator);
    project.getExtensions().create("flavors", DefaultFlavorContainer.class, instantiator);
    project.getExtensions().create("toolChains", DefaultNativeToolChainRegistry.class, instantiator);
}
项目:Reer    文件:ProjectReportTask.java   
@Override
protected void generate(Project project) throws IOException {
    BuildClientMetaData metaData = getClientMetaData();

    StyledTextOutput textOutput = getRenderer().getTextOutput();

    render(project, new GraphRenderer(textOutput), true, textOutput);
    if (project.getChildProjects().isEmpty()) {
        textOutput.withStyle(Info).text("No sub-projects");
        textOutput.println();
    }

    textOutput.println();
    textOutput.text("To see a list of the tasks of a project, run ");
    metaData.describeCommand(textOutput.withStyle(UserInput), "<project-path>:" + ProjectInternal.TASKS_TASK);
    textOutput.println();

    textOutput.text("For example, try running ");
    Project exampleProject = project.getChildProjects().isEmpty() ? project : getChildren(project).get(0);
    metaData.describeCommand(textOutput.withStyle(UserInput), exampleProject.absoluteProjectPath(
            ProjectInternal.TASKS_TASK));
    textOutput.println();

    if (project != project.getRootProject()) {
        textOutput.println();
        textOutput.text("To see a list of all the projects in this build, run ");
        metaData.describeCommand(textOutput.withStyle(UserInput), project.getRootProject().absoluteProjectPath(
                ProjectInternal.PROJECTS_TASK));
        textOutput.println();
    }
}
项目:Reer    文件:EclipsePlugin.java   
private static void registerEclipseArtifacts(Project project) {
    ProjectLocalComponentProvider projectComponentProvider = ((ProjectInternal) project).getServices().get(ProjectLocalComponentProvider.class);
    ProjectComponentIdentifier projectId = newProjectId(project);
    String projectName = project.getExtensions().getByType(EclipseModel.class).getProject().getName();
    projectComponentProvider.registerAdditionalArtifact(projectId, createArtifact("project", projectId, projectName, project));
    projectComponentProvider.registerAdditionalArtifact(projectId, createArtifact("classpath", projectId, projectName, project));
}
项目:Reer    文件:BasePlugin.java   
public void apply(Project project) {
    project.getPluginManager().apply(LifecycleBasePlugin.class);

    BasePluginConvention convention = new BasePluginConvention(project);
    project.getConvention().getPlugins().put("base", convention);

    configureBuildConfigurationRule(project);
    configureUploadRules(project);
    configureUploadArchivesTask();
    configureArchiveDefaults(project, convention);
    configureConfigurations(project);
    configureAssemble((ProjectInternal) project);
}
项目:Reer    文件:TaskFactory.java   
TaskFactory(ClassGenerator generator, ProjectInternal project, Instantiator instantiator) {
    this.generator = generator;
    this.project = project;
    this.instantiator = instantiator;

    validTaskArguments = new HashSet<String>();
    validTaskArguments.add(Task.TASK_ACTION);
    validTaskArguments.add(Task.TASK_DEPENDS_ON);
    validTaskArguments.add(Task.TASK_DESCRIPTION);
    validTaskArguments.add(Task.TASK_GROUP);
    validTaskArguments.add(Task.TASK_NAME);
    validTaskArguments.add(Task.TASK_OVERWRITE);
    validTaskArguments.add(Task.TASK_TYPE);
}
项目:Reer    文件:TaskNameResolver.java   
private static void discoverTasks(ProjectInternal project) {
    try {
        project.getTasks().discoverTasks();
    } catch (Throwable e) {
        throw new ProjectConfigurationException(String.format("A problem occurred configuring %s.", project), e);
    }
}