本文整理汇总了Java中org.jetbrains.jps.model.module.JpsModuleDependency类的典型用法代码示例。如果您正苦于以下问题:Java JpsModuleDependency类的具体用法?Java JpsModuleDependency怎么用?Java JpsModuleDependency使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
JpsModuleDependency类属于org.jetbrains.jps.model.module包,在下文中一共展示了JpsModuleDependency类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectAndroidDependencies
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
private static void collectAndroidDependencies(@NotNull JpsModule module,
@NotNull MyAndroidDeps result,
@NotNull Set<String> visitedSet,
boolean fillLibs,
boolean recursively) {
final List<JpsDependencyElement> dependencies =
new ArrayList<JpsDependencyElement>(JpsJavaExtensionService.getInstance().getDependencies(
module, JpsJavaClasspathKind.PRODUCTION_RUNTIME, false));
for (int i = dependencies.size() - 1; i >= 0; i--) {
final JpsDependencyElement item = dependencies.get(i);
if (item instanceof JpsModuleDependency) {
final JpsModule depModule = ((JpsModuleDependency)item).getModule();
if (depModule != null) {
final JpsAndroidModuleExtension depExtension = AndroidJpsUtil.getExtension(depModule);
if (depExtension != null && visitedSet.add(depModule.getName())) {
if (recursively) {
final boolean newRecursively = AndroidJpsUtil.shouldProcessDependenciesRecursively(depModule);
collectAndroidDependencies(depModule, result, visitedSet, fillLibs && depExtension.isLibrary(), newRecursively);
}
result.myAndroidDeps.add(depExtension);
if (fillLibs && depExtension.isLibrary()) {
result.myLibAndroidDeps.add(depExtension);
}
}
}
}
}
}
示例2: checkAndroidDependencies
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
private static void checkAndroidDependencies(@NotNull Map<JpsModule, MyModuleData> moduleDataMap, @NotNull CompileContext context) {
for (Map.Entry<JpsModule, MyModuleData> entry : moduleDataMap.entrySet()) {
final JpsModule module = entry.getKey();
final MyModuleData moduleData = entry.getValue();
final JpsAndroidModuleExtension extension = moduleData.getAndroidExtension();
if (extension.isLibrary()) {
continue;
}
for (JpsDependencyElement item : JpsJavaExtensionService.getInstance()
.getDependencies(module, JpsJavaClasspathKind.PRODUCTION_RUNTIME, false)) {
if (item instanceof JpsModuleDependency) {
final JpsModule depModule = ((JpsModuleDependency)item).getModule();
if (depModule != null) {
final JpsAndroidModuleExtension depExtension = AndroidJpsUtil.getExtension(depModule);
if (depExtension != null && !depExtension.isLibrary()) {
String message = "Suspicious module dependency " + module.getName() + " -> " + depModule.getName() +
": Android application module depends on other application module. Possibly, you should " +
"change type of module '" + depModule.getName() +
"' to 'Library' or change the dependency scope to 'Provided'.";
context.processMessage(new CompilerMessage(ANDROID_VALIDATOR, BuildMessage.Kind.WARNING, message));
}
}
}
}
}
}
示例3: fillDepsRecursively
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
private static void fillDepsRecursively(@NotNull JpsModule root,
@NotNull Set<JpsModule> libModules,
@NotNull Set<String> externalJars,
@NotNull BuildDataPaths dataPaths,
@NotNull AndroidPlatform platform) {
for (String jarOrLibDirPath : AndroidJpsUtil.getExternalLibraries(dataPaths, root, platform, false, false, true)) {
final String path = FileUtil.toCanonicalPath(jarOrLibDirPath);
if (path != null) {
externalJars.add(path);
}
}
for (JpsDependencyElement dependencyElement : root.getDependenciesList().getDependencies()) {
if (dependencyElement instanceof JpsModuleDependency) {
final JpsModule depModule = ((JpsModuleDependency)dependencyElement).getModule();
if (depModule != null) {
final JpsAndroidModuleExtension depExtension = AndroidJpsUtil.getExtension(depModule);
if (depExtension != null && depExtension.isLibrary()) {
if (libModules.add(depModule)) {
fillDepsRecursively(depModule, libModules, externalJars, dataPaths, platform);
}
}
}
}
}
}
示例4: buildClassPath
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
private void buildClassPath(JpsModule module, Set<JpsModule> visited) {
if (!visited.add(module)) {
return;
}
File output = JpsJavaExtensionService.getInstance().getOutputDirectory(module, false);
if (output != null) {
classPathEntries.add(output.getPath());
}
for (JpsModuleSourceRoot sourceRoot : module.getSourceRoots()) {
buildStrategy.addSourcesDirectory(sourceRoot.getFile().getAbsolutePath());
}
for (JpsDependencyElement dependency : module.getDependenciesList().getDependencies()) {
if (dependency instanceof JpsModuleDependency) {
JpsModuleDependency moduleDependency = (JpsModuleDependency) dependency;
buildClassPath(moduleDependency.getModule(), visited);
} else if (dependency instanceof JpsLibraryDependency) {
JpsLibrary library = ((JpsLibraryDependency) dependency).getLibrary();
if (library == null) {
continue;
}
classPathEntries.addAll(library.getFiles(JpsOrderRootType.COMPILED).stream().map(File::getPath)
.collect(toList()));
for (JpsLibraryRoot libraryRoot : library.getRoots(JpsOrderRootType.SOURCES)) {
File file = getFileFromUrl(libraryRoot.getUrl());
if (file != null) {
if (file.isDirectory()) {
buildStrategy.addSourcesDirectory(file.getAbsolutePath());
} else {
buildStrategy.addSourcesJar(file.getAbsolutePath());
}
}
}
}
}
}
示例5: addExportedDependency
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
private static void addExportedDependency(JpsModule main, JpsModule dep) {
JpsModuleDependency dependency = main.getDependenciesList().addModuleDependency(dep);
JpsJavaExtensionService.getInstance().getOrCreateDependencyExtension(dependency).setExported(true);
}
示例6: JpsModuleOrderEntry
import org.jetbrains.jps.model.module.JpsModuleDependency; //导入依赖的package包/类
public JpsModuleOrderEntry(JpsRootModel rootModel, JpsModuleDependency dependencyElement) {
super(rootModel, dependencyElement);
}