本文整理汇总了Java中com.intellij.openapi.externalSystem.model.ProjectKeys.PROJECT属性的典型用法代码示例。如果您正苦于以下问题:Java ProjectKeys.PROJECT属性的具体用法?Java ProjectKeys.PROJECT怎么用?Java ProjectKeys.PROJECT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.intellij.openapi.externalSystem.model.ProjectKeys
的用法示例。
在下文中一共展示了ProjectKeys.PROJECT属性的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: testPopulateModuleContentRootsWithAndroidProject
public void testPopulateModuleContentRootsWithAndroidProject() {
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<ProjectData>(ProjectKeys.PROJECT, project, null);
ModuleData module = myProjectResolver.createModule(myAndroidModule, project);
DataNode<ModuleData> moduleDataNode = projectNode.createChild(ProjectKeys.MODULE, module);
myProjectResolver.populateModuleContentRoots(myAndroidModule, moduleDataNode);
// Verify module has IdeaAndroidProject.
Collection<DataNode<IdeaAndroidProject>> androidProjects =
ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_ANDROID_PROJECT);
assertEquals(1, androidProjects.size());
DataNode<IdeaAndroidProject> androidProjectNode = ContainerUtil.getFirstItem(androidProjects);
assertNotNull(androidProjectNode);
assertSame(myAndroidProject, androidProjectNode.getData().getDelegate());
// Verify module has IdeaGradleProject.
Collection<DataNode<IdeaGradleProject>> gradleProjects =
ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_GRADLE_PROJECT);
assertEquals(1, gradleProjects.size());
DataNode<IdeaGradleProject> gradleProjectNode = ContainerUtil.getFirstItem(gradleProjects);
assertNotNull(gradleProjectNode);
assertEquals(myAndroidModule.getGradleProject().getPath(), gradleProjectNode.getData().getGradlePath());
}
示例2: testPopulateModuleContentRootsWithJavaProject
public void testPopulateModuleContentRootsWithJavaProject() {
ProjectData project = myProjectResolver.createProject();
DataNode<ProjectData> projectNode = new DataNode<ProjectData>(ProjectKeys.PROJECT, project, null);
ModuleData module = myProjectResolver.createModule(myUtilModule, project);
DataNode<ModuleData> moduleDataNode = projectNode.createChild(ProjectKeys.MODULE, module);
myProjectResolver.populateModuleContentRoots(myUtilModule, moduleDataNode);
// Verify module does not have IdeaAndroidProject.
Collection<DataNode<IdeaAndroidProject>> androidProjects =
ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_ANDROID_PROJECT);
assertEquals(0, androidProjects.size());
// Verify module has IdeaGradleProject.
Collection<DataNode<IdeaGradleProject>> gradleProjects =
ExternalSystemApiUtil.getChildren(moduleDataNode, AndroidProjectKeys.IDE_GRADLE_PROJECT);
assertEquals(1, gradleProjects.size());
DataNode<IdeaGradleProject> gradleProjectNode = ContainerUtil.getFirstItem(gradleProjects);
assertNotNull(gradleProjectNode);
assertEquals(myUtilModule.getGradleProject().getPath(), gradleProjectNode.getData().getGradlePath());
}
示例3: populateProject
@NotNull
private static DataNode<ProjectData> populateProject(@NotNull IdeaProject project, @NotNull String projectPath) {
String projectDirPath = ExternalSystemApiUtil.toCanonicalPath(projectPath);
ProjectData projectData = new ProjectData(GradleConstants.SYSTEM_ID, projectDirPath, projectPath);
projectData.setName(project.getName());
// Gradle API doesn't expose project compile output path yet.
JavaProjectData javaProjectData = new JavaProjectData(GradleConstants.SYSTEM_ID, projectDirPath + "/out");
javaProjectData.setJdkVersion(project.getJdkName());
javaProjectData.setLanguageLevel(project.getLanguageLevel().getLevel());
DataNode<ProjectData> result = new DataNode<ProjectData>(ProjectKeys.PROJECT, projectData, null);
result.createChild(JavaProjectData.KEY, javaProjectData);
return result;
}
示例4: setUp
@Override
public void setUp() throws Exception {
super.setUp();
myProjectName = "test";
myProjectRootDir = createTempDir(myProjectName);
String projectRootDirPath = myProjectRootDir.getPath();
final File projectFile = new File(myProjectRootDir, SdkConstants.FN_BUILD_GRADLE);
final String configPath = projectFile.getPath();
ProjectData projectData = new ProjectData(GradleConstants.SYSTEM_ID, myProjectName, projectRootDirPath, configPath);
myCachedProject = new DataNode<ProjectData>(ProjectKeys.PROJECT, projectData, null);
ModuleData moduleData =
new ModuleData("", GradleConstants.SYSTEM_ID, JAVA.getId(), myModule.getName(), projectRootDirPath, configPath);
myCachedModule = myCachedProject.createChild(ProjectKeys.MODULE, moduleData);
GradleProjectImporter.ImporterDelegate delegate = new GradleProjectImporter.ImporterDelegate() {
@Override
void importProject(@NotNull Project project,
@NotNull ExternalProjectRefreshCallback callback,
@NotNull final ProgressExecutionMode progressTaskMode) throws ConfigurationException {
assertNotNull(project);
assertEquals(myProjectName, project.getName());
callback.onSuccess(myCachedProject);
}
};
myImporter = new GradleProjectImporter(delegate);
}
示例5: createProjectNode
protected DataNode<ProjectData> createProjectNode() {
final PantsResolver dependenciesResolver = new PantsResolver(PantsCompileOptionsExecutor.createMock());
dependenciesResolver.setProjectInfo(getProjectInfo());
final ProjectData projectData = new ProjectData(
PantsConstants.SYSTEM_ID, "test-project", "path/to/fake/project", "path/to/fake/project/BUILD"
);
final DataNode<ProjectData> dataNode = new DataNode<>(ProjectKeys.PROJECT, projectData, null);
dependenciesResolver.addInfoTo(dataNode);
return dataNode;
}
示例6: getTargetDataKey
@NotNull
@Override
public Key<ProjectData> getTargetDataKey() {
return ProjectKeys.PROJECT;
}
示例7: resolveProjectInfoImpl
@NotNull
private DataNode<ProjectData> resolveProjectInfoImpl(
@NotNull ExternalSystemTaskId id,
@NotNull final PantsCompileOptionsExecutor executor,
@NotNull ExternalSystemTaskNotificationListener listener,
boolean isPreviewMode,
boolean isEnableIncrementalImport
) throws ExternalSystemException, IllegalArgumentException, IllegalStateException {
// todo(fkorotkov): add ability to choose a name for a project
final ProjectData projectData = new ProjectData(
PantsConstants.SYSTEM_ID,
executor.getProjectName(),
executor.getBuildRoot().getPath() + "/.idea/pants-projects/" + executor.getProjectRelativePath(),
executor.getProjectPath()
);
final DataNode<ProjectData> projectDataNode = new DataNode<>(ProjectKeys.PROJECT, projectData, null);
PantsUtil.findPantsExecutable(executor.getProjectPath())
.flatMap(file -> PantsUtil.getDefaultJavaSdk(file.getPath(), null))
.ifPresent(sdk -> projectDataNode.createChild(PantsConstants.SDK_KEY, sdk));
if (!isPreviewMode) {
PantsExternalMetricsListenerManager.getInstance().logIsIncrementalImport(isEnableIncrementalImport);
resolveUsingPantsGoal(id, executor, listener, projectDataNode);
if (!containsContentRoot(projectDataNode, executor.getProjectDir())) {
// Add a module with content root as import project directory path.
// This will allow all the files in the imported project directory will be indexed by the plugin.
final String moduleName = executor.getRootModuleName();
final ModuleData moduleData = new ModuleData(
PantsConstants.PANTS_PROJECT_MODULE_ID_PREFIX + moduleName,
PantsConstants.SYSTEM_ID,
ModuleTypeId.JAVA_MODULE,
moduleName + PantsConstants.PANTS_PROJECT_MODULE_SUFFIX,
projectData.getIdeProjectFileDirectoryPath() + "/" + moduleName,
executor.getProjectPath()
);
final DataNode<ModuleData> moduleDataNode = projectDataNode.createChild(ProjectKeys.MODULE, moduleData);
final ContentRootData contentRoot = new ContentRootData(PantsConstants.SYSTEM_ID, executor.getProjectDir());
if (FileUtil.filesEqual(executor.getBuildRoot(), new File(executor.getProjectPath()))) {
contentRoot.storePath(ExternalSystemSourceType.EXCLUDED, executor.getBuildRoot().getPath() + "/.idea");
}
moduleDataNode.createChild(ProjectKeys.CONTENT_ROOT, contentRoot);
}
}
return projectDataNode;
}
示例8: getTargetDataKey
@Nonnull
@Override
public Key<ProjectData> getTargetDataKey() {
return ProjectKeys.PROJECT;
}