build scripts cleanup: unused methods removed, some method names corrected, obsolete...
authornik <Nikolay.Chashnikov@jetbrains.com>
Mon, 17 Oct 2016 09:50:48 +0000 (12:50 +0300)
committernik <Nikolay.Chashnikov@jetbrains.com>
Mon, 17 Oct 2016 09:52:29 +0000 (12:52 +0300)
build/groovy/org/jetbrains/intellij/build/BuildTasks.groovy
build/groovy/org/jetbrains/intellij/build/IdeaCommunityBuilder.groovy
build/groovy/org/jetbrains/intellij/build/ProductProperties.groovy
build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/BuildTasksImpl.groovy
build/groovy/org/jetbrains/intellij/build/impl/CrossPlatformDistributionBuilder.groovy
build/groovy/org/jetbrains/intellij/build/impl/WindowsDistributionBuilder.groovy
build/scripts/layouts.gant

index 2f5bf5c79effae9e801b878adf01bb873c2c5f03..dc56e6436be0d7fbcdd61b1e474967e6cb2e5cad 100644 (file)
@@ -38,33 +38,11 @@ abstract class BuildTasks {
    */
   abstract void zipSourcesOfModules(Collection<String> modules, String targetFilePath)
 
-  /**
-   * Updates search/searchableOptions.xml file in {@code targetModuleName} module output directory
-   * <br>
-   * todo[nik] this is temporary solution until code from layouts.gant files moved to the new builders. After that this method will
-   * be called inside {@link #buildDistributions()}
-   */
-  abstract void buildSearchableOptions(String targetModuleName, List<String> modulesToIndex, List<String> pathsToLicenses)
-
-  /**
-   * Creates a copy of *ApplicationInfo.xml file with substituted __BUILD_NUMBER__ and __BUILD_DATE__ placeholders
-   * <br>
-   * todo[nik] this is temporary solution until code from layouts.gant files moved to the new builders. After that this method will
-   * be called inside {@link #buildDistributions()}
-   * @return path to the copied file
-   */
-  abstract File patchApplicationInfo()
-
-  /**
-   * Creates distribution for all operating systems from JAR files located at {@link BuildPaths#distAll}
-   */
-  abstract void buildDistributions()
-
   /**
    * Produces distributions for all operating systems from sources. This includes compiling required modules, packing their output into JAR
    * files accordingly to {@link ProductProperties#productLayout}, and creating distributions and installers for all OS.
    */
-  abstract void compileModulesAndBuildDistributions()
+  abstract void buildDistributions()
 
   abstract void compileProjectAndTests(List<String> includingTestsInModules)
 
@@ -97,6 +75,6 @@ abstract class BuildTasks {
     ProductProperties productProperties = (ProductProperties) Class.forName(productPropertiesClassName).constructors[0].newInstance(projectHome)
     def context = BuildContext.createContext(binding.ant, binding.projectBuilder, binding.project, binding.global,
                                              "$projectHome/$communityHomeRelativePath", projectHome, productProperties, proprietaryBuildTools)
-    create(context).compileModulesAndBuildDistributions()
+    create(context).buildDistributions()
   }
 }
\ No newline at end of file
index 3e4038b752e7b853c15b08cadc080fc36d90c311..c08dceb9ac7e1e7c0b111b3bf2be2194898e856e 100644 (file)
@@ -41,13 +41,13 @@ class IdeaCommunityBuilder {
   }
 
   void buildDistJars() {
-    BuildTasks.create(buildContext).compileModulesAndBuildDistributions()
+    BuildTasks.create(buildContext).buildDistributions()
     layoutAdditionalArtifacts()
   }
 
   void buildDistributions() {
     def tasks = BuildTasks.create(buildContext)
-    tasks.compileModulesAndBuildDistributions()
+    tasks.buildDistributions()
     layoutAdditionalArtifacts(true)
     tasks.buildUpdaterJar()
   }
