build scripts: replace 'version' String by 'versionEvaluator' function in PluginLayout

This way we can have statically defined PluginLayout even if the plugin uses non-standard versioning scheme, and it allows us to reuse PluginLayout for such plugins in different IDEs.
This commit is contained in:
nik
2017-05-12 16:14:08 +03:00
parent 9a65777129
commit 70bace24ec
5 changed files with 30 additions and 12 deletions
@@ -37,7 +37,7 @@ class PythonCommunityPluginBuilder {
def pluginBuildNumber = System.getProperty("build.number", "SNAPSHOT")
def options = new BuildOptions(targetOS: BuildOptions.OS_NONE, buildNumber: pluginBuildNumber, outputRootPath: "$home/out/pycharmCE")
def buildContext = BuildContext.createContext(binding.ant, binding.projectBuilder, binding.project, binding.global,
home, home, new PythonCommunityPluginProperties(pluginBuildNumber),
home, home, new PythonCommunityPluginProperties(),
ProprietaryBuildTools.DUMMY, options)
def buildTasks = BuildTasks.create(buildContext)
buildTasks.buildDistributions()
@@ -21,7 +21,7 @@ import org.jetbrains.intellij.build.CommunityRepositoryModules
* @author vlan
*/
class PythonCommunityPluginProperties extends PythonPluginPropertiesBase {
PythonCommunityPluginProperties(String pluginVersion) {
PythonCommunityPluginProperties() {
super()
productCode = "PC"
platformPrefix = "PyCharmCore"
@@ -29,7 +29,7 @@ class PythonCommunityPluginProperties extends PythonPluginPropertiesBase {
productLayout.pluginModulesToPublish = [pythonCommunityPluginModule]
productLayout.allNonTrivialPlugins = CommunityRepositoryModules.COMMUNITY_REPOSITORY_PLUGINS + [
pythonCommunityPluginLayout(pluginVersion)
pythonCommunityPluginLayout()
]
}
}
@@ -16,6 +16,7 @@
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
@@ -44,13 +45,13 @@ abstract class PythonPluginPropertiesBase extends PyCharmPropertiesBase {
super()
}
PluginLayout pythonCommunityPluginLayout(String pluginVersion, @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
PluginLayout pythonCommunityPluginLayout(@DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
def pluginXmlModules = [
"IntelliLang-python",
"ipnb",
]
pythonPlugin(pythonCommunityPluginModule, "python-ce", "python-community-plugin-build-patches",
communityModules, pluginVersion) {
communityModules) {
withProjectLibrary("markdown4j-2.2") // Required for ipnb
pluginXmlModules.each { module ->
excludeFromModule(module, "META-INF/plugin.xml")
@@ -62,16 +63,20 @@ abstract class PythonPluginPropertiesBase extends PyCharmPropertiesBase {
}
static PluginLayout pythonPlugin(String mainModuleName, String name, String buildPatchesModule, List<String> modules,
String pluginVersion, @DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
@DelegatesTo(PluginLayout.PluginLayoutSpec) Closure body = {}) {
return PluginLayout.plugin(mainModuleName) {
directoryName = name
mainJarName = "${name}.jar"
version = pluginVersion
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()