build scripts for IDEA UE and CE rewritten to use the new scheme to layout platform and plugin JARs instead of layouts.gant files

This commit is contained in:
nik
2016-09-15 11:12:30 +03:00
parent d39bfaa24d
commit de6523c654
5 changed files with 173 additions and 23 deletions
@@ -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<String> 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<String> 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<String> 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<PlatformLayout>
}
@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")
}
}
@@ -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
}
}
@@ -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")
+10
View File
@@ -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)
}
+2 -1
View File
@@ -59,7 +59,8 @@
</macrodef>
<target name="layout">
<run script="${project.home}/build/scripts/layouts.gant"
<run script="${project.home}/build/scripts/dist.gant"
target="update-from-sources"
deploy="${project.home}/out/deploy"/>
</target>