diff --git a/python/build/pycharm_build.gant b/python/build/pycharm_build.gant index 9d94b2f66c4b..8546b95677e7 100644 --- a/python/build/pycharm_build.gant +++ b/python/build/pycharm_build.gant @@ -5,6 +5,7 @@ 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") includeTool << Jps requireProperty("buildNumber", requireProperty("build.number", "108.SNAPSHOT")) @@ -97,37 +98,6 @@ def sandbox = "$home/out/pycharm"; setProperty("buildName", "PY-$buildNumber") -def buildDebuggerEgg(paths, buildName) { - def eggDir = "$paths.sandbox/pycharm-debug" - def egg = "$paths.sandbox/pycharm-debug.egg" - - project.stage("building $egg") - - ant.delete(dir: eggDir) - ant.mkdir(dir: eggDir) - ant.mkdir(dir:"$eggDir/pydev") - ant.copy(todir: "$eggDir/pydev") { - fileset(dir: "$home/python/helpers/pydev") - } - ant.mkdir(dir:"$eggDir/EGG-INFO") - - ant.copy(todir: "$eggDir/EGG-INFO") { - fileset(dir: "$home/python/resources/debugger-egg/EGG-INFO") - } - - ant.replace(file: "$eggDir/EGG-INFO/PKG-INFO") { - replacefilter(token: "@@BUILD_NUMBER@@", value: buildName) - } - - ant.replace(file: "$eggDir/pydev/pydevd_comm.py") { - replacefilter(token: "@@BUILD_NUMBER@@", value: buildName) - } - ant.zip(destfile: egg) { - fileset(dir: eggDir) - } - ant.copy(file: egg, todir: paths.distAll) -} - def forceDelete(String dirPath) { // if wasn't deleted - retry several times attempt = 1 @@ -239,7 +209,11 @@ target('default': "Build artifacts") { wire_build_date(buildName) LayoutInfo layoutInfo = layoutFull(paths.distAll, usedJars) generateLicensesTable("$paths.artifacts/third-party-libraries.txt", layoutInfo.usedModules); - buildDebuggerEgg(paths, buildName) + + egg = buildDebuggerEgg(paths.sandbox, "$home/python", buildName) + + ant.copy(file: egg, todir: paths.distAll) + scramble() layoutWin(paths.distWin) diff --git a/python/build/python_common.gant b/python/build/python_common.gant new file mode 100644 index 000000000000..475f4ed375ff --- /dev/null +++ b/python/build/python_common.gant @@ -0,0 +1,28 @@ +binding.setVariable("buildDebuggerEgg", {String sandbox, String pythonHome, String buildName -> + def eggDir = "$sandbox/pycharm-debug" + def egg = "$sandbox/pycharm-debug.egg" + + ant.delete(dir: eggDir) + ant.mkdir(dir: eggDir) + ant.mkdir(dir:"$eggDir/pydev") + ant.copy(todir: "$eggDir/pydev") { + fileset(dir: "$pythonHome/helpers/pydev") + } + ant.mkdir(dir:"$eggDir/EGG-INFO") + + ant.copy(todir: "$eggDir/EGG-INFO") { + fileset(dir: "$pythonHome/resources/debugger-egg/EGG-INFO") + } + + ant.replace(file: "$eggDir/EGG-INFO/PKG-INFO") { + replacefilter(token: "@@BUILD_NUMBER@@", value: buildName) + } + + ant.replace(file: "$eggDir/pydev/pydevd_comm.py") { + replacefilter(token: "@@BUILD_NUMBER@@", value: buildName) + } + ant.zip(destfile: egg) { + fileset(dir: eggDir) + } + return egg +}) diff --git a/python/build/python_plugin_build.gant b/python/build/python_plugin_build.gant index 2b221a4f18fc..f11bea298e2e 100644 --- a/python/build/python_plugin_build.gant +++ b/python/build/python_plugin_build.gant @@ -1,5 +1,7 @@ setProperty("basedir", "${ant.project.properties.basedir}/../python/build") +includeTargets << new File("${basedir}/python_common.gant") + setProperty("projectHome", "${basedir}/../..") setProperty("outDir", "${projectHome}/out/python") setProperty("ideaDir", "${outDir}/idea") @@ -71,13 +73,13 @@ target(name: "compile", description: "Compile module python") { include(name: "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(refid: "classpath.lib") } - // + //Compiler options setProperty("compilerDebug", "on") setProperty("compilerGenerateNoWarnings", "off") setProperty("compilerArgs", "") @@ -86,6 +88,7 @@ target(name: "compile", description: "Compile module python") { ant.patternset(id: "sources.pt") { exclude(name: "**/.svn/**") } + ant.patternset(id: "resources.pt") { include(name: "**/?*.properties") include(name: "**/?*.template") @@ -109,7 +112,8 @@ target(name: "compile", description: "Compile module python") { } ant.mkdir(dir: "${classesDir}") - // + + //compile ant.javac2(destdir: "${classesDir}", debug: "${compilerDebug}", nowarn: "${compilerGenerateNoWarnings}", @@ -121,7 +125,7 @@ target(name: "compile", description: "Compile module python") { patternset(refid: "sources.pt") } - // + //copy resources ant.copy(todir: "${classesDir}") { fileset(dir: "${resourcesDir}") { patternset(refid: "resources.pt") @@ -138,7 +142,7 @@ target(name: "compile", description: "Compile module python") { fileset(dir: "${pluginHome}/../community/colorSchemes/src") } - // + //copy plugin.xml ant.mkdir(dir: "${classesDir}/META-INF") ant.copy(todir: "${classesDir}/META-INF") { fileset(dir: "${pluginHome}/pluginSrc/META-INF") @@ -180,6 +184,8 @@ target(name: "zip", description: "Generate zip plugin file") { ant.mkdir(dir: "${plugindir}/help") ant.copy(file: "${pluginHelp}/pytonpluginhelp.jar", tofile: "${plugindir}/help/pythonpluginhelp.jar") + ant.move(file: "${debugEgg}", todir: "${plugindir}") + ant.zip(basedir: "${zipdir}", destfile: "${output}/${zipname}") } @@ -187,6 +193,8 @@ target(name: "build") { depends("clean") depends("unzip") depends("compile") + egg = buildDebuggerEgg(outDir, pluginHome, "Plugin-${buildNumber}") + setProperty("debugEgg", "$egg") } target(name: "dist", description: "main target") {