Skip to content

Commit

Permalink
Merge pull request square#867 from square/jwilson.0104.fakefilesystem
Browse files Browse the repository at this point in the history
Rename okio-testing to okio-fakefilesystem and start publishing it
  • Loading branch information
swankjesse authored Jan 4, 2021
2 parents 770b67f + 109d3be commit d364ec8
Show file tree
Hide file tree
Showing 15 changed files with 51 additions and 16 deletions.
2 changes: 1 addition & 1 deletion android-test/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ android {
sourceSets {
named("androidTest") {
it.java.srcDirs += [
project.file("../okio-testing/src/commonMain/kotlin"),
project.file("../okio-fakefilesystem/src/commonMain/kotlin"),
project.file("../okio/src/commonMain/kotlin"),
project.file("../okio/src/commonTest/java"),
project.file("../okio/src/commonTest/kotlin"),
Expand Down
File renamed without changes.
15 changes: 15 additions & 0 deletions okio-testing/build.gradle → okio-fakefilesystem/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -43,3 +43,18 @@ kotlin {
}
}
}

tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
targetCompatibility = JavaVersion.VERSION_1_8
}

// modify these lines for MANIFEST.MF properties or for specific bnd instructions
project.ext.bndManifest = '''
Export-Package: okio.fakefilesystem
Automatic-Module-Name: okio.fakefilesystem
Bundle-SymbolicName: com.squareup.okio.fakefilesystem
'''

apply from: "$rootDir/okio/jvm/jvm.gradle"
apply from: "$rootDir/gradle/gradle-mvn-mpp-push.gradle"
2 changes: 2 additions & 0 deletions okio-fakefilesystem/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
POM_ARTIFACT_ID=okio-fakefilesystem
POM_NAME=Okio Fake Filesystem
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,24 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package okio
package okio.fakefilesystem

import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import okio.FakeFilesystem.Element.Directory
import okio.FakeFilesystem.Element.File
import okio.Buffer
import okio.ByteString
import okio.ExperimentalFilesystem
import okio.FileMetadata
import okio.FileNotFoundException
import okio.Filesystem
import okio.IOException
import okio.Path
import okio.Path.Companion.toPath
import okio.Sink
import okio.Source
import okio.Timeout
import okio.fakefilesystem.FakeFilesystem.Element.Directory
import okio.fakefilesystem.FakeFilesystem.Element.File
import kotlin.jvm.JvmField
import kotlin.jvm.JvmName

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
* limitations under the License.
*/
@file:JvmName("-Time")
package okio
package okio.fakefilesystem

import kotlinx.datetime.Instant
import okio.ExperimentalFilesystem
import okio.FileMetadata
import kotlin.jvm.JvmName

@JvmName("newFileMetadata")
Expand Down
2 changes: 0 additions & 2 deletions okio-testing/gradle.properties

This file was deleted.

10 changes: 9 additions & 1 deletion okio/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,8 @@ kotlin {
implementation deps.kotlin.test.common
implementation deps.kotlin.test.annotations
implementation deps.kotlin.time
implementation project(":okio-testing")

implementation project(":okio-fakefilesystem")
}
}
nonJvmMain {
Expand Down Expand Up @@ -183,5 +184,12 @@ tasks.withType(JavaCompile) {
targetCompatibility = JavaVersion.VERSION_1_8
}

// modify these lines for MANIFEST.MF properties or for specific bnd instructions
project.ext.bndManifest = '''
Export-Package: okio
Automatic-Module-Name: okio
Bundle-SymbolicName: com.squareup.okio
'''

apply from: 'jvm/jvm.gradle'
apply from: "$rootDir/gradle/gradle-mvn-mpp-push.gradle"
7 changes: 1 addition & 6 deletions okio/jvm/jvm.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,7 @@ kotlin.targets.matching { it.platformType.name == 'jvm' }.all { target ->
tasks['jvmJar'].configure { t ->
// the bnd task convention modifies this jar task accordingly
def bndConvention = bndBundleTaskConventionClass.newInstance(t);
// modify these lines for MANIFEST.MF properties or for specific bnd instructions
bndConvention.bnd = '''
Export-Package: okio
Automatic-Module-Name: okio
Bundle-SymbolicName: com.squareup.okio
'''
bndConvention.bnd = project.ext.bndManifest
// call the convention when the task has finished to modify the jar to contain OSGi metadata
t.doLast {
bndConvention.buildBundle()
Expand Down
2 changes: 1 addition & 1 deletion okio/src/commonMain/kotlin/okio/Filesystem.kt
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ import kotlin.jvm.JvmField
* Other implementations are possible:
*
* * `FakeFilesystem` is an in-memory filesystem suitable for testing. Note that this class is
* included in the `okio-testing` artifact.
* included in the `okio-fakefilesystem` artifact.
*
* * A ZIP filesystem could provide access to the contents of a `.zip` file.
*
Expand Down
1 change: 1 addition & 0 deletions okio/src/commonTest/kotlin/okio/AbstractFilesystemTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import kotlinx.datetime.Clock
import kotlinx.datetime.Instant
import okio.ByteString.Companion.toByteString
import okio.Path.Companion.toPath
import okio.fakefilesystem.FakeFilesystem
import kotlin.random.Random
import kotlin.test.BeforeTest
import kotlin.test.Ignore
Expand Down
1 change: 1 addition & 0 deletions okio/src/commonTest/kotlin/okio/FakeFilesystemTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
package okio

import okio.Path.Companion.toPath
import okio.fakefilesystem.FakeFilesystem
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ package okio

import kotlinx.datetime.Clock
import okio.Path.Companion.toPath
import okio.fakefilesystem.FakeFilesystem
import kotlin.test.Test
import kotlin.test.assertEquals
import kotlin.test.assertFailsWith
Expand Down
1 change: 1 addition & 0 deletions okio/src/jvmTest/java/okio/FilesystemJavaTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
import okio.fakefilesystem.FakeFilesystem;
import org.junit.Test;

import static org.assertj.core.api.Assertions.assertThat;
Expand Down
2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
rootProject.name = 'okio-parent'

include ':okio'
include ':okio-testing'
include ':okio-fakefilesystem'
include ':okio:jvm:japicmp'
include ':okio:jvm:jmh'
include ':samples'
Expand Down

0 comments on commit d364ec8

Please sign in to comment.