Skip to content
This repository has been archived by the owner on May 27, 2020. It is now read-only.

Commit

Permalink
Also bundle together the dsyms for release builds that have that opti…
Browse files Browse the repository at this point in the history
…on turned on
  • Loading branch information
AlecKazakova committed Mar 13, 2019
1 parent c812ded commit ee80d6c
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,14 @@ open class CocoapodsCompileTask : DefaultTask() {
}

private fun hasDsyms(): Boolean {
return compilations.all { it.binary.debuggable }
return compilations.all { it.binary.debuggable || it.binary.freeCompilerArgs.contains("-g") }
}

private fun compileFatBinary(
binaryPath: String,
bundleName: String
) {
logger.debug("Creating fat binary for $binaryPath $bundleName")
val finalContainerPath = "${project.buildDir.path}/$bundleName"
val finalOutputPath = "$finalContainerPath/$binaryPath"

Expand All @@ -75,6 +76,7 @@ open class CocoapodsCompileTask : DefaultTask() {
deviceParentDir = output
}

logger.debug("Lipo'ing for arch ${target.architecture} with path $output/$bundleName/$binaryPath")
args.addAll(listOf(
"-arch", target.architecture(), "$output/$bundleName/$binaryPath"
))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -136,4 +136,28 @@ class PluginTest {
" This means no test task was added.")
}
}

@Test
fun `run createIosReleaseArtifacts with debugging turned on`() {
val fixtureName = "sample-override-framework"
val fixtureRoot = File("src/test/$fixtureName")
val runner = GradleRunner.create()
.withProjectDir(fixtureRoot)
.withPluginClasspath()
.forwardOutput()

val framework = File(fixtureRoot, "build/sample.framework").apply { deleteRecursively() }
val dsym = File(fixtureRoot, "build/sample.framework.dSYM").apply { deleteRecursively() }

runner.withArguments("createIosReleaseArtifacts", "--stacktrace", "--debug").build()

assertThat(framework.exists()).isTrue()
assertThat(dsym.exists()).isTrue()

val plist = File(dsym, "Contents/Info.plist")
assertThat(plist.exists()).isTrue()

framework.deleteRecursively()
dsym.deleteRecursively()
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,9 @@ kotlin {

targetForCocoapods('ios') {
binaries {
framework()
framework {
freeCompilerArgs = ["-g"]
}
}
}
}

0 comments on commit ee80d6c

Please sign in to comment.