From 21b566cd5db6073457c688e119d94eab82987dcb Mon Sep 17 00:00:00 2001 From: Dmitry Jemerov Date: Fri, 30 Aug 2013 19:24:03 +0200 Subject: [PATCH] pycharm community build script initial --- python/build/plugin-list.txt | 48 --- python/build/pycharm_community_build.gant | 374 ++++++++++++++++++++++ python/build/python-community-build.iml | 15 + 3 files changed, 389 insertions(+), 48 deletions(-) create mode 100644 python/build/pycharm_community_build.gant create mode 100644 python/build/python-community-build.iml diff --git a/python/build/plugin-list.txt b/python/build/plugin-list.txt index 6c9663172bef..0b27fa9432c9 100644 --- a/python/build/plugin-list.txt +++ b/python/build/plugin-list.txt @@ -1,61 +1,13 @@ -htmltools -JavaScriptLanguage -JavaScriptDebugger -FirefoxConnector -ChromeConnector -python-javascript-debugger cvsIntegration cvs-core cvs-plugin javacvs-src smartcvs-src -PerforceIntegration -Perforce -perforce_util svn4idea git4idea -CSS -css-api -JSInspections -JSIntentionPowerPack -less -sass -haml -haml-plugin hg4idea tasks tasks-core tasks-api github -webDeployment -jdbc-console -django-db-config -database-impl -DatabaseSupport -database-plugin -sql -sql-plugin -coffeescript -remote-run -python-remote-interpreter -vagrant -diagram-api -uml -python-uml -localization -python-localization -rest -python-rest -pycharm-flask -pycharm-numpy -textmate -restClient -puppet -fileWatcher terminal -IntelliLang -IntelliLang-xml -IntelliLang-js -IntelliLang-python -ini4idea -stylus diff --git a/python/build/pycharm_community_build.gant b/python/build/pycharm_community_build.gant new file mode 100644 index 000000000000..29fd37469040 --- /dev/null +++ b/python/build/pycharm_community_build.gant @@ -0,0 +1,374 @@ +import org.jetbrains.jps.LayoutInfo + +import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome + +includeTargets << new File("${guessHome(this as Script)}/community/build/scripts/utils.gant") +includeTargets << new File("${guessHome(this)}/build/scripts/libLicenses.gant") +includeTargets << new File("${guessHome(this)}/python/build/python_common.gant") + +requireProperty("buildNumber", requireProperty("build.number", snapshot)) + +setProperty("ch", "$home/community") +setProperty("pythonCommunityHome", "$home/python/community") + +// load ApplicationInfo.xml properties +ant.xmlproperty(file: "$pythonCommunityHome/resources/idea/PyCharmCoreApplicationInfo.xml", collapseAttributes: "true") + +setProperty("system_selector", "PyCharm${p("component.version.major")}0") +setProperty("dryRun", false) +setProperty("jdk16", guessJdk()) + +//modules to compile +setProperty("pluginFilter", new File("$pythonCommunityHome/build/plugin-list.txt").readLines()) + +private List pycharmPlatformApiModules() { + return [platformApiModules, "dom-openapi"].flatten() +} + + +private List pycharmImplementationModules() { //modules to put into pycharm.jar + return [platformImplementationModules, "dom-impl", "python-community", "python-ide-community", "python-openapi", "python-psi-api"] +} + +class Paths { + final sandbox + final distAll + final distWin + final distMac + final distUnix + final artifacts + final ideaSystem + final ideaConfig + + def Paths(String home) { + sandbox = "$home/out/pycharmCE" + + distAll = "$sandbox/layout" + distWin = "$sandbox/win" + distMac = "$sandbox/mac" + distUnix = "$sandbox/unix" + artifacts = "$home/out/pycharmCE/artifacts" + + ideaSystem = "$sandbox/system" + ideaConfig = "$sandbox/config" + } +} + +setProperty("paths", new Paths(home)) +setProperty("buildName", "PC-$buildNumber") + +target('default': "Build artifacts") { + def modules = [ + "python-pydev", "colorSchemes", pycharmPlatformApiModules(), pycharmImplementationModules(), pluginFilter + ].flatten() + + loadProject() + + projectBuilder.stage("Cleaning up sandbox folder") + + projectBuilder.targetFolder = "${paths.sandbox}/classes" + projectBuilder.dryRun = dryRun + + if (!dryRun) { + forceDelete(paths.sandbox) + ant.mkdir(dir: paths.sandbox) + } + + ant.tstamp() { + format(property: "todayYear", pattern: "yyyy") + } + + ant.patternset(id: "resources.included") { + include(name: "**/*.properties") + include(name: "fileTemplates/**/*") + include(name: "inspectionDescriptions/**/*") + include(name: "intentionDescriptions/**/*") + include(name: "tips/**/*") + include(name: "search/**/*") + } + + ant.patternset(id: "resources.excluded") { + exclude(name: "**/*.properties") + exclude(name: "fileTemplates/**/*") + exclude(name: "fileTemplates") + exclude(name: "inspectionDescriptions/**/*") + exclude(name: "inspectionDescriptions") + exclude(name: "intentionDescriptions/**/*") + exclude(name: "intentionDescriptions") + exclude(name: "tips/**/*") + exclude(name: "tips") + } + + zipSources(home, paths.artifacts) + + def usedJars = buildModules(modules, ["python/lib"]) + + buildSearchableOptions("${projectBuilder.moduleOutput(findModule("platform-resources"))}/search", [], { + projectBuilder.moduleRuntimeClasspath(findModule("main_pycharm_ce"), false).each { + ant.pathelement(location: it) + } + }, "-Didea.platform.prefix=PyCharmCore -Didea.no.jre.check=true") + + if (!dryRun) { + wireBuildDate(buildName, appInfoFile()) + } + + Map args = [ + buildNumber: buildName, + system_selector: system_selector, + ide_jvm_args: "-Didea.platform.prefix=PyCharmCore -Didea.no.jre.check=true"] + + LayoutInfo layoutInfo = layoutFull(args, paths.distAll, usedJars) + generateLicensesTable("$paths.artifacts/third-party-libraries.txt", layoutInfo.usedModules); + + def egg = buildDebuggerEgg(paths.sandbox, "$home/python", buildName) + ant.copy(file: egg, todir: paths.distAll) + def eggPy3k = buildDebuggerEggPy3K(paths.sandbox, "$home/python", buildName) + ant.copy(file: eggPy3k, todir: paths.distAll) + + layoutWin(args, paths.distWin) + layoutUnix(args, paths.distUnix) + layoutMac(args, paths.distMac) + + ant.echo(message: buildName, file: "${paths.sandbox}/layout/build.txt") + + /* + def launcher = "${paths.distWin}/bin/pycharm.exe" + List resourcePaths = ["$home/community/community-resources/src", + "$home/community/platform/icons/src", + "$home/python/resources", + "$home/python/community/resources"] + buildWinLauncher("$home/community", "$home/community/bin/WinLauncher/WinLauncher.exe", launcher, + appInfoFile(), "$home/python/build/pycharm_launcher.properties", system_selector, resourcePaths) + signExe(launcher) + + buildWinZip("${paths.artifacts}/pycharm${buildName}.zip", [paths.distAll, paths.distWin]) + buildNSIS([paths.distAll, paths.distWin], + "$home/python/build/strings.nsi", "$home/python/build/paths.nsi", + "pycharm", false, true, system_selector) + + String tarRoot = isEap() ? "pycharm-$buildNumber" : "pycharm-${p("component.version.major")}.${p("component.version.minor")}" + buildTarGz(tarRoot, "$paths.artifacts/pycharm${buildName}.tar", [paths.distAll, paths.distUnix]) + + String macAppRoot = isEap() ? "PyCharm ${p("component.version.major")}.${p("component.version.minor")} EAP.app" : "PyCharm.app" + buildMacZip(macAppRoot, "${paths.artifacts}/pycharm${buildName}.sit", [paths.distAll], paths.distMac) + signMacZip("pycharm") + buildDmg("pycharm", "${home}/python/build/DMG_background.png") + */ +} + +private layoutPlugins(layouts) { + dir("plugins") { + /* + layouts.layoutPlugin("django-db-config") + layouts.layoutPlugin("python-javascript-debugger") + layouts.layoutPlugin("remote-run") { + fileset(dir: "$home/plugins/remote-run/lib") { + include(name: "jediterm-0.2.jar") + } + } + layouts.layoutPlugin("python-remote-interpreter") + layouts.layoutPlugin("vagrant") { + fileset(dir: "$home/plugins/vagrant/lib") { + include(name: "jrubyparser-0.2.jar") + } + } + layouts.layoutPlugin("python-uml") + layouts.layoutPlugin("localization") + layouts.layoutPlugin("python-localization") + layouts.layoutPlugin("rest") + layouts.layoutPlugin("python-rest") + layouts.layoutPlugin("pycharm-flask") + layouts.layoutPlugin("pycharm-numpy") + layouts.layoutPlugin("textmate") { + dir("themes") { + fileset(dir: "${home}/plugins/textmate/lib/themes/", includes: "*.tmTheme") + } + fileset(dir: "${home}/plugins/textmate/lib") { + include(name: "jcodings.jar") + include(name: "joni.jar") + } + } + layouts.layoutPlugin("puppet") + layouts.layoutPlugin("fileWatcher") + layouts.layoutPlugin("ini4idea") + */ + } + + layouts.layoutPlugins() +} + +private String appInfoFile() { + return "$home/out/pycharm/classes/production/python-ide-community/idea/PyCharmCoreApplicationInfo.xml" +} + +private layoutFull(Map args, String target, Set usedJars) { + def openapiModules = pycharmPlatformApiModules() + def superLayouts = includeFile("$home/build/scripts/layouts.gant") + def result = layout(target) { + dir("lib") { + jar("util.jar") { + module("util") + module("util-rt") + } + + jar("openapi.jar") { + openapiModules.each { module it } + } + + jar("annotations.jar") { module("annotations") } + jar("extensions.jar") { module("extensions") } + + jar("pycharm.jar") { + pycharmImplementationModules().each { + module(it) { + exclude(name: "**/tips/**") + } + } + } + + jar("pycharm-pydev.jar") { + module("python-pydev") + } + + jar("bootstrap.jar") { module("bootstrap") } + jar("resources.jar") { + module("platform-resources") + module("colorSchemes") + } + + jar("forms_rt.jar") { + module("forms_rt") + } + + //noinspection GroovyAssignabilityCheck + jar([name: "resources_en.jar", duplicate: "preserve"]) { + // custom resources should go first + fileset(dir: "$home/python/resources") { + include(name: "**/tips/**") + } + fileset(dir: "$home/python/community/resources") { + include(name: "**/tips/**") + } + module("platform-resources-en") { + ant.patternset { + exclude(name: "tips/images/switcher.png") + exclude(name: "tips/images/navigateToFilePath.gif") + } + } + } + + jar("icons.jar") { module("icons") } + jar("boot.jar") { module("boot") } + + usedJars.each { + fileset(file: it) + } + + dir("ext") { + fileset(dir: "$home/community/lib") { + include(name: "cglib*.jar") + } + } + + dir("src") { + fileset(dir: "$home/community/lib/src") { + include(name: "trove4j_changes.txt") + include(name: "trove4j_src.jar") + } + + jar("pycharm-pydev-src.zip") { + fileset(dir: "$home/python/pydevSrc") + } + jar("pycharm-openapi-src.zip") { + fileset(dir: "$home/python/openapi/src") + fileset(dir: "$home/python/psi-api/src") + } + } + } + + dir("help") { + fileset(dir: "$home/python/help") { + include(name: "*.pdf") + } + } + + dir("helpers") { + fileset(dir: "$home/python/helpers") + } + + dir("license") { + fileset(dir: "$home/community/license") + } + + layoutPlugins(superLayouts) + + dir("bin") { + fileset(dir: "$home/community/bin") { + exclude(name: "appletviewer.policy") + include(name: "*.*") + } + } + } + patchPropertiesFile(target, args + [appendices: ["$home/build/conf/ideaJNC.properties"]]) + return result +} + +private layoutWin(Map args, String target) { + layout(target) { + dir("bin") { + fileset(dir: "$home/community/bin/win") { + exclude(name: "breakgen*") + } + } + + dir("skeletons") { + fileset(dir: "$home/python/skeletons") { + include(name: "skeletons-win*.zip") + } + } + } + + winScripts(target, "$home/community", "pycharm.bat", args) + winVMOptions(target, args.system_selector, "pycharm.exe") +} + +private layoutUnix(Map args, String target) { + layout(target) { + dir("bin") { + fileset(dir: "$home/community/bin/linux") { + exclude(name: "libbreakgen*") + } + } + } + + ant.copy(file: "$home/python/resources/PyCharm_128.png", tofile: "$target/bin/pycharm.png") + + unixScripts(target, "$home/community", "pycharm.sh", args) + unixVMOptions(target, "pycharm") +} + +private layoutMac(Map _args, String target) { + layout(target) { + dir("bin") { + fileset(dir: "$home/bin") { + include(name: "*.jnilib") + } + } + + dir("skeletons") { + fileset(dir: "$home/python/skeletons") { + include(name: "skeletons-mac*.zip") + } + } + } + + Map args = new HashMap(_args) + args.icns = "$home/python/resources/PyCharm.icns" + args.bundleIdentifier = "com.jetbrains.pycharm" + args.platform_prefix = "Python" + args.help_id = "PY" + args."idea.properties.path" = "${paths.distAll}/bin/idea.properties" + args."idea.properties" = ["idea.no.jre.check": true, "ide.mac.useNativeClipboard": "false"]; + layoutMacApp(target, "$home/community", args) +} diff --git a/python/build/python-community-build.iml b/python/build/python-community-build.iml new file mode 100644 index 000000000000..9dcf7cae7b5e --- /dev/null +++ b/python/build/python-community-build.iml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + +