From de6523c654f7e32eb6e19fa8f3ad0fd94f69c894 Mon Sep 17 00:00:00 2001 From: nik Date: Wed, 14 Sep 2016 20:32:10 +0300 Subject: [PATCH] build scripts for IDEA UE and CE rewritten to use the new scheme to layout platform and plugin JARs instead of layouts.gant files --- .../intellij/build/BaseIdeaProperties.groovy | 131 ++++++++++++++++++ .../build/IdeaCommunityBuilder.groovy | 33 ++--- .../build/IdeaCommunityProperties.groovy | 19 ++- build/scripts/dist.gant | 10 ++ build/update.xml | 3 +- 5 files changed, 173 insertions(+), 23 deletions(-) create mode 100644 build/groovy/org/jetbrains/intellij/build/BaseIdeaProperties.groovy diff --git a/build/groovy/org/jetbrains/intellij/build/BaseIdeaProperties.groovy b/build/groovy/org/jetbrains/intellij/build/BaseIdeaProperties.groovy new file mode 100644 index 000000000000..6442c79f88b1 --- /dev/null +++ b/build/groovy/org/jetbrains/intellij/build/BaseIdeaProperties.groovy @@ -0,0 +1,131 @@ +/* + * Copyright 2000-2016 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. + */ +/* + * Copyright 2000-2016 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. + */ +package org.jetbrains.intellij.build + +import org.jetbrains.intellij.build.impl.PlatformLayout + +import java.util.function.Consumer + +/** + * @author nik + */ +abstract class BaseIdeaProperties extends ProductProperties { + protected static final List JAVA_API_MODULES = [ + "compiler-openapi", + "debugger-openapi", + "dom-openapi", + "execution-openapi", + "java-analysis-api", + "java-indexing-api", + "java-psi-api", + "jsp-openapi", + "jsp-base-openapi", + "openapi", + "remote-servers-java-api", + "testFramework-java" + ] + protected static final List JAVA_IMPLEMENTATION_MODULES = [ + "compiler-impl", + "debugger-impl", + "dom-impl", + "execution-impl", + "external-system-impl", + "idea-ui", + "java-analysis-impl", + "java-indexing-impl", + "java-impl", + "java-psi-impl", + "java-structure-view", + "jsp-spi", + "manifest", + "remote-servers-java-impl", + "testFramework", + "tests_bootstrap", + "ui-designer-core" + ] + protected static final List BUNDLED_PLUGIN_MODULES = [ + "copyright", "properties", "terminal", "editorconfig", "settings-repository", "yaml", + "tasks-core", "tasks-java", + "maven", "gradle", + "git4idea", "remote-servers-git", "remote-servers-git-java", "svn4idea", "hg4idea", "github", "cvs-plugin", + "jetgroovy", "junit", "testng", "xpath", "xslt-debugger", "android", "javaFX-CE", + "java-i18n", "ant", "ui-designer", "ByteCodeViewer", "coverage", "java-decompiler-plugin", "devkit", "eclipse", + "IntelliLang", "IntelliLang-java", "IntelliLang-xml", "intellilang-jps-plugin" + ] + + BaseIdeaProperties() { + productLayout.mainJarName = "idea.jar" + productLayout.searchableOptionsModule = "resources-en" + + productLayout.additionalPlatformJars.put("rt/jps-plugin-system.jar", "jps-plugin-system") + productLayout.additionalPlatformJars.put("external-system-rt.jar", "external-system-rt") + productLayout.additionalPlatformJars.put("jps-launcher.jar", "jps-launcher") + productLayout.additionalPlatformJars.put("jps-builders.jar", "jps-builders") + productLayout.additionalPlatformJars.putAll("jps-model.jar", ["jps-model-impl", "jps-model-serialization"]) + productLayout.additionalPlatformJars.put("forms_rt.jar", "forms-compiler") + productLayout.additionalPlatformJars.putAll("resources.jar", ["resources", "resources-en"]) + productLayout.additionalPlatformJars. + putAll("javac2.jar", ["javac2", "forms-compiler", "forms_rt", "instrumentation-util", "instrumentation-util-8"]) + productLayout.additionalPlatformJars.putAll("annotations-java8.jar", ["annotations-common", "annotations-java8"]) + + productLayout.platformLayoutCustomizer = { PlatformLayout layout -> + layout.customize { + withModule("java-runtime", "idea_rt.jar", false) + withProjectLibrary("Eclipse") + withProjectLibrary("jgoodies-common") + withProjectLibrary("jgoodies-looks") + withProjectLibrary("commons-net") + withoutProjectLibrary("Ant") + withoutProjectLibrary("Gradle") + withoutProjectLibrary("com.twelvemonkeys.imageio:imageio-tiff:3.2.1") + } + } as Consumer + } + + @Override + void copyAdditionalFiles(BuildContext context, String targetDirectory) { + context.ant.jar(destfile: "$targetDirectory/lib/jdkAnnotations.jar") { + fileset(dir: "$context.paths.communityHome/java/jdkAnnotations") + } + context.ant.copy(todir: "$targetDirectory/lib") { + fileset(file: "$context.paths.communityHome/jps/lib/optimizedFileManager.jar") + } + context.ant.copy(todir: "$targetDirectory/lib/ant") { + fileset(dir: "$context.paths.communityHome/lib/ant") { + exclude(name: "**/src/**") + } + } + context.ant.copy(todir: "$targetDirectory/plugins/Kotlin") { + fileset(dir: "$context.paths.communityHome/build/kotlinc/plugin/Kotlin") + } + context.ant.move(file: "$targetDirectory/lib/annotations-java8.jar", tofile: "$targetDirectory/redist/annotations-java8.jar") + } +} diff --git a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityBuilder.groovy b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityBuilder.groovy index 3b0486b8eb7c..3e4038b752e7 100644 --- a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityBuilder.groovy +++ b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityBuilder.groovy @@ -13,14 +13,10 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - - - package org.jetbrains.intellij.build -import com.intellij.openapi.util.io.FileUtil import org.codehaus.gant.GantBinding -import org.jetbrains.jps.gant.LayoutInfo + /** * @author nik */ @@ -28,9 +24,9 @@ class IdeaCommunityBuilder { private final GantBinding binding private final BuildContext buildContext - IdeaCommunityBuilder(String home, GantBinding binding, BuildOptions options = new BuildOptions()) { + IdeaCommunityBuilder(String home, GantBinding binding, BuildOptions options = new BuildOptions(), String projectHome = home) { this.binding = binding - buildContext = BuildContext.createContext(binding.ant, binding.projectBuilder, binding.project, binding.global, home, home, + buildContext = BuildContext.createContext(binding.ant, binding.projectBuilder, binding.project, binding.global, home, projectHome, new IdeaCommunityProperties(home), ProprietaryBuildTools.DUMMY, options) } @@ -45,25 +41,23 @@ class IdeaCommunityBuilder { } void buildDistJars() { - def tasks = BuildTasks.create(buildContext) - compileModules() - tasks.buildSearchableOptions("resources-en", ["community-main"], []) - layoutAll() + BuildTasks.create(buildContext).compileModulesAndBuildDistributions() + layoutAdditionalArtifacts() } void buildDistributions() { def tasks = BuildTasks.create(buildContext) - compileModules() - tasks.buildSearchableOptions("resources-en", ["community-main"], []) - - layoutAll(true) + tasks.compileModulesAndBuildDistributions() + layoutAdditionalArtifacts(true) tasks.buildUpdaterJar() } - LayoutInfo layoutAll(boolean buildJps = false) { + void buildUnpackedDistribution(String targetDirectory) { + BuildTasks.create(buildContext).buildUnpackedDistribution(targetDirectory) + } + + void layoutAdditionalArtifacts(boolean buildJps = false) { def layouts = binding["includeFile"]("$buildContext.paths.communityHome/build/scripts/layouts.gant") - LayoutInfo info = layouts.layoutFull(buildContext) - FileUtil.delete(new File(buildContext.paths.distAll, "lib/libpty"))//todo[nik] this is temporary workaround until IDEA fully migrates to the new scheme buildContext.messages.block("Build intellij-core") { String coreArtifactDir = "$buildContext.paths.artifacts/core" buildContext.ant.mkdir(dir: coreArtifactDir) @@ -83,8 +77,5 @@ class IdeaCommunityBuilder { buildContext.notifyArtifactBuilt(jpsArtifactDir) } } - - BuildTasks.create(buildContext).buildDistributions() - return info } } \ No newline at end of file diff --git a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy index 6d3efc5ad9e6..679f770a5d02 100644 --- a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy +++ b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy @@ -17,12 +17,15 @@ package org.jetbrains.intellij.build import groovy.transform.CompileDynamic import groovy.transform.CompileStatic +import org.jetbrains.intellij.build.impl.PlatformLayout + +import java.util.function.Consumer /** * @author nik */ @CompileStatic -class IdeaCommunityProperties extends ProductProperties { +class IdeaCommunityProperties extends BaseIdeaProperties { IdeaCommunityProperties(String home) { baseFileName = "idea" platformPrefix = "Idea" @@ -31,11 +34,25 @@ class IdeaCommunityProperties extends ProductProperties { additionalIDEPropertiesFilePaths = ["$home/build/conf/ideaCE.properties".toString()] toolsJarRequired = true buildCrossPlatformDistribution = true + + productLayout.platformApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + JAVA_API_MODULES + productLayout.platformImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + JAVA_IMPLEMENTATION_MODULES + + ["duplicates-analysis", "structuralsearch", "structuralsearch-java", "typeMigration", "platform-main"] - + ["jps-model-impl", "jps-model-serialization"] + productLayout.additionalPlatformJars.put("resources.jar", "community-resources") + productLayout.bundledPluginModules = BUNDLED_PLUGIN_MODULES + productLayout.mainModule = "community-main" + productLayout.allNonTrivialPlugins = CommunityRepositoryModules.COMMUNITY_REPOSITORY_PLUGINS + [ + CommunityRepositoryModules.androidPlugin([:]), + CommunityRepositoryModules.groovyPlugin([]) + ] + productLayout.classesLoadingOrderFilePath = "$home/build/order.txt" } @Override @CompileDynamic void copyAdditionalFiles(BuildContext buildContext, String targetDirectory) { + super.copyAdditionalFiles(buildContext, targetDirectory) buildContext.ant.copy(todir: targetDirectory) { fileset(file: "$buildContext.paths.communityHome/LICENSE.txt") fileset(file: "$buildContext.paths.communityHome/NOTICE.txt") diff --git a/build/scripts/dist.gant b/build/scripts/dist.gant index bda315e41d48..9dac48d5f4a6 100644 --- a/build/scripts/dist.gant +++ b/build/scripts/dist.gant @@ -14,6 +14,7 @@ * limitations under the License. */ import org.jetbrains.intellij.build.BuildOptions +import org.jetbrains.intellij.build.BuildTasks import org.jetbrains.intellij.build.IdeaCommunityBuilder import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome @@ -46,3 +47,12 @@ target('build-dist-jars' : 'Target to build jars from locally compiled classes') options.useCompiledClassesFromProjectOutput = true new IdeaCommunityBuilder(home, binding, options).buildDistJars() } + +target('update-from-sources': 'Update locally installed distribution from compiled classes') { + def options = new BuildOptions() + options.useCompiledClassesFromProjectOutput = true + options.buildStepsToSkip << BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP + //when IDEA CE is updated from IDEA UE sources project should be loaded from IDEA UE directory + String projectHome = isDefined("devIdeaHome") ? devIdeaHome : home + new IdeaCommunityBuilder(home, binding, options, projectHome).buildUnpackedDistribution(deploy) +} \ No newline at end of file diff --git a/build/update.xml b/build/update.xml index c12989dd4143..97a6ce6cc93b 100644 --- a/build/update.xml +++ b/build/update.xml @@ -59,7 +59,8 @@ -