• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java DomainObjectSet类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: newIdeaGradleProject

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
/**
 * Creates a new {@link IdeaGradleProject}.
 * @param moduleName    the name of the IDEA module.
 * @param gradleProject the Gradle project.
 * @param buildFile     the build.gradle file.
 * @param gradleVersion the version of Gradle used to sync the project.
 */
public static IdeaGradleProject newIdeaGradleProject(@NotNull String moduleName,
                                                     @NotNull GradleProject gradleProject,
                                                     @Nullable File buildFile,
                                                     @Nullable String gradleVersion) {
  List<String> taskNames = Lists.newArrayList();
  DomainObjectSet<? extends GradleTask> tasks = gradleProject.getTasks();
  if (!tasks.isEmpty()) {
    for (GradleTask task : tasks) {
      String name = task.getName();
      if (isNotEmpty(name)) {
        taskNames.add(task.getProject().getPath() + SdkConstants.GRADLE_PATH_SEPARATOR + task.getName());
      }
    }
  }

  return new IdeaGradleProject(moduleName, taskNames, gradleProject.getPath(), buildFile, gradleVersion);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:IdeaGradleProject.java


示例2: getModulesMap

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
protected <T> Map<String, T> getModulesMap(final Class<T> aClass) {
  final DomainObjectSet<? extends IdeaModule> ideaModules = allModels.getIdeaProject().getModules();

  final String filterKey = "to_filter";
  final Map<String, T> map = ContainerUtil.map2Map(ideaModules, new Function<IdeaModule, Pair<String, T>>() {
    @Override
    public Pair<String, T> fun(IdeaModule module) {
      final T value = allModels.getExtraProject(module, aClass);
      final String key = value != null ? module.getGradleProject().getPath() : filterKey;
      return Pair.create(key, value);
    }
  });

  map.remove(filterKey);
  return map;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AbstractModelBuilderTest.java


示例3: createEmptyCollection

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
Collection<Object> createEmptyCollection(Class<?> collectionType) {
    if (collectionType.equals(DomainObjectSet.class)) {
        return new ArrayList<Object>();
    }
    if (collectionType.isAssignableFrom(ArrayList.class)) {
        return new ArrayList<Object>();
    }
    if (collectionType.isAssignableFrom(LinkedHashSet.class)) {
        return new LinkedHashSet<Object>();
    }
    if (collectionType.isAssignableFrom(TreeSet.class)) {
        return new TreeSet<Object>();
    }
    throw new UnsupportedOperationException(String.format("Cannot convert a Collection to type %s.", collectionType.getName()));
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:16,代码来源:CollectionMapper.java


示例4: convertCollectionInternal

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
private static Object convertCollectionInternal(Class<?> collectionClass, Type targetElementType, Iterable<?> sourceObject, ViewDecoration decoration, ViewGraphDetails graphDetails) {
    Collection<Object> convertedElements = COLLECTION_MAPPER.createEmptyCollection(collectionClass);
    convertCollectionInternal(convertedElements, targetElementType, sourceObject, decoration, graphDetails);
    if (collectionClass.equals(DomainObjectSet.class)) {
        return new ImmutableDomainObjectSet(convertedElements);
    } else {
        return convertedElements;
    }
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:ProtocolToModelAdapter.java


示例5: DefaultProjectOutcomes

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public DefaultProjectOutcomes(String name, String projectPath, String description, File projectDirectory,
                              DomainObjectSet<? extends GradleBuildOutcome> outcomes, ProjectOutcomes parent) {
    this.name = name;
    this.projectPath = projectPath;
    this.description = description;
    this.projectDirectory = projectDirectory;
    this.outcomes = outcomes;
    this.parent = parent;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:10,代码来源:DefaultProjectOutcomes.java


示例6: copy

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@NotNull
private static Collection<File> copy(@Nullable DomainObjectSet<? extends IdeaSourceDirectory> directories) {
  if (directories == null) {
    return Collections.emptySet();
  }
  Set<File> paths = Sets.newHashSet();
  for (IdeaSourceDirectory directory : directories) {
    paths.add(directory.getDirectory());
  }
  return paths;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:JavaModuleContentRoot.java


示例7: testGetGradleBuildFileFromModuleWithGradleFacet

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public void testGetGradleBuildFileFromModuleWithGradleFacet() {
  GradleProject project = createMock(GradleProject.class);
  expect(project.getPath()).andReturn(myModule.getName());

  //noinspection unchecked
  DomainObjectSet<? extends GradleTask> tasks = createMock(DomainObjectSet.class);
  project.getTasks();
  expectLastCall().andReturn(tasks);

  expect(tasks.isEmpty()).andReturn(true);
  replay(project, tasks);

  IdeaGradleProject gradleProject = IdeaGradleProject.newIdeaGradleProject(myModule.getName(), project, myBuildFile, "2.2.1");

  FacetManager facetManager = FacetManager.getInstance(myModule);
  ModifiableFacetModel model = facetManager.createModifiableModel();
  try {
    AndroidGradleFacet facet = facetManager.createFacet(AndroidGradleFacet.getFacetType(), AndroidGradleFacet.NAME, null);
    model.addFacet(facet);
    facet.setGradleProject(gradleProject);
  }
  finally {
    model.commit();
  }

  VirtualFile buildFile = GradleUtil.getGradleBuildFile(myModule);
  assertIsGradleBuildFile(buildFile);

  verify(project, tasks);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:GradleUtilIdeaTest.java


示例8: testDefaultWarModel

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@Test
public void testDefaultWarModel() throws Exception {
  DomainObjectSet<? extends IdeaModule> ideaModules = allModels.getIdeaProject().getModules();

  List<WebConfiguration> ideaModule = ContainerUtil.mapNotNull(ideaModules, new Function<IdeaModule, WebConfiguration>() {
    @Override
    public WebConfiguration fun(IdeaModule module) {
      return allModels.getExtraProject(module, WebConfiguration.class);
    }
  });

  assertEquals(1, ideaModule.size());
  WebConfiguration webConfiguration = ideaModule.get(0);
  assertEquals(1, webConfiguration.getWarModels().size());

  final WarModel warModel = webConfiguration.getWarModels().iterator().next();
  assertEquals("src/main/webapp", warModel.getWebAppDirName());

  assertArrayEquals(
    new String[]{"MANIFEST.MF", "additionalWebInf", "rootContent"},
    ContainerUtil.map2Array(warModel.getWebResources(), new Function<WebResource, Object>() {
      @Override
      public String fun(WebResource resource) {
        return resource.getFile().getName();
      }
    }));
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:28,代码来源:WebConfigurationBuilderImplTest.java


示例9: getAllPaths

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
private Collection<? extends String> getAllPaths(DomainObjectSet<? extends IdeaSourceDirectory> directories, final String moduleName) {
  List<String> list = ContainerUtil.map2List(directories, new Function<IdeaSourceDirectory, String>() {
    @Override
    public String fun(IdeaSourceDirectory sourceDirectory) {
      String path =
        FileUtil.toCanonicalPath(FileUtil.getRelativePath(new File(testDir, moduleName), sourceDirectory.getDirectory()));
      Assert.assertNotNull(path);
      return path.substring(path.indexOf("/") + 1);
    }
  });
  Collections.sort(list);
  return list;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:ModuleExtendedModelBuilderImplTest.java


示例10: findLocalLibraries

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@NotNull
private static List<IdeaSingleEntryLibraryDependency> findLocalLibraries(
  @NotNull final DomainObjectSet<? extends IdeaDependency> dependencies, @NotNull final String scope) {
  return ContainerUtil.mapNotNull(
    dependencies,
    new Function<IdeaDependency, IdeaSingleEntryLibraryDependency>() {
      @Override
      public IdeaSingleEntryLibraryDependency fun(IdeaDependency dependency) {
        return dependency instanceof IdeaSingleEntryLibraryDependency &&
               scope.equals(dependency.getScope().getScope().toLowerCase(Locale.ENGLISH))
               ? (IdeaSingleEntryLibraryDependency)dependency : null;
      }
    }
  );
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:16,代码来源:ModelDependenciesBuilderImplTest.java


示例11: getGeneratedSourceDirectories

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@Override
public DomainObjectSet<? extends IdeaSourceDirectory> getGeneratedSourceDirectories() {
  List<IdeaSourceDirectory> generatedSourceDirectories = new ArrayList<IdeaSourceDirectory>();
  for (IdeaSourceDirectory sourceDirectory : mySourceDirectories) {
    if(sourceDirectory.isGenerated()) {
      generatedSourceDirectories.add(sourceDirectory);
    }
  }
  return ImmutableDomainObjectSet.of(generatedSourceDirectories);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:IdeaContentRootImpl.java


示例12: getGeneratedTestDirectories

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@Override
public DomainObjectSet<? extends IdeaSourceDirectory> getGeneratedTestDirectories() {
  List<IdeaSourceDirectory> generatedTestDirectories = new ArrayList<IdeaSourceDirectory>();
  for (IdeaSourceDirectory sourceDirectory : myTestDirectories) {
    if(sourceDirectory.isGenerated()) {
      generatedTestDirectories.add(sourceDirectory);
    }
  }
  return ImmutableDomainObjectSet.of(generatedTestDirectories);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:IdeaContentRootImpl.java


示例13: execute

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public void execute(ProjectConfigurationProvider provider, BasicGradleProject parent) throws Exception {
	DomainObjectSet<? extends BasicGradleProject> subprojects = null;
	File parentDir = provider.getConfigurationFile().getCanonicalFile().getParentFile();

	if (parent == null) {
		GradleConnector connector = GradleConnector.newConnector();

		connector.forProjectDirectory(parentDir);
		ProjectConnection connection = connector.connect();

		GradleBuild settings = connection.getModel(GradleBuild.class);
		subprojects = settings.getProjects();
	} else {
		subprojects = parent.getChildren();
	}
	Iterator<? extends BasicGradleProject> it = subprojects.iterator();
	String currentDir = parentDir.getCanonicalPath();
	List<String> modules = new LinkedList<String>();
	while (it.hasNext()) {
		BasicGradleProject current = it.next();
		File projectDir = current.getProjectDirectory().getCanonicalFile();
		if (!projectDir.getPath().equals(currentDir)) {
			modules.add(current.getName());
			ProjectConfigurationProvider moduleCfgProvider = provider
					.clone(new File(projectDir, "walkmod." + provider.getFileExtension()));

			execute(moduleCfgProvider, current);
		}

	}
	if (!modules.isEmpty()) {
		provider.addModules(modules);
	} else {
		provider.createConfig();
	}
}
 
开发者ID:walkmod,项目名称:walkmod-gradle-plugin,代码行数:37,代码来源:GradleInitializer.java


示例14: createModules

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
@NotNull
private static Map<String, Pair<DataNode<ModuleData>, IdeaModule>> createModules(
  @NotNull IdeaProject gradleProject,
  @NotNull DataNode<ProjectData> ideProject) throws IllegalStateException
{

  DomainObjectSet<? extends IdeaModule> gradleModules = gradleProject.getModules();
  if (gradleModules == null || gradleModules.isEmpty()) {
    throw new IllegalStateException("No modules found for the target project: " + gradleProject);
  }
  Map<String, Pair<DataNode<ModuleData>, IdeaModule>> result = ContainerUtilRt.newHashMap();
  for (IdeaModule gradleModule : gradleModules) {
    if (gradleModule == null) {
      continue;
    }
    String moduleName = gradleModule.getName();
    if (moduleName == null) {
      throw new IllegalStateException("Module with undefined name detected: " + gradleModule);
    }
    ProjectData projectData = ideProject.getData();
    String moduleConfigPath
      = GradleUtil.getConfigPath(gradleModule.getGradleProject(), ideProject.getData().getLinkedExternalProjectPath());
    ModuleData ideModule = new ModuleData(GradleConstants.SYSTEM_ID,
                                          StdModuleTypes.JAVA.getId(),
                                          moduleName,
                                          projectData.getIdeProjectFileDirectoryPath(),
                                          moduleConfigPath);
    Pair<DataNode<ModuleData>, IdeaModule> previouslyParsedModule = result.get(moduleName);
    if (previouslyParsedModule != null) {
      throw new IllegalStateException(
        String.format("Modules with duplicate name (%s) detected: '%s' and '%s'", moduleName, ideModule, previouslyParsedModule)
      );
    }
    DataNode<ModuleData> moduleDataNode = ideProject.createChild(ProjectKeys.MODULE, ideModule);
    result.put(moduleName, new Pair<DataNode<ModuleData>, IdeaModule>(moduleDataNode, gradleModule));
  }
  return result;
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:39,代码来源:GradleProjectResolver.java


示例15: populateContentRoots

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
/**
 * Populates {@link ProjectKeys#CONTENT_ROOT) content roots} of the given ide module on the basis of the information
 * contained at the given gradle module.
 *
 * @param gradleModule    holder of the module information received from the gradle tooling api
 * @param ideModule       corresponding module from intellij gradle plugin domain
 * @throws IllegalArgumentException   if given gradle module contains invalid data
 */
private static void populateContentRoots(@NotNull IdeaModule gradleModule, @NotNull DataNode<ModuleData> ideModule)
  throws IllegalArgumentException
{
  DomainObjectSet<? extends IdeaContentRoot> contentRoots = gradleModule.getContentRoots();
  if (contentRoots == null) {
    return;
  }
  for (IdeaContentRoot gradleContentRoot : contentRoots) {
    if (gradleContentRoot == null) {
      continue;
    }
    File rootDirectory = gradleContentRoot.getRootDirectory();
    if (rootDirectory == null) {
      continue;
    }
    ContentRootData ideContentRoot = new ContentRootData(GradleConstants.SYSTEM_ID, rootDirectory.getAbsolutePath());
    ideModule.getData().setModuleFileDirectoryPath(ideContentRoot.getRootPath());
    populateContentRoot(ideContentRoot, ExternalSystemSourceType.SOURCE, gradleContentRoot.getSourceDirectories());
    populateContentRoot(ideContentRoot, ExternalSystemSourceType.TEST, gradleContentRoot.getTestDirectories());
    Set<File> excluded = gradleContentRoot.getExcludeDirectories();
    if (excluded != null) {
      for (File file : excluded) {
        ideContentRoot.storePath(ExternalSystemSourceType.EXCLUDED, file.getAbsolutePath());
      }
    }
    ideModule.createChild(ProjectKeys.CONTENT_ROOT, ideContentRoot);
  }
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:37,代码来源:GradleProjectResolver.java


示例16: isEclipseSupported

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
private boolean isEclipseSupported(ProjectEntry entry) {
    EclipseProject model = entry.getModel();
    DomainObjectSet<? extends GradleTask> tasks = model.getGradleProject().getTasks();
    for (GradleTask task : tasks) {
        if (task.getName().equals(GradleBuildTask.TASK_CONFIGURE_ECLIPSE)) {
            return true;
        }
    }
    return false;
}
 
开发者ID:asakusafw,项目名称:asakusafw-shafu,代码行数:11,代码来源:SelectGradleProjectsPage.java


示例17: getIncludedBuilds

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public DomainObjectSet<? extends GradleBuild> getIncludedBuilds() {
    return ImmutableDomainObjectSet.of(Collections.<GradleBuild>emptyList());
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:IncludedBuildsMixin.java


示例18: getFileOutcomes

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
private DomainObjectSet<GradleFileBuildOutcome> getFileOutcomes(Project project) {
    List<GradleFileBuildOutcome> fileBuildOutcomes = Lists.newArrayList();
    addArtifacts(project, fileBuildOutcomes);
    return new ImmutableDomainObjectSet<GradleFileBuildOutcome>(fileBuildOutcomes);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:6,代码来源:ProjectOutcomesModelBuilder.java


示例19: getOutcomes

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public DomainObjectSet<? extends GradleBuildOutcome> getOutcomes() {
    return outcomes;
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:DefaultProjectOutcomes.java


示例20: getChildren

import org.gradle.tooling.model.DomainObjectSet; //导入依赖的package包/类
public DomainObjectSet<ProjectOutcomes> getChildren() {
    return new ImmutableDomainObjectSet<ProjectOutcomes>(children);
}
 
开发者ID:lxxlxx888,项目名称:Reer,代码行数:4,代码来源:DefaultProjectOutcomes.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SimpleOptionHandler类代码示例发布时间:2022-05-22
下一篇:
Java ConstructorUtils类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap