cc61cb86e35da0f7ed0f36ee50423b2cf6b0a071
[idea/community.git] / python / build / groovy / org / jetbrains / intellij / build / pycharm / PyCharmCommunityProperties.groovy
1 /*
2  * Copyright 2000-2016 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.*
19
20 /**
21  * @author nik
22  */
23 class PyCharmCommunityProperties extends PyCharmPropertiesBase {
24   PyCharmCommunityProperties(String communityHome) {
25     productCode = "PC"
26     platformPrefix = "PyCharmCore"
27     applicationInfoModule = "python-community-ide-resources"
28     brandingResourcePaths = ["$communityHome/python/resources"]
29
30     productLayout.platformApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + ["dom-openapi"]
31     productLayout.platformImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + [
32       "dom-impl", "python-community", "python-community-ide-resources",
33       "python-ide-community", "python-community-configure", "python-openapi", "python-psi-api", "platform-main"
34     ]
35     productLayout.bundledPluginModules = new File("$communityHome/python/build/plugin-list.txt").readLines()
36     productLayout.mainModules = ["main_pycharm_ce"]
37   }
38
39   @Override
40   void copyAdditionalFiles(BuildContext context, String targetDirectory) {
41     super.copyAdditionalFiles(context, targetDirectory)
42     context.ant.copy(todir: "$targetDirectory/license") {
43       fileset(file: "$context.paths.communityHome/LICENSE.txt")
44       fileset(file: "$context.paths.communityHome/NOTICE.txt")
45     }
46   }
47
48   @Override
49   String getSystemSelector(ApplicationInfoProperties applicationInfo) {
50     "PyCharmCE${applicationInfo.majorVersion}.${applicationInfo.minorVersionMainPart}"
51   }
52
53   @Override
54   String getBaseArtifactName(ApplicationInfoProperties applicationInfo, String buildNumber) {
55     "pycharmPC-$buildNumber"
56   }
57
58   @Override
59   WindowsDistributionCustomizer createWindowsCustomizer(String projectHome) {
60     return new PyCharmWindowsDistributionCustomizer() {
61       {
62         installerImagesPath = "$projectHome/python/build/resources"
63         fileAssociations = [".py"]
64       }
65
66       @Override
67       String getFullNameIncludingEdition(ApplicationInfoProperties applicationInfo) {
68         "PyCharm Community Edition"
69       }
70
71       @Override
72       void copyAdditionalFiles(BuildContext context, String targetDirectory) {
73         super.copyAdditionalFiles(context, targetDirectory)
74         context.ant.copy(file: "$context.paths.projectHome/python/help/pycharmhelp.jar", todir: "$targetDirectory/help", failonerror: false)
75       }
76     }
77   }
78
79   @Override
80   LinuxDistributionCustomizer createLinuxCustomizer(String projectHome) {
81     return new LinuxDistributionCustomizer() {
82       {
83         iconPngPath = "$projectHome/python/resources/PyCharmCore128.png"
84       }
85       @Override
86       String getRootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber) {
87         "pycharm-community-${applicationInfo.isEAP ? buildNumber : applicationInfo.fullVersion}"
88       }
89
90       @Override
91       void copyAdditionalFiles(BuildContext context, String targetDirectory) {
92         context.ant.copy(file: "$context.paths.projectHome/python/help/pycharmhelp.jar", todir: "$targetDirectory/help", failonerror: false)
93       }
94     }
95   }
96
97   @Override
98   MacDistributionCustomizer createMacCustomizer(String projectHome) {
99     return new PyCharmMacDistributionCustomizer() {
100       {
101         icnsPath = "$projectHome/python/resources/PyCharmCore.icns"
102         bundleIdentifier = "com.jetbrains.pycharm"
103         helpId = "PY"
104         dmgImagePath = "$projectHome/python/build/DMG_background.png"
105       }
106
107       @Override
108       String getRootDirectoryName(ApplicationInfoProperties applicationInfo, String buildNumber) {
109         String suffix = applicationInfo.isEAP ? " ${applicationInfo.majorVersion}.${applicationInfo.minorVersion} EAP" : ""
110         "PyCharm CE${suffix}.app"
111       }
112     }
113   }
114
115   @Override
116   String getOutputDirectoryName(ApplicationInfoProperties applicationInfo) {
117     "pycharm-ce"
118   }
119 }