Skip to content

Commit a1138c1

Browse files
committed
...
1 parent 5995f3b commit a1138c1

File tree

4 files changed

+9
-12
lines changed

4 files changed

+9
-12
lines changed

src/main/kotlin/components/Execution.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ private fun execute(runtime: Runtime, command: String): ExecutionResult {
1414
when (getOs()) {
1515
Os.WINDOWS -> {
1616
ExecutionResult(
17-
command.normalizeCommand(),
17+
command.normalize(),
1818
runtime.exec(
1919
arrayOf(
2020
"cmd",
2121
"/c",
22-
command.normalizeCommand()
22+
command.normalize()
2323
)
2424
).outputString()
2525
)
@@ -38,7 +38,7 @@ private fun execute(runtime: Runtime, command: String): ExecutionResult {
3838
}
3939
}
4040
} catch (e: IOException) {
41-
ExecutionResult(command.normalizeCommand(), "")
41+
ExecutionResult(command.normalize(), "")
4242
}
4343
}
4444

src/main/kotlin/components/Extensions.kt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ fun String.runCommand(runner: (command: String, result: String) -> Unit = { _, _
2121
return result.result
2222
}
2323

24-
fun String.normalizeCommand(): String {
24+
fun String.normalize(): String {
2525
val com = mutableListOf<String>()
2626
this.replace("\n", " ").split(" ").forEach {
2727
if (it.trim().isNotEmpty()) {
@@ -129,10 +129,7 @@ fun Project.createExtension(): Extension {
129129
fun Process.outputString(): String {
130130
val input = this.inputStream.bufferedReader().use { it.readText() }
131131
val error = this.errorStream.bufferedReader().use { it.readText() }
132-
return (when {
133-
input.isNotEmpty() -> input
134-
else -> error
135-
}).replace("\r", "")
132+
return "$input \n $error".replace("\r", "")
136133
}
137134

138135
fun defaultConfig(): Configuration {

src/test/kotlin/SCTest.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
import components.*
22
import org.junit.Before
33
import org.junit.Test
4-
import utils.modifyForTest
54
import java.io.File
65

76
class SCTest {
@@ -16,7 +15,7 @@ class SCTest {
1615
@Test
1716
fun `01 - (PLUGIN) terminal verification`() {
1817
"echo $extensionName".runCommand { command, result ->
19-
assert(command.contains(result.removeNewLines()))
18+
assert(command.contains(result.normalize()))
2019
}
2120
}
2221

@@ -125,6 +124,7 @@ class SCTest {
125124
}
126125
}
127126

127+
/*
128128
@Test
129129
fun `10 - (PLUGIN) obfuscate xml`() {
130130
signingReportTask.runCommand { _, report ->
@@ -187,6 +187,6 @@ class SCTest {
187187
assert(androidReport.contains("BUILD SUCCESSFUL"))
188188
}
189189
}
190-
}
190+
}*/
191191

192192
}

src/test/kotlin/utils/Helper.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ fun modifyForTest(projectPath: String) {
88
val file = File("$projectPath${File.separator}build.gradle")
99
val content = file.getContent().replace(
1010
"classpath \"com.stringcare:plugin:\$stringcare_version\"",
11-
"\nclasspath files(\"..${File.separator}build${File.separator}libs${File.separator}plugin-2.3-SNAPSHOT.jar\")\n"
11+
"\nclasspath files(\"..${File.separator}build${File.separator}libs${File.separator}plugin-2.2.jar\")\n"
1212
)
1313
FileWriter(file.absolutePath).use { it.write(content) }
1414

0 commit comments

Comments
 (0)