From 8627585573c7cd450598db3d9369d5e9918f6589 Mon Sep 17 00:00:00 2001 From: nik Date: Thu, 23 Nov 2017 10:21:09 +0300 Subject: [PATCH] build scripts: get rid of product-specific platformApi(Impl)Modules lists This simplifies writing build scripts (previously it wasn't evident which modules should be included into platformApiJarModules, and which into productApiModules, javadoc for the both fields referred to CommunityRepositoryModules#PLATFORM_API_MODULES). Also this unifies layout of different products, all of them will have the same platform-api and platform-impl JARs after migration to the new productApiModules/productImplementationModules properties. --- .../build/IdeaCommunityProperties.groovy | 2 - .../build/ProductModulesLayout.groovy | 42 +++++++------------ .../intellij/build/impl/BuildTasksImpl.groovy | 16 +++++-- .../build/impl/DistributionJARsBuilder.groovy | 33 ++++++++++----- .../pycharm/PyCharmCommunityProperties.groovy | 4 +- .../pycharm/edu/PyCharmEduProperties.groovy | 4 +- 6 files changed, 53 insertions(+), 48 deletions(-) diff --git a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy index b1476a06f39a..da5ad2c92268 100644 --- a/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy +++ b/build/groovy/org/jetbrains/intellij/build/IdeaCommunityProperties.groovy @@ -32,8 +32,6 @@ class IdeaCommunityProperties extends BaseIdeaProperties { toolsJarRequired = true buildCrossPlatformDistribution = true - productLayout.platformApiJarModules = CommunityRepositoryModules.PLATFORM_API_MODULES - productLayout.platformImplJarModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES productLayout.productApiModules = JAVA_API_MODULES productLayout.productImplementationModules = JAVA_IMPLEMENTATION_MODULES + ["duplicates-analysis", "structuralsearch", "structuralsearch-java", "typeMigration", "platform-main"] diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy index 4bee011af959..3eda8cc1982e 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/ProductModulesLayout.groovy @@ -33,45 +33,31 @@ class ProductModulesLayout { */ String mainJarName - /** - * Names of the modules which need to be packed into platform-api.jar in the product's 'lib' directory. - * @see CommunityRepositoryModules#PLATFORM_API_MODULES - */ List platformApiJarModules = [] - - /** - * Names of the modules which need to be included into platform-impl in the product's 'lib' directory - * @see CommunityRepositoryModules#PLATFORM_IMPLEMENTATION_MODULES - */ List platformImplJarModules = [] - /** - * Names of the modules which need to be packed into openapi.jar in the product's 'lib' directory. - * @param modulesList - * @deprecated Use {@link #productApiModules} instead. To be removed in IDEA 2018.3. - */ - def setPlatformApiModules(List modulesList) { - productApiModules = modulesList - } - - /** - * Names of the modules which need to be included into {@link #mainJarName} in the product's 'lib' directory - * @param modulesList - * @deprecated Use {@link #productImplementationModules} instead. To be removed in IDEA 2018.3. - */ - def setPlatformImplementationModules(List modulesList) { - productImplementationModules = modulesList - } - /** * Names of the modules which need to be packed into openapi.jar in the product's 'lib' directory. * @see CommunityRepositoryModules#PLATFORM_API_MODULES + * @deprecated if you need to pack additional modules into the product, use {@link #productApiModules} instead; {@link CommunityRepositoryModules#PLATFORM_API_MODULES} + * will be packed into platform-api.jar in the product's 'lib' directory automatically then. */ - List productApiModules = [] + List platformApiModules = [] /** * Names of the modules which need to be included into {@link #mainJarName} in the product's 'lib' directory * @see CommunityRepositoryModules#PLATFORM_IMPLEMENTATION_MODULES + * @deprecated if you need to pack additional modules into the product, use {@link #productImplementationModules} instead; {@link CommunityRepositoryModules#PLATFORM_IMPLEMENTATION_MODULES} + * will be packed into platform-api.jar in the product's 'lib' directory automatically then. */ + List platformImplementationModules = [] + + /** + * Names of the additional product-specific modules which need to be packed into openapi.jar in the product's 'lib' directory. + */ + List productApiModules = [] + + /** + * Names of the additional product-specific modules which need to be included into {@link #mainJarName} in the product's 'lib' directory */ List productImplementationModules = [] diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy index 8525e13ebf85..8847097d4aa5 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy @@ -260,8 +260,10 @@ idea.fatal.error.notification=disabled def productLayout = buildContext.productProperties.productLayout def bundledPlugins = productLayout.bundledPluginModules as Set def moduleNames = productLayout.getIncludedPluginModules(bundledPlugins) + - productLayout.platformApiJarModules + productLayout.platformImplJarModules + - productLayout.productApiModules + productLayout.productImplementationModules + + DistributionJARsBuilder.getPlatformApiModules(productLayout) + + DistributionJARsBuilder.getPlatformImplModules(productLayout) + + DistributionJARsBuilder.getProductApiModules(productLayout) + + DistributionJARsBuilder.getProductImplModules(productLayout) + productLayout.additionalPlatformJars.values() + DistributionJARsBuilder.toolModules + buildContext.productProperties.additionalModulesToCompile compileModules(moduleNames + (buildContext.proprietaryBuildTools.scrambleTool?.additionalModulesToCompile ?: []) + @@ -417,10 +419,16 @@ idea.fatal.error.notification=disabled buildContext.messages.error("productProperties.productLayout.prepareCustomPluginRepositoryForPublishedPlugins option is enabled but no pluginModulesToPublish are specified") } - checkModules(layout.platformApiJarModules, "productProperties.productLayout.platformApiJarModules") - checkModules(layout.platformImplJarModules, "productProperties.productLayout.platformImplJarModules") + checkModules(layout.platformApiModules, "productProperties.productLayout.platformApiModules") + checkModules(layout.platformImplementationModules, "productProperties.productLayout.platformImplementationModules") checkModules(layout.productApiModules, "productProperties.productLayout.productApiModules") checkModules(layout.productImplementationModules, "productProperties.productLayout.productImplementationModules") + if (!layout.productApiModules.isEmpty() && !layout.platformApiModules.isEmpty()) { + buildContext.messages.error("Products which set productProperties.productLayout.productApiModules must not use deprecated platformApiModules.") + } + if (!layout.productImplementationModules.isEmpty() && !layout.platformImplementationModules.isEmpty()) { + buildContext.messages.error("Products which set productProperties.productLayout.productImplementationModules must not use deprecated platformImplementationModules.") + } checkModules(layout.additionalPlatformJars.values(), "productProperties.productLayout.additionalPlatformJars") checkModules(layout.moduleExcludes.keySet(), "productProperties.productLayout.moduleExcludes") checkModules(layout.mainModules, "productProperties.productLayout.mainModules") diff --git a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy index f9394bb0d88d..39216bdfe6bb 100644 --- a/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy +++ b/platform/build-scripts/groovy/org/jetbrains/intellij/build/impl/DistributionJARsBuilder.groovy @@ -6,10 +6,7 @@ import com.intellij.openapi.util.Pair import com.intellij.openapi.util.io.FileUtil import org.apache.tools.ant.types.FileSet import org.apache.tools.ant.types.resources.FileProvider -import org.jetbrains.intellij.build.BuildContext -import org.jetbrains.intellij.build.BuildOptions -import org.jetbrains.intellij.build.BuildTasks -import org.jetbrains.intellij.build.ProductModulesLayout +import org.jetbrains.intellij.build.* import org.jetbrains.jps.model.java.JpsJavaClasspathKind import org.jetbrains.jps.model.java.JpsJavaExtensionService import org.jetbrains.jps.model.library.JpsLibrary @@ -88,16 +85,16 @@ class DistributionJARsBuilder { withModule(it, jarName) } } - productLayout.platformApiJarModules.each { + getPlatformApiModules(productLayout).each { withModule(it, "platform-api.jar") } - productLayout.platformImplJarModules.each { + getPlatformImplModules(productLayout).each { withModule(it, "platform-impl.jar") } - productLayout.productApiModules.each { + getProductApiModules(productLayout).each { withModule(it, "openapi.jar") } - productLayout.productImplementationModules.each { + getProductImplModules(productLayout).each { withModule(it, productLayout.mainJarName) } productLayout.moduleExcludes.entrySet().each { @@ -144,8 +141,8 @@ class DistributionJARsBuilder { } static List getIncludedPlatformModules(ProductModulesLayout modulesLayout) { - modulesLayout.platformApiJarModules + modulesLayout.platformImplJarModules + modulesLayout.productApiModules + - modulesLayout.productImplementationModules + modulesLayout.additionalPlatformJars.values() + getPlatformApiModules(modulesLayout) + getPlatformImplModules(modulesLayout) + getProductApiModules(modulesLayout) + + getProductImplModules(modulesLayout) + modulesLayout.additionalPlatformJars.values() } /** @@ -155,6 +152,22 @@ class DistributionJARsBuilder { ["java-runtime", "platform-main", /*required to build searchable options index*/ "updater"] } + static List getPlatformApiModules(ProductModulesLayout productLayout) { + productLayout.platformApiModules.isEmpty() ? CommunityRepositoryModules.PLATFORM_API_MODULES : [] + } + + static List getPlatformImplModules(ProductModulesLayout productLayout) { + productLayout.platformImplementationModules.isEmpty() ? CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES : [] + } + + static List getProductApiModules(ProductModulesLayout productLayout) { + productLayout.platformApiModules.isEmpty() ? productLayout.productApiModules : productLayout.platformApiModules + } + + static List getProductImplModules(ProductModulesLayout productLayout) { + productLayout.platformImplementationModules.isEmpty() ? productLayout.productImplementationModules : productLayout.platformImplementationModules + } + Collection getIncludedProjectArtifacts() { platform.includedArtifacts.keySet() + pluginsToPublish.collectMany {it.includedArtifacts.keySet()} } diff --git a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PyCharmCommunityProperties.groovy b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PyCharmCommunityProperties.groovy index b7054129ce41..9f135c14c122 100644 --- a/python/build/groovy/org/jetbrains/intellij/build/pycharm/PyCharmCommunityProperties.groovy +++ b/python/build/groovy/org/jetbrains/intellij/build/pycharm/PyCharmCommunityProperties.groovy @@ -27,8 +27,8 @@ class PyCharmCommunityProperties extends PyCharmPropertiesBase { applicationInfoModule = "python-community-ide-resources" brandingResourcePaths = ["$communityHome/python/resources"] - productLayout.productApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + ["dom-openapi"] - productLayout.productImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + [ + productLayout.platformApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + ["dom-openapi"] + productLayout.platformImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + [ "dom-impl", "python-community", "python-community-ide-resources", "python-community-ide", "python-community-configure", "python-openapi", "python-psi-api", "platform-main" ] diff --git a/python/educational-python/build/groovy/org/jetbrains/intellij/build/pycharm/edu/PyCharmEduProperties.groovy b/python/educational-python/build/groovy/org/jetbrains/intellij/build/pycharm/edu/PyCharmEduProperties.groovy index 42eca634625e..7467a182d9ab 100644 --- a/python/educational-python/build/groovy/org/jetbrains/intellij/build/pycharm/edu/PyCharmEduProperties.groovy +++ b/python/educational-python/build/groovy/org/jetbrains/intellij/build/pycharm/edu/PyCharmEduProperties.groovy @@ -19,8 +19,8 @@ class PyCharmEduProperties extends PyCharmPropertiesBase { brandingResourcePaths = ["$pythonCommunityPath/educational-python/resources"] productLayout.mainModules = ["main_pycharm_edu"] - productLayout.productApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + ["dom-openapi"] - productLayout.productImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + [ + productLayout.platformApiModules = CommunityRepositoryModules.PLATFORM_API_MODULES + ["dom-openapi"] + productLayout.platformImplementationModules = CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES + [ "dom-impl", "python-community", "python-community-ide-resources", "python-community-ide", "python-community-configure", "educational-python", "python-openapi", "python-psi-api", "platform-main" ]