use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class ResourceCopyingTest method testResourceRoot.
public void testResourceRoot() {
String file = createFile("res/A.java", "xxx");
JpsModule m = addModule("m");
m.addSourceRoot(JpsPathUtil.pathToUrl(PathUtil.getParentPath(file)), JavaResourceRootType.RESOURCE);
rebuildAllModules();
assertOutput(m, fs().file("A.java", "xxx"));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class CleanArtifactOutputOnRebuildTest method testCleanModuleOutputIfItIsIncludedInArtifact.
public void testCleanModuleOutputIfItIsIncludedInArtifact() {
String file = createFile("src/A.java", "class A{}");
JpsModule m = addModule("m", PathUtil.getParentPath(file));
JpsArtifact a = addArtifact(root().module(m));
buildArtifacts(a);
createFileInModuleOutput(m, "b.txt");
assertOutput(m, fs().file("A.class").file("b.txt"));
rebuildAllModulesAndArtifacts();
assertOutput(m, fs().file("A.class"));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class ArtifactBuilderTest method testExtractDirectoryFromExcludedJar.
public void testExtractDirectoryFromExcludedJar() throws IOException {
String jarPath = createFile("dir/lib/j.jar");
FileUtil.copy(new File(getJUnitJarPath()), new File(jarPath));
JpsModule module = addModule("m");
String libDir = PathUtil.getParentPath(jarPath);
module.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(PathUtil.getParentPath(libDir)));
module.getExcludeRootsList().addUrl(JpsPathUtil.pathToUrl(libDir));
final JpsArtifact a = addArtifact("a", root().extractedDir(jarPath, "/junit/textui/"));
buildAll();
assertOutput(a, fs().file("ResultPrinter.class").file("TestRunner.class"));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class CleanArtifactOutputOnRebuildTest method testDoNotCleanIfContainsArtifactRoot.
public void testDoNotCleanIfContainsArtifactRoot() {
JpsModule m = addModule("m");
String resDir = PathUtil.getParentPath(createFile("res/a.txt"));
m.getContentRootsList().addUrl(JpsPathUtil.pathToUrl(resDir));
JpsArtifact a = addArtifact(root().dirCopy(resDir));
a.setOutputPath(resDir);
buildArtifacts(a);
assertOutput(a, fs().file("a.txt"));
createFile("res/b.txt");
rebuildAllModulesAndArtifacts();
assertOutput(a, fs().file("a.txt").file("b.txt"));
}
use of org.jetbrains.jps.model.module.JpsModule in project intellij-community by JetBrains.
the class JpsProjectLoader method loadModules.
private void loadModules(Element root, @Nullable final JpsSdkType<?> projectSdkType) {
Runnable timingLog = TimingLog.startActivity("loading modules");
Element componentRoot = JDomSerializationUtil.findComponent(root, "ProjectModuleManager");
if (componentRoot == null)
return;
final Set<File> foundFiles = new THashSet<>(FileUtil.FILE_HASHING_STRATEGY);
final List<File> moduleFiles = new ArrayList<>();
for (Element moduleElement : JDOMUtil.getChildren(componentRoot.getChild("modules"), "module")) {
final String path = moduleElement.getAttributeValue("filepath");
final File file = new File(path);
if (foundFiles.add(file) && file.exists()) {
moduleFiles.add(file);
} else {
LOG.info("Module '" + FileUtil.getNameWithoutExtension(file) + "' is skipped: " + file.getAbsolutePath() + " doesn't exist");
}
}
List<JpsModule> modules = loadModules(moduleFiles, projectSdkType, myPathVariables);
for (JpsModule module : modules) {
myProject.addModule(module);
}
timingLog.run();
}
Aggregations