Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
henryju committed Jun 14, 2021
1 parent 069da07 commit 6f26649
Showing 1 changed file with 62 additions and 42 deletions.
104 changes: 62 additions & 42 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -229,68 +229,87 @@ 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")
Expand Down Expand Up @@ -346,3 +365,4 @@ signing {
})
sign(configurations.archives.get())
}

0 comments on commit 6f26649

Please sign in to comment.