diff --git a/build/groovy/org/jetbrains/intellij/build/BuildContext.groovy b/build/groovy/org/jetbrains/intellij/build/BuildContext.groovy index f73294e7b9bf..50fdfa225ddd 100644 --- a/build/groovy/org/jetbrains/intellij/build/BuildContext.groovy +++ b/build/groovy/org/jetbrains/intellij/build/BuildContext.groovy @@ -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) } } diff --git a/build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy b/build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy new file mode 100644 index 000000000000..520ae6cdd276 --- /dev/null +++ b/build/groovy/org/jetbrains/intellij/build/ScrambleTool.groovy @@ -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) +} \ No newline at end of file diff --git a/build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy b/build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy index b165429b290e..0563de6aa82c 100644 --- a/build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy +++ b/build/groovy/org/jetbrains/intellij/build/impl/BuildContextImpl.groovy @@ -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)