mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
CWM scrambling
GitOrigin-RevId: 5b45986e27197c7de2e410e73feb6b6beb242e1f
This commit is contained in:
committed by
intellij-monorepo-bot
parent
47881c4a1e
commit
87164ae45e
@@ -24,7 +24,11 @@ interface ScrambleTool {
|
||||
|
||||
/**
|
||||
* Scramble plugin's {@code jarsToScramble} jars
|
||||
* Plugin's zkm script template is expected to be in "$buildContext.paths.projectHome/plugins/{@code pluginName}/build/script.zkm.stub" file
|
||||
* Plugin's zkm script template is expected to be in
|
||||
* if (pluginLayout.zkmScriptStub) is set, then
|
||||
* $buildContext.paths.projectHome/${pluginLayout.zkmScriptStub}"
|
||||
* else
|
||||
* "$buildContext.paths.projectHome/plugins/{@code pluginName}/build/script.zkm.stub"
|
||||
*/
|
||||
void scramblePlugin(BuildContext buildContext, PluginLayout pluginLayout, Path targetDir)
|
||||
|
||||
|
||||
+13
-6
@@ -746,6 +746,7 @@ final class DistributionJARsBuilder {
|
||||
private void buildPlugins(LayoutBuilder layoutBuilder, List<PluginLayout> pluginsToInclude, Path targetDirectory,
|
||||
ProjectStructureMapping parentMapping) {
|
||||
addSearchableOptions(layoutBuilder)
|
||||
List<Pair<PluginLayout, Path>> pluginsToScramble = new ArrayList<>()
|
||||
for (plugin in pluginsToInclude) {
|
||||
boolean isHelpPlugin = "intellij.platform.builtInHelp" == plugin.mainModule
|
||||
if (!isHelpPlugin) {
|
||||
@@ -763,14 +764,20 @@ final class DistributionJARsBuilder {
|
||||
|
||||
Path targetDir = targetDirectory.resolve(getActualPluginDirectoryName(plugin, buildContext))
|
||||
processPluginLayout(plugin, layoutBuilder, targetDir, generatedResources, parentMapping, true)
|
||||
if (buildContext.proprietaryBuildTools.scrambleTool != null) {
|
||||
buildContext.proprietaryBuildTools.scrambleTool.scramblePlugin(buildContext, plugin, targetDir)
|
||||
}
|
||||
else if (!plugin.pathsToScramble.isEmpty()) {
|
||||
buildContext.messages.warning("Scrambling plugin $plugin.directoryName skipped: 'scrambleTool' isn't defined, " +
|
||||
"but plugin defines paths to be scrambled")
|
||||
if (!plugin.pathsToScramble.isEmpty()) {
|
||||
pluginsToScramble.add(Pair.create(plugin, targetDir))
|
||||
}
|
||||
}
|
||||
|
||||
if (buildContext.proprietaryBuildTools.scrambleTool != null) {
|
||||
pluginsToScramble.each { pluginPair -> buildContext.proprietaryBuildTools.scrambleTool.scramblePlugin(buildContext, pluginPair.first, pluginPair.second) }
|
||||
}
|
||||
else {
|
||||
pluginsToScramble.each { pluginPair ->
|
||||
buildContext.messages.warning("Scrambling plugin $pluginPair.first.directoryName skipped: 'scrambleTool' isn't defined, but plugin defines paths to be scrambled")
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
private void patchPluginXml(LayoutBuilder layoutBuilder, PluginLayout plugin) {
|
||||
|
||||
@@ -23,7 +23,9 @@ final class PluginLayout extends BaseLayout {
|
||||
boolean directoryNameSetExplicitly
|
||||
PluginBundlingRestrictions bundlingRestrictions
|
||||
Collection<String> pathsToScramble = []
|
||||
Collection<String> scrambleClasspathPlugins = []
|
||||
BiPredicate<BuildContext, File> scrambleClasspathFilter = { context, file -> return true } as BiPredicate<BuildContext, File>
|
||||
String zkmScriptStub
|
||||
|
||||
private PluginLayout(String mainModule) {
|
||||
this.mainModule = mainModule
|
||||
@@ -190,6 +192,28 @@ final class PluginLayout extends BaseLayout {
|
||||
layout.pathsToScramble.add(relativePath)
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a relative to $buildContext.paths.projectHome path to a zkm script stub file.
|
||||
* If scramble tool is not defined, scramble toot will expect to find the script stub file at "$buildContext.paths.projectHome/plugins/{@code pluginName}/build/script.zkm.stub"
|
||||
*
|
||||
* @param relativePath - a path to a jar file relative to project home directory
|
||||
*/
|
||||
void zkmScriptStub(String relativePath) {
|
||||
layout.zkmScriptStub = relativePath
|
||||
}
|
||||
|
||||
/**
|
||||
* Specifies a dependent plugin name to be added to scrambled classpath
|
||||
* Scrambling is performed by the {@link org.jetbrains.intellij.build.ProprietaryBuildTools#scrambleTool}
|
||||
* If scramble tool is not defined, scrambling will not be performed
|
||||
* Multiple invocations of this method will add corresponding plugin names to a list of name to be added to scramble classpath
|
||||
*
|
||||
* @param pluginName - a name of dependent plugin, whose jars should be added to scramble classpath
|
||||
*/
|
||||
void scrambleClasspathPlugin(String pluginName) {
|
||||
layout.scrambleClasspathPlugins.add(pluginName)
|
||||
}
|
||||
|
||||
/**
|
||||
* Allows control over classpath entries that will be used by the scrambler to resolve references from jars being scrambled.
|
||||
* By default all platform jars are added to the 'scramble classpath'
|
||||
|
||||
Reference in New Issue
Block a user