diff --git a/build/groovy/org/jetbrains/intellij/build/python/PythonCommunityPluginModules.groovy b/build/groovy/org/jetbrains/intellij/build/python/PythonCommunityPluginModules.groovy new file mode 100644 index 000000000000..c5ce40a763b9 --- /dev/null +++ b/build/groovy/org/jetbrains/intellij/build/python/PythonCommunityPluginModules.groovy @@ -0,0 +1,80 @@ +/* + * Copyright 2000-2017 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.intellij.build.python + +import org.jetbrains.intellij.build.BuildContext +import org.jetbrains.intellij.build.impl.PluginLayout + +/** + * @author nik + */ +class PythonCommunityPluginModules { + static List COMMUNITY_MODULES = [ + "IntelliLang-python", + "ipnb", + "python-openapi", + "python-community-plugin-core", + "python-community-plugin-java", + "python-community-configure", + "python-community-plugin-minor", + "python-psi-api", + "python-pydev", + "python-community", + ] + public static String PYTHON_COMMUNITY_PLUGIN_MODULE = "python-community-plugin-resources" + + static PluginLayout pythonCommunityPluginLayout(@DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) { + def pluginXmlModules = [ + "IntelliLang-python", + "ipnb", + ] + pythonPlugin(PYTHON_COMMUNITY_PLUGIN_MODULE, "python-ce", "python-community-plugin-build-patches", + COMMUNITY_MODULES) { + withProjectLibrary("markdown4j-2.2") // Required for ipnb + pluginXmlModules.each { module -> + excludeFromModule(module, "META-INF/plugin.xml") + } + excludeFromModule(PYTHON_COMMUNITY_PLUGIN_MODULE, "META-INF/python-plugin-dependencies.xml") + body.delegate = delegate + body() + } + } + + static PluginLayout pythonPlugin(String mainModuleName, String name, String buildPatchesModule, List modules, + @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) { + PluginLayout.plugin(mainModuleName) { + directoryName = name + mainJarName = "${name}.jar" + modules.each { module -> + withModule(module, mainJarName, false) + } + withModule(buildPatchesModule, mainJarName, false) + withResourceFromModule("python-helpers", "", "helpers") + withCustomVersion { BuildContext context -> + // TODO: Make the Python plugin follow the conventional scheme for plugin versioning, build the plugin together with the IDE + def pluginBuildNumber = getPluginBuildNumber() + "$context.applicationInfo.majorVersion.$context.applicationInfo.minorVersionMainPart.$pluginBuildNumber" + } + doNotCreateSeparateJarForLocalizableResources() + body.delegate = delegate + body() + } + } + + static String getPluginBuildNumber() { + System.getProperty("build.number", "SNAPSHOT") + } +} diff --git a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonCommunityPluginProperties.groovy b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonCommunityPluginProperties.groovy index 3273bf6441f3..65f470629c12 100644 --- a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonCommunityPluginProperties.groovy +++ b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonCommunityPluginProperties.groovy @@ -16,6 +16,7 @@ package org.jetbrains.intellij.build.pycharm import org.jetbrains.intellij.build.CommunityRepositoryModules +import org.jetbrains.intellij.build.python.PythonCommunityPluginModules /** * @author vlan @@ -26,10 +27,10 @@ class PythonCommunityPluginProperties extends PythonPluginPropertiesBase { productCode = "PC" platformPrefix = "PyCharmCore" applicationInfoModule = "python-community-ide-resources" - productLayout.pluginModulesToPublish = [pythonCommunityPluginModule] + productLayout.pluginModulesToPublish = [PythonCommunityPluginModules.PYTHON_COMMUNITY_PLUGIN_MODULE] productLayout.allNonTrivialPlugins = CommunityRepositoryModules.COMMUNITY_REPOSITORY_PLUGINS + [ - pythonCommunityPluginLayout() + PythonCommunityPluginModules.pythonCommunityPluginLayout() ] } } diff --git a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonPluginPropertiesBase.groovy b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonPluginPropertiesBase.groovy index 3b506a19d572..e95dfb3d2714 100644 --- a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonPluginPropertiesBase.groovy +++ b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PythonPluginPropertiesBase.groovy @@ -16,73 +16,17 @@ package org.jetbrains.intellij.build.pycharm import org.jetbrains.intellij.build.ApplicationInfoProperties -import org.jetbrains.intellij.build.BuildContext import org.jetbrains.intellij.build.LinuxDistributionCustomizer import org.jetbrains.intellij.build.MacDistributionCustomizer import org.jetbrains.intellij.build.WindowsDistributionCustomizer -import org.jetbrains.intellij.build.impl.PluginLayout - /** * @author vlan */ abstract class PythonPluginPropertiesBase extends PyCharmPropertiesBase { - List communityModules = [ - "IntelliLang-python", - "ipnb", - "python-openapi", - "python-community-plugin-core", - "python-community-plugin-java", - "python-community-configure", - "python-community-plugin-minor", - "python-psi-api", - "python-pydev", - "python-community", - ] - - String pythonCommunityPluginModule = "python-community-plugin-resources" - PythonPluginPropertiesBase() { super() } - PluginLayout pythonCommunityPluginLayout(@DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) { - def pluginXmlModules = [ - "IntelliLang-python", - "ipnb", - ] - pythonPlugin(pythonCommunityPluginModule, "python-ce", "python-community-plugin-build-patches", - communityModules) { - withProjectLibrary("markdown4j-2.2") // Required for ipnb - pluginXmlModules.each { module -> - excludeFromModule(module, "META-INF/plugin.xml") - } - excludeFromModule(pythonCommunityPluginModule, "META-INF/python-plugin-dependencies.xml") - body.delegate = delegate - body() - } - } - - static PluginLayout pythonPlugin(String mainModuleName, String name, String buildPatchesModule, List modules, - @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) { - return PluginLayout.plugin(mainModuleName) { - directoryName = name - mainJarName = "${name}.jar" - modules.each { module -> - withModule(module, mainJarName, false) - } - withModule(buildPatchesModule, mainJarName, false) - withResourceFromModule("python-helpers", "", "helpers") - withCustomVersion { BuildContext context -> - // TODO: Make the Python plugin follow the conventional scheme for plugin versioning, build the plugin together with the IDE - def pluginBuildNumber = System.getProperty("build.number", "SNAPSHOT") - "$context.applicationInfo.majorVersion.$context.applicationInfo.minorVersionMainPart.$pluginBuildNumber" - } - doNotCreateSeparateJarForLocalizableResources() - body.delegate = delegate - body() - } - } - @Override String getBaseArtifactName(ApplicationInfoProperties applicationInfo, String buildNumber) { return null