-
Notifications
You must be signed in to change notification settings - Fork 653
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Introduce "filesystem" sourceSet and use okio 3.9.0 (#5719)
* Use okio 3.9.0 in apollo-ast * use okio 3.9.0 in apollo-api * use okio in apollo-testing-support
- Loading branch information
1 parent
5b428bb
commit 3b05088
Showing
28 changed files
with
113 additions
and
104 deletions.
There are no files selected for viewing
This file contains 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 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 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
File renamed without changes.
23 changes: 23 additions & 0 deletions
23
...o-api/src/concurrentMain/kotlin/com/apollographql/apollo3/api/DefaultUpload.concurrent.kt
This file contains 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,23 @@ | ||
@file:JvmMultifileClass | ||
@file:JvmName("DefaultUploadKt") | ||
package com.apollographql.apollo3.api | ||
|
||
import okio.FileSystem | ||
import okio.Path | ||
import okio.SYSTEM | ||
import okio.buffer | ||
import okio.use | ||
import kotlin.jvm.JvmMultifileClass | ||
import kotlin.jvm.JvmName | ||
|
||
fun Path.toUpload(contentType: String, fileSystem: FileSystem = FileSystem.SYSTEM): Upload { | ||
return DefaultUpload.Builder() | ||
.content { sink -> | ||
fileSystem.openReadOnly(this).use { | ||
sink.writeAll(it.source().buffer()) | ||
} | ||
} | ||
.contentType(contentType) | ||
.contentLength(fileSystem.metadata(this).size ?: -1L) | ||
.build() | ||
} |
1 change: 1 addition & 0 deletions
1
...lographql/apollo3/api/systemFileSystem.kt → ...pollo3/api/systemFileSystem.concurrent.kt
This file contains 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.apollographql.apollo3.api | ||
|
||
import okio.FileSystem | ||
import okio.SYSTEM | ||
|
||
internal actual val systemFileSystem: FileSystem | ||
get() = FileSystem.SYSTEM |
6 changes: 0 additions & 6 deletions
6
libraries/apollo-api/src/jvmMain/kotlin/com/apollographql/apollo3/api/-systemFileSystem.kt
This file was deleted.
Oops, something went wrong.
6 changes: 0 additions & 6 deletions
6
libraries/apollo-api/src/linuxMain/kotlin/com/apollographql/apollo3/api/systemFileSystem.kt
This file was deleted.
Oops, something went wrong.
This file contains 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
6 changes: 0 additions & 6 deletions
6
libraries/apollo-ast/src/appleMain/kotlin/com/apollographql/apollo3/ast/host.apple.kt
This file was deleted.
Oops, something went wrong.
This file contains 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 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
1 change: 1 addition & 0 deletions
1
...com/apollographql/apollo3/ast/host.jvm.kt → ...llographql/apollo3/ast/host.concurrent.kt
This file contains 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 |
---|---|---|
@@ -1,6 +1,7 @@ | ||
package com.apollographql.apollo3.ast | ||
|
||
import okio.FileSystem | ||
import okio.SYSTEM | ||
|
||
internal actual val HOST_FILESYSTEM: FileSystem | ||
get() = FileSystem.SYSTEM |
23 changes: 23 additions & 0 deletions
23
...ries/apollo-ast/src/filesystemMain/kotlin/com/apollographql.apollo3.ast/api.filesystem.kt
This file contains 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,23 @@ | ||
@file:JvmMultifileClass | ||
@file:JvmName("ApolloParser") | ||
|
||
package com.apollographql.apollo3.ast | ||
|
||
import com.apollographql.apollo3.ast.introspection.toGQLDocument | ||
import com.apollographql.apollo3.ast.introspection.toIntrospectionSchema | ||
import okio.Path | ||
import okio.buffer | ||
import kotlin.jvm.JvmMultifileClass | ||
import kotlin.jvm.JvmName | ||
|
||
fun Path.parseAsGQLDocument(options: ParserOptions = ParserOptions.Default): GQLResult<GQLDocument> { | ||
return HOST_FILESYSTEM.source(this).buffer().parseAsGQLDocument(filePath = toString(), options = options) | ||
} | ||
|
||
fun Path.toGQLDocument(options: ParserOptions = ParserOptions.Default, allowJson: Boolean = false): GQLDocument { | ||
return if (allowJson && name.endsWith(".json")) { | ||
toIntrospectionSchema().toGQLDocument() | ||
} else { | ||
parseAsGQLDocument(options).getOrThrow() | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...ain/kotlin/com/apollographql.apollo3.ast/introspection/introspection_reader.filesystem.kt
This file contains 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,19 @@ | ||
@file:JvmMultifileClass | ||
@file:JvmName("Introspection") | ||
|
||
package com.apollographql.apollo3.ast.introspection | ||
|
||
import com.apollographql.apollo3.annotations.ApolloExperimental | ||
import com.apollographql.apollo3.ast.HOST_FILESYSTEM | ||
import okio.Path | ||
import okio.buffer | ||
import kotlin.jvm.JvmMultifileClass | ||
import kotlin.jvm.JvmName | ||
|
||
@ApolloExperimental | ||
fun Path.toIntrospectionSchema(): IntrospectionSchema { | ||
return HOST_FILESYSTEM | ||
.source(this) | ||
.buffer() | ||
.toIntrospectionSchema(toString()) | ||
} |
This file contains 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
File renamed without changes.
This file contains 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
File renamed without changes.
File renamed without changes.
6 changes: 0 additions & 6 deletions
6
libraries/apollo-ast/src/linuxMain/kotlin/com/apollographql/apollo3/ast/host.linux.kt
This file was deleted.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
...apollo-ast/src/wasmJsTest/kotlin/com/apollographql/apollo3/graphql/ast/test/cwd.wasmJs.kt
This file contains 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,4 @@ | ||
package com.apollographql.apollo3.graphql.ast.test | ||
|
||
internal actual val CWD: String | ||
get() = TODO("Not yet implemented") |
This file contains 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
5 changes: 5 additions & 0 deletions
5
...-testing-support/src/appleMain/kotlin/com/apollographql/apollo3/testing/readFile.apple.kt
This file contains 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,5 @@ | ||
package com.apollographql.apollo3.testing | ||
|
||
actual fun shouldUpdateTestFixtures(): Boolean = false | ||
|
||
actual val testsPath: String = "../" |
12 changes: 0 additions & 12 deletions
12
...o-testing-support/src/appleMain/kotlin/com/apollographql/apollo3/testing/readFileApple.kt
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
...upport/src/concurrentMain/kotlin/com/apollographql/apollo3/testing/readFile.concurrent.kt
This file contains 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,12 @@ | ||
package com.apollographql.apollo3.testing | ||
|
||
import com.apollographql.apollo3.annotations.ApolloExperimental | ||
import okio.FileSystem | ||
import okio.SYSTEM | ||
|
||
/** | ||
* The host filesystem | ||
*/ | ||
@ApolloExperimental | ||
actual val HostFileSystem: FileSystem | ||
get() = FileSystem.SYSTEM |
File renamed without changes.
9 changes: 0 additions & 9 deletions
9
...llographql/apollo3/testing/readFileJvm.kt → ...lographql/apollo3/testing/readFile.jvm.kt
This file contains 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