Package org.gradle.api

Examples of org.gradle.api.Project


        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));
        }
View Full Code Here


    }

    @Test
    public void accessMethodsForNonExistingsPaths() {
        projectRegistry = new DefaultProjectRegistry<ProjectInternal>();
        Project otherRoot = TestUtil.createRootProject();
        assertNull(projectRegistry.getProject(otherRoot.getPath()));
        assertEquals(new TreeSet<ProjectInternal>(), projectRegistry.getAllProjects(otherRoot.getPath()));
        assertEquals(new TreeSet<ProjectInternal>(), projectRegistry.getSubProjects(otherRoot.getPath()));
        assertNull(projectRegistry.getProject(otherRoot.getProjectDir()));
    }
View Full Code Here

                return sourceSet.getExportedHeaders().getSrcDirs();
            }
        });
        task.source(sourceSet.getSource());

        final Project project = task.getProject();
        task.setOutputDir(project.file(String.valueOf(project.getBuildDir()) + "/objs/" + binary.getNamingScheme().getOutputDirectoryBase() + "/" + ((LanguageSourceSetInternal) sourceSet).getFullName()));

        PreprocessingTool rcCompiler = (PreprocessingTool) ((ExtensionAware) binary).getExtensions().getByName("rcCompiler");
        task.setMacros(rcCompiler.getMacros());
        task.setCompilerArgs(rcCompiler.getArgs());
View Full Code Here

    }

    // TaskExecutionListener
    public void beforeExecute(Task task) {
        long now = timeProvider.getCurrentTime();
        Project project = task.getProject();
        ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
        projectProfile.getTaskProfile(task.getPath()).setStart(now);
    }
View Full Code Here

        projectProfile.getTaskProfile(task.getPath()).setStart(now);
    }

    public void afterExecute(Task task, TaskState state) {
        long now = timeProvider.getCurrentTime();
        Project project = task.getProject();
        ProjectProfile projectProfile = buildProfile.getProjectProfile(project.getPath());
        TaskExecution taskExecution = projectProfile.getTaskProfile(task.getPath());
        taskExecution.setFinish(now);
        taskExecution.completed(state);
    }
View Full Code Here

        this.projectLocator = projectLocator;
    }

    // Converts the binaries of a project library into regular binary instances
    public DomainObjectSet<NativeLibraryBinary> getBinaries(NativeLibraryRequirement requirement) {
        Project project = findProject(requirement);
        ComponentSpecContainer componentSpecContainer = project.getExtensions().findByType(ComponentSpecContainer.class);
        if (componentSpecContainer == null) {
            throw new LibraryResolveException(String.format("Project does not have a libraries container: '%s'", project.getPath()));
        }
        DomainObjectSet<NativeBinarySpec> projectBinaries = componentSpecContainer.withType(NativeLibrarySpec.class).getByName(requirement.getLibraryName()).getNativeBinaries();
        DomainObjectSet<NativeLibraryBinary> binaries = new DefaultDomainObjectSet<NativeLibraryBinary>(NativeLibraryBinary.class);
        // TODO:DAZ Convert, don't cast
        for (NativeBinarySpec nativeBinarySpec : projectBinaries) {
View Full Code Here

            }
        });

        task.source(sourceSet.getSource());

        final Project project = task.getProject();
        task.setObjectFileDir(project.file(String.valueOf(project.getBuildDir()) + "/objs/" + binary.getNamingScheme().getOutputDirectoryBase() + "/" + sourceSet.getFullName()));

        for (String toolName : language.getBinaryTools().keySet()) {
            Tool tool = (Tool) ((ExtensionAware) binary).getExtensions().getByName(toolName);
            if (tool instanceof PreprocessingTool) {
                task.setMacros(((PreprocessingTool) tool).getMacros());
View Full Code Here

    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;
            }
View Full Code Here

        task.generate();
    }

    @Test
    public void passesEachProjectToRenderer() throws IOException {
        final Project child1 = createChildProject(project, "child1");
        final Project child2 = createChildProject(project, "child2");
        task.setProjects(project.getAllprojects());
        context.checking(new Expectations() {{
            Sequence sequence = context.sequence("seq");

            one(renderer).setOutput((StyledTextOutput) with(notNullValue()));
View Full Code Here

        throw new UnsupportedOperationException();
    }

    @TaskAction
    public void report() {
        Project project = getProject();

        StyledTextOutput textOutput = getTextOutputFactory().create(ComponentReport.class);
        ComponentReportRenderer renderer = new ComponentReportRenderer(getFileResolver());
        renderer.setOutput(textOutput);

        renderer.startProject(project);

        Collection<ComponentSpec> components = new ArrayList<ComponentSpec>();
        ComponentSpecContainer componentSpecs = project.getExtensions().findByType(ComponentSpecContainer.class);
        if (componentSpecs != null) {
            components.addAll(componentSpecs);
        }

        try {
            TestSuiteContainer testSuites = getModelRegistry().get(ModelPath.path("testSuites"), ModelType.of(TestSuiteContainer.class));
            components.addAll(testSuites);
        } catch (IllegalStateException e) {
            // TODO - need a better contract here
            // Ignore for now
        }

        renderer.renderComponents(components);

        ProjectSourceSet sourceSets = project.getExtensions().findByType(ProjectSourceSet.class);
        if (sourceSets != null) {
            renderer.renderSourceSets(sourceSets);
        }
        BinaryContainer binaries = project.getExtensions().findByType(BinaryContainer.class);
        if (binaries != null) {
            renderer.renderBinaries(binaries);
        }

        renderer.completeProject(project);
View Full Code Here

TOP

Related Classes of org.gradle.api.Project

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.