Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@

**Added**

- Nothing yet!
- Added support for using `BITDRIFT_API_KEY` as an environment variable when uploading symbols using capture-plugin

**Changed**

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,18 @@ abstract class CLIUploadMappingTask : CLITask() {
val versionCode = manifest.getAttribute("android:versionCode")
val versionName = manifest.getAttribute("android:versionName")

// retrieve key using preferred or legacy fallback env var if set
val apiKey = System.getenv("BITDRIFT_API_KEY") ?: System.getenv("API_KEY")
if (apiKey == null) {
throw IllegalStateException("Environment variable BITDRIFT_API_KEY must be set to your Bitdrift API key before running this task")
}

runBDCLI(
listOf(
"debug-files",
"upload-proguard",
"--api-key",
apiKey,
"--app-id",
appId,
"--app-version",
Expand Down Expand Up @@ -66,7 +74,6 @@ abstract class CLITask : DefaultTask() {
val downloader = BDCLIDownloader(bdcliFile)

fun runBDCLI(args: List<String>) {
checkEnvironment()
downloader.downloadIfNeeded()
runCommand(listOf(bdcliFile.absolutePath) + args)
}
Expand All @@ -81,13 +88,6 @@ abstract class CLITask : DefaultTask() {
throw RuntimeException("Command $command failed")
}
}

private fun checkEnvironment() {
val apiKeyEnvName = "API_KEY"
if (System.getenv(apiKeyEnvName) == null) {
throw IllegalStateException("Environment variable $apiKeyEnvName must be set to your Bitdrift API key before running this task")
}
}
}

class BDCLIDownloader(
Expand Down
Loading