mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-10-06 06:21:16 +07:00
304 lines
8.3 KiB
Plaintext
304 lines
8.3 KiB
Plaintext
import org.jetbrains.jps.Module
|
|
import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
|
|
import org.jetbrains.jps.Jps
|
|
|
|
includeTargets << new File("${guessHome(this as Script)}/build/scripts/utils.gant")
|
|
includeTool << Jps
|
|
|
|
requireProperty("buildNumber", requireProperty("build.number", "94.SNAPSHOT"))
|
|
|
|
setProperty("dryRun", false)
|
|
|
|
setProperty("pluginFilter", [
|
|
"htmltools",
|
|
"JavaScriptLanguage",
|
|
"cvsIntegration", "cvs-core", "cvs-plugin", "javacvs-src", "smartcvs-src",
|
|
"PerforceIntegration", "Perforce", "perforce_util",
|
|
"svn4idea",
|
|
"git4idea",
|
|
"CSS", "css-api",
|
|
"JSInspections",
|
|
"JSIntentionPowerPack",
|
|
"SpellChecker", "spellchecker",
|
|
"yaml", "yaml-plugin"
|
|
])
|
|
|
|
private List platformImplementationModules() {
|
|
return [
|
|
"RegExpSupport",
|
|
"license_common",
|
|
"platform-ultimate",
|
|
"platform-impl",
|
|
"vcs-impl",
|
|
"lang-impl",
|
|
"testRunner",
|
|
"smRunner",
|
|
"xdebugger-impl",
|
|
"testFramework",
|
|
"xml",
|
|
"lvcs-impl",
|
|
"images",
|
|
]
|
|
}
|
|
|
|
private List<String> platformApiModules() {
|
|
return ["platform-api", "lvcs-api", "lang-api", "vcs-api", "usageView", "xdebugger-api", "xml-openapi"]
|
|
}
|
|
|
|
def includeFile(String filepath) {
|
|
Script s = groovyShell.parse(new File(filepath))
|
|
s.setBinding(binding)
|
|
s
|
|
}
|
|
|
|
setProperty("buildName", "PY-$buildNumber")
|
|
|
|
target('default': "Build artifacts") {
|
|
|
|
def sandbox = "$home/out/pycharm";
|
|
|
|
def modules = [
|
|
"python", "python-ide", "python-py", platformApiModules(), platformImplementationModules(), pluginFilter
|
|
].flatten()
|
|
|
|
loadProject()
|
|
|
|
// project.dryRun = true
|
|
project.stage("Cleaning up sandbox folder")
|
|
|
|
project.targetFolder = "$sandbox/classes"
|
|
project.dryRun = dryRun
|
|
|
|
if (!dryRun) {
|
|
ant.delete(dir: sandbox)
|
|
ant.mkdir(dir: sandbox)
|
|
}
|
|
|
|
|
|
ant.tstamp() {
|
|
format(property: "today.year", 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")
|
|
}
|
|
|
|
def usedJars = new HashSet();
|
|
|
|
project.clean()
|
|
modules.each {
|
|
Module module = project[it] as Module
|
|
if (module != null) {
|
|
project.info("Building $module.name")
|
|
module.runtimeClasspath().each {
|
|
File file = new File(it)
|
|
if (file.exists()) {
|
|
String path = file.canonicalPath.replace('\\', '/')
|
|
String normalizedHome = home.replace('\\', '/')
|
|
if (path.endsWith(".jar") && (path.startsWith("$normalizedHome/lib/") || path.startsWith("$normalizedHome/community/lib/"))
|
|
&& !path.contains("/dev/") && !path.contains("/rt/") && !path.contains("/ant/")) {
|
|
usedJars.add(path);
|
|
}
|
|
}
|
|
|
|
}
|
|
module.make()
|
|
}
|
|
else {
|
|
project.warning("$it is not a module")
|
|
}
|
|
}
|
|
|
|
wire_build_date(buildName)
|
|
layoutFull(
|
|
buildName: buildName,
|
|
version: "1.0",
|
|
system_selector: "PY",
|
|
jdk_req: "1.6*",
|
|
vmoptions: "-Xms128m -Xmx512m -XX:MaxPermSize=250m -ea",
|
|
usedJars: usedJars,
|
|
|
|
"$sandbox/layout")
|
|
|
|
buildExe()
|
|
|
|
ant.echo(message: buildName, file: "$sandbox/layout/build.txt")
|
|
|
|
def root = "${buildName}.app"
|
|
|
|
def artifactsPath = "$home/out/artifacts"
|
|
ant.mkdir(dir: artifactsPath)
|
|
ant.zip(zipfile: "$artifactsPath/${buildName}.zip") {
|
|
tarfileset(dir: "$sandbox/layout", prefix: root) {
|
|
exclude(name: "bin/*.sh")
|
|
exclude(name: "Contents/MacOS/idea")
|
|
}
|
|
|
|
tarfileset(dir: "$sandbox/layout", filemode: "755", prefix: root) {
|
|
include(name: "bin/*.sh")
|
|
include(name: "Contents/MacOS/idea")
|
|
}
|
|
}
|
|
|
|
def installer = includeFile("nsis_installer.gant")
|
|
installer.nsis_installer(["$sandbox/layout"],
|
|
"$home/python/build/strings.nsi",
|
|
"$home/build/conf/nsis/paths.nsi",
|
|
"PyCharmPY-")
|
|
}
|
|
|
|
String appInfoFile() {
|
|
return "$home/out/pycharm/classes/production/python-ide/idea/PythonApplicationInfo.xml"
|
|
}
|
|
|
|
void wire_build_date(String buildName) {
|
|
if (!dryRun) {
|
|
ant.replace(token: "__BUILD_NUMBER__", value: buildName, file: appInfoFile())
|
|
ant.replace(token: "__BUILD_DATE__", value: DSTAMP, file: appInfoFile())
|
|
}
|
|
}
|
|
|
|
def buildExe() {
|
|
if (!isMac()) {
|
|
executeExternalAnt(
|
|
"config.file": "$home/python/build/pycharm.exe4j",
|
|
"output.file": "pycharm.exe",
|
|
"$home/build/buildLauncher.xml")
|
|
}
|
|
else {
|
|
project.warning("Building .exe executable skipped")
|
|
}
|
|
}
|
|
|
|
def layoutFull(Map args, String target) {
|
|
def openapiModules = platformApiModules()
|
|
def implementationModules = [platformImplementationModules(), "python", "python-ide", "python-py"].flatten()
|
|
|
|
layout(target) {
|
|
dir("lib") {
|
|
jar("util.jar") { module("util") }
|
|
|
|
jar("openapi.jar") {
|
|
openapiModules.each { module it}
|
|
}
|
|
|
|
jar("annotations.jar") { module("annotations")}
|
|
jar("extensions.jar") { module("extensions")}
|
|
|
|
jar("pycharm.jar") {
|
|
implementationModules.each { module it}
|
|
}
|
|
|
|
jar("bootstrap.jar") { module("bootstrap")}
|
|
jar("resources.jar") {
|
|
module("platform-resources")
|
|
}
|
|
|
|
jar("forms_rt.jar") {
|
|
module("forms_rt")
|
|
}
|
|
|
|
jar("resources_en.jar") {
|
|
module("platform-resources-en")
|
|
}
|
|
|
|
jar("icons.jar") { module("icons") }
|
|
jar("boot.jar") { module("boot") }
|
|
|
|
args.usedJars.each {
|
|
fileset(file: it)
|
|
}
|
|
|
|
fileset(dir: "$home/community/lib/src") {
|
|
include(name: "trove4j_changes.txt")
|
|
include(name: "trove4j_src.jar")
|
|
}
|
|
}
|
|
|
|
def layouts = includeFile("$home/build/scripts/layouts.gant")
|
|
layouts.layoutPlugins()
|
|
|
|
dir("bin") {
|
|
fileset(dir: "$home/community/bin") { include(name: "*.*") }
|
|
fileset(dir: "$home/community/bin/nix")
|
|
fileset(dir: "$home/community/bin/mac")
|
|
}
|
|
}
|
|
|
|
ant.copy(todir: target) {
|
|
fileset(dir: "$home/community/build/conf/mac")
|
|
}
|
|
|
|
ant.replace(file: "$target/Contents/Info.plist") {
|
|
replacefilter(token: "@@build@@", value: args.buildName)
|
|
|
|
|
|
replacefilter(token: "@@version@@", value: args.version)
|
|
replacefilter(token: "@@vmoptions@@", value: args.vmoptions + " -Xverify:none -XX:+UseCompressedOOPS -XX:+DoEscapeAnalysis -Didea.platform.prefix=Python")
|
|
replacefilter(token: "@@system_selector@@", value: args.system_selector)
|
|
replacefilter(token: "@@jdk_req@@", value: args.jdk_req)
|
|
}
|
|
}
|
|
|
|
def set(Map args, String key, Object value) {
|
|
if (!args.containsKey(key)) {
|
|
args[key] = value
|
|
}
|
|
}
|
|
|
|
def executeExternalAnt(Map args, String file) {
|
|
set(args, "build.number", buildName)
|
|
set(args, "project.home", home)
|
|
set(args, "artifacts.path", "$home/out/artifacts")
|
|
//set(args, "dist.win", paths.distWin)
|
|
//set(args, "dist.all", paths.distAll)
|
|
|
|
//set(args, "dist.all.15", paths.distAll15)
|
|
//set(args, "dist.all.16", paths.distAll16)
|
|
set(args, "sandbox.path", "$home/out/pycharm")
|
|
set(args, "component.version.major", getProperty("component.version.major"))
|
|
set(args, "component.version.minor", "\"" + getProperty("component.version.minor") + "\"")
|
|
|
|
ant.java(failonerror: "true", classname: "org.apache.tools.ant.Main", fork: "true") {
|
|
args.each { String key, String value ->
|
|
jvmarg(line: "-D$key=$value")
|
|
}
|
|
|
|
jvmarg(line: "-Xmx250m")
|
|
|
|
classpath {
|
|
fileset(dir: "$home/build/lib") {
|
|
include (name: "commons-net-1.4.1.jar")
|
|
include (name: "jsch-0.1.28.jar")
|
|
}
|
|
|
|
fileset(dir: "$ch/lib/ant/lib") {
|
|
include (name: "*.jar")
|
|
}
|
|
|
|
fileset (file: "$jdk15/lib/tools.jar")
|
|
fileset (file: "$ch/lib/oromatcher.jar")
|
|
}
|
|
|
|
arg(value: "-f")
|
|
arg(value: file)
|
|
}
|
|
}
|