Skip to content

Commit

Permalink
fix ios fat framework
Browse files Browse the repository at this point in the history
  • Loading branch information
crc-32 committed Apr 30, 2023
1 parent 16a8650 commit a53bfa8
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -232,17 +232,23 @@ abstract class PlatformFatFramework: DefaultTask() {
abstract val platform: Property<String>

@get:InputFiles
val inputFrameworks get(): ConfigurableFileCollection = project.objects.fileCollection()
val inputFrameworks = project.objects.fileCollection()

@get:InputFiles
val inputFrameworkDSYMs get(): ConfigurableFileCollection = project.objects.fileCollection()
val inputFrameworkDSYMs = project.objects.fileCollection()

@Internal
val platformOutputDir: Provider<Directory> = platform.map { project.layout.buildDirectory.dir("platform-fat-framework/${it}").get() }

@get:OutputDirectory
val outputDir = project.objects.directoryProperty().convention(platformOutputDir)

@get:OutputDirectories
val outputFiles: Provider<Array<File>> = platformOutputDir.map {arrayOf(
it.asFile.toPath().resolve(inputFrameworks.files.first().name).toFile(),
it.asFile.toPath().resolve(inputFrameworkDSYMs.files.first().name).toFile()
)}

private fun copyFramework() {
val file = inputFrameworks.files.first()
project.copy {
Expand All @@ -252,7 +258,7 @@ abstract class PlatformFatFramework: DefaultTask() {
}

private fun copyFrameworkDSYM() {
val file = inputFrameworkDSYMs.files.first()
val file = inputFrameworkDSYMs.first()
project.copy {
from(file)
into(outputDir.get().asFile.toPath().resolve(file.name))
Expand All @@ -267,7 +273,7 @@ abstract class PlatformFatFramework: DefaultTask() {
val out = outputDir.get().asFile.toPath()
.resolve(inputFrameworks.files.first().name+"/libpebblecommon").toString()
project.exec {
commandLine ((arrayOf("lipo", "-create") + inputs) + arrayOf("-output", out))
commandLine ("lipo", "-create", *inputs.toTypedArray(), "-output", out)
}
}

Expand All @@ -279,7 +285,7 @@ abstract class PlatformFatFramework: DefaultTask() {
val out = outputDir.get().asFile.toPath()
.resolve(inputFrameworkDSYMs.files.first().name+"/Contents/Resources/DWARF/libpebblecommon").toString()
project.exec {
commandLine ((arrayOf("lipo", "-create") + inputs) + arrayOf("-output", out))
commandLine ("lipo", "-create", *inputs.toTypedArray(), "-output", out)
}
}

Expand Down

0 comments on commit a53bfa8

Please sign in to comment.