-
Notifications
You must be signed in to change notification settings - Fork 137
Work around extractingToTemp removal in Kotlin 2.2.0
#829
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 4 commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
8d28c66
Replace `klib.extractingToTemp` with cloned `ExtractingKotlinLibraryL…
zacharee 1efd4b7
Use proper Extracting class
zacharee 1b06f27
Use ExtractingBaseLibraryImpl in `compose-resources-gallery`
zacharee 80aef33
Replace `javaFile()` extension call with File constructor
zacharee d2b8624
Make some extension functions private
zacharee 3774d4f
Update `kotlin-2-sample` to use Kotlin 2.2.0
zacharee 33e1eb2
Fix comment line length
zacharee afec74a
Update `kotlin-2-dynamic-sample` to use Kotlin 2.2.0
zacharee a59967d
Prioritize `mavenLocal()` repo in Kotlin 2 samples
zacharee 1b3bf3e
Merge branch 'develop' into extractingToTemp-fix
Alex009 d1ebefb
#827 fix apple executables run from gradle
Alex009 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
41 changes: 41 additions & 0 deletions
41
resources-generator/src/main/kotlin/dev/icerock/gradle/data/ExtractingBaseLibraryImpl.kt
|
Alex009 marked this conversation as resolved.
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| /* | ||
| * Copyright 2025 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license. | ||
| */ | ||
|
|
||
| package dev.icerock.gradle.data | ||
|
|
||
| import org.jetbrains.kotlin.konan.file.File | ||
| import org.jetbrains.kotlin.konan.file.file | ||
| import org.jetbrains.kotlin.konan.file.unzipTo | ||
| import org.jetbrains.kotlin.konan.file.withZipFileSystem | ||
| import org.jetbrains.kotlin.library.KotlinLibraryLayout | ||
| import org.jetbrains.kotlin.library.impl.KotlinLibraryLayoutImpl | ||
|
|
||
| open class ExtractingKotlinLibraryLayout(zipped: KotlinLibraryLayoutImpl) : KotlinLibraryLayout { | ||
|
Alex009 marked this conversation as resolved.
Outdated
|
||
| override val libFile: File get() = error("Extracting layout doesn't extract its own root") | ||
| override val libraryName = zipped.libraryName | ||
| override val component = zipped.component | ||
| } | ||
|
|
||
| class ExtractingBaseLibraryImpl(zipped: KotlinLibraryLayoutImpl) : ExtractingKotlinLibraryLayout(zipped) { | ||
|
Alex009 marked this conversation as resolved.
Outdated
|
||
| override val manifestFile: File by lazy { zipped.extract(zipped.manifestFile) } | ||
| override val resourcesDir: File by lazy { zipped.extractDir(zipped.resourcesDir) } | ||
| } | ||
|
|
||
| fun KotlinLibraryLayoutImpl.extract(file: File): File = extract(this.klib, file) | ||
|
zacharee marked this conversation as resolved.
Outdated
|
||
|
|
||
| private fun extract(zipFile: File, file: File) = zipFile.withZipFileSystem { zipFileSystem -> | ||
| val temporary = org.jetbrains.kotlin.konan.file.createTempFile(file.name) | ||
| zipFileSystem.file(file).copyTo(temporary) | ||
| temporary.deleteOnExit() | ||
| temporary | ||
| } | ||
|
|
||
| fun KotlinLibraryLayoutImpl.extractDir(directory: File): File = extractDir(this.klib, directory) | ||
|
zacharee marked this conversation as resolved.
Outdated
|
||
|
|
||
| private fun extractDir(zipFile: File, directory: File): File { | ||
| val temporary = org.jetbrains.kotlin.konan.file.createTempDir(directory.name) | ||
| temporary.deleteOnExitRecursively() | ||
| zipFile.unzipTo(temporary, fromSubdirectory = directory) | ||
| return temporary | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.