mirror of
https://github.com/JetBrains/intellij-sdk-code-samples.git
synced 2025-07-28 09:17:50 +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)
|
Item(name, build, version, channel, platformBuild.toString(), platformVersion.toString(), date)
|
||||||
}
|
}
|
||||||
}.let {
|
}.let {
|
||||||
Content(current.version + 1, it)
|
val version = with (current) {
|
||||||
|
when (items.hashCode() != it.hashCode()) {
|
||||||
|
true -> version + 1
|
||||||
|
false -> version
|
||||||
|
}
|
||||||
|
}
|
||||||
|
Content(version, it)
|
||||||
}.also {
|
}.also {
|
||||||
Persister().write(it, contentFile)
|
Persister().write(it, contentFile)
|
||||||
}.also { (_, items) ->
|
}.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 ->
|
File.createTempFile("android-studio", ".zip").also(File::deleteOnExit).let { tempFile ->
|
||||||
FileOutputStream(tempFile).use { outputStream ->
|
FileOutputStream(tempFile).use { outputStream ->
|
||||||
println(" Downloading $this to $tempFile")
|
println(" Downloading $this to $tempFile")
|
||||||
val data = ByteArray(1024)
|
ByteArray(1024).let { data ->
|
||||||
var count: Int
|
var count: Int
|
||||||
while (bis.read(data, 0, data.size).also { count = it } != -1) {
|
while (bis.read(data, 0, data.size).also { count = it } != -1) {
|
||||||
outputStream.write(data, 0, count)
|
outputStream.write(data, 0, count)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
block(tempFile)
|
block(tempFile)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user