From 56e9dab8064aa2ac3f94bbea543afe04bf003d4e Mon Sep 17 00:00:00 2001 From: Julien HENRY Date: Wed, 9 Jun 2021 11:14:37 +0200 Subject: [PATCH] Workaround for https://github.com/OmniSharp/omnisharp-roslyn/pull/1979 --- build.gradle.kts | 200 ++++++++++++++++++++++++++--------------------- 1 file changed, 110 insertions(+), 90 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index b4e1b6b97d..a717ee63ab 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -229,120 +229,140 @@ tasks { copy { from(zipTree(downloadOmnisharpLinuxZipFile.get().dest)) into(file("$destinationDir/$pluginName/omnisharp/linux")) + exclude("run") + } + // Workaround for https://github.com/OmniSharp/omnisharp-roslyn/pull/1979 + copy { + from(zipTree(downloadOmnisharpLinuxZipFile.get().dest)) + into(file("$destinationDir/$pluginName/omnisharp/linux")) + include("run") + filter { + it.replace("export MONO_ENV_OPTIONS=\"--assembly-loader=strict --config \${config_file}\"", "export MONO_ENV_OPTIONS=\"--assembly-loader=strict --config \\\"\${config_file}\\\"\"") + } } copy { from(zipTree(downloadOmnisharpOsxZipFile.get().dest)) into(file("$destinationDir/$pluginName/omnisharp/osx")) + exclude("run") + } + // Workaround for https://github.com/OmniSharp/omnisharp-roslyn/pull/1979 + copy { + from(zipTree(downloadOmnisharpOsxZipFile.get().dest)) + into(file("$destinationDir/$pluginName/omnisharp/osx")) + include("run") + filter { + it.replace("export MONO_ENV_OPTIONS=\"--assembly-loader=strict --config \${config_file}\"", "export MONO_ENV_OPTIONS=\"--assembly-loader=strict --config \\\"\${config_file}\\\"\"") + } } copy { from(zipTree(downloadOmnisharpWindowsZipFile.get().dest)) into(file("$destinationDir/$pluginName/omnisharp/win")) } } - } - val buildPluginBlockmap by registering { - inputs.file(buildPlugin.get().archiveFile) - doLast { - val distribZip = buildPlugin.get().archiveFile.get().asFile - val blockMapBytes = - com.fasterxml.jackson.databind.ObjectMapper().writeValueAsBytes(BlockMap(distribZip.inputStream())) - val blockMapFile = File(distribZip.parentFile, "blockmap.json") - blockMapFile.writeBytes(blockMapBytes) - val blockMapFileZipFile = file(distribZip.absolutePath + ".blockmap.zip") - val blockMapFileZip = ZipOutputStream(BufferedOutputStream(FileOutputStream(blockMapFileZipFile))) - val fi = FileInputStream(blockMapFile) - val origin = BufferedInputStream(fi) - val entry = ZipEntry(blockMapFile.name) - blockMapFileZip.putNextEntry(entry) - origin.copyTo(blockMapFileZip, 1024) - origin.close() - blockMapFileZip.close() - artifacts.add("archives", blockMapFileZipFile) { - name = project.name - extension = "zip.blockmap.zip" - type = "zip" - builtBy("buildPluginBlockmap") - } - val fileHash = com.fasterxml.jackson.databind.ObjectMapper() - .writeValueAsString(com.jetbrains.plugin.blockmap.core.FileHash(distribZip.inputStream())) - val fileHashJsonFile = file(distribZip.absolutePath + ".hash.json") - fileHashJsonFile.writeText(fileHash) - artifacts.add("archives", fileHashJsonFile) { - name = project.name - extension = "zip.hash.json" - type = "json" - builtBy("buildPluginBlockmap") + val buildPluginBlockmap by registering { + inputs.file(buildPlugin.get().archiveFile) + doLast { + val distribZip = buildPlugin.get().archiveFile.get().asFile + val blockMapBytes = + com.fasterxml.jackson.databind.ObjectMapper().writeValueAsBytes(BlockMap(distribZip.inputStream())) + val blockMapFile = File(distribZip.parentFile, "blockmap.json") + blockMapFile.writeBytes(blockMapBytes) + val blockMapFileZipFile = file(distribZip.absolutePath + ".blockmap.zip") + val blockMapFileZip = ZipOutputStream(BufferedOutputStream(FileOutputStream(blockMapFileZipFile))) + val fi = FileInputStream(blockMapFile) + val origin = BufferedInputStream(fi) + val entry = ZipEntry(blockMapFile.name) + blockMapFileZip.putNextEntry(entry) + origin.copyTo(blockMapFileZip, 1024) + origin.close() + blockMapFileZip.close() + artifacts.add("archives", blockMapFileZipFile) { + name = project.name + extension = "zip.blockmap.zip" + type = "zip" + builtBy("buildPluginBlockmap") + } + val fileHash = com.fasterxml.jackson.databind.ObjectMapper() + .writeValueAsString(com.jetbrains.plugin.blockmap.core.FileHash(distribZip.inputStream())) + val fileHashJsonFile = file(distribZip.absolutePath + ".hash.json") + fileHashJsonFile.writeText(fileHash) + artifacts.add("archives", fileHashJsonFile) { + name = project.name + extension = "zip.hash.json" + type = "json" + builtBy("buildPluginBlockmap") + } } } - } - buildPlugin { - finalizedBy(buildPluginBlockmap) - } + buildPlugin { + finalizedBy(buildPluginBlockmap) + } - jacocoTestReport { - classDirectories.setFrom(files("build/classes/java/main-instrumented")) - reports { - xml.setEnabled(true) + jacocoTestReport { + classDirectories.setFrom(files("build/classes/java/main-instrumented")) + reports { + xml.setEnabled(true) + } } } -} -sonarqube { - properties { - property("sonar.projectName", "SonarLint for IntelliJ IDEA") + sonarqube { + properties { + property("sonar.projectName", "SonarLint for IntelliJ IDEA") + } } -} -license { - mapping( - mapOf( - "java" to "SLASHSTAR_STYLE", - "kt" to "SLASHSTAR_STYLE" + license { + mapping( + mapOf( + "java" to "SLASHSTAR_STYLE", + "kt" to "SLASHSTAR_STYLE" + ) ) - ) - strictCheck = true -} + strictCheck = true + } -artifactory { - clientConfig.info.setBuildName("sonarlint-intellij") - clientConfig.info.setBuildNumber(System.getenv("BUILD_BUILDID")) - clientConfig.setIncludeEnvVars(true) - clientConfig.setEnvVarsExcludePatterns("*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*,*PASSPHRASE*,*signing*") - clientConfig.info.addEnvironmentProperty( - "ARTIFACTS_TO_DOWNLOAD", - "org.sonarsource.sonarlint.intellij:sonarlint-intellij:zip" - ) - setContextUrl(System.getenv("ARTIFACTORY_URL")) - publish(delegateClosureOf { - repository(delegateClosureOf { - setProperty("repoKey", System.getenv("ARTIFACTORY_DEPLOY_REPO")) - setProperty("username", System.getenv("ARTIFACTORY_DEPLOY_USERNAME")) - setProperty("password", System.getenv("ARTIFACTORY_DEPLOY_PASSWORD")) - }) - defaults(delegateClosureOf { - setProperty( - "properties", mapOf( - "vcs.revision" to System.getenv("BUILD_SOURCEVERSION"), - "vcs.branch" to (System.getenv("SYSTEM_PULLREQUEST_TARGETBRANCH") - ?: System.getenv("BUILD_SOURCEBRANCHNAME")), - "build.name" to "sonarlint-intellij", - "build.number" to System.getenv("BUILD_BUILDID") - ) - ) - invokeMethod("publishConfigs", "archives") - setProperty("publishPom", true) // Publish generated POM files to Artifactory (true by default) - setProperty("publishIvy", false) // Publish generated Ivy descriptor files to Artifactory (true by default) + artifactory { + clientConfig.info.setBuildName("sonarlint-intellij") + clientConfig.info.setBuildNumber(System.getenv("BUILD_BUILDID")) + clientConfig.setIncludeEnvVars(true) + clientConfig.setEnvVarsExcludePatterns("*password*,*PASSWORD*,*secret*,*MAVEN_CMD_LINE_ARGS*,sun.java.command,*token*,*TOKEN*,*LOGIN*,*login*,*key*,*KEY*,*PASSPHRASE*,*signing*") + clientConfig.info.addEnvironmentProperty( + "ARTIFACTS_TO_DOWNLOAD", + "org.sonarsource.sonarlint.intellij:sonarlint-intellij:zip" + ) + setContextUrl(System.getenv("ARTIFACTORY_URL")) + publish(delegateClosureOf { + repository(delegateClosureOf { + setProperty("repoKey", System.getenv("ARTIFACTORY_DEPLOY_REPO")) + setProperty("username", System.getenv("ARTIFACTORY_DEPLOY_USERNAME")) + setProperty("password", System.getenv("ARTIFACTORY_DEPLOY_PASSWORD")) + }) + defaults(delegateClosureOf { + setProperty( + "properties", mapOf( + "vcs.revision" to System.getenv("BUILD_SOURCEVERSION"), + "vcs.branch" to (System.getenv("SYSTEM_PULLREQUEST_TARGETBRANCH") + ?: System.getenv("BUILD_SOURCEBRANCHNAME")), + "build.name" to "sonarlint-intellij", + "build.number" to System.getenv("BUILD_BUILDID") + ) + ) + invokeMethod("publishConfigs", "archives") + setProperty("publishPom", true) // Publish generated POM files to Artifactory (true by default) + setProperty("publishIvy", false) // Publish generated Ivy descriptor files to Artifactory (true by default) + }) }) - }) -} + } -signing { - setRequired({ - gradle.taskGraph.hasTask(":artifactoryPublish") && System.getenv("SYSTEM_PULLREQUEST_TARGETBRANCH") == null; - }) - sign(configurations.archives.get()) + signing { + setRequired({ + gradle.taskGraph.hasTask(":artifactoryPublish") && System.getenv("SYSTEM_PULLREQUEST_TARGETBRANCH") == null; + }) + sign(configurations.archives.get()) + } }