Package org.gradle.api

Examples of org.gradle.api.Project


     * 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, Project... dependsOnProjects) {
        final Project project = context.mock(Project.class, "[project]_" + name + '_' + uniqueNameCounter++);

        context.checking(new Expectations() {{
            allowing(project).getName();
            will(returnValue(name));
            allowing(project).getDescription();
View Full Code Here


    }

    private void applyPlugin(Class<? extends Plugin> pluginClass) {
        for (Object target : targets) {
            if (target instanceof Project) {
                Project project = (Project) target;
                project.getPlugins().apply(pluginClass);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }
View Full Code Here

    }

    private void applyPlugin(String pluginId) {
        for (Object target : targets) {
            if (target instanceof Project) {
                Project project = (Project) target;
                project.getPlugins().apply(pluginId);
            } else {
                throw new UnsupportedOperationException();
            }
        }
    }
View Full Code Here

    private StyledTextOutput textOutput = getServices().get(StyledTextOutputFactory.class).create(ProjectReportTask.class);

    @TaskAction
    void listProjects() {
        BuildClientMetaData metaData = getServices().get(BuildClientMetaData.class);
        Project project = getProject();

        textOutput.println();
        render(project, new GraphRenderer(textOutput), true);
        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), String.format("<project-path>:%s", ImplicitTasksConfigurer.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(ImplicitTasksConfigurer.TASKS_TASK));
        textOutput.println();

        if (project != project.getRootProject()) {
            textOutput.println();
            textOutput.text("To see a list of all the projects in this build, run ");
View Full Code Here

        context = new JUnit4Mockery();

        Task subsubCompileTask = TestUtility.createTask(context, "compile", "compile description");
        Task subsubLibTask = TestUtility.createTask(context, "lib", "lib description");
        Task subsubDocTask = TestUtility.createTask(context, "doc", "doc description");
        Project subsubProject = TestUtility.createMockProject(context, "mysubsubproject", "filepath3", 2, null,
                new Task[]{subsubCompileTask, subsubLibTask, subsubDocTask}, null, (Project[]) null);

        Task subCompileTask1 = TestUtility.createTask(context, "compile", "compile description");
        Task subLibTask1 = TestUtility.createTask(context, "lib", "lib description");
        Task subDocTask1 = TestUtility.createTask(context, "doc", "doc description");
        Project subProject1 = TestUtility.createMockProject(context, "mysubproject1", "filepath2a", 1,
                new Project[]{subsubProject}, new Task[]{subCompileTask1, subLibTask1, subDocTask1}, null,
                (Project[]) null);

        Task subCompileTask2 = TestUtility.createTask(context, "compile", "compile description");
        Task subLibTask2 = TestUtility.createTask(context, "lib", "lib description");
        Task subDocTask2 = TestUtility.createTask(context, "doc", "doc description");
        Project subProject2 = TestUtility.createMockProject(context, "mysubproject2", "filepath2b", 1, null,
                new Task[]{subCompileTask2, subLibTask2, subDocTask2}, null, (Project[]) null);

        Project rootProject = TestUtility.createMockProject(context, "myrootproject", "filepath1", 0,
                new Project[]{subProject1, subProject2}, null, null, (Project[]) null);

        buildInformation = new BuildInformation(rootProject);

        //now get the converted objects to simplify our matching
View Full Code Here

    private List<ProjectView> getProjectViews(Set<Project> projects) {
        List<ProjectView> views = new ArrayList<ProjectView>();

        Iterator<Project> projectIterator = projects.iterator();
        while (projectIterator.hasNext()) {
            Project project = projectIterator.next();
            ProjectView projectView = projectMap.get(project);
            if (projectView == null) {
                logger.error("Missing project: " + project.getName());
            } else {
                views.add(projectView);
            }
        }
View Full Code Here

    private ProjectDependencyFactory projectDependencyFactory = new DefaultProjectDependencyFactory(projectDependenciesBuildInstruction, new AsmBackedClassGenerator());
    private ProjectFinder projectFinder = context.mock(ProjectFinder.class);

    @Test
    public void testCreateProjectDependencyWithProject() {
        Project dependencyProject = HelperUtil.createRootProject();
        DefaultProjectDependency projectDependency = (DefaultProjectDependency)
                projectDependencyFactory.createDependency(Dependency.class, dependencyProject);
        assertThat((ProjectInternal) projectDependency.getDependencyProject(), equalTo(dependencyProject));
    }
View Full Code Here

    private final TaskExecutionLogger executionLogger = new TaskExecutionLogger(progressLoggerFactory);

    @Before
    public void setUp() {
        context.checking(new Expectations() {{
            Project project = context.mock(Project.class);
            allowing(task).getProject();
            will(returnValue(project));
            allowing(project).getGradle();
            will(returnValue(gradle));
            allowing(task).getPath();
View Full Code Here

    }

    @Test
    public void logsExecutionOfTaskInSubBuild() {
        context.checking(new Expectations() {{
            Project rootProject = context.mock(Project.class, "rootProject");

            allowing(gradle).getParent();
            will(returnValue(context.mock(Gradle.class, "rootBuild")));
            allowing(gradle).getRootProject();
            will(returnValue(rootProject));
View Full Code Here

        assertThat(renderer.getTextOutput(), nullValue());
    }

    @Test
    public void writeRootProjectHeader() throws IOException {
        final Project project = context.mock(Project.class);
        TestStyledTextOutput textOutput = new TestStyledTextOutput();

        context.checking(new Expectations() {{
            allowing(project).getRootProject();
            will(returnValue(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.