diff options
Diffstat (limited to 'buildSrc/src/main/groovy/org/jetbrains')
4 files changed, 0 insertions, 209 deletions
diff --git a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy b/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy deleted file mode 100644 index 62cc3d3c..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/CorrectShadowPublishing.groovy +++ /dev/null @@ -1,40 +0,0 @@ -package org.jetbrains - -import org.gradle.api.Project -import org.gradle.api.artifacts.ModuleVersionIdentifier -import org.gradle.api.artifacts.ProjectDependency -import org.gradle.api.artifacts.SelfResolvingDependency -import org.gradle.api.internal.artifacts.ivyservice.projectmodule.ProjectDependencyPublicationResolver -import org.gradle.api.publish.maven.MavenPom -import org.gradle.api.publish.maven.MavenPublication - -//https://github.com/johnrengelman/shadow/issues/334 -static void configure(MavenPublication publication, Project project) { - publication.artifact(project.tasks.shadowJar) - - - publication.pom { MavenPom pom -> - pom.withXml { xml -> - def dependenciesNode = xml.asNode().appendNode('dependencies') - - project.configurations.shadow.allDependencies.each { - if (it instanceof ProjectDependency) { - final ProjectDependencyPublicationResolver projectDependencyResolver = project.gradle.services.get(ProjectDependencyPublicationResolver) - final ModuleVersionIdentifier identifier = projectDependencyResolver.resolve(ModuleVersionIdentifier, it) - addDependency(dependenciesNode, identifier) - } else if (!(it instanceof SelfResolvingDependency)) { - addDependency(dependenciesNode, it) - } - - } - } - } -} - -private static void addDependency(Node dependenciesNode, dep) { - def dependencyNode = dependenciesNode.appendNode('dependency') - dependencyNode.appendNode('groupId', dep.group) - dependencyNode.appendNode('artifactId', dep.name) - dependencyNode.appendNode('version', dep.version) - dependencyNode.appendNode('scope', 'compile') -} diff --git a/buildSrc/src/main/groovy/org/jetbrains/CrossPlatformExec.groovy b/buildSrc/src/main/groovy/org/jetbrains/CrossPlatformExec.groovy deleted file mode 100644 index d3973a8a..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/CrossPlatformExec.groovy +++ /dev/null @@ -1,84 +0,0 @@ -package org.jetbrains - -import org.gradle.api.tasks.AbstractExecTask -import org.gradle.api.tasks.TaskAction -import org.gradle.internal.os.OperatingSystem - -import java.nio.file.Files -import java.nio.file.Path -import java.nio.file.Paths - -class CrossPlatformExec extends AbstractExecTask { - private static final def windowsExtensions = ['bat', 'cmd', 'exe']; - private static final def unixExtensions = [null, 'sh']; - - private boolean windows; - - public CrossPlatformExec() { - super(CrossPlatformExec.class); - windows = OperatingSystem.current().windows; - } - - @Override - @TaskAction - protected void exec() { - List<String> commandLine = this.getCommandLine(); - - if (!commandLine.isEmpty()) { - commandLine[0] = findCommand(commandLine[0], windows); - } - - if (windows) { - if (!commandLine.isEmpty() && commandLine[0]) { - commandLine - } - commandLine.add(0, '/c'); - commandLine.add(0, 'cmd'); - } - - this.setCommandLine(commandLine); - - super.exec(); - } - - private static String findCommand(String command, boolean windows) { - command = normalizeCommandPaths(command); - def extensions = windows ? windowsExtensions : unixExtensions; - - return extensions.findResult(command) { extension -> - Path commandFile - if (extension) { - commandFile = Paths.get(command + '.' + extension); - } else { - commandFile = Paths.get(command); - } - - return resolveCommandFromFile(commandFile, windows); - }; - } - - private static String resolveCommandFromFile(Path commandFile, boolean windows) { - if (!Files.isExecutable(commandFile)) { - return null; - } - - return commandFile.toAbsolutePath().normalize(); - } - - private static String normalizeCommandPaths(String command) { - // need to escape backslash so it works with regex - String backslashSeparator = '\\\\'; - - String forwardSlashSeparator = '/'; - - // escape separator if it's a backslash - char backslash = '\\'; - String separator = File.separatorChar == backslash ? backslashSeparator : File.separator - - return command - // first replace all of the backslashes with forward slashes - .replaceAll(backslashSeparator, forwardSlashSeparator) - // then replace all forward slashes with whatever the separator actually is - .replaceAll(forwardSlashSeparator, separator); - } -}
\ No newline at end of file diff --git a/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy b/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy deleted file mode 100644 index 194f11af..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/DependenciesVersionGetter.groovy +++ /dev/null @@ -1,14 +0,0 @@ -package org.jetbrains - -import org.gradle.api.Project - -class DependenciesVersionGetter { - static Properties getVersions(Project project, String artifactVersionSelector) { - def dep = project.dependencies.create(group: 'teamcity', name: 'dependencies', version: artifactVersionSelector, ext: 'properties') - def file = project.configurations.detachedConfiguration(dep).resolve().first() - - def prop = new Properties() - prop.load(new FileReader(file)) - return prop - } -} diff --git a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy b/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy deleted file mode 100644 index e711388f..00000000 --- a/buildSrc/src/main/groovy/org/jetbrains/PluginXmlTransformer.groovy +++ /dev/null @@ -1,71 +0,0 @@ -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 -import groovy.xml.XmlUtil -import org.gradle.api.file.FileTreeElement -import shadow.org.apache.tools.zip.ZipEntry -import shadow.org.apache.tools.zip.ZipOutputStream - -public class PluginXmlTransformer implements Transformer { - private Map<String, Node> transformedPluginXmlFiles = new HashMap<>(); - - @Override - boolean canTransformResource(FileTreeElement fileTreeElement) { - return fileTreeElement.relativePath.segments.contains("META-INF") && fileTreeElement.name.endsWith(".xml") - } - - @Override - void transform(TransformerContext context) { - def path = context.path - def inputStream = context.is - System.out.println(path) - Node node = new XmlParser().parse(inputStream) - relocateXml(node, context) - transformedPluginXmlFiles.put(path, node) - } - - @Override - boolean hasTransformedResource() { - return !transformedPluginXmlFiles.isEmpty() - } - - @Override - void modifyOutputStream(ZipOutputStream zipOutputStream) { - for (Map.Entry<String, Node> entry : transformedPluginXmlFiles.entrySet()) { - zipOutputStream.putNextEntry(new ZipEntry(entry.key)) - XmlUtil.serialize(entry.value, zipOutputStream) - } - } - - 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()) { - relocateClassContext.setClassName((String) entry.getValue()) - entry.setValue(relocateClassName(relocateClassContext, context)) - } - List<String> localText = node.localText() - if (localText.size() == 1) { - relocateClassContext.setClassName(localText[0]) - node.setValue(relocateClassName(relocateClassContext, context)) - } - node.children().each { - if (it instanceof Node) { - relocateXml((Node) it, context) - } - } - } - - private static String relocateClassName(RelocateClassContext relocateContext, TransformerContext context) { - for (Relocator relocator : context.relocators) { - if (relocator.canRelocateClass(relocateContext)) { - return relocator.relocateClass(relocateContext) - } - } - return relocateContext.className - } -}
\ No newline at end of file |