Fix Python plugin to work with CLion as well as Python plugin for CLion
[idea/community.git] / python / build / groovy / org / jetbrains / intellij / build / pycharm / PythonPluginPropertiesBase.groovy
1 /*
2  * Copyright 2000-2017 JetBrains s.r.o.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 package org.jetbrains.intellij.build.pycharm
17
18 import org.jetbrains.intellij.build.ApplicationInfoProperties
19 import org.jetbrains.intellij.build.LinuxDistributionCustomizer
20 import org.jetbrains.intellij.build.MacDistributionCustomizer
21 import org.jetbrains.intellij.build.WindowsDistributionCustomizer
22 import org.jetbrains.intellij.build.impl.PluginLayout
23
24 /**
25  * @author vlan
26  */
27 abstract class PythonPluginPropertiesBase extends PyCharmPropertiesBase {
28   List<String> communityModules = [
29     "IntelliLang-python",
30     "ipnb",
31     "python-openapi",
32     "python-community-plugin-core",
33     "python-community-plugin-java",
34     "python-community-configure",
35     "python-community-plugin-minor",
36     "python-psi-api",
37     "python-pydev",
38     "python-community",
39   ]
40
41   String pythonCommunityPluginModule = "python-community-plugin-resources"
42
43   PythonPluginPropertiesBase() {
44     super()
45   }
46
47   PluginLayout pythonCommunityPluginLayout(String pluginVersion, @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
48     def pluginXmlModules = [
49       "IntelliLang-python",
50       "ipnb",
51     ]
52     pythonPlugin(pythonCommunityPluginModule, "python-ce", "python-community-plugin-build-patches",
53                  communityModules, pluginVersion) {
54       withProjectLibrary("markdown4j-2.2")  // Required for ipnb
55       pluginXmlModules.each { module ->
56         excludeFromModule(module, "META-INF/plugin.xml")
57       }
58       excludeFromModule(pythonCommunityPluginModule, "META-INF/python-plugin-dependencies.xml")
59       body.delegate = delegate
60       body()
61     }
62   }
63
64   static PluginLayout pythonPlugin(String mainModuleName, String name, String buildPatchesModule, List<String> modules,
65                                    String pluginVersion, @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
66     return PluginLayout.plugin(mainModuleName) {
67       directoryName = name
68       mainJarName = "${name}.jar"
69       version = pluginVersion
70       modules.each { module ->
71         withModule(module, mainJarName, false)
72       }
73       withModule(buildPatchesModule, mainJarName, false)
74       withResourceFromModule("python-helpers", "", "helpers")
75       doNotCreateSeparateJarForLocalizableResources()
76       body.delegate = delegate
77       body()
78     }
79   }
80
81   @Override
82   String getBaseArtifactName(ApplicationInfoProperties applicationInfo, String buildNumber) {
83     return null
84   }
85
86   @Override
87   WindowsDistributionCustomizer createWindowsCustomizer(String projectHome) {
88     return null
89   }
90
91   @Override
92   LinuxDistributionCustomizer createLinuxCustomizer(String projectHome) {
93     return null
94   }
95
96   @Override
97   MacDistributionCustomizer createMacCustomizer(String projectHome) {
98     return null
99   }
100 }