mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Merge branch 'master' into incremental
This commit is contained in:
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="jps-appLauncher">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts</output-path>
|
||||
<root id="archive" name="jps-appLauncher.jar">
|
||||
<element id="module-output" name="appLauncher" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
Generated
+8
@@ -0,0 +1,8 @@
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="jps-scala">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts</output-path>
|
||||
<root id="archive" name="jps-scala.jar">
|
||||
<element id="module-output" name="scala" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
Generated
+1
@@ -6,6 +6,7 @@
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/plugins/javaee/src" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/plugins/gwt/src" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/plugins/jpa/src" />
|
||||
<element id="dir-copy" path="$PROJECT_DIR$/antLayout/src" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
@@ -1,5 +1,8 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="PROJECT_PROFILE" value="Project Default" />
|
||||
<option name="USE_PROJECT_PROFILE" value="true" />
|
||||
<version value="1.0" />
|
||||
<list size="6">
|
||||
<item index="0" class="java.lang.String" itemvalue="TYPO" />
|
||||
<item index="1" class="java.lang.String" itemvalue="WEAK WARNING" />
|
||||
|
||||
Generated
+2
@@ -3,10 +3,12 @@
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/antLayout/antlayout.iml" filepath="$PROJECT_DIR$/antLayout/antlayout.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/appLauncher/appLauncher.iml" filepath="$PROJECT_DIR$/plugins/appLauncher/appLauncher.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/gwt/gwt.iml" filepath="$PROJECT_DIR$/plugins/gwt/gwt.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/javaee/javaee.iml" filepath="$PROJECT_DIR$/plugins/javaee/javaee.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/jpa/jpa.iml" filepath="$PROJECT_DIR$/plugins/jpa/jpa.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/jps.iml" filepath="$PROJECT_DIR$/jps.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/plugins/scala/scala.iml" filepath="$PROJECT_DIR$/plugins/scala/scala.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/serverFacade/serverFacade.iml" filepath="$PROJECT_DIR$/serverFacade/serverFacade.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
|
||||
Generated
+10
-10
@@ -1,10 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClearCaseSharedConfig">
|
||||
<option name="myUseUcmModel" value="true" />
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClearCaseSharedConfig">
|
||||
<option name="myUseUcmModel" value="true" />
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="Git" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
|
||||
@@ -7,4 +7,5 @@
|
||||
<typedef name="renamedFile" classname="jetbrains.antlayout.datatypes.RenamedFileContainer"/>
|
||||
<typedef name="extractedDir" classname="jetbrains.antlayout.datatypes.ExtractedDirContent"/>
|
||||
<typedef name="module" classname="jetbrains.antlayout.datatypes.IdeaModule"/>
|
||||
<typedef name="moduleTests" classname="jetbrains.antlayout.datatypes.IdeaModuleTests"/>
|
||||
</antlib>
|
||||
@@ -60,6 +60,10 @@ public abstract class Container extends Content {
|
||||
children.add(new FileSetContainer(module));
|
||||
}
|
||||
|
||||
public void addModuleTests(IdeaModuleTests module) {
|
||||
children.add(new FileSetContainer(module));
|
||||
}
|
||||
|
||||
public List<Content> getChildren() {
|
||||
return children;
|
||||
}
|
||||
@@ -100,6 +104,9 @@ public abstract class Container extends Content {
|
||||
if (set instanceof IdeaModule) {
|
||||
return new IdeaModule((IdeaModule) set);
|
||||
}
|
||||
if (set instanceof IdeaModuleTests) {
|
||||
return new IdeaModuleTests((IdeaModuleTests) set);
|
||||
}
|
||||
if (set instanceof ZipFileSet) {
|
||||
return new LayoutFileSet((ZipFileSet) set.clone());
|
||||
} else {
|
||||
|
||||
@@ -27,8 +27,8 @@ public class FileSetContainer extends Content {
|
||||
|
||||
@Override
|
||||
public void validateArguments() throws BuildException {
|
||||
if (fileSet instanceof IdeaModule) {
|
||||
((IdeaModule) fileSet).validateArguments();
|
||||
if (fileSet instanceof IdeaModuleBase) {
|
||||
((IdeaModuleBase) fileSet).validateArguments();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,65 +1,23 @@
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import jetbrains.antlayout.util.LayoutFileSet;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class IdeaModule extends LayoutFileSet {
|
||||
private String name;
|
||||
|
||||
public IdeaModule() {
|
||||
}
|
||||
|
||||
public IdeaModule(IdeaModule fileset) {
|
||||
super(fileset);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
setDir(getMainOutput());
|
||||
}
|
||||
|
||||
private File getMainOutput() {
|
||||
String common = getProject().getProperty("modules.output");
|
||||
if (common != null) {
|
||||
return new File(new File(common), "production/" + name);
|
||||
}
|
||||
|
||||
String adhoc = getProject().getProperty("module." + name +".output.main");
|
||||
return adhoc != null ? new File(adhoc) : null;
|
||||
}
|
||||
|
||||
public void validateArguments() throws BuildException {
|
||||
if (name == null) {
|
||||
throw new BuildException("name attribute must be specified for moduleentry");
|
||||
}
|
||||
|
||||
File main = getMainOutput();
|
||||
|
||||
if (main == null || !main.exists()) {
|
||||
throw new BuildException("No production output found for module " + name +
|
||||
". Either modules.output property references project output that doesn't contain this module or " +
|
||||
"module." + name +".output.main is not defined or references non-existing directory.");
|
||||
}
|
||||
}
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
IdeaModule that = (IdeaModule) o;
|
||||
return getDir(getProject()).equals(that.getDir(getProject()));
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return getDir(getProject()).hashCode();
|
||||
}
|
||||
}
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class IdeaModule extends IdeaModuleBase {
|
||||
public IdeaModule() {
|
||||
}
|
||||
|
||||
public IdeaModule(IdeaModule fileset) {
|
||||
super(fileset);
|
||||
}
|
||||
|
||||
protected String getKind() {
|
||||
return "production";
|
||||
}
|
||||
|
||||
protected String getOutputDirProperty() {
|
||||
return "module." + getName() + ".output.main";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,70 @@
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import jetbrains.antlayout.util.LayoutFileSet;
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.types.ZipFileSet;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public abstract class IdeaModuleBase extends LayoutFileSet {
|
||||
private String name;
|
||||
|
||||
protected IdeaModuleBase() {
|
||||
}
|
||||
|
||||
public IdeaModuleBase(ZipFileSet fileset) {
|
||||
super(fileset);
|
||||
}
|
||||
|
||||
public String getName() {
|
||||
return name;
|
||||
}
|
||||
|
||||
public void setName(String name) {
|
||||
this.name = name;
|
||||
setDir(getOutputDir());
|
||||
}
|
||||
|
||||
protected File getOutputDir() {
|
||||
String common = getProject().getProperty("modules.output");
|
||||
if (common != null) {
|
||||
return new File(new File(common), getKind() + "/" + getName());
|
||||
}
|
||||
|
||||
String adhoc = getProject().getProperty(getOutputDirProperty());
|
||||
return adhoc != null ? new File(adhoc) : null;
|
||||
}
|
||||
|
||||
public void validateArguments() throws BuildException {
|
||||
if (name == null) {
|
||||
throw new BuildException("name attribute must be specified for module entry");
|
||||
}
|
||||
|
||||
File outputDir = getOutputDir();
|
||||
|
||||
if (outputDir == null || !outputDir.exists()) {
|
||||
throw new BuildException("No " + getKind() + " output found for module " + name +
|
||||
". Either modules.output property references project output that doesn't contain this module or " +
|
||||
getOutputDirProperty() + " is not defined or references non-existing directory.");
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract String getOutputDirProperty();
|
||||
|
||||
protected abstract String getKind();
|
||||
|
||||
public boolean equals(Object o) {
|
||||
if (this == o) return true;
|
||||
if (o == null || getClass() != o.getClass()) return false;
|
||||
|
||||
IdeaModule that = (IdeaModule) o;
|
||||
return getDir(getProject()).equals(that.getDir(getProject()));
|
||||
}
|
||||
|
||||
public int hashCode() {
|
||||
return getDir(getProject()).hashCode();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import org.apache.tools.ant.types.ZipFileSet;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class IdeaModuleTests extends IdeaModuleBase {
|
||||
public IdeaModuleTests() {
|
||||
}
|
||||
|
||||
public IdeaModuleTests(ZipFileSet fileset) {
|
||||
super(fileset);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getOutputDirProperty() {
|
||||
return "module." + getName() + ".output.test";
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getKind() {
|
||||
return "test";
|
||||
}
|
||||
}
|
||||
@@ -1,46 +1,50 @@
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import org.apache.tools.ant.taskdefs.Zip;
|
||||
import org.apache.tools.ant.taskdefs.Jar;
|
||||
import org.apache.tools.ant.taskdefs.Manifest;
|
||||
import org.apache.tools.ant.taskdefs.ManifestException;
|
||||
import org.apache.tools.ant.types.ZipFileSet;
|
||||
import org.apache.tools.ant.types.Path;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JarContainer extends ZipContainer {
|
||||
protected Zip createTask() {
|
||||
Jar task = new Jar();
|
||||
task.setTaskName("jar");
|
||||
task.setWhenmanifestonly((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "skip"));
|
||||
return task;
|
||||
}
|
||||
|
||||
public void setIndex(boolean flag) {
|
||||
((Jar) task).setIndex(flag);
|
||||
}
|
||||
|
||||
public void setManifestEncoding(String manifestEncoding) {
|
||||
((Jar) task).setManifestEncoding(manifestEncoding);
|
||||
}
|
||||
|
||||
public void setManifest(File manifestFile) {
|
||||
((Jar) task).setManifest(manifestFile);
|
||||
}
|
||||
|
||||
public void setFilesetmanifest(Jar.FilesetManifestConfig config) {
|
||||
((Jar) task).setFilesetmanifest(config);
|
||||
}
|
||||
|
||||
public void addConfiguredManifest(Manifest newManifest) throws ManifestException {
|
||||
((Jar) task).addConfiguredManifest(newManifest);
|
||||
}
|
||||
|
||||
public void addMetainf(ZipFileSet fs) {
|
||||
((Jar) task).addMetainf(fs);
|
||||
}
|
||||
}
|
||||
package jetbrains.antlayout.datatypes;
|
||||
|
||||
import org.apache.tools.ant.Main;
|
||||
import org.apache.tools.ant.taskdefs.*;
|
||||
import org.apache.tools.ant.types.ZipFileSet;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* @author max
|
||||
*/
|
||||
public class JarContainer extends ZipContainer {
|
||||
protected Zip createTask() {
|
||||
String version = Main.getAntVersion();
|
||||
Jar task;
|
||||
if (version != null && (version.indexOf("1.8.0") != -1 || version.indexOf("1.8.1") != -1)) {
|
||||
task = new PatchedJar();
|
||||
}
|
||||
else {
|
||||
task = new Jar();
|
||||
}
|
||||
task.setTaskName("jar");
|
||||
task.setWhenmanifestonly((Zip.WhenEmpty) Zip.WhenEmpty.getInstance(Zip.WhenEmpty.class, "skip"));
|
||||
return task;
|
||||
}
|
||||
|
||||
public void setIndex(boolean flag) {
|
||||
((Jar) task).setIndex(flag);
|
||||
}
|
||||
|
||||
public void setManifestEncoding(String manifestEncoding) {
|
||||
((Jar) task).setManifestEncoding(manifestEncoding);
|
||||
}
|
||||
|
||||
public void setManifest(File manifestFile) {
|
||||
((Jar) task).setManifest(manifestFile);
|
||||
}
|
||||
|
||||
public void setFilesetmanifest(Jar.FilesetManifestConfig config) {
|
||||
((Jar) task).setFilesetmanifest(config);
|
||||
}
|
||||
|
||||
public void addConfiguredManifest(Manifest newManifest) throws ManifestException {
|
||||
((Jar) task).addConfiguredManifest(newManifest);
|
||||
}
|
||||
|
||||
public void addMetainf(ZipFileSet fs) {
|
||||
((Jar) task).addMetainf(fs);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,10 @@ public class LayoutTask extends Task {
|
||||
containers.add(new FileSetContainer(module));
|
||||
}
|
||||
|
||||
public void addModuleTests(IdeaModuleTests module) {
|
||||
containers.add(new FileSetContainer(module));
|
||||
}
|
||||
|
||||
public void addFileset(FileSet fileSet) {
|
||||
containers.add(new FileSetContainer(fileSet));
|
||||
}
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.apache.tools.ant.taskdefs;
|
||||
|
||||
import org.apache.tools.ant.BuildException;
|
||||
import org.apache.tools.ant.Project;
|
||||
import org.apache.tools.ant.taskdefs.Jar;
|
||||
import org.apache.tools.ant.taskdefs.Zip;
|
||||
import org.apache.tools.ant.types.ArchiveFileSet;
|
||||
import org.apache.tools.ant.types.FileSet;
|
||||
import org.apache.tools.ant.types.Resource;
|
||||
import org.apache.tools.ant.types.ResourceCollection;
|
||||
|
||||
import java.io.File;
|
||||
|
||||
/**
|
||||
* This class is added to workaround https://issues.apache.org/bugzilla/show_bug.cgi?id=49605
|
||||
* in Ant 1.8.0 and 1.8.1
|
||||
*
|
||||
* @author nik
|
||||
*/
|
||||
public class PatchedJar extends Jar {
|
||||
private static final String MANIFEST_NAME = "META-INF/MANIFEST.MF";
|
||||
|
||||
@Override
|
||||
protected ArchiveState getResourcesToAdd(ResourceCollection[] rcs, File zipFile, boolean needsUpdate) throws BuildException {
|
||||
if (skipWriting) {
|
||||
// this pass is only there to construct the merged
|
||||
// manifest this means we claim an update was needed and
|
||||
// only include the manifests, skipping any uptodate
|
||||
// checks here defering them for the second run
|
||||
Resource[][] manifests = grabManifests(rcs);
|
||||
int count = 0;
|
||||
for (int i = 0; i < manifests.length; i++) {
|
||||
count += manifests[i].length;
|
||||
}
|
||||
log("found a total of " + count + " manifests in "
|
||||
+ manifests.length + " resource collections",
|
||||
Project.MSG_VERBOSE);
|
||||
return new ArchiveState(true, manifests);
|
||||
}
|
||||
|
||||
return super.getResourcesToAdd(rcs, zipFile, needsUpdate);
|
||||
}
|
||||
|
||||
/**
|
||||
* This method is copied from Jar class in Ant 1.8.2
|
||||
*/
|
||||
private Resource[][] grabManifests(ResourceCollection[] rcs) {
|
||||
Resource[][] manifests = new Resource[rcs.length][];
|
||||
for (int i = 0; i < rcs.length; i++) {
|
||||
Resource[][] resources = null;
|
||||
if (rcs[i] instanceof FileSet) {
|
||||
resources = grabResources(new FileSet[] {(FileSet) rcs[i]});
|
||||
} else {
|
||||
resources = grabNonFileSetResources(new ResourceCollection[] {
|
||||
rcs[i]
|
||||
});
|
||||
}
|
||||
for (int j = 0; j < resources[0].length; j++) {
|
||||
String name = resources[0][j].getName().replace('\\', '/');
|
||||
if (rcs[i] instanceof ArchiveFileSet) {
|
||||
ArchiveFileSet afs = (ArchiveFileSet) rcs[i];
|
||||
if (!"".equals(afs.getFullpath(getProject()))) {
|
||||
name = afs.getFullpath(getProject());
|
||||
} else if (!"".equals(afs.getPrefix(getProject()))) {
|
||||
String prefix = afs.getPrefix(getProject());
|
||||
if (!prefix.endsWith("/") && !prefix.endsWith("\\")) {
|
||||
prefix += "/";
|
||||
}
|
||||
name = prefix + name;
|
||||
}
|
||||
}
|
||||
if (name.equalsIgnoreCase(MANIFEST_NAME)) {
|
||||
manifests[i] = new Resource[] {resources[0][j]};
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (manifests[i] == null) {
|
||||
manifests[i] = new Resource[0];
|
||||
}
|
||||
}
|
||||
return manifests;
|
||||
}
|
||||
}
|
||||
Binary file not shown.
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="Groovy" level="project" />
|
||||
<orderEntry type="module" module-name="jps" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jps.runConf.java.JavaAppLauncher
|
||||
@@ -0,0 +1,24 @@
|
||||
package org.jetbrains.jps.runConf.java
|
||||
|
||||
import org.jetbrains.jps.RunConfiguration
|
||||
|
||||
class JavaAppLauncher extends JavaBasedRunConfigurationLauncher {
|
||||
public JavaAppLauncher() {
|
||||
super("Application")
|
||||
}
|
||||
|
||||
@Override
|
||||
String getMainClassName(RunConfiguration runConf) {
|
||||
return runConf.allOptions["MAIN_CLASS_NAME"]
|
||||
}
|
||||
|
||||
@Override
|
||||
String getMainClassArguments(RunConfiguration runConf) {
|
||||
return runConf.allOptions["PROGRAM_PARAMETERS"]
|
||||
}
|
||||
|
||||
@Override
|
||||
List<String> getMainClassClasspath(RunConfiguration runConf) {
|
||||
return Collections.emptyList()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions>
|
||||
<entry name=".+\.(properties|xml|html|dtd|tld)" />
|
||||
<entry name=".+\.(gif|png|jpeg|jpg)" />
|
||||
</resourceExtensions>
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.ftl" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing enabled="false" useClasspath="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,31 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="A8EB56D5B100B7935A4D03BDCB67E4B6" />
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="mySupportsUserInfoFilter" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/main-class-run-conf.iml" filepath="$PROJECT_DIR$/main-class-run-conf.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
Generated
+23
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MainClass" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" sample_coverage="true" runner="idea" merge="false" />
|
||||
<extension name="snapshooter" />
|
||||
<option name="MAIN_CLASS_NAME" value="MainClass" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="arg1 arg2" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="main-class-run-conf" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" snapshots-dir= additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
+23
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MainClassComplexArgs" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" sample_coverage="true" runner="idea" merge="false" />
|
||||
<extension name="snapshooter" />
|
||||
<option name="MAIN_CLASS_NAME" value="MainClass" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value='"argument with space1" "argument with space2" aa bb'/>
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="main-class-run-conf" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" snapshots-dir= additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
Generated
+26
@@ -0,0 +1,26 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MainClassEnvVars" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<extension name="snapshooter" />
|
||||
<option name="MAIN_CLASS_NAME" value="MainClassEnvVars" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="main-class-run-conf" />
|
||||
<envs>
|
||||
<env name="ENV1" value="val1" />
|
||||
<env name="ENV2" value="val2" />
|
||||
</envs>
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" snapshots-dir= additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
jps/plugins/appLauncher/testData/main-class-run-conf/.idea/runConfigurations/MainClassProperties.xml
Generated
+23
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MainClassProperties" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<extension name="snapshooter" />
|
||||
<option name="MAIN_CLASS_NAME" value="MainClassProperties" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="main-class-run-conf" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" snapshots-dir= additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
Generated
+23
@@ -0,0 +1,23 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="MainClassVmArgs" type="Application" factoryName="Application">
|
||||
<extension name="coverage" enabled="false" sample_coverage="true" runner="idea" merge="false" />
|
||||
<extension name="snapshooter" />
|
||||
<option name="MAIN_CLASS_NAME" value="MainClassProperties" />
|
||||
<option name="VM_PARAMETERS" value="-Dmy.prop1=val1 -Dmy.prop2=val2 -Dmy.prop3=$PROJECT_DIR$" />
|
||||
<option name="PROGRAM_PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="ENABLE_SWING_INSPECTOR" value="false" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<module name="main-class-run-conf" />
|
||||
<envs />
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" snapshots-dir= additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,12 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
|
||||
public class MainClass {
|
||||
public static void main(String[] args) {
|
||||
for (String arg: args) {
|
||||
System.out.println(arg);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
import java.lang.System;
|
||||
|
||||
public class MainClassEnvVars {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(System.getenv("ENV1"));
|
||||
System.out.println(System.getenv("ENV2"));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
import java.lang.System;
|
||||
|
||||
public class MainClassProperties {
|
||||
public static void main(String[] args) {
|
||||
System.out.println(System.getProperty("my.prop1"));
|
||||
System.out.println(System.getProperty("my.prop2"));
|
||||
System.out.println(System.getProperty("my.prop3"));
|
||||
}
|
||||
}
|
||||
+72
@@ -0,0 +1,72 @@
|
||||
package org.jetbrains.jps.runConf.java
|
||||
|
||||
import org.jetbrains.jps.JpsBuildTestCase
|
||||
import org.jetbrains.jps.Project
|
||||
import org.jetbrains.jps.RunConfiguration
|
||||
import org.jetbrains.jps.util.FileUtil
|
||||
|
||||
class JavaAppLauncherTest extends JpsBuildTestCase {
|
||||
public void test_simple() {
|
||||
runAndAssertOutput("MainClass", null, { output ->
|
||||
assertTrue(output, output.indexOf("arg1" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("arg2") != -1)
|
||||
})
|
||||
}
|
||||
|
||||
public void test_properties() {
|
||||
runAndAssertOutput("MainClassProperties", {JavaBasedRunConfigurationLauncher launcher ->
|
||||
launcher.addSystemProperties(["my.prop1" : "val1", "my.prop2" : "val2"])
|
||||
}, { output ->
|
||||
assertTrue(output, output.indexOf("val1" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("val2") != -1)
|
||||
})
|
||||
}
|
||||
|
||||
public void test_env_vars() {
|
||||
runAndAssertOutput("MainClassEnvVars", null, { output ->
|
||||
assertTrue(output, output.indexOf("val1" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("val2") != -1)
|
||||
})
|
||||
}
|
||||
|
||||
public void test_jvm_args() {
|
||||
runAndAssertOutput("MainClassVmArgs", null, { output ->
|
||||
assertTrue(output, output.indexOf("val1" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("val2") != -1)
|
||||
assertTrue(output, output.indexOf("plugins/appLauncher/testData/main-class-run-conf") != -1)
|
||||
})
|
||||
}
|
||||
|
||||
public void test_args_with_spaces() {
|
||||
runAndAssertOutput("MainClassComplexArgs", null, { output ->
|
||||
assertTrue(output, output.indexOf("argument with space1" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("argument with space2" + System.getProperty("line.separator")) != -1)
|
||||
assertTrue(output, output.indexOf("aa") != -1)
|
||||
assertTrue(output, output.indexOf("bb") != -1)
|
||||
})
|
||||
}
|
||||
|
||||
private void runAndAssertOutput(String runConfName, Closure launcherInitializer, Closure assertions) {
|
||||
Project project = loadProject("plugins/appLauncher/testData/main-class-run-conf", [:]);
|
||||
|
||||
RunConfiguration runConf = project.runConfigurations[runConfName];
|
||||
|
||||
project.targetFolder = createTempDir().absolutePath;
|
||||
|
||||
project.makeAll();
|
||||
|
||||
File outFile = createTempFile();
|
||||
|
||||
JavaAppLauncher launcher = new JavaAppLauncher();
|
||||
launcher.setOutputFile(outFile);
|
||||
|
||||
if (launcherInitializer != null) {
|
||||
launcherInitializer(launcher);
|
||||
}
|
||||
|
||||
launcher.start(runConf);
|
||||
|
||||
String output = FileUtil.loadFileText(outFile);
|
||||
assertions(output);
|
||||
}
|
||||
}
|
||||
@@ -4,12 +4,22 @@
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="IDEA jdk" jdkType="JavaSDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="jps" />
|
||||
<orderEntry type="library" name="Groovy" level="project" />
|
||||
<orderEntry type="module" module-name="javaee" />
|
||||
<orderEntry type="module-library">
|
||||
<library>
|
||||
<CLASSES>
|
||||
<root url="jar://$APPLICATION_HOME_DIR$/lib/junit.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</orderEntry>
|
||||
</component>
|
||||
</module>
|
||||
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.jetbrains.jps.gwt
|
||||
|
||||
import org.xml.sax.SAXParseException;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class GwtModuleUtil {
|
||||
public static boolean hasEntryPoints(File child) {
|
||||
try {
|
||||
def root = new XmlParser(false, false).parse(child)
|
||||
return !root."entry-point".isEmpty()
|
||||
}
|
||||
catch (IOException e) {
|
||||
return true;
|
||||
}
|
||||
catch (SAXParseException e) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,7 @@
|
||||
package org.jetbrains.jps.gwt;
|
||||
|
||||
import groovy.util.XmlParser;
|
||||
|
||||
import java.io.File;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -28,7 +30,9 @@ public class GwtModulesSearcher {
|
||||
for (File child : files) {
|
||||
final String name = child.getName();
|
||||
if (child.isFile() && name.endsWith(GWT_XML_SUFFIX)) {
|
||||
result.add(packageName + name.substring(0, name.length() - GWT_XML_SUFFIX.length()));
|
||||
if (GwtModuleUtil.hasEntryPoints(child)) {
|
||||
result.add(packageName + name.substring(0, name.length() - GWT_XML_SUFFIX.length()));
|
||||
}
|
||||
}
|
||||
else {
|
||||
collectGwtModules(child, packageName + name + ".", result);
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
|
||||
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
<entry-point class='com.app.client.App'/>
|
||||
</module>
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
|
||||
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
</modu>
|
||||
@@ -0,0 +1,5 @@
|
||||
<!DOCTYPE module PUBLIC "-//Google Inc.//DTD Google Web Toolkit 2.0//EN"
|
||||
"http://google-web-toolkit.googlecode.com/svn/releases/2.0/distro-source/core/src/gwt-module.dtd">
|
||||
<module>
|
||||
<inherits name='com.google.gwt.user.User'/>
|
||||
</module>
|
||||
@@ -0,0 +1,19 @@
|
||||
package org.jetbrains.jps.gwt;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashSet;
|
||||
import java.util.List;
|
||||
import java.util.Set;
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
public class GwtModulesSearcherTest extends TestCase {
|
||||
public void test() {
|
||||
List<String> modules = GwtModulesSearcher.findGwtModules(Arrays.asList("plugins/gwt/testData/modules"));
|
||||
assertEquals(new HashSet<String>(Arrays.asList("com.app.App", "com.app.InvalidXml")),
|
||||
new HashSet<String>(modules));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="module" module-name="jps" />
|
||||
<orderEntry type="library" name="Groovy" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
+1
@@ -0,0 +1 @@
|
||||
org.jetbrains.jps.scala.ScalaModuleBuilderService
|
||||
@@ -0,0 +1 @@
|
||||
org.jetbrains.jps.scala.ScalaFacetType
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.jetbrains.jps.scala
|
||||
|
||||
import org.jetbrains.jps.idea.Facet
|
||||
|
||||
class ScalaFacet extends Facet {
|
||||
String compilerLibraryName
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package org.jetbrains.jps.scala
|
||||
|
||||
import org.jetbrains.jps.idea.FacetTypeService
|
||||
import org.jetbrains.jps.idea.Facet
|
||||
import org.jetbrains.jps.Module
|
||||
import org.jetbrains.jps.MacroExpander
|
||||
|
||||
class ScalaFacetType extends FacetTypeService {
|
||||
ScalaFacetType() {
|
||||
super("scala")
|
||||
}
|
||||
|
||||
@Override
|
||||
Facet createFacet(Module module, String name, Node facetConfiguration, MacroExpander macroExpander) {
|
||||
Facet facet = new ScalaFacet(name: name)
|
||||
facetConfiguration.option.each {Node child ->
|
||||
String value = child."@value"
|
||||
switch (child."@name") {
|
||||
case "compilerLibraryName":
|
||||
facet.compilerLibraryName = value
|
||||
break
|
||||
}
|
||||
}
|
||||
|
||||
return facet;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,54 @@
|
||||
package org.jetbrains.jps.scala
|
||||
|
||||
import org.jetbrains.jps.*
|
||||
|
||||
class ScalaModuleBuilder implements ModuleBuilder {
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, Project project) {
|
||||
List<ScalaFacet> facets = []
|
||||
moduleChunk.modules.each {
|
||||
it.facets.values().each {
|
||||
if (it instanceof ScalaFacet) {
|
||||
facets << it
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (facets.isEmpty()) return
|
||||
|
||||
facets.each {ScalaFacet facet ->
|
||||
compileScalaFacet(facet, project, state)
|
||||
}
|
||||
}
|
||||
|
||||
def compileScalaFacet(ScalaFacet facet, Project project, ModuleBuildState state) {
|
||||
Library scalaCompiler = project.libraries[facet.compilerLibraryName]
|
||||
if (scalaCompiler == null) {
|
||||
project.error("Cannot find Scala compiler project library with name: ${facet.compilerLibraryName}");
|
||||
return
|
||||
}
|
||||
|
||||
def ant = project.binding.ant
|
||||
|
||||
if (!ant.hasProperty("scalac")) {
|
||||
ant.taskdef(name: "scalac", classname: "scala.tools.ant.Scalac") {
|
||||
classpath {
|
||||
scalaCompiler.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ant.scalac(destdir: state.targetFolder) {
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package org.jetbrains.jps.scala
|
||||
|
||||
import org.jetbrains.jps.builders.ModuleBuilderService
|
||||
import org.jetbrains.jps.ProjectBuilder
|
||||
|
||||
class ScalaModuleBuilderService extends ModuleBuilderService {
|
||||
@Override
|
||||
registerBuilders(ProjectBuilder builder) {
|
||||
builder.sourceModifyingBuilders << new ScalaModuleBuilder();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
scala-test
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="AntConfiguration">
|
||||
<defaultAnt bundledAnt="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="CompilerConfiguration">
|
||||
<option name="DEFAULT_COMPILER" value="Javac" />
|
||||
<resourceExtensions />
|
||||
<wildcardResourcePatterns>
|
||||
<entry name="?*.properties" />
|
||||
<entry name="?*.xml" />
|
||||
<entry name="?*.gif" />
|
||||
<entry name="?*.png" />
|
||||
<entry name="?*.jpeg" />
|
||||
<entry name="?*.jpg" />
|
||||
<entry name="?*.html" />
|
||||
<entry name="?*.dtd" />
|
||||
<entry name="?*.tld" />
|
||||
<entry name="?*.ftl" />
|
||||
</wildcardResourcePatterns>
|
||||
<annotationProcessing enabled="false" useClasspath="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Encoding" useUTFGuessing="true" native2AsciiForPropertiesFiles="false" />
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="HighlightingAdvisor">
|
||||
<option name="SUGGEST_TYPE_AWARE_HIGHLIGHTING" value="false" />
|
||||
<option name="TYPE_AWARE_HIGHLIGHTING_ENABLED" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<component name="libraryTable">
|
||||
<library name="scala-compiler-2.9.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/scala-compiler.jar!/" />
|
||||
<root url="jar://$PROJECT_DIR$/lib/scala-library.jar!/" />
|
||||
</CLASSES>
|
||||
<JAVADOC />
|
||||
<SOURCES />
|
||||
</library>
|
||||
</component>
|
||||
+7
@@ -0,0 +1,7 @@
|
||||
<component name="libraryTable">
|
||||
<library name="scala-library-2.9.1">
|
||||
<CLASSES>
|
||||
<root url="jar://$PROJECT_DIR$/lib/scala-library.jar!/" />
|
||||
</CLASSES>
|
||||
</library>
|
||||
</component>
|
||||
@@ -0,0 +1,49 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="A6C9363515510A8902AF3E81401DC42A" />
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="NullableNotNullManager">
|
||||
<option name="myDefaultNullable" value="org.jetbrains.annotations.Nullable" />
|
||||
<option name="myDefaultNotNull" value="org.jetbrains.annotations.NotNull" />
|
||||
<option name="myNullables">
|
||||
<value>
|
||||
<list size="0" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="myNotNulls">
|
||||
<value>
|
||||
<list size="3">
|
||||
<item index="0" class="java.lang.String" itemvalue="org.jetbrains.annotations.NotNull" />
|
||||
<item index="1" class="java.lang.String" itemvalue="javax.annotation.Nonnull" />
|
||||
<item index="2" class="java.lang.String" itemvalue="edu.umd.cs.findbugs.annotations.NonNull" />
|
||||
</list>
|
||||
</value>
|
||||
</option>
|
||||
</component>
|
||||
<component name="ProjectResources">
|
||||
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/mod1/mod1.iml" filepath="$PROJECT_DIR$/mod1/mod1.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/mod2/mod2.iml" filepath="$PROJECT_DIR$/mod2/mod2.iml" />
|
||||
<module fileurl="file://$PROJECT_DIR$/scala-test.iml" filepath="$PROJECT_DIR$/scala-test.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
+10
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ClearCaseSharedConfig">
|
||||
<option name="myUseUcmModel" value="true" />
|
||||
</component>
|
||||
<component name="VcsDirectoryMappings">
|
||||
<mapping directory="" vcs="" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="scala" name="Scala">
|
||||
<configuration>
|
||||
<option name="compilerLibraryLevel" value="Project" />
|
||||
<option name="compilerLibraryName" value="scala-compiler-2.9.1" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="scala-library-2.9.1" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class HelloWorld {
|
||||
def main(args: Array[String]) {
|
||||
println("Hello world!")
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="FacetManager">
|
||||
<facet type="scala" name="Scala">
|
||||
<configuration>
|
||||
<option name="compilerLibraryLevel" value="Project" />
|
||||
<option name="compilerLibraryName" value="scala-compiler-2.9.1" />
|
||||
</configuration>
|
||||
</facet>
|
||||
</component>
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" name="scala-library-2.9.1" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,6 @@
|
||||
|
||||
class A {
|
||||
def fun() {
|
||||
System.out.println("Hello!");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
public class B {
|
||||
public void doIt() {
|
||||
new A().fun();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.jetbrains.jps.scala
|
||||
|
||||
import org.jetbrains.jps.JpsBuildTestCase
|
||||
import org.jetbrains.jps.Project
|
||||
import org.jetbrains.jps.idea.Facet
|
||||
|
||||
class ScalaModuleTest extends JpsBuildTestCase {
|
||||
public void test_load_scala_facet() {
|
||||
Project project = loadProject("plugins/scala/testData/scala-test", [:]);
|
||||
Map<String, Facet> facets = project.modules["mod1"].facets;
|
||||
assertEquals(1, facets.size());
|
||||
ScalaFacet facet = facets.values().iterator().next();
|
||||
assertNotNull(facet);
|
||||
assertEquals("scala-compiler-2.9.1", facet.compilerLibraryName);
|
||||
}
|
||||
|
||||
public void test_compile_scala_module() {
|
||||
def projectPath = "plugins/scala/testData/scala-test"
|
||||
Project project = loadProject(projectPath, [:]);
|
||||
project.clean();
|
||||
project.modules["mod1"].make();
|
||||
|
||||
def path = projectPath + "/out/production/mod1/HelloWorld.class"
|
||||
assertTrue(path, new File(path).isFile());
|
||||
}
|
||||
|
||||
public void test_joint_compilation() {
|
||||
def projectPath = "plugins/scala/testData/scala-test"
|
||||
Project project = loadProject(projectPath, [:]);
|
||||
project.clean();
|
||||
project.modules["mod2"].make();
|
||||
|
||||
def path = projectPath + "/out/production/mod2/"
|
||||
assertTrue(path, new File(path, "A.class").isFile());
|
||||
assertTrue(path, new File(path, "B.class").isFile());
|
||||
}
|
||||
}
|
||||
@@ -40,7 +40,7 @@ final class Jps {
|
||||
def old = binding.getVariable("module")
|
||||
def layoutInfo = new LayoutInfo()
|
||||
|
||||
["module", "zip", "dir"].each {tag ->
|
||||
["module", "moduleTests", "zip", "dir"].each {tag ->
|
||||
binding.setVariable(tag, {Object[] args ->
|
||||
if (args.length == 1) {
|
||||
binding.ant."$tag"(name: args[0])
|
||||
@@ -58,7 +58,22 @@ final class Jps {
|
||||
}
|
||||
binding.setVariable("jar", {Object[] args ->
|
||||
if (args.length == 2) {
|
||||
binding.ant.jar(name: args[0], compress: project.builder.compressJars, args[1])
|
||||
def param0 = args[0]
|
||||
String name;
|
||||
String duplicate = null;
|
||||
if (param0 instanceof Map) {
|
||||
name = param0.name;
|
||||
duplicate = param0.duplicate;
|
||||
}
|
||||
else {
|
||||
name = (String)param0;
|
||||
}
|
||||
if (duplicate != null) {
|
||||
binding.ant.jar(name: name, compress: project.builder.compressJars, duplicate: duplicate, args[1])
|
||||
}
|
||||
else {
|
||||
binding.ant.jar(name: name, compress: project.builder.compressJars, args[1])
|
||||
}
|
||||
}
|
||||
else {
|
||||
project.error("unexpected number of parameters for 'jar' task: $args.length")
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
package org.jetbrains.jps
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class PathUtil {
|
||||
static String toSystemIndependentPath(String path) {
|
||||
return path.replace('\\', '/')
|
||||
}
|
||||
}
|
||||
@@ -27,6 +27,7 @@ class Project {
|
||||
final Map<String, Module> modules = [:]
|
||||
final Map<String, Library> libraries = [:]
|
||||
final Map<String, Artifact> artifacts = [:]
|
||||
final Map<String, RunConfiguration> runConfigurations = [:]
|
||||
|
||||
String targetFolder = null
|
||||
String tempFolder = null
|
||||
|
||||
@@ -0,0 +1,75 @@
|
||||
package org.jetbrains.jps
|
||||
|
||||
import org.jetbrains.jps.idea.IdeaProjectLoadingUtil
|
||||
import org.jetbrains.jps.idea.ModuleMacroExpander
|
||||
import org.jetbrains.jps.idea.OwnServiceLoader
|
||||
import org.jetbrains.jps.runConf.RunConfigurationLauncherService
|
||||
|
||||
/**
|
||||
* Represents IntelliJ IDEA run configuration.
|
||||
* @author pavel.sher
|
||||
*/
|
||||
public class RunConfiguration {
|
||||
final Project project;
|
||||
final String name;
|
||||
final String type;
|
||||
final Module module;
|
||||
final String workingDir;
|
||||
final Map<String, String> allOptions;
|
||||
final Map<String, String> envVars;
|
||||
final Node node;
|
||||
final MacroExpander macroExpander;
|
||||
|
||||
def RunConfiguration(Project project, MacroExpander macroExpander, Node confTag) {
|
||||
this.project = project;
|
||||
this.name = confTag.'@name';
|
||||
this.type = confTag.'@type';
|
||||
this.node = confTag;
|
||||
|
||||
this.allOptions = [:];
|
||||
confTag.option.each{ opt ->
|
||||
def value = opt.'@value';
|
||||
if (value == null) {
|
||||
value = opt.value ? opt.value[0].'@defaultName' : null;
|
||||
}
|
||||
this.allOptions[opt.'@name'] = value;
|
||||
}
|
||||
|
||||
def moduleNode = confTag.module[0];
|
||||
if (moduleNode != null && !"wholeProject".equals(this.allOptions['TEST_SEARCH_SCOPE'])) {
|
||||
this.module = project.modules[moduleNode.'@name'];
|
||||
} else {
|
||||
this.module = null;
|
||||
}
|
||||
|
||||
this.macroExpander = macroExpander;
|
||||
if (this.module != null) {
|
||||
this.macroExpander = new ModuleMacroExpander(macroExpander, this.module.basePath);
|
||||
}
|
||||
|
||||
def String workDirUrl = this.allOptions['WORKING_DIRECTORY'];
|
||||
if (workDirUrl == null) workDirUrl = "";
|
||||
if (workDirUrl != '') {
|
||||
workDirUrl = this.macroExpander.expandMacros(IdeaProjectLoadingUtil.pathFromUrl(workDirUrl));
|
||||
}
|
||||
|
||||
this.workingDir = workDirUrl == '' ? new File(".").getCanonicalPath() : new File(workDirUrl).getCanonicalPath();
|
||||
|
||||
this.envVars = [:];
|
||||
confTag.envs.env.each{ el ->
|
||||
this.envVars[el.'@name'] = el.'@value';
|
||||
}
|
||||
}
|
||||
|
||||
private static OwnServiceLoader<RunConfigurationLauncherService> runConfLauncherServices = OwnServiceLoader.load(RunConfigurationLauncherService.class)
|
||||
|
||||
def RunConfigurationLauncherService getLauncher() {
|
||||
for (RunConfigurationLauncherService service: runConfLauncherServices.iterator()) {
|
||||
if (service.typeId == type) {
|
||||
return service;
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
package org.jetbrains.jps.artifacts
|
||||
|
||||
import org.jetbrains.jps.Project
|
||||
import org.jetbrains.jps.Library
|
||||
|
||||
/**
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
abstract class LayoutElement {
|
||||
@@ -58,3 +57,11 @@ class ModuleOutputElement extends LayoutElement {
|
||||
project.binding.module.call(moduleName)
|
||||
}
|
||||
}
|
||||
|
||||
class ModuleTestOutputElement extends LayoutElement {
|
||||
String moduleName
|
||||
|
||||
def build(Project project) {
|
||||
project.binding.moduleTests.call(moduleName)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,399 +17,399 @@ import org.jetbrains.jps.*
|
||||
*/
|
||||
class JavacBuilder implements ModuleBuilder, ModuleCycleBuilder {
|
||||
|
||||
def preprocessModuleCycle(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
doBuildModule(moduleChunk, state)
|
||||
def preprocessModuleCycle(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
doBuildModule(moduleChunk, state)
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
doBuildModule(moduleChunk, state)
|
||||
}
|
||||
|
||||
def doBuildModule(ModuleChunk module, ModuleBuildState state) {
|
||||
if (state.sourceRoots.isEmpty()) return;
|
||||
|
||||
String sourceLevel = module["sourceLevel"]
|
||||
String targetLevel = module["targetLevel"]
|
||||
String customArgs = module["javac_args"]; // it seems javac_args property is not set, can we drop it?
|
||||
if (module.project.builder.useInProcessJavac) {
|
||||
String version = System.getProperty("java.version")
|
||||
if (true) {
|
||||
if (Java16ApiCompilerRunner.compile(module, state, sourceLevel, targetLevel, customArgs)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
module.project.info("In-process Javac won't be used for '${module.name}', because Java version ($version) doesn't match to source level ($sourceLevel)")
|
||||
}
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
doBuildModule(moduleChunk, state)
|
||||
def params = [:]
|
||||
params.destdir = state.targetFolder
|
||||
if (sourceLevel != null) params.source = sourceLevel
|
||||
if (targetLevel != null) params.target = targetLevel
|
||||
|
||||
def javacOpts = module.project.props["compiler.javac.options"] ?: [:];
|
||||
def memHeapSize = javacOpts["MAXIMUM_HEAP_SIZE"] == null ? "512m" : javacOpts["MAXIMUM_HEAP_SIZE"] + "m";
|
||||
def boolean debugInfo = !"false".equals(javacOpts["DEBUGGING_INFO"]);
|
||||
def boolean nowarn = "true".equals(javacOpts["GENERATE_NO_WARNINGS"]);
|
||||
def boolean deprecation = !"false".equals(javacOpts["DEPRECATION"]);
|
||||
customArgs = javacOpts["ADDITIONAL_OPTIONS_STRING"];
|
||||
|
||||
params.fork = "true"
|
||||
params.memoryMaximumSize = memHeapSize;
|
||||
params.debug = String.valueOf(debugInfo);
|
||||
params.nowarn = String.valueOf(nowarn);
|
||||
params.deprecation = String.valueOf(deprecation);
|
||||
params.verbose = "true"
|
||||
|
||||
def javacExecutable = getJavacExecutable(module)
|
||||
if (javacExecutable != null) {
|
||||
params.executable = javacExecutable
|
||||
}
|
||||
|
||||
def doBuildModule(ModuleChunk module, ModuleBuildState state) {
|
||||
if (state.sourceRoots.isEmpty()) return;
|
||||
def ant = module.project.binding.ant
|
||||
|
||||
String sourceLevel = module["sourceLevel"]
|
||||
String targetLevel = module["targetLevel"]
|
||||
String customArgs = module["javac_args"]; // it seems javac_args property is not set, can we drop it?
|
||||
if (module.project.builder.useInProcessJavac) {
|
||||
String version = System.getProperty("java.version")
|
||||
if (true) {
|
||||
if (Java16ApiCompilerRunner.compile(module, state, sourceLevel, targetLevel, customArgs)) {
|
||||
return
|
||||
}
|
||||
}
|
||||
else {
|
||||
module.project.info("In-process Javac won't be used for '${module.name}', because Java version ($version) doesn't match to source level ($sourceLevel)")
|
||||
final BuildListener listener = new AntListener(state.targetFolder, state.sourceRoots, state.callback);
|
||||
|
||||
ant.project.addBuildListener(listener);
|
||||
|
||||
ant.javac(params) {
|
||||
if (customArgs) {
|
||||
compilerarg(line: customArgs)
|
||||
}
|
||||
|
||||
if (state.sourceFiles != null) {
|
||||
List patterns = []
|
||||
|
||||
state.sourceFiles.each {
|
||||
for (String root: state.sourceRoots) {
|
||||
if (it.startsWith(root) && it.endsWith(".java")) {
|
||||
patterns << it.substring(root.length() + 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
patterns.each {
|
||||
include(name: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def params = [:]
|
||||
params.destdir = state.targetFolder
|
||||
if (sourceLevel != null) params.source = sourceLevel
|
||||
if (targetLevel != null) params.target = targetLevel
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
def javacOpts = module.project.props["compiler.javac.options"];
|
||||
def memHeapSize = javacOpts["MAXIMUM_HEAP_SIZE"] == null ? "512m" : javacOpts["MAXIMUM_HEAP_SIZE"] + "m";
|
||||
def boolean debugInfo = !"false".equals(javacOpts["DEBUGGING_INFO"]);
|
||||
def boolean nowarn = "true".equals(javacOpts["GENERATE_NO_WARNINGS"]);
|
||||
def boolean deprecation = !"false".equals(javacOpts["DEPRECATION"]);
|
||||
customArgs = javacOpts["ADDITIONAL_OPTIONS_STRING"];
|
||||
|
||||
params.fork = "true"
|
||||
params.memoryMaximumSize = memHeapSize;
|
||||
params.debug = String.valueOf(debugInfo);
|
||||
params.nowarn = String.valueOf(nowarn);
|
||||
params.deprecation = String.valueOf(deprecation);
|
||||
params.verbose = "true"
|
||||
|
||||
def javacExecutable = getJavacExecutable(module)
|
||||
if (javacExecutable != null) {
|
||||
params.executable = javacExecutable
|
||||
state.excludes.each { String root ->
|
||||
state.sourceRoots.each {String src ->
|
||||
if (root.startsWith("${src}/")) {
|
||||
exclude(name: "${root.substring(src.length() + 1)}/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def ant = module.project.binding.ant
|
||||
|
||||
final BuildListener listener = new AntListener(state.targetFolder, state.sourceRoots, state.callback);
|
||||
|
||||
ant.project.addBuildListener(listener);
|
||||
|
||||
ant.javac(params) {
|
||||
if (customArgs) {
|
||||
compilerarg(line: customArgs)
|
||||
}
|
||||
|
||||
if (state.sourceFiles != null) {
|
||||
List patterns = []
|
||||
|
||||
state.sourceFiles.each {
|
||||
for (String root: state.sourceRoots) {
|
||||
if (it.startsWith(root) && it.endsWith(".java")) {
|
||||
patterns << it.substring(root.length() + 1)
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
patterns.each {
|
||||
include(name: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
state.excludes.each { String root ->
|
||||
state.sourceRoots.each {String src ->
|
||||
if (root.startsWith("${src}/")) {
|
||||
exclude(name: "${root.substring(src.length() + 1)}/**")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
ant.project.removeBuildListener(listener);
|
||||
|
||||
if (state.sourceFiles != null) {
|
||||
module.project.builder.listeners*.onJavaFilesCompiled(module, state.sourceFiles.size())
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private String getJavacExecutable(ModuleChunk module) {
|
||||
def customJavac = module["javac"]
|
||||
def jdk = module.getSdk()
|
||||
if (customJavac != null) {
|
||||
return customJavac
|
||||
}
|
||||
else if (jdk instanceof JavaSdk) {
|
||||
return jdk.getJavacExecutable()
|
||||
}
|
||||
return null
|
||||
ant.project.removeBuildListener(listener);
|
||||
|
||||
if (state.sourceFiles != null) {
|
||||
module.project.builder.listeners*.onJavaFilesCompiled(module, state.sourceFiles.size())
|
||||
}
|
||||
}
|
||||
|
||||
private String getJavacExecutable(ModuleChunk module) {
|
||||
def customJavac = module["javac"]
|
||||
def jdk = module.getSdk()
|
||||
if (customJavac != null) {
|
||||
return customJavac
|
||||
}
|
||||
else if (jdk instanceof JavaSdk) {
|
||||
return jdk.getJavacExecutable()
|
||||
}
|
||||
return null
|
||||
}
|
||||
}
|
||||
|
||||
class ResourceCopier implements ModuleBuilder {
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (state.iterated) return;
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (state.iterated) return;
|
||||
|
||||
state.iterated = true
|
||||
state.iterated = true
|
||||
|
||||
if (state.sourceRoots.isEmpty()) return;
|
||||
if (state.sourceRoots.isEmpty()) return;
|
||||
|
||||
def ant = project.binding.ant
|
||||
def ant = project.binding.ant
|
||||
|
||||
state.sourceRoots.each {String root ->
|
||||
final File f = MockFS.fromFiles(root, state.sourceFiles)
|
||||
state.sourceRoots.each {String root ->
|
||||
final File f = MockFS.fromFiles(root, state.sourceFiles)
|
||||
|
||||
if (new File(root).exists()) {
|
||||
def target = state.targetFolder
|
||||
def prefix = moduleChunk.modules.collect { it.sourceRootPrefixes[root] }.find {it != null}
|
||||
if (prefix != null) {
|
||||
if (!(target.endsWith("/") || target.endsWith("\\"))) {
|
||||
target += "/"
|
||||
}
|
||||
target += prefix
|
||||
}
|
||||
|
||||
ant.copy(todir: target) {
|
||||
fileset(dir: root) {
|
||||
patternset(refid: moduleChunk["compiler.resources.id"])
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
project.warning("$root doesn't exist")
|
||||
}
|
||||
if (new File(root).exists()) {
|
||||
def target = state.targetFolder
|
||||
def prefix = moduleChunk.modules.collect { it.sourceRootPrefixes[root] }.find {it != null}
|
||||
if (prefix != null) {
|
||||
if (!(target.endsWith("/") || target.endsWith("\\"))) {
|
||||
target += "/"
|
||||
}
|
||||
target += prefix
|
||||
}
|
||||
|
||||
ant.copy(todir: target) {
|
||||
fileset(dir: root) {
|
||||
patternset(refid: moduleChunk["compiler.resources.id"])
|
||||
type(type: "file")
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
project.warning("$root doesn't exist")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GroovycBuilder implements ModuleBuilder {
|
||||
def GroovycBuilder(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "groovyc", classname: "org.codehaus.groovy.ant.Groovyc")
|
||||
def GroovycBuilder(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "groovyc", classname: "org.codehaus.groovy.ant.Groovyc")
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (!GroovyFileSearcher.containGroovyFiles(state.sourceRoots)) return
|
||||
|
||||
def ant = project.binding.ant
|
||||
|
||||
final String destDir = state.targetFolder
|
||||
|
||||
ant.touch(millis: 239) {
|
||||
fileset(dir: destDir) {
|
||||
include(name: "**/*.class")
|
||||
}
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (!GroovyFileSearcher.containGroovyFiles(state.sourceRoots)) return
|
||||
// unfortunately we have to disable fork here because of a bug in Groovyc task: it creates too long command line if classpath is large
|
||||
ant.groovyc(destdir: destDir /*, fork: "true"*/) {
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
def ant = project.binding.ant
|
||||
include(name: "**/*.groovy")
|
||||
|
||||
final String destDir = state.targetFolder
|
||||
|
||||
ant.touch(millis: 239) {
|
||||
fileset(dir: destDir) {
|
||||
include(name: "**/*.class")
|
||||
}
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
|
||||
// unfortunately we have to disable fork here because of a bug in Groovyc task: it creates too long command line if classpath is large
|
||||
ant.groovyc(destdir: destDir /*, fork: "true"*/) {
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
include(name: "**/*.groovy")
|
||||
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
|
||||
pathelement(location: destDir) // Includes classes generated there by javac compiler
|
||||
}
|
||||
}
|
||||
|
||||
ant.touch() {
|
||||
fileset(dir: destDir) {
|
||||
include(name: "**/*.class")
|
||||
}
|
||||
}
|
||||
pathelement(location: destDir) // Includes classes generated there by javac compiler
|
||||
}
|
||||
}
|
||||
|
||||
ant.touch() {
|
||||
fileset(dir: destDir) {
|
||||
include(name: "**/*.class")
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class GroovyStubGenerator implements ModuleBuilder {
|
||||
|
||||
def GroovyStubGenerator(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "generatestubs", classname: "org.codehaus.groovy.ant.GenerateStubsTask")
|
||||
def GroovyStubGenerator(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "generatestubs", classname: "org.codehaus.groovy.ant.GenerateStubsTask")
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (!GroovyFileSearcher.containGroovyFiles(state.sourceRoots)) return
|
||||
|
||||
def ant = project.binding.ant
|
||||
|
||||
String targetFolder = project.targetFolder
|
||||
File dir = new File(targetFolder != null ? targetFolder : ".", "___temp___")
|
||||
BuildUtil.deleteDir(project, dir.absolutePath)
|
||||
ant.mkdir(dir: dir)
|
||||
|
||||
def stubsRoot = dir.getAbsolutePath()
|
||||
ant.generatestubs(destdir: stubsRoot) {
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
include(name: "**/*.groovy")
|
||||
include(name: "**/*.java")
|
||||
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (!GroovyFileSearcher.containGroovyFiles(state.sourceRoots)) return
|
||||
if (state.incremental) {
|
||||
Set<File> excluded = state.excludes.collect { new File(it.toString()) }
|
||||
List<File> filesToCompile = new LinkedList<File>()
|
||||
|
||||
def ant = project.binding.ant
|
||||
JavaFileCollector.collectRecursively(new File(stubsRoot), filesToCompile, excluded)
|
||||
|
||||
String targetFolder = project.targetFolder
|
||||
File dir = new File(targetFolder != null ? targetFolder : ".", "___temp___")
|
||||
BuildUtil.deleteDir(project, dir.absolutePath)
|
||||
ant.mkdir(dir: dir)
|
||||
|
||||
def stubsRoot = dir.getAbsolutePath()
|
||||
ant.generatestubs(destdir: stubsRoot) {
|
||||
state.sourceRoots.each {
|
||||
src(path: it)
|
||||
}
|
||||
|
||||
include(name: "**/*.groovy")
|
||||
include(name: "**/*.java")
|
||||
|
||||
classpath {
|
||||
state.classpath.each {
|
||||
pathelement(location: it)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.incremental) {
|
||||
Set<File> excluded = state.excludes.collect { new File(it.toString()) }
|
||||
List<File> filesToCompile = new LinkedList<File>()
|
||||
|
||||
JavaFileCollector.collectRecursively(new File(stubsRoot), filesToCompile, excluded)
|
||||
|
||||
filesToCompile.each {state.sourceFiles << it.getAbsolutePath()}
|
||||
}
|
||||
|
||||
state.sourceRoots << stubsRoot
|
||||
state.tempRootsToDelete << stubsRoot
|
||||
filesToCompile.each {state.sourceFiles << it.getAbsolutePath()}
|
||||
}
|
||||
|
||||
state.sourceRoots << stubsRoot
|
||||
state.tempRootsToDelete << stubsRoot
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class JetBrainsInstrumentations implements ModuleBuilder {
|
||||
class CustomFormInstrumenter extends
|
||||
FormInstrumenter {
|
||||
final List<String> formFiles;
|
||||
final ModuleBuildState state;
|
||||
class CustomFormInstrumenter extends
|
||||
FormInstrumenter {
|
||||
final List<String> formFiles;
|
||||
final ModuleBuildState state;
|
||||
|
||||
@Override
|
||||
void associate(final String formFile, final String classFile) {
|
||||
if (state.callback != null) {
|
||||
final String formRelPath = state.projectWrapper.getRelativePath(formFile);
|
||||
final String classRelPath = state.projectWrapper.getRelativePath(classFile);
|
||||
@Override
|
||||
void associate(final String formFile, final String classFile) {
|
||||
if (state.callback != null) {
|
||||
final String formRelPath = state.projectWrapper.getRelativePath(formFile);
|
||||
final String classRelPath = state.projectWrapper.getRelativePath(classFile);
|
||||
|
||||
state.callback.associateForm(StringCache.get(formRelPath), StringCache.get(classRelPath));
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
void log(String msg, int option) {
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
||||
@Override
|
||||
void fireError(String msg) {
|
||||
throw new RuntimeException(msg);
|
||||
}
|
||||
|
||||
CustomFormInstrumenter(final File destDir, final List<String> nestedFormPathList, final List<String> ff, final ModuleBuildState s) {
|
||||
super(destDir, nestedFormPathList);
|
||||
formFiles = ff;
|
||||
state = s;
|
||||
}
|
||||
state.callback.associateForm(StringCache.get(formRelPath), StringCache.get(classRelPath));
|
||||
}
|
||||
}
|
||||
|
||||
def JetBrainsInstrumentations(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "jb_instrumentations", classname: "com.intellij.ant.InstrumentIdeaExtensions")
|
||||
@Override
|
||||
void log(String msg, int option) {
|
||||
System.out.println(msg);
|
||||
}
|
||||
|
||||
def getPrefixedPath(org.jetbrains.jps.Project project, String root, ModuleChunk moduleChunk) {
|
||||
final path = new PrefixedPath(project.binding.ant.project, root)
|
||||
|
||||
moduleChunk.elements.each {module ->
|
||||
final String prefix = module.sourceRootPrefixes[root]
|
||||
if (prefix != null) {
|
||||
path.setPrefix(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
return path
|
||||
@Override
|
||||
void fireError(String msg) {
|
||||
throw new RuntimeException(msg);
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (state.loader == null) {
|
||||
final StringBuilder cp = new StringBuilder()
|
||||
|
||||
cp.append(state.targetFolder)
|
||||
cp.append(File.pathSeparator)
|
||||
|
||||
state.classpath.each {
|
||||
cp.append(it)
|
||||
cp.append(File.pathSeparator)
|
||||
}
|
||||
|
||||
state.loader = InstrumentationUtil.createPseudoClassLoader(cp.toString())
|
||||
|
||||
final List<File> formFiles = new ArrayList<File>();
|
||||
final ProjectWrapper pw = state.projectWrapper;
|
||||
|
||||
for (Module m: moduleChunk.elements) {
|
||||
final Set<S> names = state.tests ? pw.getModule(m.getName()).getTests() : pw.getModule(m.getName()).getSources();
|
||||
for (S name: names) {
|
||||
if (name.value.endsWith(".form")) {
|
||||
formFiles.add(new File(pw.getAbsolutePath(name.value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<PrefixedPath> nestedFormDirs = new ArrayList<PrefixedPath>();
|
||||
|
||||
state.sourceRoots.each {
|
||||
nestedFormDirs << getPrefixedPath(project, it, moduleChunk)
|
||||
}
|
||||
|
||||
state.moduleDependenciesSourceRoots.each {
|
||||
nestedFormDirs << getPrefixedPath(project, it, moduleChunk)
|
||||
}
|
||||
|
||||
state.formInstrumenter = new CustomFormInstrumenter(new File(state.targetFolder), nestedFormDirs, formFiles, state);
|
||||
|
||||
if (!state.incremental) {
|
||||
for (File formFile: formFiles) {
|
||||
state.formInstrumenter.instrumentForm(formFile, state.loader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.incremental) {
|
||||
for (String f: state.sourceFiles) {
|
||||
if (f.endsWith(".form")) {
|
||||
state.formInstrumenter.instrumentForm(new File(f), state.loader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (project.getBuilder().useInProcessJavac)
|
||||
return;
|
||||
|
||||
if (!state.incremental) {
|
||||
new Object() {
|
||||
public void traverse(final File root) {
|
||||
final File[] files = root.listFiles();
|
||||
|
||||
for (File f: files) {
|
||||
final String name = f.getName();
|
||||
|
||||
if (name.endsWith(".class")) {
|
||||
InstrumentationUtil.instrumentNotNull(f, state.loader)
|
||||
}
|
||||
else if (f.isDirectory()) {
|
||||
traverse(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.traverse(new File(state.targetFolder))
|
||||
}
|
||||
else {
|
||||
final Collection<StringCache.S> classes = state.callback.getClassFiles()
|
||||
|
||||
classes.each {
|
||||
InstrumentationUtil.instrumentNotNull(new File(state.targetFolder + File.separator + it.value + ".class"), state.loader)
|
||||
}
|
||||
}
|
||||
CustomFormInstrumenter(final File destDir, final List<String> nestedFormPathList, final List<String> ff, final ModuleBuildState s) {
|
||||
super(destDir, nestedFormPathList);
|
||||
formFiles = ff;
|
||||
state = s;
|
||||
}
|
||||
}
|
||||
|
||||
def JetBrainsInstrumentations(org.jetbrains.jps.Project project) {
|
||||
project.taskdef(name: "jb_instrumentations", classname: "com.intellij.ant.InstrumentIdeaExtensions")
|
||||
}
|
||||
|
||||
def getPrefixedPath(org.jetbrains.jps.Project project, String root, ModuleChunk moduleChunk) {
|
||||
final path = new PrefixedPath(project.binding.ant.project, root)
|
||||
|
||||
moduleChunk.elements.each {module ->
|
||||
final String prefix = module.sourceRootPrefixes[root]
|
||||
if (prefix != null) {
|
||||
path.setPrefix(prefix)
|
||||
}
|
||||
}
|
||||
|
||||
return path
|
||||
}
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
if (state.loader == null) {
|
||||
final StringBuilder cp = new StringBuilder()
|
||||
|
||||
cp.append(state.targetFolder)
|
||||
cp.append(File.pathSeparator)
|
||||
|
||||
state.classpath.each {
|
||||
cp.append(it)
|
||||
cp.append(File.pathSeparator)
|
||||
}
|
||||
|
||||
state.loader = InstrumentationUtil.createPseudoClassLoader(cp.toString())
|
||||
|
||||
final List<File> formFiles = new ArrayList<File>();
|
||||
final ProjectWrapper pw = state.projectWrapper;
|
||||
|
||||
for (Module m: moduleChunk.elements) {
|
||||
final Set<S> names = state.tests ? pw.getModule(m.getName()).getTests() : pw.getModule(m.getName()).getSources();
|
||||
for (S name: names) {
|
||||
if (name.value.endsWith(".form")) {
|
||||
formFiles.add(new File(pw.getAbsolutePath(name.value)));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
final List<PrefixedPath> nestedFormDirs = new ArrayList<PrefixedPath>();
|
||||
|
||||
state.sourceRoots.each {
|
||||
nestedFormDirs << getPrefixedPath(project, it, moduleChunk)
|
||||
}
|
||||
|
||||
state.moduleDependenciesSourceRoots.each {
|
||||
nestedFormDirs << getPrefixedPath(project, it, moduleChunk)
|
||||
}
|
||||
|
||||
state.formInstrumenter = new CustomFormInstrumenter(new File(state.targetFolder), nestedFormDirs, formFiles, state);
|
||||
|
||||
if (!state.incremental) {
|
||||
for (File formFile: formFiles) {
|
||||
state.formInstrumenter.instrumentForm(formFile, state.loader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (state.incremental) {
|
||||
for (String f: state.sourceFiles) {
|
||||
if (f.endsWith(".form")) {
|
||||
state.formInstrumenter.instrumentForm(new File(f), state.loader);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (project.getBuilder().useInProcessJavac)
|
||||
return;
|
||||
|
||||
if (!state.incremental) {
|
||||
new Object() {
|
||||
public void traverse(final File root) {
|
||||
final File[] files = root.listFiles();
|
||||
|
||||
for (File f: files) {
|
||||
final String name = f.getName();
|
||||
|
||||
if (name.endsWith(".class")) {
|
||||
InstrumentationUtil.instrumentNotNull(f, state.loader)
|
||||
}
|
||||
else if (f.isDirectory()) {
|
||||
traverse(f)
|
||||
}
|
||||
}
|
||||
}
|
||||
}.traverse(new File(state.targetFolder))
|
||||
}
|
||||
else {
|
||||
final Collection<StringCache.S> classes = state.callback.getClassFiles()
|
||||
|
||||
classes.each {
|
||||
InstrumentationUtil.instrumentNotNull(new File(state.targetFolder + File.separator + it.value + ".class"), state.loader)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class CustomTasksBuilder implements ModuleBuilder {
|
||||
List<ModuleBuildTask> tasks = []
|
||||
List<ModuleBuildTask> tasks = []
|
||||
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
moduleChunk.modules.each {Module module ->
|
||||
tasks*.perform(module, state.targetFolder)
|
||||
}
|
||||
def processModule(ModuleBuildState state, ModuleChunk moduleChunk, org.jetbrains.jps.Project project) {
|
||||
moduleChunk.modules.each {Module module ->
|
||||
tasks*.perform(module, state.targetFolder)
|
||||
}
|
||||
}
|
||||
|
||||
def registerTask(String moduleName, Closure task) {
|
||||
tasks << ({Module module, String outputFolder ->
|
||||
if (module.name == moduleName) {
|
||||
task(module, outputFolder)
|
||||
}
|
||||
} as ModuleBuildTask)
|
||||
}
|
||||
}
|
||||
def registerTask(String moduleName, Closure task) {
|
||||
tasks << ({Module module, String outputFolder ->
|
||||
if (module.name == moduleName) {
|
||||
task(module, outputFolder)
|
||||
}
|
||||
} as ModuleBuildTask)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -48,7 +48,7 @@ class ArtifactLoader {
|
||||
def jarPath = macroExpander.expandMacros(tag."@path")
|
||||
String pathInJar = tag."@path-in-jar"
|
||||
if (pathInJar == null) pathInJar = "/"
|
||||
if (!new File(pathInJar).exists()) {
|
||||
if (!new File(jarPath).exists()) {
|
||||
project.warning("Error in '$artifactName' artifact: file '$jarPath' doesn't exist")
|
||||
}
|
||||
return new ExtractedDirectoryElement(jarPath: jarPath, pathInJar: pathInJar)
|
||||
@@ -58,6 +58,12 @@ class ArtifactLoader {
|
||||
project.error("Unknown module '$name' in '$artifactName' artifact")
|
||||
}
|
||||
return new ModuleOutputElement(moduleName: name);
|
||||
case "module-test-output":
|
||||
def name = tag."@name"
|
||||
if (project.modules[name] == null) {
|
||||
project.error("Unknown module '$name' in '$artifactName' artifact")
|
||||
}
|
||||
return new ModuleTestOutputElement(moduleName: name);
|
||||
case "library":
|
||||
return new LibraryFilesElement(libraryLevel: tag."@level", libraryName: tag."@name", moduleName: tag."@module-name");
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package org.jetbrains.jps.idea
|
||||
|
||||
import org.jetbrains.jps.artifacts.Artifact
|
||||
import org.jetbrains.jps.*
|
||||
import org.jetbrains.jps.builders.GroovyStubGenerator
|
||||
|
||||
/**
|
||||
* @author max
|
||||
@@ -93,6 +92,7 @@ public class IdeaProjectLoader {
|
||||
loadModules(getComponent(root, "ProjectModuleManager"))
|
||||
loadProjectLibraries(getComponent(root, "libraryTable"))
|
||||
loadArtifacts(getComponent(root, "ArtifactManager"))
|
||||
loadRunConfigurations(getComponent(root, "ProjectRunConfigurationManager"))
|
||||
}
|
||||
|
||||
def loadFromDirectoryBased(File dir) {
|
||||
@@ -131,6 +131,16 @@ public class IdeaProjectLoader {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
def runConfFolder = new File(dir, "runConfigurations")
|
||||
if (runConfFolder.isDirectory()) {
|
||||
runConfFolder.eachFile {File file ->
|
||||
if (file.isFile()) {
|
||||
def runConfManager = new XmlParser(false, false).parse(file);
|
||||
loadRunConfigurations(runConfManager);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private def loadCompilerConfiguration(Node root) {
|
||||
@@ -204,6 +214,16 @@ public class IdeaProjectLoader {
|
||||
}
|
||||
}
|
||||
|
||||
def loadRunConfigurations(Node runConfManager) {
|
||||
if (runConfManager == null) return;
|
||||
|
||||
runConfManager.configuration.each {Node confTag ->
|
||||
def name = confTag.'@name';
|
||||
RunConfiguration runConf = new RunConfiguration(project, projectMacroExpander, confTag);
|
||||
project.runConfigurations[name] = runConf;
|
||||
}
|
||||
}
|
||||
|
||||
private def loadModules(Node modulesComponent) {
|
||||
modulesComponent?.modules?.module?.each {Node moduleTag ->
|
||||
loadModule(projectMacroExpander.expandMacros(moduleTag.@filepath))
|
||||
@@ -379,8 +399,8 @@ public class IdeaProjectLoader {
|
||||
if (projectOutputPath == null) {
|
||||
project.error("Module '$currentModuleName' uses output path inherited from project but project output path is not specified")
|
||||
}
|
||||
currentModule.outputPath = new File(new File(projectOutputPath, "production"), currentModuleName).absolutePath
|
||||
currentModule.testOutputPath = new File(new File(projectOutputPath, "test"), currentModuleName).absolutePath
|
||||
currentModule.outputPath = PathUtil.toSystemIndependentPath(new File(new File(projectOutputPath, "production"), currentModuleName).absolutePath)
|
||||
currentModule.testOutputPath = PathUtil.toSystemIndependentPath(new File(new File(projectOutputPath, "test"), currentModuleName).absolutePath)
|
||||
}
|
||||
else {
|
||||
currentModule.outputPath = moduleMacroExpander.expandMacros(IdeaProjectLoadingUtil.pathFromUrl(componentTag.output[0]?.@url))
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package org.jetbrains.jps.idea
|
||||
|
||||
import org.jetbrains.jps.MacroExpander
|
||||
import org.jetbrains.jps.PathUtil
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
@@ -11,7 +12,7 @@ public class ProjectMacroExpander implements MacroExpander {
|
||||
|
||||
ProjectMacroExpander(Map<String, String> pathVariables, String projectBasePath) {
|
||||
this.pathVariables = pathVariables
|
||||
this.projectBasePath = projectBasePath
|
||||
this.projectBasePath = PathUtil.toSystemIndependentPath(projectBasePath)
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -19,8 +20,8 @@ public class ProjectMacroExpander implements MacroExpander {
|
||||
if (path == null) return path
|
||||
path = path.replace("\$PROJECT_DIR\$", projectBasePath)
|
||||
pathVariables.each { name, value ->
|
||||
path = path.replace("\$${name}\$", value);
|
||||
path = path.replace("\$${name}\$", value)
|
||||
}
|
||||
return path.replace("/", File.separator);
|
||||
return path
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package org.jetbrains.jps.runConf;
|
||||
|
||||
import org.jetbrains.jps.RunConfiguration;
|
||||
|
||||
public abstract class RunConfigurationLauncherService {
|
||||
private final String typeId;
|
||||
|
||||
public RunConfigurationLauncherService(String typeId) {
|
||||
this.typeId = typeId;
|
||||
}
|
||||
|
||||
public String getTypeId() {
|
||||
return typeId;
|
||||
}
|
||||
|
||||
public void beforeStart(RunConfiguration runConf) {}
|
||||
|
||||
public void afterFinish(RunConfiguration runConf) {}
|
||||
|
||||
public final void start(RunConfiguration runConf) {
|
||||
beforeStart(runConf);
|
||||
try {
|
||||
startInternal(runConf);
|
||||
} finally {
|
||||
afterFinish(runConf);
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract void startInternal(RunConfiguration runConf);
|
||||
}
|
||||
@@ -0,0 +1,118 @@
|
||||
package org.jetbrains.jps.runConf.java;
|
||||
|
||||
import java.io.File;
|
||||
import java.net.URL;
|
||||
import java.util.LinkedHashSet;
|
||||
import java.util.Set;
|
||||
|
||||
public class ClasspathUtil {
|
||||
private static final String FILE = "file";
|
||||
private static final String JAR = "jar";
|
||||
private static final String JAR_DELIMITER = "!";
|
||||
private static final String PROTOCOL_DELIMITER = ":";
|
||||
|
||||
public static String composeClasspath(Class[] classes) {
|
||||
Set<String> cp = new LinkedHashSet<String>();
|
||||
if (classes != null) {
|
||||
for (Class classFromLib : classes) {
|
||||
cp.add(getResourceRoot(classFromLib));
|
||||
}
|
||||
}
|
||||
|
||||
StringBuilder result = new StringBuilder();
|
||||
for (String path : cp) {
|
||||
if (result.length() > 0) {
|
||||
result.append(File.pathSeparator);
|
||||
}
|
||||
result.append(path);
|
||||
}
|
||||
|
||||
return result.toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to detect classpath entry which contains given resource
|
||||
*/
|
||||
private static String getResourceRoot(Class context, String path) {
|
||||
URL url = context.getResource(path);
|
||||
if (url == null) {
|
||||
url = ClassLoader.getSystemResource(path.substring(1));
|
||||
}
|
||||
if (url == null) {
|
||||
return null;
|
||||
}
|
||||
return extractRoot(url, path);
|
||||
}
|
||||
|
||||
/**
|
||||
* Attempts to extract classpath entry part from passed URL.
|
||||
*/
|
||||
private static String extractRoot(URL resourceURL, String resourcePath) {
|
||||
if (!(resourcePath.startsWith("/") || resourcePath.startsWith("\\"))) {
|
||||
//noinspection HardCodedStringLiteral
|
||||
System.err.println("precondition failed");
|
||||
return null;
|
||||
}
|
||||
String protocol = resourceURL.getProtocol();
|
||||
String resultPath = null;
|
||||
|
||||
if (FILE.equals(protocol)) {
|
||||
String path = resourceURL.getFile();
|
||||
String testPath = path.replace('\\', '/').toLowerCase();
|
||||
String testResourcePath = resourcePath.replace('\\', '/').toLowerCase();
|
||||
if (testPath.endsWith(testResourcePath)) {
|
||||
resultPath = path.substring(0, path.length() - resourcePath.length());
|
||||
}
|
||||
}
|
||||
else if (JAR.equals(protocol)) {
|
||||
String fullPath = resourceURL.getFile();
|
||||
int delimiter = fullPath.indexOf(JAR_DELIMITER);
|
||||
if (delimiter >= 0) {
|
||||
String archivePath = fullPath.substring(0, delimiter);
|
||||
if (archivePath.startsWith(FILE + PROTOCOL_DELIMITER)) {
|
||||
resultPath = archivePath.substring(FILE.length() + PROTOCOL_DELIMITER.length());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (resultPath != null && resultPath.endsWith(File.separator)) {
|
||||
resultPath = resultPath.substring(0, resultPath.length() - 1);
|
||||
}
|
||||
|
||||
resultPath = replaceAll(resultPath, "%20", " ");
|
||||
resultPath = replaceAll(resultPath, "%23", "#");
|
||||
|
||||
// !Workaround for /D:/some/path/a.jar, which doesn't work if D is subst disk
|
||||
if (resultPath.startsWith("/") && resultPath.indexOf(":") == 2) {
|
||||
resultPath = resultPath.substring(1);
|
||||
}
|
||||
|
||||
return resultPath;
|
||||
}
|
||||
|
||||
private static String replaceAll(final String text, final String pattern, final String replacement) {
|
||||
if (pattern.length() == 0 || text.length() < pattern.length()) {
|
||||
return text;
|
||||
}
|
||||
final StringBuilder buf = new StringBuilder(text.length());
|
||||
int currentTextIndex = 0;
|
||||
while (currentTextIndex < text.length()) {
|
||||
final int startOfPattern = text.indexOf(pattern, currentTextIndex);
|
||||
if (startOfPattern < 0) {
|
||||
if (currentTextIndex == 0) { // there are no patterns in the text at all
|
||||
return text;
|
||||
}
|
||||
buf.append(text.substring(currentTextIndex)); // append the rest of the text
|
||||
return buf.toString();
|
||||
}
|
||||
buf.append(text.substring(currentTextIndex, startOfPattern));
|
||||
buf.append(replacement);
|
||||
currentTextIndex = startOfPattern + pattern.length();
|
||||
}
|
||||
return buf.toString();
|
||||
}
|
||||
|
||||
private static String getResourceRoot(final Class aClass) {
|
||||
return getResourceRoot(aClass, "/" + aClass.getName().replace('.', '/') + ".class");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package org.jetbrains.jps.runConf.java
|
||||
|
||||
import org.jetbrains.jps.ClasspathKind
|
||||
import org.jetbrains.jps.RunConfiguration
|
||||
import org.jetbrains.jps.runConf.RunConfigurationLauncherService
|
||||
|
||||
/**
|
||||
* This launcher is able can be used to start Java main class.
|
||||
*/
|
||||
public abstract class JavaBasedRunConfigurationLauncher extends RunConfigurationLauncherService {
|
||||
private File myOutputFile;
|
||||
private File myErrorFile;
|
||||
private Map<String, String> mySystemProperties = [:];
|
||||
|
||||
public JavaBasedRunConfigurationLauncher(String typeId) {
|
||||
super(typeId)
|
||||
}
|
||||
|
||||
/**
|
||||
* @return FQN of the main class to execute
|
||||
*/
|
||||
public abstract String getMainClassName(RunConfiguration runConf);
|
||||
|
||||
/**
|
||||
* @return main class arguments
|
||||
*/
|
||||
public abstract String getMainClassArguments(RunConfiguration runConf);
|
||||
|
||||
/**
|
||||
* @return additional JVM arguments
|
||||
*/
|
||||
public String getJVMArguments(RunConfiguration runConf) {
|
||||
return runConf.macroExpander.expandMacros(runConf.allOptions["VM_PARAMETERS"]);
|
||||
}
|
||||
|
||||
/**
|
||||
* @return system properties (can be specified in JVM arguments too, but this call is more convenient)
|
||||
*/
|
||||
public Map<String, String> getSystemProperties(RunConfiguration runConf) { return mySystemProperties; };
|
||||
|
||||
/**
|
||||
* @return classpath required to launch specified main class
|
||||
*/
|
||||
public abstract List<String> getMainClassClasspath(RunConfiguration runConf);
|
||||
|
||||
/**
|
||||
* Sets file where to write output of the process.
|
||||
*/
|
||||
public void setOutputFile(File outputFile) {
|
||||
myOutputFile = outputFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets file where to write error output of the process.
|
||||
*/
|
||||
public void setErrorFile(File errFile) {
|
||||
myErrorFile = errFile;
|
||||
}
|
||||
|
||||
/**
|
||||
* Adds system properties.
|
||||
*/
|
||||
public void addSystemProperties(Map<String, String> props) {
|
||||
mySystemProperties.putAll(props);
|
||||
}
|
||||
|
||||
final void startInternal(RunConfiguration runConf) {
|
||||
def project = runConf.project;
|
||||
|
||||
def ant = project.binding.ant;
|
||||
def params = [
|
||||
mainClass: getMainClassName(runConf),
|
||||
jvmArgs: getJVMArguments(runConf),
|
||||
classArgs: getMainClassArguments(runConf)
|
||||
];
|
||||
|
||||
def module = runConf.module;
|
||||
def runConfRuntimeCp = getRuntimeClasspath(runConf);
|
||||
|
||||
def attrs = [:];
|
||||
def sdk = module?.sdk ? module.sdk : project.projectSdk;
|
||||
if (sdk != null) {
|
||||
attrs["jvm"] = sdk.getJavaExecutable();
|
||||
} else {
|
||||
project.warning("Cannot find java executable, will use java of the current process.");
|
||||
}
|
||||
|
||||
attrs["classname"] = MainClassLauncher.class.getName();
|
||||
attrs["classpath"] = ClasspathUtil.composeClasspath([MainClassLauncher] as Class[]);
|
||||
attrs["fork"] = "true";
|
||||
attrs["dir"] = runConf.workingDir;
|
||||
attrs["logError"] = "true";
|
||||
attrs["failonerror"] = "true";
|
||||
|
||||
if (myOutputFile != null) {
|
||||
attrs["output"] = myOutputFile.absolutePath;
|
||||
}
|
||||
|
||||
if (myErrorFile != null) {
|
||||
attrs["error"] = myErrorFile.absolutePath;
|
||||
}
|
||||
|
||||
def runConfRuntimeCpFile = createTempFile(runConfRuntimeCp);
|
||||
def mainClassCpFile = createTempFile(getMainClassClasspath(runConf));
|
||||
def tmpArgs = createTempFile(splitCommandArgumentsAndUnquote(params.classArgs));
|
||||
project.info("Starting run configuration $runConf.name ...");
|
||||
|
||||
ant.java(attrs) {
|
||||
arg(line: "$params.mainClass \"$mainClassCpFile\" \"$runConfRuntimeCpFile\" \"$tmpArgs\"");
|
||||
jvmarg(line: params.jvmArgs);
|
||||
for (Map.Entry<String, String> envVar: runConf.envVars.entrySet()) {
|
||||
env(key: envVar.getKey(), value: envVar.getValue());
|
||||
}
|
||||
for (Map.Entry<String, String> propEntry: getSystemProperties(runConf).entrySet()) {
|
||||
sysproperty(key: propEntry.getKey(), value: propEntry.getValue());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
/** This utility differs from splitHonorQuote: it considers quote in sequence 'ddd\" -' as boundary quote.
|
||||
* So it can split "-Dffoo=c:\some\path\ddd\" -Dfff=sss correctly.
|
||||
* */
|
||||
private static List<String> splitCommandArgumentsAndUnquote(String line) {
|
||||
final ArrayList<String> result = new ArrayList<String>();
|
||||
final StringBuilder builder = new StringBuilder();
|
||||
boolean inQuotes = false;
|
||||
for (int i = 0; i < line.length(); i++) {
|
||||
final char c = line.charAt(i);
|
||||
if (c == ' ' && !inQuotes) {
|
||||
if (builder.length() > 0) {
|
||||
result.add(builder.toString());
|
||||
builder.setLength(0);
|
||||
}
|
||||
continue;
|
||||
}
|
||||
|
||||
if ((c == '"' || c == '\'') && isNotEscapedQuote(line, i)) {
|
||||
inQuotes = !inQuotes;
|
||||
}
|
||||
builder.append(c);
|
||||
}
|
||||
|
||||
if (builder.length() > 0) {
|
||||
result.add(builder.toString());
|
||||
}
|
||||
return removeQuotes(result);
|
||||
}
|
||||
|
||||
private static List<String> removeQuotes(final List<String> result) {
|
||||
for (int i = 0; i < result.size(); i++) {
|
||||
String value = result.get(i);
|
||||
if (value.length() > 1 && value.charAt(0) == '"' && value.charAt(value.length() - 1) == '"') {
|
||||
value = value.substring(1, value.length()-1);
|
||||
}
|
||||
result.set(i, value);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private static boolean isNotEscapedQuote(final String line, final int i) {
|
||||
if (i == 0) return true;
|
||||
if (line.charAt(i - 1) == '\\') { // Previous character is escaping one
|
||||
|
||||
int j;
|
||||
for(j = i + 1; j < line.length(); j ++) { // inspect chars after the quote
|
||||
if (line.charAt(j) == ' ') continue;
|
||||
return (line.charAt(j) == '-') || (line.charAt(j) == '\"' && j + 1 < line.length() && line.charAt(j + 1) == '-'); // next option started, so quote is not escaped actually
|
||||
}
|
||||
return j == line.length();
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
protected String createTempFile(Collection<String> runtimeClasspath) {
|
||||
def tmp = File.createTempFile("runConf", "suffix");
|
||||
def writer = new BufferedWriter(new FileWriter(tmp));
|
||||
|
||||
try {
|
||||
for (String item: runtimeClasspath) {
|
||||
if (item == null) continue;
|
||||
writer.writeLine(item);
|
||||
}
|
||||
} finally {
|
||||
writer.close();
|
||||
}
|
||||
return tmp.getCanonicalPath();
|
||||
}
|
||||
|
||||
protected Collection<String> splitClasspath(String classpathStr) {
|
||||
def result = new LinkedHashSet<String>();
|
||||
if (classpathStr != null) {
|
||||
result.addAll(Arrays.asList(classpathStr.split(File.pathSeparator)));
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
private Collection<String> getRuntimeClasspath(RunConfiguration runConf) {
|
||||
def runConfRuntimeCp = new LinkedHashSet<String>();
|
||||
if (runConf.module != null) {
|
||||
runConfRuntimeCp.addAll(runConf.module.testRuntimeClasspath());
|
||||
} else {
|
||||
runConfRuntimeCp.addAll(runConf.project.testRuntimeClasspath());
|
||||
}
|
||||
|
||||
def sdk = runConf.module?.sdk ? runConf.module.sdk : runConf.project.projectSdk;
|
||||
if (sdk != null) {
|
||||
for (String pathEl: sdk.getClasspathRoots(ClasspathKind.TEST_RUNTIME)) {
|
||||
runConfRuntimeCp.add(pathEl);
|
||||
}
|
||||
}
|
||||
|
||||
return runConfRuntimeCp;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,107 @@
|
||||
package org.jetbrains.jps.runConf.java;
|
||||
|
||||
import java.io.BufferedReader;
|
||||
import java.io.File;
|
||||
import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.lang.reflect.Method;
|
||||
import java.net.URL;
|
||||
import java.net.URLClassLoader;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
public class MainClassLauncher {
|
||||
public static void main(String[] args) throws Throwable {
|
||||
if (args.length < 4) {
|
||||
return;
|
||||
}
|
||||
|
||||
String className = args[0];
|
||||
String testRunnerCp = args[1];
|
||||
String testsRuntimeCp = args[2];
|
||||
String tempArgsFileName = args[3];
|
||||
|
||||
URL[] testsRuntimeClasspath = getClasspathElems(testsRuntimeCp);
|
||||
URL[] tcRuntimeClasspath = getClasspathElems(testRunnerCp);
|
||||
List<String> arguments = getArguments(tempArgsFileName);
|
||||
|
||||
System.out.println("Runtime classpath: " + Arrays.asList(testsRuntimeClasspath));
|
||||
|
||||
ClassLoader testsRuntimeClassloader = new URLClassLoader(testsRuntimeClasspath, null);
|
||||
ClassLoader mainClassLoader = new MainClassClassLoader(tcRuntimeClasspath, testsRuntimeClassloader);
|
||||
|
||||
Class<?> main = mainClassLoader.loadClass(className);
|
||||
Method mainMethod = main.getMethod("main", String[].class);
|
||||
|
||||
// we must not set mainClassLoader to context classloader, because it allows access to our classes, which we want to hide
|
||||
Thread.currentThread().setContextClassLoader(testsRuntimeClassloader);
|
||||
|
||||
try {
|
||||
mainMethod.invoke(null, new Object[] { arguments.toArray(new String[arguments.size()])});
|
||||
} catch (Throwable e) {
|
||||
throw new RuntimeException("Exception occurred in main class: " + main.getName() + ", error: " + e.toString(), e);
|
||||
}
|
||||
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private static URL[] getClasspathElems(String tempFileName) throws IOException {
|
||||
List<URL> result = new ArrayList<URL>();
|
||||
for (String line: loadLines(tempFileName)) {
|
||||
URL url = new File(line).toURL();
|
||||
result.add(url);
|
||||
}
|
||||
|
||||
//System.out.println("DEBUG INFO: libraries: " + result);
|
||||
URL[] array = new URL[result.size()];
|
||||
result.toArray(array);
|
||||
return array;
|
||||
}
|
||||
|
||||
private static List<String> getArguments(String tempFileName) throws IOException {
|
||||
return loadLines(tempFileName);
|
||||
}
|
||||
|
||||
private static List<String> loadLines(final String tempFileName) throws IOException {
|
||||
List<String> result = new ArrayList<String>();
|
||||
BufferedReader reader = new BufferedReader(new FileReader(tempFileName));
|
||||
try {
|
||||
while(true) {
|
||||
String line = reader.readLine();
|
||||
if (line == null) break;
|
||||
result.add(line);
|
||||
}
|
||||
//System.out.println("DEBUG INFO: arguments: " + result.toString());
|
||||
return result;
|
||||
} finally {
|
||||
reader.close();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* This classloader makes classes from the specified URLs more preferrable than classes from the parent classloader.
|
||||
* Specified main class is loaded by this classloader.
|
||||
*/
|
||||
private static class MainClassClassLoader extends URLClassLoader {
|
||||
public MainClassClassLoader(final URL[] urls, final ClassLoader parent) {
|
||||
super(urls, parent);
|
||||
}
|
||||
|
||||
public synchronized Class loadClass(String name, boolean resolve) throws ClassNotFoundException {
|
||||
Class c = findLoadedClass(name);
|
||||
if (c == null) {
|
||||
try {
|
||||
c = findClass(name);
|
||||
}
|
||||
catch (ClassNotFoundException e) {
|
||||
c = super.loadClass(name, resolve);
|
||||
}
|
||||
}
|
||||
if (resolve) {
|
||||
resolveClass(c);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
Manifest-Version: 1.0
|
||||
Main-Class: MyClass
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ArtifactManager">
|
||||
<artifact type="jar" name="simple">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/simple</output-path>
|
||||
<root id="archive" name="simple.jar">
|
||||
<element id="directory" name="META-INF">
|
||||
<element id="file-copy" path="$PROJECT_DIR$/META-INF/MANIFEST.MF" />
|
||||
</element>
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ArtifactManager">
|
||||
<artifact name="tests">
|
||||
<output-path>$PROJECT_DIR$/out/artifacts/tests</output-path>
|
||||
<root id="root">
|
||||
<element id="module-test-output" name="moduleTestOutput" />
|
||||
</root>
|
||||
</artifact>
|
||||
</component>
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/moduleTestOutput.iml" filepath="$PROJECT_DIR$/moduleTestOutput.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: nik
|
||||
* Date: 4/5/11
|
||||
* Time: 4:39 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class MyClass {
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
/**
|
||||
* Created by IntelliJ IDEA.
|
||||
* User: nik
|
||||
* Date: 4/5/11
|
||||
* Time: 4:39 PM
|
||||
* To change this template use File | Settings | File Templates.
|
||||
*/
|
||||
public class MyTest {
|
||||
}
|
||||
+57
@@ -0,0 +1,57 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="DependencyValidationManager">
|
||||
<option name="SKIP_IMPORT_STATEMENTS" value="false" />
|
||||
</component>
|
||||
<component name="EntryPointsManager">
|
||||
<entry_points version="2.0" />
|
||||
</component>
|
||||
<component name="FacetAutodetectingManager">
|
||||
<autodetection-disabled>
|
||||
<facet-type id="Groovy">
|
||||
<modules>
|
||||
<module name="A">
|
||||
<files>
|
||||
<file url="file://$PROJECT_DIR$/A/src/test/a/SomeGroovyClass.groovy" />
|
||||
<file url="file://$PROJECT_DIR$/samples/A/src/test/a/SomeGroovyClass.groovy" />
|
||||
</files>
|
||||
</module>
|
||||
</modules>
|
||||
</facet-type>
|
||||
</autodetection-disabled>
|
||||
</component>
|
||||
<component name="IdProvider" IDEtalkID="56801B29E60003A3AED3E894FD8130D3" />
|
||||
<component name="JavadocGenerationManager">
|
||||
<option name="OUTPUT_DIRECTORY" />
|
||||
<option name="OPTION_SCOPE" value="protected" />
|
||||
<option name="OPTION_HIERARCHY" value="true" />
|
||||
<option name="OPTION_NAVIGATOR" value="true" />
|
||||
<option name="OPTION_INDEX" value="true" />
|
||||
<option name="OPTION_SEPARATE_INDEX" value="true" />
|
||||
<option name="OPTION_DOCUMENT_TAG_USE" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_AUTHOR" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_VERSION" value="false" />
|
||||
<option name="OPTION_DOCUMENT_TAG_DEPRECATED" value="true" />
|
||||
<option name="OPTION_DEPRECATED_LIST" value="true" />
|
||||
<option name="OTHER_OPTIONS" value="" />
|
||||
<option name="HEAP_SIZE" />
|
||||
<option name="LOCALE" />
|
||||
<option name="OPEN_IN_BROWSER" value="true" />
|
||||
</component>
|
||||
<component name="ProjectDetails">
|
||||
<option name="projectName" value="jps" />
|
||||
</component>
|
||||
<component name="ProjectKey">
|
||||
<option name="state" value="project://default" />
|
||||
</component>
|
||||
<component name="ProjectResources">
|
||||
<default-html-doctype>http://www.w3.org/1999/xhtml</default-html-doctype>
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_5" assert-keyword="true" jdk-15="true" project-jdk-name="1.6" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/out" />
|
||||
</component>
|
||||
<component name="SvnBranchConfigurationManager">
|
||||
<option name="mySupportsUserInfoFilter" value="true" />
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/jps.iml" filepath="$PROJECT_DIR$/jps.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
|
||||
@@ -0,0 +1,80 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="Web" type="#com.intellij.j2ee.web.tomcat.TomcatRunConfigurationFactory" factoryName="Local" APPLICATION_SERVER_NAME="TeamCity 6.0">
|
||||
<option name="OPEN_IN_BROWSER" value="false" />
|
||||
<option name="OPEN_IN_BROWSER_URL" value="http://localhost:8080/" />
|
||||
<option name="COMMON_VM_ARGUMENTS" value="-ea -Xmx384m -XX:MaxPermSize=200m -Ddebug=true -server -XX:+HeapDumpOnOutOfMemoryError -Duser.language=en -Duser.country=GB -Dorg.apache.jasper.runtime.BodyContentImpl.LIMIT_BUFFER=true -Djava.awt.headless -DTC.res.disableAll=true -Dteamcity.development.mode=true -Dteamcity_logs=C:/BuildServer/logs -Dlog4j.configuration=file:C:/BuildServer/common/src/teamcity-server-log4j.xml -Dteamcity.maintenance.backup.file.name=development-backup -Dteamcity.startup.maintenance=false -Dteamcity.agentsUpgrade.enabled=false" />
|
||||
<option name="UPDATING_POLICY" value="restart-server" />
|
||||
<deployment>
|
||||
<artifact name="Web">
|
||||
<settings>
|
||||
<option name="CONTEXT_PATH" value="/" />
|
||||
</settings>
|
||||
</artifact>
|
||||
</deployment>
|
||||
<server-settings>
|
||||
<option name="DEPLOY_TOMCAT_APPS" value="false" />
|
||||
<option name="BASE_DIRECTORY_NAME" value="Unnamed_android-runners" />
|
||||
</server-settings>
|
||||
<predefined_log_file id="TOMCAT_LOCALHOST_LOG_ID" enabled="true" />
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea" />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="4428" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" additional-options2=onexit\=snapshot " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Debug">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" run" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" stop" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Profile ">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" run" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" stop" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<ConfigurationWrapper VM_VAR="JAVA_OPTS" RunnerId="Run">
|
||||
<option name="USE_ENV_VARIABLES" value="true" />
|
||||
<STARTUP>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" run" />
|
||||
</STARTUP>
|
||||
<SHUTDOWN>
|
||||
<option name="USE_DEFAULT" value="true" />
|
||||
<option name="SCRIPT" value="C:/svn/usage-statistics-server/tools/tomcat/bin/catalina.bat" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PROGRAM_PARAMETERS" value=" stop" />
|
||||
</SHUTDOWN>
|
||||
</ConfigurationWrapper>
|
||||
<method>
|
||||
<option name="BuildArtifacts" enabled="true">
|
||||
<artifact name="Web" />
|
||||
</option>
|
||||
</method>
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,39 @@
|
||||
<component name="ProjectRunConfigurationManager">
|
||||
<configuration default="false" name="all tests" type="JUnit" factoryName="JUnit">
|
||||
<extension name="coverage" enabled="false" merge="false" sample_coverage="true" runner="idea">
|
||||
<pattern>
|
||||
<option name="PATTERN" value="org.jetbrains.jps.*" />
|
||||
<option name="ENABLED" value="true" />
|
||||
</pattern>
|
||||
</extension>
|
||||
<module name="" />
|
||||
<option name="ALTERNATIVE_JRE_PATH_ENABLED" value="false" />
|
||||
<option name="ALTERNATIVE_JRE_PATH" value="" />
|
||||
<option name="PACKAGE_NAME" value="org.jetbrains.jps" />
|
||||
<option name="MAIN_CLASS_NAME" value="" />
|
||||
<option name="METHOD_NAME" value="" />
|
||||
<option name="TEST_OBJECT" value="package" />
|
||||
<option name="VM_PARAMETERS" value="" />
|
||||
<option name="PARAMETERS" value="" />
|
||||
<option name="WORKING_DIRECTORY" value="file://$PROJECT_DIR$" />
|
||||
<option name="ENV_VARIABLES" />
|
||||
<option name="PASS_PARENT_ENVS" value="true" />
|
||||
<option name="TEST_SEARCH_SCOPE">
|
||||
<value defaultName="wholeProject" />
|
||||
</option>
|
||||
<envs />
|
||||
<patterns />
|
||||
<RunnerSettings RunnerId="Debug">
|
||||
<option name="DEBUG_PORT" value="34924" />
|
||||
<option name="TRANSPORT" value="0" />
|
||||
<option name="LOCAL" value="true" />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Profile ">
|
||||
<option name="myExternalizedOptions" value=" additional-options= snapshots-dir= " />
|
||||
</RunnerSettings>
|
||||
<RunnerSettings RunnerId="Run" />
|
||||
<ConfigurationWrapper RunnerId="Debug" />
|
||||
<ConfigurationWrapper RunnerId="Run" />
|
||||
<method />
|
||||
</configuration>
|
||||
</component>
|
||||
@@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module relativePaths="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<sourceFolder url="file://$MODULE_DIR$/src" isTestSource="false" />
|
||||
<sourceFolder url="file://$MODULE_DIR$/testSrc" isTestSource="true" />
|
||||
<excludeFolder url="file://$MODULE_DIR$/build" />
|
||||
</content>
|
||||
<orderEntry type="jdk" jdkName="1.6" jdkType="JavaSDK" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module org.jetbrains.idea.maven.project.MavenProjectsManager.isMavenModule="true" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" LANGUAGE_LEVEL="JDK_1_5" inherit-compiler-output="false">
|
||||
<output url="file://$MODULE_DIR$/target/classes" />
|
||||
<output-test url="file://$MODULE_DIR$/target/test-classes" />
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
<excludeFolder url="file://$MODULE_DIR$/target" />
|
||||
</content>
|
||||
<orderEntry type="inheritedJdk" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: org.testng:testng:jdk15:5.8" level="project" />
|
||||
<orderEntry type="library" scope="TEST" name="Maven: junit:junit:3.8.1" level="project" />
|
||||
<orderEntry type="library" name="m2" level="project" />
|
||||
<orderEntry type="library" name="others" level="project" />
|
||||
</component>
|
||||
</module>
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,7 +18,7 @@ class AntPrePostStepsInArtifactsTest extends JpsBuildTestCase {
|
||||
file("file.txt")
|
||||
}
|
||||
file("prestep.txt", "pre1")
|
||||
file("poststep.txt", "$outDir.absolutePath" + File.separator + "artifacts" + File.separator + "main")
|
||||
file("poststep.txt", "${PathUtil.toSystemIndependentPath(outDir.absolutePath)}/artifacts/main")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,70 +5,88 @@ import org.codehaus.gant.GantBinding
|
||||
import org.jetbrains.ether.ProjectWrapper
|
||||
import org.jetbrains.jps.idea.IdeaProjectLoader
|
||||
import org.jetbrains.jps.util.FileSystemItem
|
||||
import org.jetbrains.jps.util.FileUtil
|
||||
import org.jetbrains.jps.util.TempFiles
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
abstract class JpsBuildTestCase extends TestCase {
|
||||
private TempFiles myTempFiles;
|
||||
|
||||
def doTest(String projectPath, Closure initProject, Closure expectedOutput) {
|
||||
doTest(projectPath, [:], initProject, expectedOutput)
|
||||
@Override
|
||||
protected void setUp() {
|
||||
myTempFiles = new TempFiles();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void tearDown() {
|
||||
myTempFiles.cleanup();
|
||||
}
|
||||
|
||||
def doTest(String projectPath, Closure initProject, Closure expectedOutput) {
|
||||
doTest(projectPath, [:], initProject, expectedOutput)
|
||||
}
|
||||
|
||||
def doTest(String projectPath, Map<String, String> pathVariables, Closure initProject, Closure expectedOutput) {
|
||||
Project project = buildAll(projectPath, pathVariables, initProject)
|
||||
assertOutput(project, project.targetFolder, expectedOutput);
|
||||
}
|
||||
|
||||
def protected assertOutput(Project project, String targetFolder, Closure expectedOutput) {
|
||||
def root = new FileSystemItem(name: "<root>")
|
||||
initFileSystemItem(root, expectedOutput)
|
||||
root.assertDirectoryEqual(new File(targetFolder), "")
|
||||
}
|
||||
|
||||
def protected buildAll(String projectPath, Map<String, String> pathVariables, Closure initProject) {
|
||||
def binding = new GantBinding()
|
||||
binding.includeTool << Jps
|
||||
ProjectWrapper pw = ProjectWrapper.load(binding, projectPath, null, pathVariables, false)
|
||||
Project project = pw.getProject()
|
||||
def target = createTempDir()
|
||||
project.targetFolder = target.absolutePath
|
||||
initProject(project)
|
||||
pw.clean()
|
||||
pw.rebuild()
|
||||
pw.buildArtifacts()
|
||||
pw.deleteTempFiles()
|
||||
return project
|
||||
}
|
||||
|
||||
protected Project loadProject(String projectPath, Map<String, String> pathVariables) {
|
||||
def binding = new GantBinding()
|
||||
binding.includeTool << Jps
|
||||
def project = new Project(binding)
|
||||
IdeaProjectLoader.loadFromPath(project, projectPath, pathVariables, null)
|
||||
return project
|
||||
}
|
||||
|
||||
def initFileSystemItem(FileSystemItem item, Closure initializer) {
|
||||
def meta = new InitializingExpando()
|
||||
meta.dir = {String name, Closure content ->
|
||||
def dir = new FileSystemItem(name: name, directory: true)
|
||||
initFileSystemItem(dir, content)
|
||||
item << dir
|
||||
}
|
||||
meta.archive = {String name, Closure content ->
|
||||
def archive = new FileSystemItem(name: name, archive: true)
|
||||
initFileSystemItem(archive, content)
|
||||
item << archive
|
||||
}
|
||||
meta.file = {Object[] args ->
|
||||
item << new FileSystemItem(name: args[0], content: args.length > 1 ? args[1] : null)
|
||||
}
|
||||
|
||||
def doTest(String projectPath, Map<String, String> pathVariables, Closure initProject, Closure expectedOutput) {
|
||||
Project project = buildAll(projectPath, pathVariables, initProject)
|
||||
assertOutput(project, project.targetFolder, expectedOutput);
|
||||
}
|
||||
initializer.delegate = meta
|
||||
initializer.setResolveStrategy Closure.DELEGATE_FIRST
|
||||
initializer()
|
||||
}
|
||||
|
||||
def protected assertOutput(Project project, String targetFolder, Closure expectedOutput) {
|
||||
def root = new FileSystemItem(name: "<root>")
|
||||
initFileSystemItem(root, expectedOutput)
|
||||
root.assertDirectoryEqual(new File(targetFolder), "")
|
||||
}
|
||||
|
||||
def protected buildAll(String projectPath, Map<String, String> pathVariables, Closure initProject) {
|
||||
def binding = new GantBinding()
|
||||
binding.includeTool << Jps
|
||||
ProjectWrapper pw = ProjectWrapper.load(binding, projectPath, null, pathVariables, false)
|
||||
Project project = pw.getProject()
|
||||
def target = FileUtil.createTempDirectory("targetDir")
|
||||
project.targetFolder = target.absolutePath
|
||||
initProject(project)
|
||||
pw.clean()
|
||||
pw.rebuild()
|
||||
pw.buildArtifacts()
|
||||
pw.deleteTempFiles()
|
||||
return project
|
||||
}
|
||||
|
||||
protected Project loadProject(String projectPath, Map<String, String> pathVariables) {
|
||||
def binding = new GantBinding()
|
||||
binding.includeTool << Jps
|
||||
def project = new Project(binding)
|
||||
IdeaProjectLoader.loadFromPath(project, projectPath, pathVariables, null)
|
||||
return project
|
||||
}
|
||||
|
||||
def initFileSystemItem(FileSystemItem item, Closure initializer) {
|
||||
def meta = new InitializingExpando()
|
||||
meta.dir = {String name, Closure content ->
|
||||
def dir = new FileSystemItem(name: name, directory: true)
|
||||
initFileSystemItem(dir, content)
|
||||
item << dir
|
||||
}
|
||||
meta.archive = {String name, Closure content ->
|
||||
def archive = new FileSystemItem(name: name, archive: true)
|
||||
initFileSystemItem(archive, content)
|
||||
item << archive
|
||||
}
|
||||
meta.file = {Object[] args ->
|
||||
item << new FileSystemItem(name: args[0], content: args.length > 1 ? args[1] : null)
|
||||
}
|
||||
|
||||
initializer.delegate = meta
|
||||
initializer.setResolveStrategy Closure.DELEGATE_FIRST
|
||||
initializer()
|
||||
}
|
||||
def File createTempDir() {
|
||||
return myTempFiles.createTempDir();
|
||||
}
|
||||
|
||||
def File createTempFile() {
|
||||
return myTempFiles.createTempFile();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.jetbrains.jps
|
||||
|
||||
import java.util.jar.Manifest
|
||||
import org.jetbrains.jps.util.ZipUtil
|
||||
import java.util.jar.Attributes
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class ManifestInArtifactTest extends JpsBuildTestCase {
|
||||
public void test() {
|
||||
def project = buildAll("testData/manifestInArtifact/manifest.ipr", [:], {})
|
||||
File jarFile = new File(project.targetFolder + "/artifacts/simple/simple.jar")
|
||||
assertTrue(jarFile.exists())
|
||||
File extracted = ZipUtil.extractToTempDir(jarFile)
|
||||
File manifestFile = new File(extracted, "META-INF/MANIFEST.MF")
|
||||
assertTrue(manifestFile.exists())
|
||||
Manifest manifest = new Manifest(new FileInputStream(manifestFile))
|
||||
assertEquals("MyClass", manifest.getMainAttributes().getValue(Attributes.Name.MAIN_CLASS))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.jetbrains.jps
|
||||
|
||||
/**
|
||||
* @author nik
|
||||
*/
|
||||
class ModuleTestOutputElementTest extends JpsBuildTestCase {
|
||||
public void test() {
|
||||
doTest("testData/moduleTestOutput/moduleTestOutput.ipr", {}, {
|
||||
dir("artifacts") {
|
||||
dir("tests") {
|
||||
file("MyTest.class")
|
||||
}
|
||||
}
|
||||
dir("production") {
|
||||
dir("moduleTestOutput") {
|
||||
file("MyClass.class")
|
||||
}
|
||||
}
|
||||
dir("test") {
|
||||
dir("moduleTestOutput") {
|
||||
file("MyTest.class")
|
||||
}
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package org.jetbrains.jps
|
||||
|
||||
/**
|
||||
* @author pavel.sher
|
||||
*/
|
||||
class RunConfLoaderTest extends JpsBuildTestCase {
|
||||
public void testLoadRunConfigurationsIpr() {
|
||||
Project project = loadProject("testData/runConfigurationsIpr/maven-watcher.ipr", [:]);
|
||||
assertEquals(2, project.runConfigurations.size());
|
||||
assertNotNull(project.runConfigurations["maven-watcher-core"]);
|
||||
assertNotNull(project.runConfigurations["testng maven-watcher-core"]);
|
||||
|
||||
RunConfiguration junitRunConf = project.runConfigurations["maven-watcher-core"];
|
||||
assertEquals("JUnit", junitRunConf.type);
|
||||
assertEquals("com.jetbrains.maven.watcher", junitRunConf.allOptions["PACKAGE_NAME"]);
|
||||
assertEquals(project.modules["maven-watcher-core"], junitRunConf.module)
|
||||
}
|
||||
|
||||
public void testLoadRunConfigurationsDir() {
|
||||
Project project = loadProject("testData/runConfigurationsDir", [:]);
|
||||
assertEquals(2, project.runConfigurations.size());
|
||||
assertNotNull(project.runConfigurations["all tests"]);
|
||||
assertNotNull(project.runConfigurations["Web"]);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,83 @@
|
||||
package org.jetbrains.jps.util;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
/**
|
||||
* @author Pavel.Sher
|
||||
* Date: 05.03.2008
|
||||
*/
|
||||
public class TempFiles {
|
||||
private static final File ourCurrentTempDir = new File(System.getProperty("java.io.tmpdir"));
|
||||
private final File myCurrentTempDir;
|
||||
|
||||
private static Random ourRandom;
|
||||
|
||||
static {
|
||||
ourRandom = new Random();
|
||||
ourRandom.setSeed(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
private final List<File> myFilesToDelete = new ArrayList<File>();
|
||||
|
||||
public TempFiles() {
|
||||
myCurrentTempDir = ourCurrentTempDir;
|
||||
if (!myCurrentTempDir.isDirectory()) {
|
||||
throw new IllegalStateException("Temp directory is not a directory, was deleted by some process: " + myCurrentTempDir.getAbsolutePath());
|
||||
}
|
||||
}
|
||||
|
||||
private File doCreateTempDir(String prefix, String suffix) throws IOException {
|
||||
prefix = prefix == null ? "" : prefix;
|
||||
suffix = suffix == null ? ".tmp" : suffix;
|
||||
|
||||
do {
|
||||
int count = ourRandom.nextInt();
|
||||
final File f = new File(myCurrentTempDir, prefix + count + suffix);
|
||||
if (!f.exists() && f.mkdirs()) {
|
||||
return f.getCanonicalFile();
|
||||
}
|
||||
} while (true);
|
||||
}
|
||||
|
||||
private File doCreateTempFile(String prefix, String suffix) throws IOException {
|
||||
final File file = doCreateTempDir(prefix, suffix);
|
||||
file.delete();
|
||||
file.createNewFile();
|
||||
return file;
|
||||
}
|
||||
|
||||
public final File createTempFile() throws IOException {
|
||||
File tempFile = doCreateTempFile("test", null);
|
||||
registerAsTempFile(tempFile);
|
||||
return tempFile;
|
||||
}
|
||||
|
||||
private void registerAsTempFile(final File tempFile) {
|
||||
myFilesToDelete.add(tempFile);
|
||||
}
|
||||
|
||||
/**
|
||||
* Returns a File object for created temp directory.
|
||||
*
|
||||
* @return a File object for created temp directory
|
||||
* @throws IOException if directory creation fails.
|
||||
*/
|
||||
public final File createTempDir() throws IOException {
|
||||
File f = doCreateTempDir("test", "");
|
||||
registerAsTempFile(f);
|
||||
return f;
|
||||
}
|
||||
|
||||
public void cleanup() {
|
||||
for (File file : myFilesToDelete) {
|
||||
if (file.exists()) {
|
||||
FileUtil.delete(file);
|
||||
}
|
||||
}
|
||||
myFilesToDelete.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user