当前位置: 首页>>代码示例>>Java>>正文


Java ProjectInternal类代码示例

本文整理汇总了Java中org.gradle.api.internal.project.ProjectInternal的典型用法代码示例。如果您正苦于以下问题:Java ProjectInternal类的具体用法?Java ProjectInternal怎么用?Java ProjectInternal使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


ProjectInternal类属于org.gradle.api.internal.project包,在下文中一共展示了ProjectInternal类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: apply

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:23,代码来源:JavaBasePlugin.java

示例2: apply

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:OsgiPlugin.java

示例3: getTargetProject

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:DefaultBuildController.java

示例4: wrap

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:21,代码来源:DefaultScriptPluginFactory.java

示例5: apply

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
@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));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:HelpTasksPlugin.java

示例6: createChildProject

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:18,代码来源:ProjectBuilderImpl.java

示例7: createProject

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:26,代码来源:ProjectBuilderImpl.java

示例8: getSelection

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:TaskSelector.java

示例9: visitFile

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
@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()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:17,代码来源:JavaScriptMinify.java

示例10: getFilter

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
        }
    };
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:19,代码来源:TaskSelector.java

示例11: findProject

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:25,代码来源:ProjectFinderByTaskPath.java

示例12: apply

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
@Override
public void apply(ProjectInternal project) {
    addClean(project);
    addCleanRule(project);
    addAssemble(project);
    addCheck(project);
    addBuild(project);
    addDeprecationWarningsAboutCustomLifecycleTasks(project);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:LifecycleBasePlugin.java

示例13: addClean

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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();
                }
            });
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:15,代码来源:LifecycleBasePlugin.java

示例14: addAssemble

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:LifecycleBasePlugin.java

示例15: addCheck

import org.gradle.api.internal.project.ProjectInternal; //导入依赖的package包/类
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);
        }
    });
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:LifecycleBasePlugin.java


注:本文中的org.gradle.api.internal.project.ProjectInternal类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。