index 78d246f8b6b081a2bcbc0e69d898f90fede250ac..a31b68493867b747c78f924342176c066f74d7fa 100644 (file)
@@ -164,8 +164,6 @@ abstract class ProductProperties {
    */
   boolean enableYourkitAgentInEAP = false
 
-  List<String> excludedPlugins = []
-
   /**
    * Specified additional modules (not included into the product layout) which need to be compiled when product is built.
    * todo[nik] get rid of this
index 6238cc0a438c1c840f766d29f88b4028543de17a..369ea2a8095164d3c75151f89243e549f2bbcd3c 100644 (file)
@@ -311,9 +311,7 @@ class BuildContextImpl extends BuildContext {
 
   private boolean isJavaSupportedInProduct() {
     def productLayout = productProperties.productLayout
-    return productLayout.mainJarName == null ||
-           //todo[nik] remove this condition later; currently build scripts for IDEA don't fully migrated to the new scheme
-           productLayout.includedPlatformModules.contains("execution-impl")
+    return productLayout.includedPlatformModules.contains("execution-impl")
   }
 
   @CompileDynamic
index 9d5fcfb40b60ad13b89fec64ac84044bb170cc59..118e7c8f66998efffab4eb6ca6c9ea967e5f3978 100644 (file)
@@ -91,12 +91,6 @@ class BuildTasksImpl extends BuildTasks {
     }
   }
 
-  @Override
-  void buildSearchableOptions(String targetModuleName, List<String> modulesToIndex, List<String> pathsToLicenses) {
-    buildSearchableOptions(new File(buildContext.projectBuilder.moduleOutput(buildContext.findRequiredModule(targetModuleName))), modulesToIndex, pathsToLicenses)
-  }
-
-//todo[nik] do we need 'cp' and 'jvmArgs' parameters?
   void buildSearchableOptions(File targetDirectory, List<String> modulesToIndex, List<String> pathsToLicenses) {
     buildContext.executeStep("Build searchable options index", BuildOptions.SEARCHABLE_OPTIONS_INDEX_STEP, {
       def javaRuntimeClasses = "${buildContext.projectBuilder.moduleOutput(buildContext.findModule("java-runtime"))}"
@@ -187,7 +181,6 @@ idea.fatal.error.notification=disabled
     return propertiesFile
   }
 
-  @Override
   File patchApplicationInfo() {
     def sourceFile = buildContext.findApplicationInfoInSources()
     def targetFile = new File(buildContext.paths.temp, sourceFile.name)
@@ -229,24 +222,54 @@ idea.fatal.error.notification=disabled
     src.filterLine { String it -> !it.contains('appender-ref ref="CONSOLE-WARN"') }.writeTo(dst.newWriter()).close()
   }
 
+  private static BuildTaskRunnable<String> createDistributionForOsTask(String taskName, Function<BuildContext, OsSpecificDistributionBuilder> factory) {
+    new BuildTaskRunnable<String>(taskName) {
+      @Override
+      String run(BuildContext context) {
+        def builder = factory.apply(context)
+        if (builder != null && context.shouldBuildDistributionForOS(builder.osTargetId)) {
+          return context.messages.block("Build $builder.osName Distribution") {
+            def distDirectory = builder.copyFilesForOsDistribution()
+            builder.buildArtifacts(distDirectory)
+            distDirectory
+          }
+        }
+        return null
+      }
+    }
+  }
+
   @Override
   void buildDistributions() {
+    checkProductProperties()
+
+    def distributionJARsBuilder = new DistributionJARsBuilder(buildContext)
+    compileModules(buildContext.productProperties.productLayout.includedPluginModules + distributionJARsBuilder.platformModules +
+                   buildContext.productProperties.additionalModulesToCompile, buildContext.productProperties.modulesToCompileTests)
+    buildContext.messages.block("Build platform and plugin JARs") {
+      distributionJARsBuilder.buildJARs()
+      distributionJARsBuilder.buildAdditionalArtifacts()
+    }
+    if (buildContext.productProperties.scrambleMainJar) {
+      scramble()
+    }
+
     layoutShared()
 
     def propertiesFile = patchIdeaPropertiesFile()
     List<BuildTaskRunnable<String>> tasks = [
       createDistributionForOsTask("win", { BuildContext context ->
-        context.windowsDistributionCustomizer?.with {new WindowsDistributionBuilder(context, it, propertiesFile)}
+        context.windowsDistributionCustomizer?.with { new WindowsDistributionBuilder(context, it, propertiesFile) }
       }),
       createDistributionForOsTask("linux", { BuildContext context ->
-        context.linuxDistributionCustomizer?.with {new LinuxDistributionBuilder(context, it, propertiesFile)}
+        context.linuxDistributionCustomizer?.with { new LinuxDistributionBuilder(context, it, propertiesFile) }
       }),
       createDistributionForOsTask("mac", { BuildContext context ->
-        context.macDistributionCustomizer?.with {new MacDistributionBuilder(context, it, propertiesFile)}
+        context.macDistributionCustomizer?.with { new MacDistributionBuilder(context, it, propertiesFile) }
       })
     ]
 
-    List<String> paths = runInParallel(tasks).findAll {it != null}
+    List<String> paths = runInParallel(tasks).findAll { it != null }
 
     if (buildContext.productProperties.buildCrossPlatformDistribution) {
       if (paths.size() == 3) {
@@ -261,52 +284,23 @@ idea.fatal.error.notification=disabled
     }
   }
 
-  private static BuildTaskRunnable<String> createDistributionForOsTask(String taskName, Function<BuildContext, OsSpecificDistributionBuilder> factory) {
-    new BuildTaskRunnable<String>(taskName) {
-      @Override
-      String run(BuildContext context) {
-        def builder = factory.apply(context)
-        if (builder != null && context.shouldBuildDistributionForOS(builder.osTargetId)) {
-          return context.messages.block("Build $builder.osName Distribution") {
-            def distDirectory = builder.copyFilesForOsDistribution()
-            builder.buildArtifacts(distDirectory)
-            distDirectory
-          }
-        }
-        return null
-      }
+  private void scramble() {
+    if (buildContext.proprietaryBuildTools.scrambleTool != null) {
+      buildContext.proprietaryBuildTools.scrambleTool.scramble(buildContext.productProperties.productLayout.mainJarName, buildContext)
     }
-  }
-
-  @Override
-  void compileModulesAndBuildDistributions() {
-    checkProductProperties()
-    def distributionJARsBuilder = new DistributionJARsBuilder(buildContext)
-    compileModules(buildContext.productProperties.productLayout.includedPluginModules + distributionJARsBuilder.platformModules +
-                   buildContext.productProperties.additionalModulesToCompile, buildContext.productProperties.modulesToCompileTests)
-    buildContext.messages.block("Build platform and plugin JARs") {
-      distributionJARsBuilder.buildJARs()
-      distributionJARsBuilder.buildAdditionalArtifacts()
+    else {
+      buildContext.messages.warning("Scrambling skipped: 'scrambleTool' isn't defined")
     }
-    if (buildContext.productProperties.scrambleMainJar) {
-      if (buildContext.proprietaryBuildTools.scrambleTool != null) {
-        buildContext.proprietaryBuildTools.scrambleTool.scramble(buildContext.productProperties.productLayout.mainJarName, buildContext)
+    buildContext.ant.zip(destfile: "$buildContext.paths.artifacts/internalUtilities.zip") {
+      fileset(file: "$buildContext.paths.buildOutputRoot/internal/internalUtilities.jar")
+      fileset(dir: "$buildContext.paths.communityHome/lib") {
+        include(name: "junit-4*.jar")
+        include(name: "hamcrest-core-*.jar")
       }
-      else {
-        buildContext.messages.warning("Scrambling skipped: 'scrambleTool' isn't defined")
-      }
-      buildContext.ant.zip(destfile: "$buildContext.paths.artifacts/internalUtilities.zip") {
-        fileset(file: "$buildContext.paths.buildOutputRoot/internal/internalUtilities.jar")
-        fileset(dir: "$buildContext.paths.communityHome/lib") {
-          include(name: "junit-4*.jar")
-          include(name: "hamcrest-core-*.jar")
-        }
-        zipfileset(src: "$buildContext.paths.buildOutputRoot/internal/internalUtilities.jar") {
-          include(name: "*.xml")
-        }
+      zipfileset(src: "$buildContext.paths.buildOutputRoot/internal/internalUtilities.jar") {
+        include(name: "*.xml")
       }
     }
-    buildDistributions()
   }
 
   private void checkProductProperties() {
index 88a4085198170592fabce4345745e49093822c95..ba9494402aa42bd6ee1bd2989b4b6c6bfee6383f 100644 (file)
@@ -59,7 +59,6 @@ class CrossPlatformDistributionBuilder {
       buildContext.ant.zip(zipfile: targetPath, duplicate: "fail") {
         fileset(dir: buildContext.paths.distAll) {
           exclude(name: "bin/idea.properties")
-          exclude(name: "lib/libpty/**") //todo[nik] this is temporary workaround until IDEA fully migrates to the new scheme
         }
         fileset(dir: zipDir)
 
index d2e245facb845a0407a789e1a8798029ed304b18..55f3e4d1f2a906ea0814182249ee7e441a691a94 100644 (file)
@@ -101,7 +101,6 @@ class WindowsDistributionBuilder extends OsSpecificDistributionBuilder {
 
   private void generateScripts(String winDistPath) {
     String fullName = buildContext.applicationInfo.productName
-    //todo[nik] looks like names without .exe were also supported, do we need this?
     String vmOptionsFileName = "${buildContext.productProperties.baseFileName}%BITS%.exe"
 
     String classPath = "SET CLASS_PATH=%IDE_HOME%\\lib\\${buildContext.bootClassPathJarNames[0]}\n"
index b9ce6b6cf519693583d28fd2d0d557cb1e3bdd54..93b097440515938a2c609abbc5a30ec5e135278d 100644 (file)
@@ -16,6 +16,7 @@
 
 
 import org.jetbrains.intellij.build.*
+import org.jetbrains.intellij.build.impl.BuildTasksImpl
 import org.jetbrains.jps.util.JpsPathUtil
 
 import static org.jetbrains.jps.idea.IdeaProjectLoader.guessHome
@@ -41,7 +42,7 @@ boolean setPluginAndIDEVersionInPluginXml() {
 }
 
 List<String> getExcludedPlugins() {
-  return isDefined("productProperties") ? productProperties.excludedPlugins : []
+  return []
 }
 
 /**
@@ -51,7 +52,7 @@ def layoutFull(BuildContext context) {
   binding.setVariable("productProperties", context.productProperties)
   String home = context.paths.communityHome
   String targetDirectory = context.paths.distAll
-  File patchedApplicationInfo = BuildTasks.create(context).patchApplicationInfo()
+  File patchedApplicationInfo = ((BuildTasksImpl)BuildTasks.create(context)).patchApplicationInfo()
   projectBuilder.stage("layout to $targetDirectory")
 
   List<String> jpsCommonModules = ["jps-model-impl", "jps-model-serialization"]