Search in sources :

Example 31 with ProjectInternal

use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.

the class InstantiatingBuildLoader method createProjects.

private void createProjects(ProjectDescriptor rootProjectDescriptor, GradleInternal gradle, ClassLoaderScope buildRootClassLoaderScope) {
    ProjectInternal rootProject = projectFactory.createProject(rootProjectDescriptor, null, gradle, buildRootClassLoaderScope.createChild("root-project"), buildRootClassLoaderScope);
    gradle.setRootProject(rootProject);
    addProjects(rootProject, rootProjectDescriptor, gradle, buildRootClassLoaderScope);
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal)

Example 32 with ProjectInternal

use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.

the class AntGroovydoc method execute.

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);
}
Also used : CopySpec(org.gradle.api.file.CopySpec) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) FileOperations(org.gradle.api.internal.file.FileOperations) File(java.io.File) VersionNumber(org.gradle.util.VersionNumber)

Example 33 with ProjectInternal

use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.

the class TestUtility method createMockProject.

/**
     * Creates a mock project with the specified properties.
     *
     * Note: depth is 0 for a root project. 1 for a root project's subproject, etc.
     */
public static Project createMockProject(JUnit4Mockery context, final String name, final String buildFilePath, final int depth, Project[] subProjectArray, Task[] tasks, String[] defaultTasks) {
    final ProjectInternal project = context.mock(ProjectInternal.class, "[project]_" + name + '_' + uniqueNameCounter++);
    final ServiceRegistry services = ServiceRegistryBuilder.builder().provider(new Object() {

        ProjectTaskLister createTaskLister() {
            return new DefaultProjectTaskLister();
        }
    }).build();
    context.checking(new Expectations() {

        {
            allowing(project).getName();
            will(returnValue(name));
            allowing(project).getDescription();
            will(returnValue(null));
            allowing(project).getBuildFile();
            will(returnValue(new File(buildFilePath)));
            allowing(project).getDepth();
            will(returnValue(depth));
            allowing(project).getServices();
            will(returnValue(services));
        }
    });
    attachSubProjects(context, project, subProjectArray);
    attachTasks(context, project, tasks);
    assignDefaultTasks(context, project, defaultTasks);
    return project;
}
Also used : Expectations(org.jmock.Expectations) DefaultProjectTaskLister(org.gradle.api.internal.project.DefaultProjectTaskLister) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ServiceRegistry(org.gradle.internal.service.ServiceRegistry) File(java.io.File)

Example 34 with ProjectInternal

use of org.gradle.api.internal.project.ProjectInternal in project gradle by gradle.

the class DefaultConfiguration method markReferencedProjectConfigurationsObserved.

private void markReferencedProjectConfigurationsObserved(final InternalState requestedState) {
    for (ResolvedProjectConfiguration projectResult : cachedResolverResults.getResolvedLocalComponents().getResolvedProjectConfigurations()) {
        ProjectInternal project = projectFinder.getProject(projectResult.getId().getProjectPath());
        ConfigurationInternal targetConfig = (ConfigurationInternal) project.getConfigurations().getByName(projectResult.getTargetConfiguration());
        targetConfig.markAsObserved(requestedState);
    }
}
Also used : ProjectInternal(org.gradle.api.internal.project.ProjectInternal) ResolvedProjectConfiguration(org.gradle.api.internal.artifacts.ivyservice.resolveengine.projectresult.ResolvedProjectConfiguration)

Example 35 with ProjectInternal

use of org.gradle.api.internal.project.ProjectInternal in project spring-boot by spring-projects.

the class BuildInfoTests method createProject.

private Project createProject(String projectName) {
    File projectDir = new File(this.temp, projectName);
    Project project = GradleProjectBuilder.builder().withProjectDir(projectDir).withName(projectName).build();
    ((ProjectInternal) project).getServices().get(GradlePropertiesController.class).loadGradlePropertiesFrom(projectDir);
    return project;
}
Also used : Project(org.gradle.api.Project) ProjectInternal(org.gradle.api.internal.project.ProjectInternal) File(java.io.File) GradlePropertiesController(org.gradle.initialization.GradlePropertiesController)

Aggregations

ProjectInternal (org.gradle.api.internal.project.ProjectInternal)58 File (java.io.File)13 Project (org.gradle.api.Project)11 Task (org.gradle.api.Task)6 ServiceRegistry (org.gradle.internal.service.ServiceRegistry)6 Inject (javax.inject.Inject)5 Plugin (org.gradle.api.Plugin)5 ProjectStateRegistry (org.gradle.api.internal.project.ProjectStateRegistry)5 Map (java.util.Map)4 Configuration (org.gradle.api.artifacts.Configuration)4 FileResolver (org.gradle.api.internal.file.FileResolver)4 Lists (com.google.common.collect.Lists)3 ArrayList (java.util.ArrayList)3 Collections (java.util.Collections)3 HashSet (java.util.HashSet)3 List (java.util.List)3 Set (java.util.Set)3 Callable (java.util.concurrent.Callable)3 Collectors (java.util.stream.Collectors)3 FileCollectionFactory (org.gradle.api.internal.file.FileCollectionFactory)3