build scripts: interface from scrambling task extracted to allow its use from the common 'build distributions' code

This commit is contained in:
nik
2016-07-15 17:54:44 +03:00
parent 16ec744599
commit ea44febad9
3 changed files with 35 additions and 3 deletions
@@ -40,6 +40,7 @@ abstract class BuildContext {
MacHostProperties macHostProperties
BuildOptions options
SignTool signTool
ScrambleTool scrambleTool
BundledJreManager bundledJreManager
/**
@@ -80,9 +81,10 @@ abstract class BuildContext {
public static BuildContext createContext(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null, SignTool signTool = null) {
BuildOptions options = new BuildOptions(), MacHostProperties macHostProperties = null, SignTool signTool = null,
ScrambleTool scrambleTool = null) {
return new BuildContextImpl(ant, projectBuilder, project, global, communityHome, projectHome, buildOutputRoot, productProperties,
options, macHostProperties, signTool)
options, macHostProperties, signTool, scrambleTool)
}
}
@@ -0,0 +1,29 @@
/*
* 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
/**
* Implement this interfaces and pass the implementation to {@link BuildContext#createContext} method to support scrambling the product
* JAR files.
*
* @author nik
*/
interface ScrambleTool {
/**
* Scramble {@code mainJarName} in {@code "$buildContext.paths.distAll/lib"} directory
*/
void scramble(String mainJarName, BuildContext buildContext)
}
@@ -38,7 +38,7 @@ class BuildContextImpl extends BuildContext {
//todo[nik] construct buildOutputRoot automatically based on product name
BuildContextImpl(GantBuilder ant, JpsGantProjectBuilder projectBuilder, JpsProject project, JpsGlobal global,
String communityHome, String projectHome, String buildOutputRoot, ProductProperties productProperties,
BuildOptions options, MacHostProperties macHostProperties, SignTool signTool) {
BuildOptions options, MacHostProperties macHostProperties, SignTool signTool, ScrambleTool scrambleTool) {
this.projectBuilder = projectBuilder
this.ant = ant
this.project = project
@@ -50,6 +50,7 @@ class BuildContextImpl extends BuildContext {
this.options = options
this.macHostProperties = macHostProperties
this.signTool = signTool
this.scrambleTool = scrambleTool
underTeamCity = System.getProperty("teamcity.buildType.id") != null
messages = new BuildMessagesImpl(projectBuilder, ant.project, underTeamCity)