Create FileSystem.SYSTEM property in shared source set#1455
Merged
swankjesse merged 3 commits intosquare:masterfrom Mar 12, 2024
Merged
Create FileSystem.SYSTEM property in shared source set#1455swankjesse merged 3 commits intosquare:masterfrom
swankjesse merged 3 commits intosquare:masterfrom
Conversation
Co-authored-by: Sebastian Sellmair <[email protected]>
JakeWharton
approved these changes
Mar 11, 2024
Collaborator
JakeWharton
left a comment
There was a problem hiding this comment.
Clever! LGTM once the sample build issues are fixed.
swankjesse
reviewed
Mar 12, 2024
| import okio.Path.Companion.toPath | ||
| import okio.SYSTEM | ||
|
|
||
| class MultiplatformFileSystem { |
Collaborator
There was a problem hiding this comment.
Maybe skip this new sample, and instead delete SYSTEM_FILE_SYSTEM from TestingJvm.kt and TestingNative.kt ?
Contributor
Author
There was a problem hiding this comment.
Makes sense, added this change.
swankjesse
approved these changes
Mar 12, 2024
Collaborator
swankjesse
left a comment
There was a problem hiding this comment.
Long overdue. Nice fix.
swankjesse
approved these changes
Mar 12, 2024
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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This PR creates a new source set called
systemFileSystemthatjvmandnativedepend on, and makesFileSystem.SYSTEMavailable there.We can't remove the existing
SYSTEMdeclarations in the companion objects ofFileSystem, and we can't introduce a companion object in the shared source set as it could not be further refined in more specific source sets.Therefore, this new declaration is added as an
expectextension on the companion. This lets code targeting JVM and native platforms resolve to the extension in common code, while they will actually use the properties of the companions directly when compiled.To make this change easier to test, we add additional platforms to the
samplesproject, and a sample function that exercises the new property.