本文整理匯總了Java中org.jetbrains.jps.model.library.JpsOrderRootType類的典型用法代碼示例。如果您正苦於以下問題:Java JpsOrderRootType類的具體用法?Java JpsOrderRootType怎麽用?Java JpsOrderRootType使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
JpsOrderRootType類屬於org.jetbrains.jps.model.library包,在下文中一共展示了JpsOrderRootType類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: getSubstitution
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
public List<JpsPackagingElement> getSubstitution() {
JpsLibrary library = getLibraryReference().resolve();
if (library == null) return Collections.emptyList();
List<JpsPackagingElement> result = new ArrayList<JpsPackagingElement>();
for (File file : library.getFiles(JpsOrderRootType.COMPILED)) {
String path = FileUtil.toSystemIndependentName(file.getAbsolutePath());
if (file.isDirectory()) {
result.add(JpsPackagingElementFactory.getInstance().createDirectoryCopy(path));
}
else {
result.add(JpsPackagingElementFactory.getInstance().createFileCopy(path, null));
}
}
return result;
}
示例2: addModuleLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
protected void addModuleLibrary(JpsModule rootModel,
Element element,
boolean exported,
String libName,
String url,
String srcUrl,
String nativeRoot,
ExpandMacroToPathMap macroMap) {
final JpsLibrary jpsLibrary = rootModel.addModuleLibrary(libName, JpsJavaLibraryType.INSTANCE);
final JpsDependenciesList dependenciesList = rootModel.getDependenciesList();
final JpsLibraryDependency dependency = dependenciesList.addLibraryDependency(jpsLibrary);
url = StringUtil.trimStart(url, "file://");
final String linked = expandLinkedResourcesPath(url, macroMap);
if (linked != null) {
url = pathToUrl(linked);
}
else {
url = expandEclipsePath2Url(rootModel, url);
}
LOG.debug("loading " + rootModel.getName() + ": adding module library " + libName + ": " + url);
jpsLibrary.addRoot(url, JpsOrderRootType.COMPILED);
setLibraryEntryExported(dependency, exported);
}
示例3: addModuleLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
protected void addModuleLibrary(JpsModule rootModel,
Element element,
boolean exported,
String libName,
String url,
String srcUrl,
ExpandMacroToPathMap macroMap) {
final JpsLibrary jpsLibrary = rootModel.addModuleLibrary(libName, JpsJavaLibraryType.INSTANCE);
final JpsDependenciesList dependenciesList = rootModel.getDependenciesList();
final JpsLibraryDependency dependency = dependenciesList.addLibraryDependency(jpsLibrary);
url = StringUtil.trimStart(url, "file://");
final String linked = expandLinkedResourcesPath(url, macroMap);
if (linked != null) {
url = pathToUrl(linked);
}
else {
url = expandEclipsePath2Url(rootModel, url);
}
LOG.debug("loading " + rootModel.getName() + ": adding module library " + libName + ": " + url);
jpsLibrary.addRoot(url, JpsOrderRootType.COMPILED);
setLibraryEntryExported(dependency, exported);
}
示例4: addJdk
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
protected JpsSdk<JpsDummyElement> addJdk(final String name, final String path) {
String homePath = System.getProperty("java.home");
String versionString = System.getProperty("java.version");
JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk = myModel.getGlobal().addSdk(name, homePath, versionString, JpsJavaSdkType.INSTANCE);
jdk.addRoot(JpsPathUtil.pathToUrl(path), JpsOrderRootType.COMPILED);
return jdk.getProperties();
}
示例5: addJavaSdk
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
public JpsTypedLibrary<JpsSdk<JpsDummyElement>> addJavaSdk(@NotNull JpsGlobal global, @NotNull String name, @NotNull String homePath) {
String version = JdkVersionDetector.getInstance().detectJdkVersion(homePath);
JpsTypedLibrary<JpsSdk<JpsDummyElement>> sdk = global.addSdk(name, homePath, version, JpsJavaSdkType.INSTANCE);
File homeDir = new File(FileUtil.toSystemDependentName(homePath));
List<File> roots = JavaSdkUtil.getJdkClassesRoots(homeDir, false);
for (File root : roots) {
sdk.addRoot(root, JpsOrderRootType.COMPILED);
}
return sdk;
}
示例6: addJdk
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@NotNull
private JpsTypedLibrary<JpsSdk<JpsDummyElement>> addJdk(final String mockJdkVersion) {
final String mockJdkDir = "mockJDK-" + mockJdkVersion;
File home = PathManagerEx.findFileUnderCommunityHome("java/" + mockJdkDir);
JpsTypedLibrary<JpsSdk<JpsDummyElement>> jdk = myModel.getGlobal().addSdk(mockJdkVersion, home.getAbsolutePath(), mockJdkVersion, JpsJavaSdkType.INSTANCE);
jdk.addRoot(getRtJar(mockJdkDir), JpsOrderRootType.COMPILED);
return jdk;
}
示例7: testDuplicatedModuleLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
public void testDuplicatedModuleLibrary() {
loadProject("/jps/model-serialization/testData/duplicatedModuleLibrary/duplicatedModuleLibrary.ipr");
JpsModule module = assertOneElement(myProject.getModules());
List<JpsDependencyElement> dependencies = module.getDependenciesList().getDependencies();
assertEquals(4, dependencies.size());
JpsLibrary lib1 = assertInstanceOf(dependencies.get(2), JpsLibraryDependency.class).getLibrary();
assertNotNull(lib1);
assertSameElements(lib1.getRootUrls(JpsOrderRootType.COMPILED), getUrl("data/lib1"));
JpsLibrary lib2 = assertInstanceOf(dependencies.get(3), JpsLibraryDependency.class).getLibrary();
assertNotSame(lib1, lib2);
assertNotNull(lib2);
assertSameElements(lib2.getRootUrls(JpsOrderRootType.COMPILED), getUrl("data/lib2"));
}
示例8: addJdkAndAndroidSdk
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
private JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>> addJdkAndAndroidSdk() {
final String jdkName = "java_sdk";
addJdk(jdkName);
final JpsAndroidSdkProperties properties = new JpsAndroidSdkProperties("android-17", jdkName);
final String sdkPath = getAndroidHomePath() + "/testData/sdk1.5";
final JpsTypedLibrary<JpsSdk<JpsSimpleElement<JpsAndroidSdkProperties>>> library =
myModel.getGlobal().addSdk("android_sdk", sdkPath, "", JpsAndroidSdkType.INSTANCE,
new JpsSimpleElementImpl<JpsAndroidSdkProperties>(properties));
library.addRoot(new File(sdkPath + "/platforms/android-1.5/android.jar"), JpsOrderRootType.COMPILED);
//library.addRoot(new File(getAndroidHomePath() + "/testData/android.jar"), JpsOrderRootType.COMPILED);
return library.getProperties();
}
示例9: addJUnitDefaultLib
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
protected void addJUnitDefaultLib(JpsModule rootModel, String junitName, ExpandMacroToPathMap macroMap) {
final String ideaHome = macroMap.substitute("$APPLICATION_HOME_DIR$", SystemInfo.isFileSystemCaseSensitive);
final FilenameFilter junitFilter = new FilenameFilter() {
@Override
public boolean accept(File dir, String name) {
return name.startsWith("junit");
}
};
File[] junitJars = new File(ideaHome, "lib").listFiles(junitFilter);
if (junitJars == null || junitJars.length == 0) {
junitJars = new File(new File(ideaHome, "community"), "lib").listFiles(junitFilter);
}
if (junitJars != null && junitJars.length > 0) {
final boolean isJUnit4 = junitName.contains("4");
File junitJar = null;
for (File jar : junitJars) {
final boolean isCurrentJarV4 = jar.getName().contains("4");
if (isCurrentJarV4 && isJUnit4 || !isCurrentJarV4 && !isJUnit4) {
junitJar = jar;
break;
}
}
if (junitJar != null) {
final JpsLibrary jpsLibrary = rootModel.addModuleLibrary(junitName, JpsJavaLibraryType.INSTANCE);
jpsLibrary.addRoot(pathToUrl(junitJar.getPath()), JpsOrderRootType.COMPILED);
final JpsDependenciesList dependenciesList = rootModel.getDependenciesList();
dependenciesList.addLibraryDependency(jpsLibrary);
}
}
}
示例10: hasDirsOnly
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
private static boolean hasDirsOnly(JpsLibrary library) {
List<File> files = library.getFiles(JpsOrderRootType.COMPILED);
for (File file : files) {
if (!file.isDirectory()) {
return false;
}
}
return true;
}
示例11: setUp
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@Override
public void setUp() throws Exception {
super.setUp();
File home = PathManagerEx.findFileUnderCommunityHome("java/mockJDK-1.7");
myJdk = myModel.getGlobal().addSdk("mockJDK-1.7", home.getAbsolutePath(), "1.7", JpsJavaSdkType.INSTANCE);
myJdk.addRoot(getRtJar(), JpsOrderRootType.COMPILED);
myModule = addModule();
myModule.getSdkReferencesTable().setSdkReference(JpsJavaSdkType.INSTANCE, myJdk.getProperties().createReference());
myModule.getDependenciesList().addSdkDependency(JpsJavaSdkType.INSTANCE);
}
示例12: buildClassPath
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的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());
}
}
}
}
}
}
示例13: addProjectLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
protected JpsLibrary addProjectLibrary(String name, String jarPath) {
final JpsLibrary library = myProject.getLibraryCollection().addLibrary(name, JpsJavaLibraryType.INSTANCE);
library.addRoot(JpsPathUtil.pathToUrl(jarPath), JpsOrderRootType.COMPILED);
return library;
}
示例14: addLibrary
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
protected JpsLibrary addLibrary(final String jarPath) {
JpsLibrary library = myProject.addLibrary("l", JpsJavaLibraryType.INSTANCE);
library.addRoot(new File(getAbsolutePath(jarPath)), JpsOrderRootType.COMPILED);
return library;
}
示例15: classes
import org.jetbrains.jps.model.library.JpsOrderRootType; //導入依賴的package包/類
@NotNull
@Override
public JpsJavaDependenciesRootsEnumerator classes() {
return new JpsJavaDependenciesRootsEnumeratorImpl(this, JpsOrderRootType.COMPILED);
}