use of org.jetbrains.jps.model.library.JpsLibraryRoot in project intellij-elixir by KronicDeth.
the class Builder method prependCodePaths.
private static void prependCodePaths(@NotNull GeneralCommandLine commandLine, @NotNull JpsSdk sdk) {
JpsLibrary jpsLibrary = sdk.getParent();
List<JpsLibraryRoot> compiledRoots = jpsLibrary.getRoots(JpsOrderRootType.COMPILED);
for (JpsLibraryRoot compiledRoot : compiledRoots) {
String url = compiledRoot.getUrl();
assert url.startsWith(URL_PREFIX);
String path = url.substring(URL_PREFIX.length(), url.length());
commandLine.addParameters("-pa", path);
}
}
use of org.jetbrains.jps.model.library.JpsLibraryRoot in project intellij-elixir by KronicDeth.
the class BuilderTest method addElixirSdk.
private JpsSdk<SdkProperties> addElixirSdk(@NotNull JpsSdk erlangSdk) {
JpsTypedLibrary<JpsSdk<SdkProperties>> elixirTypedLibrary = myModel.getGlobal().addSdk("Elixir " + elixirVersion(), elixirSdkHome(), elixirVersion(), Elixir.INSTANCE);
HomePath.eachEbinPath(elixirSdkHome(), ebinPath -> elixirTypedLibrary.addRoot(JpsPathUtil.pathToUrl(ebinPath.toAbsolutePath().toString()), JpsOrderRootType.COMPILED));
JpsLibrary erlangSdkLibrary = erlangSdk.getParent();
elixirTypedLibrary.getProperties().getSdkProperties().setErlangSdkName(erlangSdkLibrary.getName());
for (JpsLibraryRoot erlangLibraryRoot : erlangSdkLibrary.getRoots(JpsOrderRootType.COMPILED)) {
elixirTypedLibrary.addRoot(erlangLibraryRoot.getUrl(), JpsOrderRootType.COMPILED);
}
return elixirTypedLibrary.getProperties();
}
use of org.jetbrains.jps.model.library.JpsLibraryRoot in project teavm by konsoletyper.
the class TeaVMBuild method buildClassPath.
private void buildClassPath(JpsModule module) {
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;
File dependencyOutput = JpsJavaExtensionService.getInstance().getOutputDirectory(moduleDependency.getModule(), false);
if (dependencyOutput != null && !isBlacklistedDependency(dependencyOutput)) {
classPathEntries.add(dependencyOutput.getPath());
}
for (JpsModuleSourceRoot sourceRoot : moduleDependency.getModule().getSourceRoots()) {
buildStrategy.addSourcesDirectory(sourceRoot.getFile().getAbsolutePath());
}
} 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());
}
}
}
}
}
}
Aggregations