diff options
author | Tor Norbye <tnorbye@google.com> | 2014-08-19 22:27:03 +0000 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2014-08-19 21:25:05 +0000 |
commit | 4ca751c002784c4bfd349cc5240b045b62277c80 (patch) | |
tree | dfc17b31990e2429535609b85f6d080c4fa0d9fe /python/edu/build/pycharm_edu_build.gant | |
parent | 890d9a2952301682ffecaed4495f5f65c84c3642 (diff) | |
parent | 060e58b3afea3ea39f5ba1cb5a443ca3ebda28c8 (diff) | |
download | idea-4ca751c002784c4bfd349cc5240b045b62277c80.tar.gz |
Merge "Merge remote-tracking branch 'aosp/upstream-master' into merge"
Diffstat (limited to 'python/edu/build/pycharm_edu_build.gant')
-rw-r--r-- | python/edu/build/pycharm_edu_build.gant | 393 |
1 files changed, 393 insertions, 0 deletions
diff --git a/python/edu/build/pycharm_edu_build.gant b/python/edu/build/pycharm_edu_build.gant new file mode 100644 index 000000000000..8c857c159874 --- /dev/null +++ b/python/edu/build/pycharm_edu_build.gant @@ -0,0 +1,393 @@ +/* + * Copyright 2000-2014 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. + */ +import org.jetbrains.jps.LayoutInfo + +import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome + +setProperty("home", guessHome(this as Script)) + +includeTargets << new File("${guessHome(this as Script)}/build/scripts/utils.gant") +// signMacZip locates in ultimate_utils.gant + includeTargets << new File("${guessHome(this)}/ultimate/build/scripts/ultimate_utils.gant") +includeTargets << new File("${guessHome(this)}/build/scripts/libLicenses.gant") + +requireProperty("buildNumber", requireProperty("build.number", snapshot)) + +setProperty("ch", "$home") +setProperty("pythonCommunityHome", "$ch/python") +setProperty("pythonEduHome", "$ch/python/edu") + +// load ApplicationInfo.xml properties +ant.xmlproperty(file: "$pythonEduHome/resources/idea/PyCharmEduApplicationInfo.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("$pythonEduHome/build/plugin-list.txt").readLines()) + +private List<String> 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-educational", "python-openapi", "python-psi-api", + "platform-main"].flatten() +} + +private List modules() { + return [ + "python-pydev", "colorSchemes", pycharmPlatformApiModules(), pycharmImplementationModules(), pluginFilter + ].flatten() +} + +private List approvedJars() { + def normalizedHome = ch.replace('\\', '/') + def normalizedPythonHome = pythonCommunityHome.replace('\\', '/') + return ["$normalizedHome/lib/", "$normalizedPythonHome/lib/", "$normalizedHome/xml/relaxng/lib/"] +} + +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/pycharmEDU" + + distAll = "$sandbox/layout" + distWin = "$sandbox/win" + distMac = "$sandbox/mac" + distUnix = "$sandbox/unix" + artifacts = "$sandbox/artifacts" + + ideaSystem = "$sandbox/system" + ideaConfig = "$sandbox/config" + } +} + +setProperty("paths", new Paths(home)) +setProperty("buildName", "PE-$buildNumber") + +target('default': "Build artifacts") { + + 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 = buildModulesAndCollectUsedJars(modules(), approvedJars(), ["/ant/"]) + + layoutEducational("${paths.sandbox}/classes/production", usedJars) + + + //buildNSIS([paths.distAll, paths.distWin], + // "${pythonEduHome}/build/strings.nsi", "${pythonEduHome}/build/paths.nsi", + // "pycharm", false, true, ".py", system_selector) + + def extraArgs = ["build.code": "pycharmEDU-${buildNumber}", "build.number": "PE-$buildNumber", "artifacts.path": "${paths.artifacts}"] + signMacZip("pycharm", extraArgs) + buildDmg("pycharm", "${pythonEduHome}/build/DMG_background.png", extraArgs) + +} + +public layoutEducational(String classesPath, Set usedJars) { + setProperty("pluginFilter", new File("$pythonEduHome/build/plugin-list.txt").readLines()) + + if (usedJars == null) { + usedJars = collectUsedJars(modules(), approvedJars(), ["/ant/"], null) + } + + def appInfo = appInfoFile(classesPath) + def paths = new Paths(home) + buildSearchableOptions("${projectBuilder.moduleOutput(findModule("platform-resources"))}/search", [], { + projectBuilder.moduleRuntimeClasspath(findModule("main_pycharm_edu"), false).each { + ant.pathelement(location: it) + } + }, "-Didea.platform.prefix=PyCharmEdu -Didea.no.jre.check=true") + + if (!dryRun) { + wireBuildDate("PE-${buildNumber}", appInfo) + } + + Map args = [ + buildNumber: "PE-${buildNumber}", + system_selector: system_selector, + ide_jvm_args: "-Didea.platform.prefix=PyCharmEdu -Didea.no.jre.check=true"] + + LayoutInfo layoutInfo = layoutFull(args, paths.distAll, usedJars) + generateLicensesTable("$paths.artifacts/third-party-libraries.txt", layoutInfo.usedModules); + + layoutWin(args, paths.distWin) + layoutUnix(args, paths.distUnix) + layoutMac(args, paths.distMac) + + ant.echo(message: "PE-${buildNumber}", file: "${paths.distAll}/build.txt") + + def launcher = "${paths.distWin}/bin/pycharm.exe" + List resourcePaths = ["$ch/community-resources/src", + "$ch/platform/icons/src", + "$pythonEduHome/resources"] + buildWinLauncher("$ch", "$ch/bin/WinLauncher/WinLauncher.exe", launcher, + appInfo, "$pythonEduHome/build/pycharm_edu_launcher.properties", system_selector, resourcePaths) + + buildWinZip("${paths.artifacts}/pycharmPE-${buildNumber}.zip", [paths.distAll, paths.distWin]) + + String tarRoot = isEap() ? "pycharm-edu-$buildNumber" : "pycharm-edu-${p("component.version.major")}.${p("component.version.minor")}" + buildTarGz(tarRoot, "$paths.artifacts/pycharmPE-${buildNumber}.tar", [paths.distAll, paths.distUnix]) + + String macAppRoot = isEap() ? "PyCharm EDU ${p("component.version.major")}.${p("component.version.minor")} EAP.app/Contents" : "PyCharm EDU.app/Contents" + buildMacZip(macAppRoot, "${paths.artifacts}/pycharmEDU-${buildNumber}.sit", [paths.distAll], paths.distMac) +} + +private layoutPlugins(layouts) { + dir("plugins") { + layouts.layoutPlugin("rest") + layouts.layoutPlugin("python-rest") + } + + layouts.layoutCommunityPlugins(ch) +} + +private String appInfoFile(String classesPath) { + return "$classesPath/python-educational/idea/PyCharmEduApplicationInfo.xml" +} + +private layoutFull(Map args, String target, Set usedJars) { + def openapiModules = pycharmPlatformApiModules() + def superLayouts = includeFile("$ch/build/scripts/layouts.gant") + + reassignAltClickToMultipleCarets("$ch") + + 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: "$pythonCommunityHome/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("libpty") { + fileset(dir: "$ch/lib/libpty") { + exclude(name: "*.txt") + } + } + + dir("ext") { + fileset(dir: "$ch/lib") { + include(name: "cglib*.jar") + } + } + + dir("src") { + fileset(dir: "$ch/lib/src") { + include(name: "trove4j_changes.txt") + include(name: "trove4j_src.jar") + } + + jar("pycharm-pydev-src.zip") { + fileset(dir: "$pythonCommunityHome/pydevSrc") + } + jar("pycharm-openapi-src.zip") { + fileset(dir: "$pythonCommunityHome/openapi/src") + fileset(dir: "$pythonCommunityHome/psi-api/src") + } + } + } + + dir("help") { + fileset(dir: "$home/python/help") { + include(name: "*.pdf") + } + } + + dir("helpers") { + fileset(dir: "$pythonCommunityHome/helpers") + } + + dir("license") { + fileset(dir: "$ch/license") + fileset(dir: "$ch") { + include(name: "LICENSE.txt") + include(name: "NOTICE.txt") + } + } + + layoutPlugins(superLayouts) + + dir("bin") { + fileset(dir: "$ch/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: "$ch/bin/win") { + exclude(name: "breakgen*") + } + } + + dir("skeletons") { + fileset(dir: "$pythonCommunityHome/skeletons") { + include(name: "skeletons-win*.zip") + } + } + } + + winScripts(target, ch, "pycharm.bat", args) + winVMOptions(target, null, "pycharm.exe") + + ant.copy(file: "$home/python/help/pycharmhelp.jar", todir: "$target/help", failonerror: false) +} + +private layoutUnix(Map args, String target) { + layout(target) { + dir("bin") { + fileset(dir: "$ch/bin/linux") { + exclude(name: "libbreakgen*") + } + } + } + + ant.copy(file: "$pythonCommunityHome/resources/PyCharmCore128.png", tofile: "$target/bin/pycharm.png") + + unixScripts(target, ch, "pycharm.sh", args) + unixVMOptions(target, "pycharm") + + ant.copy(file: "$home/python/help/pycharmhelp.jar", todir: "$target/help", failonerror: false) +} + +private layoutMac(Map _args, String target) { + layout(target) { + dir("bin") { + fileset(dir: "$home/bin") { + include(name: "*.jnilib") + } + } + + dir("skeletons") { + fileset(dir: "$pythonCommunityHome/skeletons") { + include(name: "skeletons-mac*.zip") + } + } + } + + Map args = new HashMap(_args) + args.icns = "$pythonCommunityHome/resources/PyCharmCore.icns" + args.bundleIdentifier = "com.jetbrains.pycharm" + args.platform_prefix = "PyCharmEdu" + 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, ch, args) +} |