Skip to content

Commit

Permalink
Revert "Flank scripts for generating test artifacts"
Browse files Browse the repository at this point in the history
This reverts commit bc03d64.

Flank scripts for generating game loop artifacts will be added in #1345
  • Loading branch information
zuziaka committed Nov 24, 2020
1 parent d73008a commit efee6ee
Show file tree
Hide file tree
Showing 12 changed files with 21 additions and 150 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,13 +26,14 @@ private fun buildExample() {
toFile().deleteRecursively()
}

val xcodeCommandSwiftTests = createXcodeBuildForTestingCommand(
val xcodeCommandSwiftTests = createIosBuildCommand(
dataPath.toString(),
"./EarlGreyExample.xcworkspace",
"EarlGreyExampleSwiftTests"
)
xcodeCommandSwiftTests pipe "xcpretty"

val xcodeCommandTests = createXcodeBuildForTestingCommand(dataPath.toString(), "EarlGreyExampleTests")
val xcodeCommandTests = createIosBuildCommand(dataPath.toString(), "./EarlGreyExample.xcworkspace", "EarlGreyExampleTests")
xcodeCommandTests pipe "xcpretty"

copyExampleOutputFiles(dataPath.toString())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ private fun buildFtl() {
val dataPath = Paths.get("", "dd_tmp").apply {
toFile().deleteRecursively()
}.toString()
val xcodeCommand = createXcodeBuildForTestingCommand(dataPath, "\"EarlGreyExampleSwiftTests\"")
val xcodeCommand = createIosBuildCommand(dataPath, "./EarlGreyExample.xcworkspace", "\"EarlGreyExampleSwiftTests\"")

xcodeCommand pipe "xcpretty"
copyFtlOutputFiles(dataPath)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,26 +1,10 @@
package flank.scripts.shell.ios

fun createXcodeBuildForTestingCommand(buildDir: String, scheme: String, project: String = "", workspace: String = "") =
fun createIosBuildCommand(buildDir: String, workspace: String, scheme: String, project: String = "") =
"xcodebuild build-for-testing" +
" -allowProvisioningUpdates" +
(if (workspace.isBlank()) "" else " -workspace $workspace") +
(if (project.isBlank()) "" else " -project $project") +
" -scheme $scheme" +
" -derivedDataPath $buildDir" +
" -sdk iphoneos"

fun createXcodeArchiveCommand(archivePath: String, scheme: String, project: String = "", workspace: String = "") =
"xcodebuild" +
" -allowProvisioningUpdates" +
(if (workspace.isBlank()) "" else " -workspace $workspace") +
(if (project.isBlank()) "" else " -project $project") +
" -scheme $scheme" +
" archive" +
" -archivePath $archivePath"

fun createXcodeExportArchiveCommand(archivePath: String, exportOptionsPlistPath: String, exportPath: String = "") =
"xcodebuild -exportArchive" +
" -allowProvisioningUpdates" +
" -archivePath $archivePath" +
" -exportOptionsPlist $exportOptionsPlistPath" +
" -exportPath $exportPath"
Original file line number Diff line number Diff line change
Expand Up @@ -5,13 +5,13 @@ import flank.scripts.shell.ops.EARL_GREY_EXAMPLE
import flank.scripts.shell.utils.failIfWindows
import flank.scripts.shell.utils.iOSTestProjectsPath
import flank.scripts.utils.downloadCocoaPodsIfNeeded
import flank.scripts.utils.installPodsIfNeeded
import flank.scripts.utils.installPods
import java.nio.file.Paths

object SetupIosEnvCommand : CliktCommand(name = "setup_ios_env", help = "Build ios app with tests") {
override fun run() {
failIfWindows()
downloadCocoaPodsIfNeeded()
installPodsIfNeeded(Paths.get(iOSTestProjectsPath, EARL_GREY_EXAMPLE))
installPods(Paths.get(iOSTestProjectsPath, EARL_GREY_EXAMPLE))
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ object BuildEarlGreyExampleCommand : CliktCommand(name = "build_earl_grey_exampl
useWorkspace = true,
generate = generate ?: true,
copy = copy ?: true
).generateIosTestArtifacts()
).generateIos()
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ object BuildFlankExampleCommand : CliktCommand(name = "build_flank_example", hel
useWorkspace = false,
generate = generate ?: true,
copy = copy ?: true
).generateIosTestArtifacts()
).generateIos()
}
}

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,24 +1,24 @@
package flank.scripts.shell.ops

import flank.scripts.shell.ios.createXcodeBuildForTestingCommand
import flank.scripts.shell.ios.createIosBuildCommand
import flank.scripts.shell.utils.flankFixturesIosTmpPath
import flank.scripts.shell.utils.pipe
import flank.scripts.utils.archive
import flank.scripts.utils.downloadCocoaPodsIfNeeded
import flank.scripts.utils.downloadXcPrettyIfNeeded
import flank.scripts.utils.installPodsIfNeeded
import flank.scripts.utils.installPods
import java.io.File
import java.nio.file.Path
import java.nio.file.Paths

fun IosBuildConfiguration.generateIosTestArtifacts() {
fun IosBuildConfiguration.generateIos() {
downloadCocoaPodsIfNeeded()
installPodsIfNeeded(Paths.get(projectPath))
installPods(Paths.get(projectPath))
downloadXcPrettyIfNeeded()
if (generate) buildProject()
if (generate) buildEarlGreyExample()
}

private fun IosBuildConfiguration.buildProject() = Paths.get(projectPath, "Build")
private fun IosBuildConfiguration.buildEarlGreyExample() = Paths.get(projectPath, "Build")
.runBuilds(this)
.resolve("Products")
.apply { renameXctestFiles().filterFilesToCopy().archiveProject(projectName).copyIosProductFiles(projectName) }
Expand All @@ -34,11 +34,11 @@ private fun Path.runBuilds(configuration: IosBuildConfiguration) = apply {
val project = if (configuration.useWorkspace) ""
else Paths.get(parent, "${configuration.projectName}.xcodeproj").toString()
configuration.buildConfigurations.forEach {
val buildCommand = createXcodeBuildForTestingCommand(
val buildCommand = createIosBuildCommand(
parent,
workspace,
scheme = it.scheme,
project = project,
workspace = workspace
project,
)
buildCommand pipe "xcpretty"
}
Expand Down Expand Up @@ -95,5 +95,5 @@ data class IosBuildConfiguration(

data class IosTestBuildConfiguration(val scheme: String, val outputDirectoryName: String)

val IosBuildConfiguration.workspaceName
private val IosBuildConfiguration.workspaceName
get() = "$projectName.xcworkspace"

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ object OpsCommand : CliktCommand(name = "ops", help = "Contains all ops command:
subcommands(
AndroidOpsCommand,
BuildEarlGreyExampleCommand,
BuildGameLoopExampleCommand,
BuildMultiTestTargetsExample,
BuildFlankExampleCommand,
GoOpsCommand
)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@ fun downloadCocoaPodsIfNeeded() {
"xcpretty".checkAndInstallIfNeed("gem install cocoapods -v 1.9.3")
}

fun installPodsIfNeeded(path: Path) {
if (path.toFile().listFiles().map { it.name }.contains("Podfile"))
"pod install --project-directory=$path --verbose".runCommand()
fun installPods(path: Path) {
"pod install --project-directory=$path --verbose".runCommand()
}

fun checkIfPipInstalled() {
Expand Down

0 comments on commit efee6ee

Please sign in to comment.