Skip to content

Commit b351b2d

Browse files
committed
[support] use writeText instead of custom File.create extension
1 parent eada9bb commit b351b2d

File tree

1 file changed

+2
-8
lines changed

1 file changed

+2
-8
lines changed

plugin/src/main/kotlin/io/github/ttypic/swiftklib/gradle/task/CompileSwiftTask.kt

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@ abstract class CompileSwiftTask @Inject constructor(
9292
*/
9393
private fun createPackageSwift() {
9494
File(swiftBuildDir, "Package.swift")
95-
.create(createPackageSwiftContents(cinteropName))
95+
.writeText(createPackageSwiftContents(cinteropName))
9696
}
9797

9898
private fun buildSwift(xcodeVersion: Int): SwiftBuildResult {
@@ -249,7 +249,7 @@ abstract class CompileSwiftTask @Inject constructor(
249249
logger.info(content)
250250
logger.info("---/ cinterop def /---")
251251

252-
defFile.create(content)
252+
defFile.writeText(content)
253253
}
254254

255255
private fun CompileTarget.operatingSystem(): String =
@@ -286,12 +286,6 @@ val SDKLESS_TARGETS = listOf(
286286
CompileTarget.tvosSimulatorArm64,
287287
)
288288

289-
private fun File.create(content: String) {
290-
bufferedWriter().use {
291-
it.write(content)
292-
}
293-
}
294-
295289
private fun File.md5() = BigInteger(1, MessageDigest.getInstance("MD5").digest(readBytes()))
296290
.toString(16)
297291
.padStart(32, '0')

0 commit comments

Comments
 (0)