Skip to content

Commit 47ad140

Browse files
authored
Merge pull request #45 from icerockdev/develop
Release 0.10.1
2 parents cc0f4d6 + 7873e3e commit 47ad140

File tree

4 files changed

+36
-32
lines changed

4 files changed

+36
-32
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ repositories {
1313
}
1414

1515
dependencies {
16-
implementation("dev.icerock:mobile-multiplatform:0.9.2")
16+
implementation("dev.icerock:mobile-multiplatform:0.10.1")
1717
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:1.4.31")
1818
implementation("com.android.tools.build:gradle:4.1.1")
1919
}

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ plugins {
1111
}
1212

1313
group = "dev.icerock"
14-
version = "0.10.0"
14+
version = "0.10.1"
1515

1616
repositories {
1717
mavenCentral()
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
/*
2+
* Copyright 2021 IceRock MAG Inc. Use of this source code is governed by the Apache 2.0 license.
3+
*/
4+
5+
package dev.icerock.gradle
6+
7+
import org.gradle.api.logging.LogLevel
8+
import org.gradle.api.logging.Logger
9+
import java.io.OutputStream
10+
11+
internal class LogOutputStream(
12+
private val logger: Logger,
13+
private val level: LogLevel
14+
) : OutputStream() {
15+
private var mem: StringBuffer = StringBuffer()
16+
17+
override fun write(byte: Int) {
18+
if (byte.toChar() == '\n') {
19+
flush()
20+
return
21+
}
22+
23+
mem = mem.append(byte.toChar())
24+
}
25+
26+
override fun flush() {
27+
logger.log(level, mem.toString())
28+
mem = StringBuffer()
29+
}
30+
}

src/main/kotlin/dev/icerock/gradle/tasks/CompileCocoaPod.kt

Lines changed: 4 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ import org.gradle.api.tasks.InputDirectory
1212
import org.gradle.api.tasks.Internal
1313
import org.gradle.api.tasks.OutputDirectory
1414
import org.gradle.api.tasks.TaskAction
15-
import org.gradle.internal.io.LineBufferingOutputStream
16-
import org.gradle.internal.io.TextStream
15+
import dev.icerock.gradle.LogOutputStream
16+
import org.gradle.api.logging.LogLevel
1717
import java.io.File
1818

1919
open class CompileCocoaPod : DefaultTask() {
@@ -77,37 +77,11 @@ open class CompileCocoaPod : DefaultTask() {
7777
project.logger.lifecycle("cocoapod build cmd: $it")
7878
}
7979

80-
val errOut = LineBufferingOutputStream(
81-
object : TextStream {
82-
override fun endOfStream(failure: Throwable?) {
83-
if (failure != null) {
84-
project.logger.error(failure.message, failure)
85-
}
86-
}
87-
88-
override fun text(text: String) {
89-
project.logger.error(text)
90-
}
91-
}
92-
)
93-
val stdOut = LineBufferingOutputStream(
94-
object : TextStream {
95-
override fun endOfStream(failure: Throwable?) {
96-
if (failure != null) {
97-
project.logger.info(failure.message, failure)
98-
}
99-
}
100-
101-
override fun text(text: String) {
102-
project.logger.info(text)
103-
}
104-
}
105-
)
10680
val result = project.exec {
10781
workingDir = podsProject
10882
commandLine = cmdLine.toList()
109-
standardOutput = stdOut
110-
errorOutput = errOut
83+
standardOutput = LogOutputStream(project.logger, LogLevel.INFO)
84+
errorOutput = LogOutputStream(project.logger, LogLevel.ERROR)
11185
}
11286
project.logger.lifecycle("xcodebuild result is ${result.exitValue}")
11387
result.assertNormalExitValue()

0 commit comments

Comments
 (0)