mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-18 22:17:05 +07:00
250 lines
7.7 KiB
Plaintext
250 lines
7.7 KiB
Plaintext
import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
|
|
|
|
setProperty("projectHome", guessHome(this as Script))
|
|
setProperty("home", projectHome)
|
|
|
|
includeTargets << new File("${projectHome}/build/scripts/utils.gant")
|
|
|
|
setProperty("outDir", "${projectHome}/out/python")
|
|
setProperty("ideaDir", "${outDir}/ideaCE")
|
|
requireProperty("ideaPath", ideaDir)
|
|
|
|
setProperty("pluginHelp", "${outDir}/help")
|
|
|
|
setProperty("buildNumber", requireProperty("build.number", snapshot))
|
|
setProperty("ideaBuildNumber", requireProperty("idea.build.number"))
|
|
|
|
setProperty("ideaSinceBuildNumber", ("${ideaBuildNumber}" =~ /(\d+\.[A-Z0-9]+)/)[0][1])
|
|
|
|
setProperty("ideaHomePacked", "${ideaDir}/jdk16") //compiled idea
|
|
setProperty("ideaHome", "${ideaDir}/jdk16/idea-IC-${ideaBuildNumber}") //compiled idea
|
|
|
|
setProperty("pluginHome", "${projectHome}/python")
|
|
setProperty("pluginRevision", "${buildNumber}")
|
|
|
|
setProperty("ideaLib", "${ideaHome}/lib")
|
|
setProperty("ideaPlugins", "${ideaHome}/plugins") //compiled plugins
|
|
|
|
|
|
setProperty("output", "${projectHome}/python/distCE")
|
|
|
|
setProperty("zipdir", "${output}/zip")
|
|
setProperty("plugindir", "${zipdir}/python")
|
|
setProperty("zipname", "python-community-${pluginRevision}.zip")
|
|
|
|
setProperty("srcDir", "${pluginHome}/src")
|
|
|
|
setProperty("classesRootDir", "${outDir}/classes")
|
|
setProperty("classesDir", "${classesRootDir}/python")
|
|
|
|
//Compiler options
|
|
setProperty("compilerDebug", "on")
|
|
setProperty("compilerGenerateNoWarnings", "off")
|
|
setProperty("compilerArgs", "")
|
|
setProperty("compilerMaxMemory", "256m")
|
|
|
|
ant.patternset(id: "resources.pt") {
|
|
include(name: "**/?*.properties")
|
|
include(name: "**/?*.template")
|
|
include(name: "**/?*.xml")
|
|
include(name: "**/?*.gif")
|
|
include(name: "**/?*.png")
|
|
include(name: "**/?*.txt")
|
|
include(name: "**/?*.jpeg")
|
|
include(name: "**/?*.jpg")
|
|
include(name: "**/?*.html")
|
|
include(name: "**/?*.dtd")
|
|
include(name: "**/?*.tld")
|
|
include(name: "**/?*.py")
|
|
include(name: "**/?*.ft")
|
|
include(name: "**/?*.dic")
|
|
exclude(name: "**/plugin.xml")
|
|
}
|
|
|
|
target(name: "clean", description: "Cleanup output") {
|
|
ant.echo("Cleaning ${output}")
|
|
ant.delete(dir: "${output}", failonerror: "false")
|
|
ant.echo("Cleaning ${classesRootDir}")
|
|
ant.delete(dir: "${classesRootDir}", failonerror: "false")
|
|
ant.echo("Cleaning ${ideaHome}")
|
|
ant.delete(dir: "${ideaHome}", failonerror: "false") // out/python/idea/
|
|
}
|
|
|
|
target(name: "unzip") {
|
|
ant.mkdir(dir: "${ideaHomePacked}")
|
|
ant.gunzip(src: "${ideaPath}/ideaIC-${ideaBuildNumber}.tar.gz")
|
|
ant.untar(src: "${ideaPath}/ideaIC-${ideaBuildNumber}.tar", dest: "${ideaHomePacked}")
|
|
}
|
|
|
|
target(name: "compile", description: "Compile module python") {
|
|
depends("unzip")
|
|
|
|
ant.path(id: "classpath.lib") {
|
|
fileset(dir: "${ideaLib}") {
|
|
include(name: "?*.jar")
|
|
}
|
|
fileset(dir: "${ideaPlugins}/terminal/lib") {
|
|
include(name: "*.jar")
|
|
}
|
|
fileset(dir: "${ideaPlugins}/IntelliLang/lib") {
|
|
include(name: "*.jar")
|
|
}
|
|
fileset(dir: "${pluginHome}/ipnb/lib") {
|
|
include(name: "*.jar")
|
|
}
|
|
}
|
|
|
|
ant.path(id: "sourcepath") {
|
|
dirset(dir: "${pluginHome}") {
|
|
include(name: "src")
|
|
include(name: "gen")
|
|
include(name: "pluginCore")
|
|
include(name: "pluginJava")
|
|
include(name: "pydevSrc")
|
|
include(name: "openapi/src")
|
|
include(name: "psi-api/src")
|
|
include(name: "IntelliLang-python/src")
|
|
include(name: "ipnb/src")
|
|
}
|
|
}
|
|
//The task requires the following libraries from IntelliJ IDEA distribution:
|
|
//javac2.jar; jdom.jar; asm.jar; asm-commons.jar
|
|
ant.taskdef(name: "javac2", classname: "com.intellij.ant.Javac2") {
|
|
classpath {
|
|
fileset(dir: "${ideaLib}") {
|
|
include(name: "?*.jar")
|
|
}
|
|
}
|
|
}
|
|
|
|
ant.mkdir(dir: "${classesDir}")
|
|
|
|
//compile
|
|
ant.javac2(destdir: "${classesDir}",
|
|
debug: "${compilerDebug}",
|
|
nowarn: "${compilerGenerateNoWarnings}",
|
|
memorymaximumsize: "${compilerMaxMemory}",
|
|
fork: "true") {
|
|
compilerarg(line: "${compilerArgs}")
|
|
classpath(refid: "classpath.lib")
|
|
src(refid: "sourcepath")
|
|
}
|
|
|
|
//copy resources
|
|
ant.copy(todir: "${classesDir}") {
|
|
fileset(dir: "${pluginHome}/resources") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
fileset(dir: "${pluginHome}/python-community-ide-resources/resources") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
fileset(dir: "${pluginHome}/src") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
fileset(dir: "${pluginHome}/psi-api/resources") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
fileset(dir: "${pluginHome}/IntelliLang-python/resources") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
fileset(dir: "${pluginHome}/IntelliLang-python/src") {
|
|
include(name: "resources/*.xml")
|
|
}
|
|
fileset(dir: "${home}/colorSchemes/src")
|
|
fileset(dir: "${pluginHome}/ipnb/resources") {
|
|
patternset(refid: "resources.pt")
|
|
type(type: "file")
|
|
}
|
|
}
|
|
|
|
//copy plugin.xml
|
|
ant.mkdir(dir: "${classesDir}/META-INF")
|
|
ant.copy(todir: "${classesDir}/META-INF") {
|
|
fileset(file: "${pluginHome}/pluginCore/META-INF/python-community-plugin-core.xml")
|
|
fileset(file: "${pluginHome}/pluginJava/META-INF/python-community-plugin-java.xml")
|
|
fileset(file: "${pluginHome}/pluginResources/META-INF/plugin.xml")
|
|
fileset(file: "${pluginHome}/build/python-plugin-dependencies.xml")
|
|
}
|
|
|
|
// set version to PyCharm current version from ApplicationInfo.xml
|
|
ant.loadfile(property: "appInfo", srcFile: "${pluginHome}/python-community-ide-resources/resources/idea/PyCharmCoreApplicationInfo.xml") {
|
|
}
|
|
|
|
major = ("${appInfo}" =~ /major\s*=\s*\"([^"])\"/)[0][1]
|
|
minor = ("${appInfo}" =~ /minor\s*=\s*\"([^"])\"/)[0][1]
|
|
|
|
|
|
ant.replaceregexp(file: "${classesDir}/META-INF/plugin.xml",
|
|
match: "@@PYCHARM_VERSION@@",
|
|
replace: "${major}.${minor}")
|
|
|
|
// set since-build to the current idea build number
|
|
ant.replace(file: "${classesDir}/META-INF/plugin.xml") {
|
|
replacefilter(token: "@@BUILD_NUMBER@@", value: "${buildNumber}")
|
|
}
|
|
|
|
ant.replaceregexp(file: "${classesDir}/META-INF/plugin.xml",
|
|
match: "since-build=\"\\d+\\.\\d+\"",
|
|
replace: "since-build=\"${ideaSinceBuildNumber}\"")
|
|
}
|
|
|
|
target(name: "jar", description: "Generate jar file") {
|
|
depends("compile")
|
|
ant.mkdir(dir: "${output}")
|
|
ant.jar(destfile: "${output}/python-community.jar", basedir: "${classesDir}") {
|
|
manifest() {
|
|
attribute(name: "Revision", value: "${pluginRevision}")
|
|
//<!--<attribute name="Build" value="${plugin.version}"/>-->
|
|
}
|
|
}
|
|
}
|
|
|
|
target(name: "zip", description: "Generate zip plugin file") {
|
|
depends("jar")
|
|
|
|
ant.mkdir(dir: "${zipdir}")
|
|
|
|
// copy plugin jar
|
|
ant.mkdir(dir: "${plugindir}/lib")
|
|
ant.move(file: "${output}/python-community.jar", todir: "${plugindir}/lib")
|
|
|
|
ant.copy(todir: "${plugindir}/lib") {
|
|
fileset(dir: "${pluginHome}/ipnb/lib") {
|
|
include(name: "*.jar")
|
|
}
|
|
}
|
|
|
|
ant.mkdir(dir: "${plugindir}/helpers")
|
|
ant.copy(todir: "${plugindir}/helpers") {
|
|
fileset(dir: "${pluginHome}/helpers") {
|
|
include(name: "**/*")
|
|
}
|
|
}
|
|
|
|
ant.mkdir(dir: "${plugindir}/help")
|
|
ant.copy(file: "${pluginHelp}/pytonpluginhelp.jar", tofile: "${plugindir}/help/pythonpluginhelp.jar", failonerror: false)
|
|
ant.copy(file: "${pluginHelp}/pytonpluginhelp_mac.jar", tofile: "${plugindir}/help/pythonpluginhelp_mac.jar", failonerror: false)
|
|
|
|
ant.zip(basedir: "${zipdir}", destfile: "${output}/${zipname}")
|
|
}
|
|
|
|
target(name: "build") {
|
|
depends("unzip")
|
|
depends("compile")
|
|
}
|
|
|
|
target(name: "dist", description: "main target") {
|
|
depends("clean")
|
|
depends("build")
|
|
depends("zip")
|
|
}
|
|
|
|
target('default': "Build artifacts") {
|
|
depends("dist")
|
|
}
|