diff --git a/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java b/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java index 8a1775d27ab9..fe6c98ad65de 100644 --- a/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java +++ b/java/compiler/impl/src/com/intellij/compiler/server/CompileServerPlugin.java @@ -15,7 +15,7 @@ public class CompileServerPlugin implements PluginAware { /** * Specifies path to a jar file which should be added to the classpath of the compile server. The path is relative to the plugin 'lib' directory. - * In the development node the name of this file without extension is treated as a module name and the output directory of the module is added to the classpath. + * In the development mode the name of this file without extension is treated as a module name and the output directory of the module is added to the classpath. */ @Attribute("jar-path") public String getJarPath() { diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java index fece721e2966..669dc5a7aa59 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsLoaderBase.java @@ -5,6 +5,7 @@ import com.intellij.openapi.util.SystemInfo; import com.intellij.openapi.util.io.FileUtil; import org.jdom.Element; import org.jdom.JDOMException; +import org.jetbrains.annotations.NotNull; import org.jetbrains.annotations.Nullable; import java.io.File; @@ -43,7 +44,7 @@ public abstract class JpsLoaderBase { } @Nullable - protected static Element findComponent(Element root, String componentName) { + public static Element findComponent(@Nullable Element root, @NotNull String componentName) { for (Element element : JDOMUtil.getChildren(root, "component")) { if (componentName.equals(element.getAttributeValue("name"))) { return element; diff --git a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModelLoaderExtension.java b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModelLoaderExtension.java index 8689a84cf625..72cf3483a712 100644 --- a/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModelLoaderExtension.java +++ b/jps/model-serialization/src/org/jetbrains/jps/model/serialization/JpsModelLoaderExtension.java @@ -7,7 +7,6 @@ import org.jetbrains.jps.model.JpsCompositeElement; import org.jetbrains.jps.model.JpsElementReference; import org.jetbrains.jps.model.JpsProject; import org.jetbrains.jps.model.library.JpsOrderRootType; -import org.jetbrains.jps.model.library.JpsSdkType; import org.jetbrains.jps.model.module.JpsDependencyElement; import org.jetbrains.jps.model.module.JpsModule; import org.jetbrains.jps.model.serialization.facet.JpsModuleExtensionLoader; @@ -31,11 +30,6 @@ public abstract class JpsModelLoaderExtension { return null; } - @Nullable - public JpsSdkType getSdkType(@NotNull String typeId) { - return null; - } - public void loadModuleDependencyProperties(JpsDependencyElement dependency, Element orderEntry) { } @@ -45,7 +39,7 @@ public abstract class JpsModelLoaderExtension { } @NotNull - public List> getModulePropertiesLoaders() { + public List> getModulePropertiesLoaders() { return Collections.emptyList(); } diff --git a/plugins/devkit/jps-plugin/devkit-jps-plugin.iml b/plugins/devkit/jps-plugin/devkit-jps-plugin.iml index d862612d0783..98f28486f7fd 100644 --- a/plugins/devkit/jps-plugin/devkit-jps-plugin.iml +++ b/plugins/devkit/jps-plugin/devkit-jps-plugin.iml @@ -8,6 +8,9 @@ + + + diff --git a/plugins/devkit/jps-plugin/src/META-INF/org.jetbrains.jps.model.serialization.JpsModelLoaderExtension b/plugins/devkit/jps-plugin/src/META-INF/org.jetbrains.jps.model.serialization.JpsModelLoaderExtension new file mode 100644 index 000000000000..c4d6e3eb7f05 --- /dev/null +++ b/plugins/devkit/jps-plugin/src/META-INF/org.jetbrains.jps.model.serialization.JpsModelLoaderExtension @@ -0,0 +1 @@ +org.jetbrains.jps.devkit.model.impl.JpsDevKitModelLoaderExtension \ No newline at end of file diff --git a/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkProperties.java b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkProperties.java new file mode 100644 index 000000000000..ab0e86635fda --- /dev/null +++ b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkProperties.java @@ -0,0 +1,49 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.jps.devkit.model; + +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jps.model.library.JpsSdkProperties; + +/** + * @author nik + */ +public class JpsIdeaSdkProperties extends JpsSdkProperties { + private final String mySandboxHome; + private final String myJdkName; + + public JpsIdeaSdkProperties(String homePath, String versionString, String sandboxHome, String jdkName) { + super(homePath, versionString); + mySandboxHome = sandboxHome; + myJdkName = jdkName; + } + + public JpsIdeaSdkProperties(JpsIdeaSdkProperties properties) { + super(properties); + mySandboxHome = properties.mySandboxHome; + myJdkName = properties.myJdkName; + } + + @Nullable + public String getSandboxHome() { + return mySandboxHome; + } + + @Nullable + public String getJdkName() { + return myJdkName; + } +} diff --git a/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkType.java b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkType.java new file mode 100644 index 000000000000..0c91c605915f --- /dev/null +++ b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsIdeaSdkType.java @@ -0,0 +1,38 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.jps.devkit.model; + +import org.jetbrains.annotations.NotNull; +import org.jetbrains.jps.model.java.JpsJavaSdkTypeWrapper; +import org.jetbrains.jps.model.library.JpsSdkProperties; +import org.jetbrains.jps.model.library.JpsSdkType; + +/** + * @author nik + */ +public class JpsIdeaSdkType extends JpsSdkType implements JpsJavaSdkTypeWrapper { + public static final JpsIdeaSdkType INSTANCE = new JpsIdeaSdkType(); + + @Override + public JpsIdeaSdkProperties createCopy(JpsIdeaSdkProperties properties) { + return new JpsIdeaSdkProperties(properties); + } + + @Override + public String getJavaSdkName(@NotNull JpsSdkProperties properties) { + return properties instanceof JpsIdeaSdkProperties ? ((JpsIdeaSdkProperties)properties).getJdkName() : null; + } +} diff --git a/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleProperties.java b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleProperties.java new file mode 100644 index 000000000000..3d0c743ca410 --- /dev/null +++ b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleProperties.java @@ -0,0 +1,37 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.jps.devkit.model; + +import org.jetbrains.jps.model.JpsElementProperties; + +/** + * @author nik + */ +public class JpsPluginModuleProperties extends JpsElementProperties { + private final String myPluginXmlUrl; + + public JpsPluginModuleProperties(String pluginXmlUrl) { + myPluginXmlUrl = pluginXmlUrl; + } + + public JpsPluginModuleProperties(JpsPluginModuleProperties properties) { + myPluginXmlUrl = properties.getPluginXmlUrl(); + } + + public String getPluginXmlUrl() { + return myPluginXmlUrl; + } +} diff --git a/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleType.java b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleType.java new file mode 100644 index 000000000000..295450213143 --- /dev/null +++ b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/JpsPluginModuleType.java @@ -0,0 +1,30 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.jps.devkit.model; + +import org.jetbrains.jps.model.module.JpsModuleType; + +/** + * @author nik + */ +public class JpsPluginModuleType extends JpsModuleType { + public static final JpsPluginModuleType INSTANCE = new JpsPluginModuleType(); + + @Override + public JpsPluginModuleProperties createCopy(JpsPluginModuleProperties properties) { + return new JpsPluginModuleProperties(properties); + } +} diff --git a/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/impl/JpsDevKitModelLoaderExtension.java b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/impl/JpsDevKitModelLoaderExtension.java new file mode 100644 index 000000000000..d5e400a69e03 --- /dev/null +++ b/plugins/devkit/jps-plugin/src/org/jetbrains/jps/devkit/model/impl/JpsDevKitModelLoaderExtension.java @@ -0,0 +1,79 @@ +/* + * Copyright 2000-2012 JetBrains s.r.o. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.jetbrains.jps.devkit.model.impl; + +import com.intellij.openapi.util.JDOMExternalizerUtil; +import org.jdom.Element; +import org.jetbrains.annotations.NotNull; +import org.jetbrains.annotations.Nullable; +import org.jetbrains.jps.devkit.model.JpsIdeaSdkProperties; +import org.jetbrains.jps.devkit.model.JpsIdeaSdkType; +import org.jetbrains.jps.devkit.model.JpsPluginModuleProperties; +import org.jetbrains.jps.devkit.model.JpsPluginModuleType; +import org.jetbrains.jps.model.serialization.JpsLoaderBase; +import org.jetbrains.jps.model.serialization.JpsModelLoaderExtension; +import org.jetbrains.jps.model.serialization.JpsModulePropertiesLoader; +import org.jetbrains.jps.model.serialization.JpsSdkPropertiesLoader; + +import java.util.Arrays; +import java.util.List; + +/** + * @author nik + */ +public class JpsDevKitModelLoaderExtension extends JpsModelLoaderExtension { + @NotNull + @Override + public List> getModulePropertiesLoaders() { + return Arrays.asList(new JpsPluginModulePropertiesLoader()); + } + + @NotNull + @Override + public List> getSdkPropertiesLoaders() { + return Arrays.asList(new JpsIdeaSdkPropertiesLoader()); + } + + private static class JpsIdeaSdkPropertiesLoader extends JpsSdkPropertiesLoader { + public JpsIdeaSdkPropertiesLoader() { + super("IDEA JDK", JpsIdeaSdkType.INSTANCE); + } + + @Override + public JpsIdeaSdkProperties loadProperties(String homePath, String version, @Nullable Element propertiesElement) { + String sandboxHome = null; + String jdkName = null; + if (propertiesElement != null) { + sandboxHome = JDOMExternalizerUtil.readField(propertiesElement, "mySandboxHome"); + jdkName = propertiesElement.getAttributeValue("sdk"); + } + return new JpsIdeaSdkProperties(homePath, version, sandboxHome, jdkName); + } + } + + private static class JpsPluginModulePropertiesLoader extends JpsModulePropertiesLoader { + private JpsPluginModulePropertiesLoader() { + super(JpsPluginModuleType.INSTANCE, "PLUGIN_MODULE"); + } + + @Override + public JpsPluginModuleProperties loadProperties(@Nullable Element moduleRootElement) { + Element component = JpsLoaderBase.findComponent(moduleRootElement, "DevKit.ModuleBuildProperties"); + return new JpsPluginModuleProperties(component != null ? component.getAttributeValue("url") : null); + } + } +} +