diff options
author | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-08 18:53:50 +0300 |
---|---|---|
committer | Simon Ogorodnik <Simon.Ogorodnik@jetbrains.com> | 2017-11-08 18:53:50 +0300 |
commit | e1dd83ed777d121fc9627460f76d1b09fa0c9c3b (patch) | |
tree | 844bd0e7bffffd1b7f591ce608a16acb8eb4b2d7 /buildSrc | |
parent | 9c1d23b8bfa74b74a036d9500d8f8d57c978e553 (diff) | |
download | dokka-e1dd83ed777d121fc9627460f76d1b09fa0c9c3b.tar.gz dokka-e1dd83ed777d121fc9627460f76d1b09fa0c9c3b.tar.bz2 dokka-e1dd83ed777d121fc9627460f76d1b09fa0c9c3b.zip |
Fix PluginXmlTransformer
Diffstat (limited to 'buildSrc')
-rw-r--r-- | buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy | 25 |
1 files changed, 15 insertions, 10 deletions
diff --git a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy b/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy index 7482a01a..e711388f 100644 --- a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy +++ b/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy @@ -1,5 +1,6 @@ package org.jetbrains +import com.github.jengelman.gradle.plugins.shadow.relocation.RelocateClassContext import com.github.jengelman.gradle.plugins.shadow.relocation.Relocator import com.github.jengelman.gradle.plugins.shadow.transformers.Transformer import com.github.jengelman.gradle.plugins.shadow.transformers.TransformerContext @@ -22,7 +23,7 @@ public class PluginXmlTransformer implements Transformer { def inputStream = context.is System.out.println(path) Node node = new XmlParser().parse(inputStream) - relocateXml(node, context.relocators) + relocateXml(node, context) transformedPluginXmlFiles.put(path, node) } @@ -39,28 +40,32 @@ public class PluginXmlTransformer implements Transformer { } } - private static void relocateXml(Node node, List<Relocator> relocators) { + private static void relocateXml(Node node, TransformerContext context) { Map attributes = node.attributes() + RelocateClassContext relocateClassContext = new RelocateClassContext() + relocateClassContext.stats = context.stats for (Map.Entry entry : attributes.entrySet()) { - entry.setValue(relocateClassName((String) entry.getValue(), relocators)) + relocateClassContext.setClassName((String) entry.getValue()) + entry.setValue(relocateClassName(relocateClassContext, context)) } List<String> localText = node.localText() if (localText.size() == 1) { - node.setValue(relocateClassName(localText[0], relocators)) + relocateClassContext.setClassName(localText[0]) + node.setValue(relocateClassName(relocateClassContext, context)) } node.children().each { if (it instanceof Node) { - relocateXml((Node) it, relocators) + relocateXml((Node) it, context) } } } - private static String relocateClassName(String className, List<Relocator> relocators) { - for (Relocator relocator : relocators) { - if (relocator.canRelocateClass(className)) { - return relocator.relocateClass(className) + private static String relocateClassName(RelocateClassContext relocateContext, TransformerContext context) { + for (Relocator relocator : context.relocators) { + if (relocator.canRelocateClass(relocateContext)) { + return relocator.relocateClass(relocateContext) } } - return className + return relocateContext.className } }
\ No newline at end of file |