Skip to content

Commit

Permalink
Prepare for 2024.2.0.2 release
Browse files Browse the repository at this point in the history
  • Loading branch information
soywiz committed Aug 21, 2024
1 parent 2874720 commit 21c4a41
Show file tree
Hide file tree
Showing 4 changed files with 39 additions and 20 deletions.
16 changes: 8 additions & 8 deletions src/main/kotlin/korge/Util.kt
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,10 @@ enum class ARCH {
suspend fun downloadFile(
url: String,
outFile: File,
sha256: String? = null,
shasum: String? = null,
progress: (remaining: LongRange) -> Unit = { range -> }
) {
val shaSize = if (shasum != null && shasum.length == 128) 512 else 256
val outFile = outFile.absoluteFile
withContext(Dispatchers.IO) {
if (!outFile.exists()) {
Expand All @@ -74,27 +75,26 @@ suspend fun downloadFile(
val totalLength = connection.contentLengthLong
val digest = connection.getInputStream().use { inp ->
tmpFile.outputStream().use { out ->
inp.copyTo(out) {
inp.copyTo(out, digest = MessageDigest.getInstance("SHA-$shaSize")) {
progress(it..totalLength)
}
}
}
if (sha256 != null) {
val downloadedSha256 = digest.toHexString().lowercase()
val expectedSha256 = sha256.lowercase()
check(downloadedSha256 == expectedSha256) { "Digest for\n url=$url\n expected=${expectedSha256}\n given=${downloadedSha256}\n tmp=$tmpFile"}
if (shasum != null) {
val downloadedShasum = digest.toHexString().lowercase()
val expectedShasum = shasum.lowercase()
check(downloadedShasum == expectedShasum) { "Digest for\n url=$url\n expected=${expectedShasum}\n given=${downloadedShasum}\n tmp=$tmpFile"}
}
tmpFile.renameTo(outFile)
println("DOWNLOADED $outFile from $url")
}
}
}

public fun InputStream.copyTo(out: OutputStream, bufferSize: Int = DEFAULT_BUFFER_SIZE, progress: (Long) -> Unit = { }): ByteArray {
public fun InputStream.copyTo(out: OutputStream, bufferSize: Int = DEFAULT_BUFFER_SIZE, digest: MessageDigest = MessageDigest.getInstance("SHA-256"), progress: (Long) -> Unit = { }): ByteArray {
var bytesCopied: Long = 0
val buffer = ByteArray(bufferSize)
var bytes = read(buffer)
val digest = MessageDigest.getInstance("SHA-256")
digest.reset()
progress(0L)
while (bytes >= 0) {
Expand Down
4 changes: 2 additions & 2 deletions src/main/kotlin/korge/catalog/CatalogModel.kt
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ class CatalogModel(val info: Dyn) {
override fun toString(): String = "$ldownloads"
}

inner class Download(val type: String, val url: String, val sha256: String?) {
inner class Download(val type: String, val url: String, val shasum: String?) {
val typeParts = type.split(".").filter { it != "download" }
var os: OS? = typeParts.firstNotNullOfOrNull { OS[it] }
var arch: ARCH? = typeParts.firstNotNullOfOrNull { ARCH[it] }
Expand All @@ -71,7 +71,7 @@ class CatalogModel(val info: Dyn) {
return File("korge-forge-installer-download-cache", action.localFile ?: File(URL(url).path).name).absoluteFile
}

override fun toString(): String = "Download(type=$type, os=$os, arch=$arch, url=$url, sha256=$sha256)"
override fun toString(): String = "Download(type=$type, os=$os, arch=$arch, url=$url, sha256/512=$shasum)"
}

fun parseAction(it: Dyn, index: Int, groupName: String): SimpleAction {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class DownloadSimpleActionTask(val action: CatalogModel.SimpleAction, name: Stri
download.url,
download.realLocalFile(action),
progress = context::report,
sha256 = download.sha256
shasum = download.shasum
)
}
}
Expand Down
37 changes: 28 additions & 9 deletions src/main/resources/catalog.yaml
Original file line number Diff line number Diff line change
@@ -1,20 +1,39 @@
forge_version: 6.1.3
forge_version: 2024.2.0.2

installers:
KorGE Forge 2024.1.2-patch4:
version: 2024.1
name: "KorGE Forge 2024.1-patch4"
actions: ["jbr_21_0_3", "2024_1", "forge_patch", "shortcuts", "parallel_empty", "m2.korlibs", "m2.korge"]
KorGE Forge 2024.1.2:
version: 2024.1
name: "KorGE Forge 2024.1"
actions: ["jbr_21_0_3", "2024_1", "shortcuts", "parallel_empty", "m2.korlibs", "m2.korge"]
KorGE Forge 2024.2.0.2:
version: 2024.2
name: "KorGE Forge 2024.2"
actions: ["jbr_21_0_3a", "2024_2_0_2", "shortcuts", "parallel_empty"]
#KorGE Forge 2024.1.2-patch4:
# version: 2024.1
# name: "KorGE Forge 2024.1-patch4"
# actions: ["jbr_21_0_3", "2024_1", "forge_patch", "shortcuts", "parallel_empty", "m2.korlibs", "m2.korge"]
#KorGE Forge 2024.1.2:
# version: 2024.1
# name: "KorGE Forge 2024.1"
# actions: ["jbr_21_0_3", "2024_1", "shortcuts", "parallel_empty", "m2.korlibs", "m2.korge"]
#KorGE Forge 2024.1:
# version: 2024.1
# name: "KorGE Forge 2024.1"
# actions: ["jbr_21_0_3", "2024_1", "m2.korlibs", "m2.korge", "shortcuts"]

actions:
jbr_21_0_3a:
- download.windows.x64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-windows-x64-b509.11.tar.gz::ebb7c54bbfdaa6e5a6716f7cd2aa2ad73ae8e13e347d676dcf7b3ca07c2026233119e53d86bc0267c8e6dacb8e6fb4f56ccf417dd85b78bab4daaec6d8183f3c"
download.windows.arm64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-windows-aarch64-b509.11.tar.gz::f31d598084c3ef35acf776e84c59b489fd5cfda263f9af4a480a5aefaa14a3db6f1923f1a88e7c9ec00dbcbf102e8486b195347cd8e53700636cba31ee1d52bf"
download.linux.x64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-linux-x64-b509.11.tar.gz::b77fd786a8e6ec9e247ef216c1fbbb4b7d62449a9283aa51a1c3f6f8ce34e98e27a7e4defa717d505c4d5c36450c467bcf2429bc1dc863a144baf932367c3f7c"
download.linux.arm64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-linux-aarch64-b509.11.tar.gz::98eb370b65e7006dd3e66094a3c5d30e15928a606d5e9d4f4aec67204565ecac2adebd92e348af7187f259ff5f8954d5201403e979284ca307e9224b8cfcbe7f"
download.macos.x64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-osx-x64-b509.11.tar.gz::c7818fc624616fc0121c9545d14662594a286c70f4daaf7ba3571ed1ac452b903d55bc3763445b7327ae19d1679cbb699aa071aeebb775cc236c4399f972b548"
download.macos.arm64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-osx-aarch64-b509.11.tar.gz::87ff6eb329d5f822acf81c6cd3ae235be59f16b75e50bf731e6cab92e8912cc95bc85de2b4403753368046b69f764cddff897450a20cce1865feafafc6460faf"
filter: remove_first
extract: $out/jbr
2024_2_0_2:
- download: "https://github.com/korlibs/intellij-community/releases/download/forge-2024.2.0.2/forge-2024.2.0.2-dist.tar.zst::4f12db3ef1b816a920da25a49d75424fbcafcc11db3197cf64f6e0869b99cf51eaec040eb45aafe761897c54c2c67b4269253e92740d05e4de8b4c1c0772945b"
filter: dist
extract: $out
- download: "https://github.com/korlibs/intellij-community/releases/download/forge-2024.2.0.2/korge-forge-plugin-2024.2.0.2-patch-1.jar::fed5de0685b55955e83ac01048c87c5a650fa8ff3d59becf27ed41c2627bc18d00557e63bc62436cb4da97e203c556ce3ef47bb60eb7120b25655f41f34a6e56"
copy: $out/plugins/KorgePlugin/lib/korge-forge-plugin.jar.jar
jbr_21_0_3:
# https://github.com/JetBrains/JetBrainsRuntime/releases
- download.windows.x64: "https://cache-redirector.jetbrains.com/intellij-jbr/jbr_jcef-21.0.3-windows-x64-b480.1.tar.gz::094ab7f2693bb517a9bcc44abab768233afe3c44c8c09195e3046502ede5ed7c"
Expand Down

0 comments on commit 21c4a41

Please sign in to comment.