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.
This commit is contained in:
nik
2017-11-23 10:21:45 +03:00
parent 849e81e52b
commit 8627585573
6 changed files with 53 additions and 48 deletions
@@ -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"]
@@ -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<String> 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<String> 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<String> 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<String> 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<String> productApiModules = []
List<String> 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<String> platformImplementationModules = []
/**
* Names of the additional product-specific modules which need to be packed into openapi.jar in the product's 'lib' directory.
*/
List<String> productApiModules = []
/**
* Names of the additional product-specific modules which need to be included into {@link #mainJarName} in the product's 'lib' directory
*/
List<String> productImplementationModules = []
@@ -260,8 +260,10 @@ idea.fatal.error.notification=disabled
def productLayout = buildContext.productProperties.productLayout
def bundledPlugins = productLayout.bundledPluginModules as Set<String>
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")
@@ -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<String> 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<String> getPlatformApiModules(ProductModulesLayout productLayout) {
productLayout.platformApiModules.isEmpty() ? CommunityRepositoryModules.PLATFORM_API_MODULES : []
}
static List<String> getPlatformImplModules(ProductModulesLayout productLayout) {
productLayout.platformImplementationModules.isEmpty() ? CommunityRepositoryModules.PLATFORM_IMPLEMENTATION_MODULES : []
}
static List<String> getProductApiModules(ProductModulesLayout productLayout) {
productLayout.platformApiModules.isEmpty() ? productLayout.productApiModules : productLayout.platformApiModules
}
static List<String> getProductImplModules(ProductModulesLayout productLayout) {
productLayout.platformImplementationModules.isEmpty() ? productLayout.productImplementationModules : productLayout.platformImplementationModules
}
Collection<String> getIncludedProjectArtifacts() {
platform.includedArtifacts.keySet() + pluginsToPublish.collectMany {it.includedArtifacts.keySet()}
}
@@ -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"
]
@@ -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"
]