mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 01:07:49 +08:00
android_studio_releases.main.kts: bump version only if content changed
This commit is contained in:
parent
bae310e01c
commit
47dcad5a3d
17
.github/scripts/android_studio_releases.main.kts
vendored
17
.github/scripts/android_studio_releases.main.kts
vendored
@ -84,7 +84,13 @@ frameUrl.fetch { content ->
|
||||
Item(name, build, version, channel, platformBuild.toString(), platformVersion.toString(), date)
|
||||
}
|
||||
}.let {
|
||||
Content(current.version + 1, it)
|
||||
val version = with (current) {
|
||||
when (items.hashCode() != it.hashCode()) {
|
||||
true -> version + 1
|
||||
false -> version
|
||||
}
|
||||
}
|
||||
Content(version, it)
|
||||
}.also {
|
||||
Persister().write(it, contentFile)
|
||||
}.also { (_, items) ->
|
||||
@ -130,10 +136,11 @@ fun <T> String.download(block: (File) -> T) = URL(this).openStream().use { input
|
||||
File.createTempFile("android-studio", ".zip").also(File::deleteOnExit).let { tempFile ->
|
||||
FileOutputStream(tempFile).use { outputStream ->
|
||||
println(" Downloading $this to $tempFile")
|
||||
val data = ByteArray(1024)
|
||||
var count: Int
|
||||
while (bis.read(data, 0, data.size).also { count = it } != -1) {
|
||||
outputStream.write(data, 0, count)
|
||||
ByteArray(1024).let { data ->
|
||||
var count: Int
|
||||
while (bis.read(data, 0, data.size).also { count = it } != -1) {
|
||||
outputStream.write(data, 0, count)
|
||||
}
|
||||
}
|
||||
}
|
||||
block(tempFile)
|
||||
|
Loading…
x
Reference in New Issue
Block a user