@invarn/cibuild 2.9.6 → 2.9.8
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/chunk-35SI42CD.mjs +1 -0
- package/dist/chunk-IC45KVLJ.mjs +1 -0
- package/dist/chunk-XDY4V23V.mjs +1 -0
- package/dist/cli.cjs +14 -14
- package/dist/commands.mjs +1 -0
- package/dist/lib.mjs +3934 -0
- package/package.json +6 -10
- package/dist/src/cli.d.ts +0 -3
- package/dist/src/cli.d.ts.map +0 -1
- package/dist/src/cli.js +0 -399
- package/dist/src/commands/a-credential-target-follows-the-flavor-source-set.test.d.ts +0 -38
- package/dist/src/commands/a-credential-target-follows-the-flavor-source-set.test.d.ts.map +0 -1
- package/dist/src/commands/a-credential-target-follows-the-flavor-source-set.test.js +0 -222
- package/dist/src/commands/a-credential-two-workflows-cannot-share-is-declared-per-workflow.test.d.ts +0 -41
- package/dist/src/commands/a-credential-two-workflows-cannot-share-is-declared-per-workflow.test.d.ts.map +0 -1
- package/dist/src/commands/a-credential-two-workflows-cannot-share-is-declared-per-workflow.test.js +0 -324
- package/dist/src/commands/a-properties-stand-in-declares-the-keys-the-build-reads.test.d.ts +0 -2
- package/dist/src/commands/a-properties-stand-in-declares-the-keys-the-build-reads.test.d.ts.map +0 -1
- package/dist/src/commands/a-properties-stand-in-declares-the-keys-the-build-reads.test.js +0 -382
- package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.d.ts +0 -29
- package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.d.ts.map +0 -1
- package/dist/src/commands/an-already-stored-value-does-not-answer-the-target-question.test.js +0 -160
- package/dist/src/commands/android-gms-guard.test.d.ts +0 -9
- package/dist/src/commands/android-gms-guard.test.d.ts.map +0 -1
- package/dist/src/commands/android-gms-guard.test.js +0 -78
- package/dist/src/commands/android-java-version.test.d.ts +0 -12
- package/dist/src/commands/android-java-version.test.d.ts.map +0 -1
- package/dist/src/commands/android-java-version.test.js +0 -209
- package/dist/src/commands/android-scanner-java.test.d.ts +0 -2
- package/dist/src/commands/android-scanner-java.test.d.ts.map +0 -1
- package/dist/src/commands/android-scanner-java.test.js +0 -130
- package/dist/src/commands/android-scanner.d.ts +0 -250
- package/dist/src/commands/android-scanner.d.ts.map +0 -1
- package/dist/src/commands/android-scanner.js +0 -1639
- package/dist/src/commands/build.d.ts +0 -215
- package/dist/src/commands/build.d.ts.map +0 -1
- package/dist/src/commands/build.js +0 -1433
- package/dist/src/commands/build.test.d.ts +0 -13
- package/dist/src/commands/build.test.d.ts.map +0 -1
- package/dist/src/commands/build.test.js +0 -121
- package/dist/src/commands/detect-platform.d.ts +0 -13
- package/dist/src/commands/detect-platform.d.ts.map +0 -1
- package/dist/src/commands/detect-platform.js +0 -51
- package/dist/src/commands/detect-project.d.ts +0 -7
- package/dist/src/commands/detect-project.d.ts.map +0 -1
- package/dist/src/commands/detect-project.js +0 -12
- package/dist/src/commands/each-flavor-is-asked-for-its-own-properties-file.test.d.ts +0 -26
- package/dist/src/commands/each-flavor-is-asked-for-its-own-properties-file.test.d.ts.map +0 -1
- package/dist/src/commands/each-flavor-is-asked-for-its-own-properties-file.test.js +0 -196
- package/dist/src/commands/edit.d.ts +0 -12
- package/dist/src/commands/edit.d.ts.map +0 -1
- package/dist/src/commands/edit.js +0 -652
- package/dist/src/commands/edit.test.d.ts +0 -6
- package/dist/src/commands/edit.test.d.ts.map +0 -1
- package/dist/src/commands/edit.test.js +0 -45
- package/dist/src/commands/fidelity-trim.d.ts +0 -13
- package/dist/src/commands/fidelity-trim.d.ts.map +0 -1
- package/dist/src/commands/fidelity-trim.js +0 -21
- package/dist/src/commands/fidelity-trim.test.d.ts +0 -8
- package/dist/src/commands/fidelity-trim.test.d.ts.map +0 -1
- package/dist/src/commands/fidelity-trim.test.js +0 -79
- package/dist/src/commands/file-secret-collector.d.ts +0 -50
- package/dist/src/commands/file-secret-collector.d.ts.map +0 -1
- package/dist/src/commands/file-secret-collector.js +0 -217
- package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.d.ts +0 -38
- package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.d.ts.map +0 -1
- package/dist/src/commands/flavors-a-convention-plugin-creates-are-still-found.test.js +0 -300
- package/dist/src/commands/github-workflow.d.ts +0 -5
- package/dist/src/commands/github-workflow.d.ts.map +0 -1
- package/dist/src/commands/github-workflow.js +0 -45
- package/dist/src/commands/index.d.ts +0 -33
- package/dist/src/commands/index.d.ts.map +0 -1
- package/dist/src/commands/index.js +0 -33
- package/dist/src/commands/init.d.ts +0 -20
- package/dist/src/commands/init.d.ts.map +0 -1
- package/dist/src/commands/init.js +0 -264
- package/dist/src/commands/ios-scanner.d.ts +0 -104
- package/dist/src/commands/ios-scanner.d.ts.map +0 -1
- package/dist/src/commands/ios-scanner.js +0 -492
- package/dist/src/commands/ios-scheme-ranking.test.d.ts +0 -2
- package/dist/src/commands/ios-scheme-ranking.test.d.ts.map +0 -1
- package/dist/src/commands/ios-scheme-ranking.test.js +0 -264
- package/dist/src/commands/local-properties-reaches-every-workflow.test.d.ts +0 -30
- package/dist/src/commands/local-properties-reaches-every-workflow.test.d.ts.map +0 -1
- package/dist/src/commands/local-properties-reaches-every-workflow.test.js +0 -146
- package/dist/src/commands/reset.d.ts +0 -7
- package/dist/src/commands/reset.d.ts.map +0 -1
- package/dist/src/commands/reset.js +0 -81
- package/dist/src/commands/run.d.ts +0 -22
- package/dist/src/commands/run.d.ts.map +0 -1
- package/dist/src/commands/run.js +0 -141
- package/dist/src/commands/secrets-sync-workflow.d.ts +0 -15
- package/dist/src/commands/secrets-sync-workflow.d.ts.map +0 -1
- package/dist/src/commands/secrets-sync-workflow.js +0 -255
- package/dist/src/commands/secrets-upload.d.ts +0 -21
- package/dist/src/commands/secrets-upload.d.ts.map +0 -1
- package/dist/src/commands/secrets-upload.js +0 -177
- package/dist/src/commands/secrets-upload.test.d.ts +0 -5
- package/dist/src/commands/secrets-upload.test.d.ts.map +0 -1
- package/dist/src/commands/secrets-upload.test.js +0 -60
- package/dist/src/commands/validate.d.ts +0 -10
- package/dist/src/commands/validate.d.ts.map +0 -1
- package/dist/src/commands/validate.js +0 -46
- package/dist/src/config.d.ts +0 -3
- package/dist/src/config.d.ts.map +0 -1
- package/dist/src/config.js +0 -47
- package/dist/src/envman/cli.d.ts +0 -21
- package/dist/src/envman/cli.d.ts.map +0 -1
- package/dist/src/envman/cli.js +0 -240
- package/dist/src/envman/envman.d.ts +0 -83
- package/dist/src/envman/envman.d.ts.map +0 -1
- package/dist/src/envman/envman.js +0 -361
- package/dist/src/envman/envman.test.d.ts +0 -5
- package/dist/src/envman/envman.test.d.ts.map +0 -1
- package/dist/src/envman/envman.test.js +0 -236
- package/dist/src/envman/envstore-round-trip.test.d.ts +0 -27
- package/dist/src/envman/envstore-round-trip.test.d.ts.map +0 -1
- package/dist/src/envman/envstore-round-trip.test.js +0 -130
- package/dist/src/envman/index.d.ts +0 -23
- package/dist/src/envman/index.d.ts.map +0 -1
- package/dist/src/envman/index.js +0 -23
- package/dist/src/envman/shim.d.ts +0 -16
- package/dist/src/envman/shim.d.ts.map +0 -1
- package/dist/src/envman/shim.js +0 -66
- package/dist/src/envman/types.d.ts +0 -55
- package/dist/src/envman/types.d.ts.map +0 -1
- package/dist/src/envman/types.js +0 -12
- package/dist/src/lib.d.ts +0 -33
- package/dist/src/lib.d.ts.map +0 -1
- package/dist/src/lib.js +0 -37
- package/dist/src/pipeline.d.ts +0 -3
- package/dist/src/pipeline.d.ts.map +0 -1
- package/dist/src/pipeline.js +0 -57
- package/dist/src/runner-node-step.test.d.ts +0 -12
- package/dist/src/runner-node-step.test.d.ts.map +0 -1
- package/dist/src/runner-node-step.test.js +0 -61
- package/dist/src/runner.d.ts +0 -31
- package/dist/src/runner.d.ts.map +0 -1
- package/dist/src/runner.js +0 -240
- package/dist/src/shared/detect-project.d.ts +0 -57
- package/dist/src/shared/detect-project.d.ts.map +0 -1
- package/dist/src/shared/detect-project.js +0 -219
- package/dist/src/shared/detect-project.test.d.ts +0 -2
- package/dist/src/shared/detect-project.test.d.ts.map +0 -1
- package/dist/src/shared/detect-project.test.js +0 -161
- package/dist/src/shared/git.d.ts +0 -25
- package/dist/src/shared/git.d.ts.map +0 -1
- package/dist/src/shared/git.js +0 -53
- package/dist/src/shared/git.test.d.ts +0 -9
- package/dist/src/shared/git.test.d.ts.map +0 -1
- package/dist/src/shared/git.test.js +0 -66
- package/dist/src/shared/gitignore.d.ts +0 -6
- package/dist/src/shared/gitignore.d.ts.map +0 -1
- package/dist/src/shared/gitignore.js +0 -26
- package/dist/src/shared/gradle-settings.d.ts +0 -49
- package/dist/src/shared/gradle-settings.d.ts.map +0 -1
- package/dist/src/shared/gradle-settings.js +0 -138
- package/dist/src/shared/gradle-settings.test.d.ts +0 -2
- package/dist/src/shared/gradle-settings.test.d.ts.map +0 -1
- package/dist/src/shared/gradle-settings.test.js +0 -65
- package/dist/src/shared/prompts.d.ts +0 -30
- package/dist/src/shared/prompts.d.ts.map +0 -1
- package/dist/src/shared/prompts.js +0 -121
- package/dist/src/shared/xcode-container.test.d.ts +0 -2
- package/dist/src/shared/xcode-container.test.d.ts.map +0 -1
- package/dist/src/shared/xcode-container.test.js +0 -123
- package/dist/src/step-marker.d.ts +0 -12
- package/dist/src/step-marker.d.ts.map +0 -1
- package/dist/src/step-marker.js +0 -29
- package/dist/src/step-marker.test.d.ts +0 -11
- package/dist/src/step-marker.test.d.ts.map +0 -1
- package/dist/src/step-marker.test.js +0 -45
- package/dist/src/types.d.ts +0 -58
- package/dist/src/types.d.ts.map +0 -1
- package/dist/src/types.js +0 -2
- package/dist/src/yaml/a-cache-path-must-not-swallow-a-credential.test.d.ts +0 -28
- package/dist/src/yaml/a-cache-path-must-not-swallow-a-credential.test.d.ts.map +0 -1
- package/dist/src/yaml/a-cache-path-must-not-swallow-a-credential.test.js +0 -223
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.d.ts +0 -20
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.d.ts.map +0 -1
- package/dist/src/yaml/a-declared-secret-reaches-the-file-step.test.js +0 -201
- package/dist/src/yaml/a-declared-slot-may-name-the-workflow-it-belongs-to.test.d.ts +0 -37
- package/dist/src/yaml/a-declared-slot-may-name-the-workflow-it-belongs-to.test.d.ts.map +0 -1
- package/dist/src/yaml/a-declared-slot-may-name-the-workflow-it-belongs-to.test.js +0 -255
- package/dist/src/yaml/a-missing-credential-is-loud.test.d.ts +0 -32
- package/dist/src/yaml/a-missing-credential-is-loud.test.d.ts.map +0 -1
- package/dist/src/yaml/a-missing-credential-is-loud.test.js +0 -301
- package/dist/src/yaml/a-runtime-requirement-names-a-real-provider.test.d.ts +0 -18
- package/dist/src/yaml/a-runtime-requirement-names-a-real-provider.test.d.ts.map +0 -1
- package/dist/src/yaml/a-runtime-requirement-names-a-real-provider.test.js +0 -66
- package/dist/src/yaml/a-scoped-slot-must-name-a-workflow-the-pipeline-has.test.d.ts +0 -34
- package/dist/src/yaml/a-scoped-slot-must-name-a-workflow-the-pipeline-has.test.d.ts.map +0 -1
- package/dist/src/yaml/a-scoped-slot-must-name-a-workflow-the-pipeline-has.test.js +0 -218
- package/dist/src/yaml/a-value-this-instance-stored-is-a-value-it-has.test.d.ts +0 -27
- package/dist/src/yaml/a-value-this-instance-stored-is-a-value-it-has.test.d.ts.map +0 -1
- package/dist/src/yaml/a-value-this-instance-stored-is-a-value-it-has.test.js +0 -126
- package/dist/src/yaml/bitrise-compat.d.ts +0 -65
- package/dist/src/yaml/bitrise-compat.d.ts.map +0 -1
- package/dist/src/yaml/bitrise-compat.js +0 -206
- package/dist/src/yaml/bitrise-compat.test.d.ts +0 -5
- package/dist/src/yaml/bitrise-compat.test.d.ts.map +0 -1
- package/dist/src/yaml/bitrise-compat.test.js +0 -347
- package/dist/src/yaml/cache-key-missing-file.test.d.ts +0 -12
- package/dist/src/yaml/cache-key-missing-file.test.d.ts.map +0 -1
- package/dist/src/yaml/cache-key-missing-file.test.js +0 -116
- package/dist/src/yaml/converter.d.ts +0 -103
- package/dist/src/yaml/converter.d.ts.map +0 -1
- package/dist/src/yaml/converter.js +0 -420
- package/dist/src/yaml/converter.test.d.ts +0 -5
- package/dist/src/yaml/converter.test.d.ts.map +0 -1
- package/dist/src/yaml/converter.test.js +0 -548
- package/dist/src/yaml/e2e.test.d.ts +0 -6
- package/dist/src/yaml/e2e.test.d.ts.map +0 -1
- package/dist/src/yaml/e2e.test.js +0 -446
- package/dist/src/yaml/env-resolver.d.ts +0 -218
- package/dist/src/yaml/env-resolver.d.ts.map +0 -1
- package/dist/src/yaml/env-resolver.js +0 -591
- package/dist/src/yaml/env-resolver.test.d.ts +0 -5
- package/dist/src/yaml/env-resolver.test.d.ts.map +0 -1
- package/dist/src/yaml/env-resolver.test.js +0 -502
- package/dist/src/yaml/every-build-log-witnesses-the-commit-on-disk.test.d.ts +0 -16
- package/dist/src/yaml/every-build-log-witnesses-the-commit-on-disk.test.d.ts.map +0 -1
- package/dist/src/yaml/every-build-log-witnesses-the-commit-on-disk.test.js +0 -126
- package/dist/src/yaml/fidelity-input-digest.d.ts +0 -37
- package/dist/src/yaml/fidelity-input-digest.d.ts.map +0 -1
- package/dist/src/yaml/fidelity-input-digest.js +0 -208
- package/dist/src/yaml/fidelity-input-digest.test.d.ts +0 -2
- package/dist/src/yaml/fidelity-input-digest.test.d.ts.map +0 -1
- package/dist/src/yaml/fidelity-input-digest.test.js +0 -167
- package/dist/src/yaml/fidelity-manifest.d.ts +0 -126
- package/dist/src/yaml/fidelity-manifest.d.ts.map +0 -1
- package/dist/src/yaml/fidelity-manifest.js +0 -134
- package/dist/src/yaml/fidelity-manifest.test.d.ts +0 -12
- package/dist/src/yaml/fidelity-manifest.test.d.ts.map +0 -1
- package/dist/src/yaml/fidelity-manifest.test.js +0 -251
- package/dist/src/yaml/interactive-prompts.d.ts +0 -71
- package/dist/src/yaml/interactive-prompts.d.ts.map +0 -1
- package/dist/src/yaml/interactive-prompts.js +0 -260
- package/dist/src/yaml/meta-helpers.d.ts +0 -28
- package/dist/src/yaml/meta-helpers.d.ts.map +0 -1
- package/dist/src/yaml/meta-helpers.js +0 -46
- package/dist/src/yaml/missing-env-handler.d.ts +0 -45
- package/dist/src/yaml/missing-env-handler.d.ts.map +0 -1
- package/dist/src/yaml/missing-env-handler.js +0 -64
- package/dist/src/yaml/parser.d.ts +0 -33
- package/dist/src/yaml/parser.d.ts.map +0 -1
- package/dist/src/yaml/parser.js +0 -148
- package/dist/src/yaml/parser.test.d.ts +0 -5
- package/dist/src/yaml/parser.test.d.ts.map +0 -1
- package/dist/src/yaml/parser.test.js +0 -83
- package/dist/src/yaml/pipeline-with-secrets.d.ts +0 -25
- package/dist/src/yaml/pipeline-with-secrets.d.ts.map +0 -1
- package/dist/src/yaml/pipeline-with-secrets.js +0 -76
- package/dist/src/yaml/platform-detector.d.ts +0 -83
- package/dist/src/yaml/platform-detector.d.ts.map +0 -1
- package/dist/src/yaml/platform-detector.js +0 -189
- package/dist/src/yaml/platform-detector.test.d.ts +0 -5
- package/dist/src/yaml/platform-detector.test.d.ts.map +0 -1
- package/dist/src/yaml/platform-detector.test.js +0 -525
- package/dist/src/yaml/preflight-validation.d.ts +0 -29
- package/dist/src/yaml/preflight-validation.d.ts.map +0 -1
- package/dist/src/yaml/preflight-validation.js +0 -21
- package/dist/src/yaml/secrets-manager.d.ts +0 -87
- package/dist/src/yaml/secrets-manager.d.ts.map +0 -1
- package/dist/src/yaml/secrets-manager.js +0 -230
- package/dist/src/yaml/shell-assignments.d.ts +0 -40
- package/dist/src/yaml/shell-assignments.d.ts.map +0 -1
- package/dist/src/yaml/shell-assignments.js +0 -77
- package/dist/src/yaml/step-validator-check-failure.test.d.ts +0 -24
- package/dist/src/yaml/step-validator-check-failure.test.d.ts.map +0 -1
- package/dist/src/yaml/step-validator-check-failure.test.js +0 -130
- package/dist/src/yaml/step-validator-self-assigned.test.d.ts +0 -23
- package/dist/src/yaml/step-validator-self-assigned.test.d.ts.map +0 -1
- package/dist/src/yaml/step-validator-self-assigned.test.js +0 -191
- package/dist/src/yaml/step-validator.d.ts +0 -67
- package/dist/src/yaml/step-validator.d.ts.map +0 -1
- package/dist/src/yaml/step-validator.js +0 -466
- package/dist/src/yaml/step-validator.test.d.ts +0 -18
- package/dist/src/yaml/step-validator.test.d.ts.map +0 -1
- package/dist/src/yaml/step-validator.test.js +0 -140
- package/dist/src/yaml/steps/a-missing-pinned-jdk-yields-for-every-gradle-run.test.d.ts +0 -2
- package/dist/src/yaml/steps/a-missing-pinned-jdk-yields-for-every-gradle-run.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/a-missing-pinned-jdk-yields-for-every-gradle-run.test.js +0 -96
- package/dist/src/yaml/steps/android-sign.d.ts +0 -35
- package/dist/src/yaml/steps/android-sign.d.ts.map +0 -1
- package/dist/src/yaml/steps/android-sign.js +0 -147
- package/dist/src/yaml/steps/android-variant-resolution.test.d.ts +0 -2
- package/dist/src/yaml/steps/android-variant-resolution.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/android-variant-resolution.test.js +0 -260
- package/dist/src/yaml/steps/android-version.d.ts +0 -26
- package/dist/src/yaml/steps/android-version.d.ts.map +0 -1
- package/dist/src/yaml/steps/android-version.js +0 -128
- package/dist/src/yaml/steps/android-version.test.d.ts +0 -5
- package/dist/src/yaml/steps/android-version.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/android-version.test.js +0 -196
- package/dist/src/yaml/steps/android.d.ts +0 -156
- package/dist/src/yaml/steps/android.d.ts.map +0 -1
- package/dist/src/yaml/steps/android.js +0 -1100
- package/dist/src/yaml/steps/app-store-deploy.d.ts +0 -48
- package/dist/src/yaml/steps/app-store-deploy.d.ts.map +0 -1
- package/dist/src/yaml/steps/app-store-deploy.js +0 -167
- package/dist/src/yaml/steps/base.d.ts +0 -263
- package/dist/src/yaml/steps/base.d.ts.map +0 -1
- package/dist/src/yaml/steps/base.js +0 -380
- package/dist/src/yaml/steps/bitrise-android-tools.d.ts +0 -26
- package/dist/src/yaml/steps/bitrise-android-tools.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-android-tools.js +0 -200
- package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts +0 -5
- package/dist/src/yaml/steps/bitrise-android-tools.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-android-tools.test.js +0 -280
- package/dist/src/yaml/steps/bitrise-apk-info.d.ts +0 -22
- package/dist/src/yaml/steps/bitrise-apk-info.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-apk-info.js +0 -144
- package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts +0 -5
- package/dist/src/yaml/steps/bitrise-apk-info.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-apk-info.test.js +0 -331
- package/dist/src/yaml/steps/bitrise-slack.d.ts +0 -49
- package/dist/src/yaml/steps/bitrise-slack.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-slack.js +0 -280
- package/dist/src/yaml/steps/bitrise-slack.test.d.ts +0 -5
- package/dist/src/yaml/steps/bitrise-slack.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-slack.test.js +0 -484
- package/dist/src/yaml/steps/bitrise-ssh.d.ts +0 -27
- package/dist/src/yaml/steps/bitrise-ssh.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-ssh.js +0 -134
- package/dist/src/yaml/steps/bitrise-ssh.test.d.ts +0 -5
- package/dist/src/yaml/steps/bitrise-ssh.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/bitrise-ssh.test.js +0 -205
- package/dist/src/yaml/steps/cache-pull-daemon.test.d.ts +0 -27
- package/dist/src/yaml/steps/cache-pull-daemon.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cache-pull-daemon.test.js +0 -212
- package/dist/src/yaml/steps/cache-pull-restore-roots.test.d.ts +0 -42
- package/dist/src/yaml/steps/cache-pull-restore-roots.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cache-pull-restore-roots.test.js +0 -209
- package/dist/src/yaml/steps/cache-push-daemon.test.d.ts +0 -27
- package/dist/src/yaml/steps/cache-push-daemon.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cache-push-daemon.test.js +0 -171
- package/dist/src/yaml/steps/cache.d.ts +0 -59
- package/dist/src/yaml/steps/cache.d.ts.map +0 -1
- package/dist/src/yaml/steps/cache.js +0 -1027
- package/dist/src/yaml/steps/capture-injection.d.ts +0 -30
- package/dist/src/yaml/steps/capture-injection.d.ts.map +0 -1
- package/dist/src/yaml/steps/capture-injection.js +0 -88
- package/dist/src/yaml/steps/capture-injection.test.d.ts +0 -2
- package/dist/src/yaml/steps/capture-injection.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/capture-injection.test.js +0 -163
- package/dist/src/yaml/steps/cocoapods-deployment-floor.d.ts +0 -42
- package/dist/src/yaml/steps/cocoapods-deployment-floor.d.ts.map +0 -1
- package/dist/src/yaml/steps/cocoapods-deployment-floor.js +0 -140
- package/dist/src/yaml/steps/cocoapods-deployment-floor.test.d.ts +0 -11
- package/dist/src/yaml/steps/cocoapods-deployment-floor.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cocoapods-deployment-floor.test.js +0 -176
- package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.d.ts +0 -22
- package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cocoapods-install-emits-valid-bash.test.js +0 -97
- package/dist/src/yaml/steps/cocoapods-locked-bundler.test.d.ts +0 -17
- package/dist/src/yaml/steps/cocoapods-locked-bundler.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cocoapods-locked-bundler.test.js +0 -282
- package/dist/src/yaml/steps/cocoapods-skip-if-absent.test.d.ts +0 -17
- package/dist/src/yaml/steps/cocoapods-skip-if-absent.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/cocoapods-skip-if-absent.test.js +0 -132
- package/dist/src/yaml/steps/envstore-loader.test.d.ts +0 -15
- package/dist/src/yaml/steps/envstore-loader.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/envstore-loader.test.js +0 -143
- package/dist/src/yaml/steps/fastlane.d.ts +0 -27
- package/dist/src/yaml/steps/fastlane.d.ts.map +0 -1
- package/dist/src/yaml/steps/fastlane.js +0 -79
- package/dist/src/yaml/steps/fidelity-aspect-guard.d.ts +0 -53
- package/dist/src/yaml/steps/fidelity-aspect-guard.d.ts.map +0 -1
- package/dist/src/yaml/steps/fidelity-aspect-guard.js +0 -72
- package/dist/src/yaml/steps/fidelity-aspect-guard.test.d.ts +0 -11
- package/dist/src/yaml/steps/fidelity-aspect-guard.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/fidelity-aspect-guard.test.js +0 -50
- package/dist/src/yaml/steps/fidelity-reference-provenance.d.ts +0 -87
- package/dist/src/yaml/steps/fidelity-reference-provenance.d.ts.map +0 -1
- package/dist/src/yaml/steps/fidelity-reference-provenance.js +0 -111
- package/dist/src/yaml/steps/fidelity-reference-provenance.test.d.ts +0 -22
- package/dist/src/yaml/steps/fidelity-reference-provenance.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/fidelity-reference-provenance.test.js +0 -118
- package/dist/src/yaml/steps/file.d.ts +0 -52
- package/dist/src/yaml/steps/file.d.ts.map +0 -1
- package/dist/src/yaml/steps/file.js +0 -108
- package/dist/src/yaml/steps/flutter.d.ts +0 -63
- package/dist/src/yaml/steps/flutter.d.ts.map +0 -1
- package/dist/src/yaml/steps/flutter.js +0 -215
- package/dist/src/yaml/steps/git-clone-names-the-inputs-it-ignores.test.d.ts +0 -16
- package/dist/src/yaml/steps/git-clone-names-the-inputs-it-ignores.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/git-clone-names-the-inputs-it-ignores.test.js +0 -127
- package/dist/src/yaml/steps/git-clone.d.ts +0 -32
- package/dist/src/yaml/steps/git-clone.d.ts.map +0 -1
- package/dist/src/yaml/steps/git-clone.js +0 -171
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.d.ts +0 -10
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/git-fetch-retry-exec.test.js +0 -162
- package/dist/src/yaml/steps/git-fetch-retry.d.ts +0 -62
- package/dist/src/yaml/steps/git-fetch-retry.d.ts.map +0 -1
- package/dist/src/yaml/steps/git-fetch-retry.js +0 -155
- package/dist/src/yaml/steps/git-fetch-retry.test.d.ts +0 -5
- package/dist/src/yaml/steps/git-fetch-retry.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/git-fetch-retry.test.js +0 -86
- package/dist/src/yaml/steps/google-play-deploy.d.ts +0 -37
- package/dist/src/yaml/steps/google-play-deploy.d.ts.map +0 -1
- package/dist/src/yaml/steps/google-play-deploy.js +0 -193
- package/dist/src/yaml/steps/google-play-deploy.test.d.ts +0 -5
- package/dist/src/yaml/steps/google-play-deploy.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/google-play-deploy.test.js +0 -310
- package/dist/src/yaml/steps/gradle-memory.d.ts +0 -91
- package/dist/src/yaml/steps/gradle-memory.d.ts.map +0 -1
- package/dist/src/yaml/steps/gradle-memory.js +0 -495
- package/dist/src/yaml/steps/gradle-memory.test.d.ts +0 -2
- package/dist/src/yaml/steps/gradle-memory.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/gradle-memory.test.js +0 -344
- package/dist/src/yaml/steps/gradle-sdk-cmake.d.ts +0 -28
- package/dist/src/yaml/steps/gradle-sdk-cmake.d.ts.map +0 -1
- package/dist/src/yaml/steps/gradle-sdk-cmake.js +0 -107
- package/dist/src/yaml/steps/gradle-sdk-cmake.test.d.ts +0 -2
- package/dist/src/yaml/steps/gradle-sdk-cmake.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/gradle-sdk-cmake.test.js +0 -183
- package/dist/src/yaml/steps/index.d.ts +0 -10
- package/dist/src/yaml/steps/index.d.ts.map +0 -1
- package/dist/src/yaml/steps/index.js +0 -1461
- package/dist/src/yaml/steps/ios-deps.d.ts +0 -78
- package/dist/src/yaml/steps/ios-deps.d.ts.map +0 -1
- package/dist/src/yaml/steps/ios-deps.js +0 -279
- package/dist/src/yaml/steps/ios-deps.test.d.ts +0 -5
- package/dist/src/yaml/steps/ios-deps.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/ios-deps.test.js +0 -90
- package/dist/src/yaml/steps/ios-signing.d.ts +0 -31
- package/dist/src/yaml/steps/ios-signing.d.ts.map +0 -1
- package/dist/src/yaml/steps/ios-signing.js +0 -144
- package/dist/src/yaml/steps/ios-version.d.ts +0 -47
- package/dist/src/yaml/steps/ios-version.d.ts.map +0 -1
- package/dist/src/yaml/steps/ios-version.js +0 -151
- package/dist/src/yaml/steps/java-home-version-spec.test.d.ts +0 -10
- package/dist/src/yaml/steps/java-home-version-spec.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/java-home-version-spec.test.js +0 -58
- package/dist/src/yaml/steps/kotlin-metadata-compiles-on-a-daemon.test.d.ts +0 -2
- package/dist/src/yaml/steps/kotlin-metadata-compiles-on-a-daemon.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/kotlin-metadata-compiles-on-a-daemon.test.js +0 -139
- package/dist/src/yaml/steps/linting.d.ts +0 -47
- package/dist/src/yaml/steps/linting.d.ts.map +0 -1
- package/dist/src/yaml/steps/linting.js +0 -148
- package/dist/src/yaml/steps/phase2.test.d.ts +0 -6
- package/dist/src/yaml/steps/phase2.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/phase2.test.js +0 -197
- package/dist/src/yaml/steps/phase3.test.d.ts +0 -5
- package/dist/src/yaml/steps/phase3.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/phase3.test.js +0 -144
- package/dist/src/yaml/steps/phase4.test.d.ts +0 -5
- package/dist/src/yaml/steps/phase4.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/phase4.test.js +0 -166
- package/dist/src/yaml/steps/phase5.test.d.ts +0 -6
- package/dist/src/yaml/steps/phase5.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/phase5.test.js +0 -263
- package/dist/src/yaml/steps/registry.d.ts +0 -88
- package/dist/src/yaml/steps/registry.d.ts.map +0 -1
- package/dist/src/yaml/steps/registry.js +0 -125
- package/dist/src/yaml/steps/registry.test.d.ts +0 -5
- package/dist/src/yaml/steps/registry.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/registry.test.js +0 -235
- package/dist/src/yaml/steps/release.d.ts +0 -50
- package/dist/src/yaml/steps/release.d.ts.map +0 -1
- package/dist/src/yaml/steps/release.js +0 -154
- package/dist/src/yaml/steps/render-post-processor.d.ts +0 -100
- package/dist/src/yaml/steps/render-post-processor.d.ts.map +0 -1
- package/dist/src/yaml/steps/render-post-processor.js +0 -270
- package/dist/src/yaml/steps/render-post-processor.test.d.ts +0 -13
- package/dist/src/yaml/steps/render-post-processor.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/render-post-processor.test.js +0 -220
- package/dist/src/yaml/steps/script.d.ts +0 -23
- package/dist/src/yaml/steps/script.d.ts.map +0 -1
- package/dist/src/yaml/steps/script.js +0 -63
- package/dist/src/yaml/steps/spec-validation.test.d.ts +0 -6
- package/dist/src/yaml/steps/spec-validation.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/spec-validation.test.js +0 -130
- package/dist/src/yaml/steps/steps.test.d.ts +0 -6
- package/dist/src/yaml/steps/steps.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/steps.test.js +0 -881
- package/dist/src/yaml/steps/structural-facts.d.ts +0 -992
- package/dist/src/yaml/steps/structural-facts.d.ts.map +0 -1
- package/dist/src/yaml/steps/structural-facts.js +0 -3276
- package/dist/src/yaml/steps/structural-facts.test.d.ts +0 -12
- package/dist/src/yaml/steps/structural-facts.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/structural-facts.test.js +0 -3039
- package/dist/src/yaml/steps/test-config.d.ts +0 -5
- package/dist/src/yaml/steps/test-config.d.ts.map +0 -1
- package/dist/src/yaml/steps/test-config.js +0 -25
- package/dist/src/yaml/steps/trim-align-corpus.test.d.ts +0 -28
- package/dist/src/yaml/steps/trim-align-corpus.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/trim-align-corpus.test.js +0 -383
- package/dist/src/yaml/steps/trim-align.d.ts +0 -87
- package/dist/src/yaml/steps/trim-align.d.ts.map +0 -1
- package/dist/src/yaml/steps/trim-align.js +0 -367
- package/dist/src/yaml/steps/trim-align.test.d.ts +0 -11
- package/dist/src/yaml/steps/trim-align.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/trim-align.test.js +0 -261
- package/dist/src/yaml/steps/ui-fidelity-preview-android.d.ts +0 -66
- package/dist/src/yaml/steps/ui-fidelity-preview-android.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-preview-android.js +0 -251
- package/dist/src/yaml/steps/ui-fidelity-preview-android.test.d.ts +0 -13
- package/dist/src/yaml/steps/ui-fidelity-preview-android.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-preview-android.test.js +0 -302
- package/dist/src/yaml/steps/ui-fidelity-preview.d.ts +0 -134
- package/dist/src/yaml/steps/ui-fidelity-preview.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-preview.js +0 -173
- package/dist/src/yaml/steps/ui-fidelity-preview.test.d.ts +0 -11
- package/dist/src/yaml/steps/ui-fidelity-preview.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-preview.test.js +0 -210
- package/dist/src/yaml/steps/ui-fidelity-render-android.d.ts +0 -155
- package/dist/src/yaml/steps/ui-fidelity-render-android.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-render-android.js +0 -1389
- package/dist/src/yaml/steps/ui-fidelity-render-android.test.d.ts +0 -2
- package/dist/src/yaml/steps/ui-fidelity-render-android.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-render-android.test.js +0 -1106
- package/dist/src/yaml/steps/ui-fidelity-render.d.ts +0 -230
- package/dist/src/yaml/steps/ui-fidelity-render.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-render.js +0 -1597
- package/dist/src/yaml/steps/ui-fidelity-render.test.d.ts +0 -18
- package/dist/src/yaml/steps/ui-fidelity-render.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/ui-fidelity-render.test.js +0 -1871
- package/dist/src/yaml/steps/xcode-app-product.d.ts +0 -90
- package/dist/src/yaml/steps/xcode-app-product.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-app-product.js +0 -247
- package/dist/src/yaml/steps/xcode-app-product.test.d.ts +0 -2
- package/dist/src/yaml/steps/xcode-app-product.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-app-product.test.js +0 -202
- package/dist/src/yaml/steps/xcode-derived-data.test.d.ts +0 -30
- package/dist/src/yaml/steps/xcode-derived-data.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-derived-data.test.js +0 -279
- package/dist/src/yaml/steps/xcode-destination.d.ts +0 -47
- package/dist/src/yaml/steps/xcode-destination.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-destination.js +0 -202
- package/dist/src/yaml/steps/xcode-destination.test.d.ts +0 -9
- package/dist/src/yaml/steps/xcode-destination.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-destination.test.js +0 -227
- package/dist/src/yaml/steps/xcode-new.test.d.ts +0 -5
- package/dist/src/yaml/steps/xcode-new.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-new.test.js +0 -211
- package/dist/src/yaml/steps/xcode-resolve-retry.test.d.ts +0 -9
- package/dist/src/yaml/steps/xcode-resolve-retry.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-resolve-retry.test.js +0 -146
- package/dist/src/yaml/steps/xcode-simulator-archs.d.ts +0 -53
- package/dist/src/yaml/steps/xcode-simulator-archs.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-simulator-archs.js +0 -98
- package/dist/src/yaml/steps/xcode-simulator-archs.test.d.ts +0 -21
- package/dist/src/yaml/steps/xcode-simulator-archs.test.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode-simulator-archs.test.js +0 -155
- package/dist/src/yaml/steps/xcode.d.ts +0 -230
- package/dist/src/yaml/steps/xcode.d.ts.map +0 -1
- package/dist/src/yaml/steps/xcode.js +0 -1350
- package/dist/src/yaml/types.d.ts +0 -76
- package/dist/src/yaml/types.d.ts.map +0 -1
- package/dist/src/yaml/types.js +0 -5
- package/dist/src/yaml/validation-types.d.ts +0 -102
- package/dist/src/yaml/validation-types.d.ts.map +0 -1
- package/dist/src/yaml/validation-types.js +0 -8
- package/dist/src/yaml/yaml-updater.d.ts +0 -24
- package/dist/src/yaml/yaml-updater.d.ts.map +0 -1
- package/dist/src/yaml/yaml-updater.js +0 -128
|
@@ -1,1100 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Android step implementations (set-java-version, gradle-build, android-lint, android-unit-test)
|
|
3
|
-
*/
|
|
4
|
-
// Static, deliberately. The released macOS binary is built with `pkg`, which
|
|
5
|
-
// cannot evaluate a dynamic `import()` of a builtin — esbuild leaves those
|
|
6
|
-
// external, so they survive into the bundle as real imports and throw
|
|
7
|
-
// `Invalid host defined options` at runtime. A validation check that reaches
|
|
8
|
-
// for one never runs on a runner.
|
|
9
|
-
import { existsSync, readFileSync } from 'node:fs';
|
|
10
|
-
import { execSync } from 'node:child_process';
|
|
11
|
-
import { BaseStepExecutor, javaHomeVersionSpec } from './base.js';
|
|
12
|
-
import { GRADLE_JAVA_HOME_PIN_FUNCTIONS, gradleMemoryCommands } from './gradle-memory.js';
|
|
13
|
-
import { gradleSdkCmakeCommands } from './gradle-sdk-cmake.js';
|
|
14
|
-
import { appProjectOfTask, captureAssembleCommands, captureSetupCommands, isDebugAssembleTask } from './capture-injection.js';
|
|
15
|
-
/**
|
|
16
|
-
* Set Java version step executor
|
|
17
|
-
* Sets the Java version to use for Android builds
|
|
18
|
-
*/
|
|
19
|
-
export class SetJavaVersionStepExecutor extends BaseStepExecutor {
|
|
20
|
-
getValidationRequirements(inputs, _env, _config) {
|
|
21
|
-
const javaVersion = this.getInput(inputs, 'java_version', '17');
|
|
22
|
-
return [
|
|
23
|
-
{
|
|
24
|
-
category: 'command',
|
|
25
|
-
name: `java-${javaVersion}`,
|
|
26
|
-
description: `Java ${javaVersion} JDK`,
|
|
27
|
-
timing: 'pre-execution',
|
|
28
|
-
// The step this validates ends in `exit 1` when it cannot find the
|
|
29
|
-
// JDK, so a failed check is a build that is already lost. Reported as
|
|
30
|
-
// info, it printed "Java <n> not found", let the run proceed, and the
|
|
31
|
-
// pipeline died at the very next step — the same message, one VM
|
|
32
|
-
// later. The check now looks in every place the step looks, so the
|
|
33
|
-
// two can only disagree about a JDK that is genuinely absent.
|
|
34
|
-
severity: 'error',
|
|
35
|
-
hint: process.platform === 'darwin'
|
|
36
|
-
? `Install: brew install openjdk@${javaVersion}`
|
|
37
|
-
: `Install: sudo apt install openjdk-${javaVersion}-jdk`,
|
|
38
|
-
check: async () => this.checkJavaVersionWithHomebrew(String(javaVersion)),
|
|
39
|
-
},
|
|
40
|
-
];
|
|
41
|
-
}
|
|
42
|
-
/**
|
|
43
|
-
* Check Java version including Homebrew installations
|
|
44
|
-
* Matches the logic in execute() method
|
|
45
|
-
*/
|
|
46
|
-
async checkJavaVersionWithHomebrew(version) {
|
|
47
|
-
// Check Homebrew paths first (same order as execute())
|
|
48
|
-
const homebrewPaths = [
|
|
49
|
-
`/opt/homebrew/opt/openjdk@${version}`, // Apple Silicon
|
|
50
|
-
`/usr/local/opt/openjdk@${version}`, // Intel Mac
|
|
51
|
-
];
|
|
52
|
-
for (const path of homebrewPaths) {
|
|
53
|
-
if (existsSync(path)) {
|
|
54
|
-
return {
|
|
55
|
-
passed: true,
|
|
56
|
-
message: `Java ${version} found at: ${path}`,
|
|
57
|
-
};
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
// Check Android Studio JBR
|
|
61
|
-
if (process.platform === 'darwin') {
|
|
62
|
-
const jbrPath = '/Applications/Android Studio.app/Contents/jbr/Contents/Home';
|
|
63
|
-
if (existsSync(jbrPath)) {
|
|
64
|
-
try {
|
|
65
|
-
const releaseContent = readFileSync(`${jbrPath}/release`, 'utf-8');
|
|
66
|
-
const jbrVersionMatch = /JAVA_VERSION="(\d+)/.exec(releaseContent);
|
|
67
|
-
if (jbrVersionMatch && jbrVersionMatch[1] === String(version)) {
|
|
68
|
-
return { passed: true, message: `Java ${version} found at: ${jbrPath} (Android Studio JBR)` };
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
catch {
|
|
72
|
-
// Ignore — release file unreadable
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
// Try java_home utility on macOS
|
|
77
|
-
if (process.platform === 'darwin') {
|
|
78
|
-
// java_home wants `1.8` for Java 8, and answers a wrong request with the
|
|
79
|
-
// newest JDK rather than an error -- see javaHomeVersionSpec.
|
|
80
|
-
const spec = javaHomeVersionSpec(version);
|
|
81
|
-
try {
|
|
82
|
-
execSync(`/usr/libexec/java_home -v "${spec}"`, { stdio: 'pipe' });
|
|
83
|
-
return { passed: true, message: `Java ${version} is available` };
|
|
84
|
-
}
|
|
85
|
-
catch {
|
|
86
|
-
// Try with pattern
|
|
87
|
-
try {
|
|
88
|
-
execSync(`/usr/libexec/java_home -v "${spec}.*"`, { stdio: 'pipe' });
|
|
89
|
-
return { passed: true, message: `Java ${version} is available` };
|
|
90
|
-
}
|
|
91
|
-
catch {
|
|
92
|
-
// Continue to Linux paths
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
// GitHub Actions publishes each preinstalled JDK as JAVA_HOME_<ver>_X64.
|
|
97
|
-
// The step reads it; without this the check could fail a build that the
|
|
98
|
-
// step itself would have run perfectly well.
|
|
99
|
-
const actionsHome = process.env[`JAVA_HOME_${version}_X64`];
|
|
100
|
-
if (actionsHome && existsSync(actionsHome)) {
|
|
101
|
-
return {
|
|
102
|
-
passed: true,
|
|
103
|
-
message: `Java ${version} found at: ${actionsHome} (GitHub Actions)`,
|
|
104
|
-
};
|
|
105
|
-
}
|
|
106
|
-
// Check Linux paths
|
|
107
|
-
const linuxPaths = [
|
|
108
|
-
`/usr/lib/jvm/java-${version}-openjdk-amd64`,
|
|
109
|
-
`/usr/lib/jvm/java-${version}-openjdk`,
|
|
110
|
-
`/usr/lib/jvm/temurin-${version}-jdk-amd64`,
|
|
111
|
-
];
|
|
112
|
-
for (const path of linuxPaths) {
|
|
113
|
-
if (existsSync(path)) {
|
|
114
|
-
return {
|
|
115
|
-
passed: true,
|
|
116
|
-
message: `Java ${version} found at: ${path}`,
|
|
117
|
-
};
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
return {
|
|
121
|
-
passed: false,
|
|
122
|
-
message: `Java ${version} not found`,
|
|
123
|
-
details: process.platform === 'darwin'
|
|
124
|
-
? `Install: brew install openjdk@${version}`
|
|
125
|
-
: `Install: sudo apt install openjdk-${version}-jdk`,
|
|
126
|
-
};
|
|
127
|
-
}
|
|
128
|
-
getOutputs() {
|
|
129
|
-
return [
|
|
130
|
-
{
|
|
131
|
-
name: 'JAVA_HOME',
|
|
132
|
-
type: 'environment',
|
|
133
|
-
description: 'Path to Java installation',
|
|
134
|
-
},
|
|
135
|
-
];
|
|
136
|
-
}
|
|
137
|
-
async execute(inputs, env, config) {
|
|
138
|
-
const stepName = 'set-java-version';
|
|
139
|
-
// Get Java version - defaults to 17
|
|
140
|
-
const javaVersion = this.getInput(inputs, 'java_version', '17');
|
|
141
|
-
const commands = [];
|
|
142
|
-
commands.push('# Set Java Version');
|
|
143
|
-
commands.push(`echo "Setting Java version to: ${javaVersion}"`);
|
|
144
|
-
// Set JAVA_HOME based on version
|
|
145
|
-
commands.push('');
|
|
146
|
-
commands.push('# Set JAVA_HOME');
|
|
147
|
-
// Common Java installation paths
|
|
148
|
-
commands.push(`JAVA_VERSION="${javaVersion}"`);
|
|
149
|
-
commands.push('');
|
|
150
|
-
commands.push('# Try to locate Java installation');
|
|
151
|
-
commands.push('JAVA_HOME=""');
|
|
152
|
-
commands.push('');
|
|
153
|
-
commands.push('# 1. Homebrew Apple Silicon');
|
|
154
|
-
commands.push('if [ -d "/opt/homebrew/opt/openjdk@${JAVA_VERSION}" ]; then');
|
|
155
|
-
commands.push(' JAVA_HOME="/opt/homebrew/opt/openjdk@${JAVA_VERSION}"');
|
|
156
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Homebrew Apple Silicon)"');
|
|
157
|
-
commands.push('fi');
|
|
158
|
-
commands.push('');
|
|
159
|
-
commands.push('# 2. Homebrew Intel');
|
|
160
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -d "/usr/local/opt/openjdk@${JAVA_VERSION}" ]; then');
|
|
161
|
-
commands.push(' JAVA_HOME="/usr/local/opt/openjdk@${JAVA_VERSION}"');
|
|
162
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Homebrew Intel)"');
|
|
163
|
-
commands.push('fi');
|
|
164
|
-
commands.push('');
|
|
165
|
-
commands.push('# 3. Android Studio JBR');
|
|
166
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then');
|
|
167
|
-
commands.push(' JBR_PATH="/Applications/Android Studio.app/Contents/jbr/Contents/Home"');
|
|
168
|
-
commands.push(' JBR_MAJOR=$(grep "^JAVA_VERSION=" "$JBR_PATH/release" 2>/dev/null | grep -oE \'"[0-9]+\' | tr -d \'"\' || echo "")');
|
|
169
|
-
commands.push(' if [ "$JBR_MAJOR" = "$JAVA_VERSION" ]; then');
|
|
170
|
-
commands.push(' JAVA_HOME="$JBR_PATH"');
|
|
171
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Android Studio JBR)"');
|
|
172
|
-
commands.push(' fi');
|
|
173
|
-
commands.push('fi');
|
|
174
|
-
commands.push('');
|
|
175
|
-
commands.push('# 4. macOS java_home utility');
|
|
176
|
-
commands.push('# java_home matches Java 8 only as 1.8 (it predates JEP 223), and it is');
|
|
177
|
-
commands.push('# permissive: an unmatched -v N returns the NEWEST JDK >= N instead of');
|
|
178
|
-
commands.push('# failing. Asking as "8" therefore does not miss, it silently returns the');
|
|
179
|
-
commands.push('# wrong JDK -- measured as OpenJDK 25 on an image where Corretto 8 was');
|
|
180
|
-
commands.push('# installed and found correctly by -v 1.8.');
|
|
181
|
-
commands.push('JAVA_HOME_SPEC="$JAVA_VERSION"');
|
|
182
|
-
commands.push('case "$JAVA_VERSION" in');
|
|
183
|
-
commands.push(' 1|2|3|4|5|6|7|8) JAVA_HOME_SPEC="1.$JAVA_VERSION" ;;');
|
|
184
|
-
commands.push('esac');
|
|
185
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -x "/usr/libexec/java_home" ]; then');
|
|
186
|
-
commands.push(' JAVA_HOME=$(/usr/libexec/java_home -v "$JAVA_HOME_SPEC" 2>/dev/null || true)');
|
|
187
|
-
commands.push(' if [ -z "$JAVA_HOME" ]; then');
|
|
188
|
-
commands.push(' JAVA_HOME=$(/usr/libexec/java_home -v "${JAVA_HOME_SPEC}.*" 2>/dev/null || true)');
|
|
189
|
-
commands.push(' fi');
|
|
190
|
-
commands.push(' if [ -n "$JAVA_HOME" ]; then');
|
|
191
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (java_home)"');
|
|
192
|
-
commands.push(' fi');
|
|
193
|
-
commands.push('fi');
|
|
194
|
-
commands.push('');
|
|
195
|
-
commands.push('# 5. GitHub Actions runner (JAVA_HOME_<ver>_X64 env var)');
|
|
196
|
-
commands.push('JAVA_HOME_VAR="JAVA_HOME_${JAVA_VERSION}_X64"');
|
|
197
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -n "${!JAVA_HOME_VAR:-}" ]; then');
|
|
198
|
-
commands.push(' JAVA_HOME="${!JAVA_HOME_VAR}"');
|
|
199
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (GitHub Actions)"');
|
|
200
|
-
commands.push('fi');
|
|
201
|
-
commands.push('');
|
|
202
|
-
commands.push('# 6. Linux paths');
|
|
203
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -d "/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64" ]; then');
|
|
204
|
-
commands.push(' JAVA_HOME="/usr/lib/jvm/temurin-${JAVA_VERSION}-jdk-amd64"');
|
|
205
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Temurin)"');
|
|
206
|
-
commands.push('fi');
|
|
207
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -d "/usr/lib/jvm/java-${JAVA_VERSION}-openjdk-amd64" ]; then');
|
|
208
|
-
commands.push(' JAVA_HOME="/usr/lib/jvm/java-${JAVA_VERSION}-openjdk-amd64"');
|
|
209
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Linux)"');
|
|
210
|
-
commands.push('fi');
|
|
211
|
-
commands.push('if [ -z "$JAVA_HOME" ] && [ -d "/usr/lib/jvm/java-${JAVA_VERSION}-openjdk" ]; then');
|
|
212
|
-
commands.push(' JAVA_HOME="/usr/lib/jvm/java-${JAVA_VERSION}-openjdk"');
|
|
213
|
-
commands.push(' echo "Found Java at: $JAVA_HOME (Linux alt)"');
|
|
214
|
-
commands.push('fi');
|
|
215
|
-
commands.push('');
|
|
216
|
-
commands.push('# Validate JAVA_HOME was found');
|
|
217
|
-
commands.push('if [ -z "$JAVA_HOME" ] || [ ! -d "$JAVA_HOME" ]; then');
|
|
218
|
-
commands.push(' echo "⚠️ Java $JAVA_VERSION not found"');
|
|
219
|
-
commands.push(' echo ""');
|
|
220
|
-
commands.push(' echo "Available versions:"');
|
|
221
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
222
|
-
commands.push(' /usr/libexec/java_home -V 2>&1 | grep -E "^[[:space:]]+[0-9]" || echo " No Java installations found via java_home"');
|
|
223
|
-
commands.push(' fi');
|
|
224
|
-
commands.push(' if [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then');
|
|
225
|
-
commands.push(' JBR_VER=$(grep "^JAVA_VERSION=" "/Applications/Android Studio.app/Contents/jbr/Contents/Home/release" 2>/dev/null | grep -oE \'"[0-9.]+\' | tr -d \'"\' || echo "unknown")');
|
|
226
|
-
commands.push(' echo " Android Studio JBR: $JBR_VER (/Applications/Android Studio.app/Contents/jbr/Contents/Home)"');
|
|
227
|
-
commands.push(' fi');
|
|
228
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
229
|
-
commands.push(' echo ""');
|
|
230
|
-
commands.push(' echo "Install Java $JAVA_VERSION:"');
|
|
231
|
-
commands.push(' echo " brew install openjdk@$JAVA_VERSION"');
|
|
232
|
-
commands.push(' else');
|
|
233
|
-
commands.push(' echo "Install Java $JAVA_VERSION (Ubuntu/Debian):"');
|
|
234
|
-
commands.push(' echo " sudo apt-get install openjdk-${JAVA_VERSION}-jdk"');
|
|
235
|
-
commands.push(' fi');
|
|
236
|
-
commands.push(' exit 1');
|
|
237
|
-
commands.push('fi');
|
|
238
|
-
commands.push('');
|
|
239
|
-
commands.push('export JAVA_HOME');
|
|
240
|
-
commands.push('');
|
|
241
|
-
commands.push('# Update PATH');
|
|
242
|
-
commands.push('export PATH="$JAVA_HOME/bin:$PATH"');
|
|
243
|
-
commands.push('');
|
|
244
|
-
commands.push('# Verify Java version');
|
|
245
|
-
commands.push('echo "JAVA_HOME: $JAVA_HOME"');
|
|
246
|
-
commands.push('java -version');
|
|
247
|
-
commands.push('');
|
|
248
|
-
commands.push('# Persist JAVA_HOME to envman for subsequent steps');
|
|
249
|
-
commands.push('envman add --key JAVA_HOME --value "$JAVA_HOME"');
|
|
250
|
-
// Every Gradle run in the build, not only the Gradle steps, must get past
|
|
251
|
-
// a project's pin of its developer's own JDK (nightly-baseline 92). Not on
|
|
252
|
-
// a local run: there the checkout is a developer's working copy.
|
|
253
|
-
if (!config.local) {
|
|
254
|
-
commands.push('');
|
|
255
|
-
commands.push(GRADLE_JAVA_HOME_PIN_FUNCTIONS);
|
|
256
|
-
commands.push('cibuild_gradle_java_home_pin');
|
|
257
|
-
}
|
|
258
|
-
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
259
|
-
return this.createScriptStep(script, stepName);
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Gradle build step executor
|
|
264
|
-
* Builds Android projects using Gradle
|
|
265
|
-
*/
|
|
266
|
-
export class GradleBuildStepExecutor extends BaseStepExecutor {
|
|
267
|
-
getOutputs() {
|
|
268
|
-
return [
|
|
269
|
-
{
|
|
270
|
-
name: 'CIBUILD_APK_PATH',
|
|
271
|
-
type: 'environment',
|
|
272
|
-
description: 'Path to the built APK file',
|
|
273
|
-
},
|
|
274
|
-
{
|
|
275
|
-
name: 'CIBUILD_AAB_PATH',
|
|
276
|
-
type: 'environment',
|
|
277
|
-
description: 'Path to the built AAB file',
|
|
278
|
-
},
|
|
279
|
-
];
|
|
280
|
-
}
|
|
281
|
-
getValidationRequirements(_inputs, env, _config) {
|
|
282
|
-
return [
|
|
283
|
-
this.requireEnvVar('JAVA_HOME', 'Java installation directory', env, 'Add a set-java-version step before gradle-build, or set JAVA_HOME env var'),
|
|
284
|
-
this.runtimeRequirement('gradlew', 'Gradle wrapper (./gradlew) or gradle command', 'file', 'the checkout'),
|
|
285
|
-
];
|
|
286
|
-
}
|
|
287
|
-
async execute(inputs, env, config) {
|
|
288
|
-
const stepName = 'gradle-build';
|
|
289
|
-
// Get project location from YAML input (if explicitly specified)
|
|
290
|
-
const explicitLocation = this.getInput(inputs, 'project_location', '');
|
|
291
|
-
// Handle both gradle-build and android-build (Bitrise) inputs
|
|
292
|
-
// Bitrise android-build uses: variant (debug/release), module (app)
|
|
293
|
-
// Our gradle-build uses: build_type (Debug/Release)
|
|
294
|
-
const variant = this.getInput(inputs, 'variant', '');
|
|
295
|
-
const module = this.getInput(inputs, 'module', '');
|
|
296
|
-
const buildType = this.getInput(inputs, 'build_type', '');
|
|
297
|
-
// Determine build type from variant or build_type
|
|
298
|
-
let finalBuildType = 'Release';
|
|
299
|
-
if (variant && variant.length > 0) {
|
|
300
|
-
// Bitrise android-build: use variant (e.g., "debug" -> "Debug", "release" -> "Release")
|
|
301
|
-
finalBuildType = variant.charAt(0).toUpperCase() + variant.slice(1).toLowerCase();
|
|
302
|
-
}
|
|
303
|
-
else if (buildType && buildType.length > 0) {
|
|
304
|
-
// gradle-build: use build_type
|
|
305
|
-
finalBuildType = buildType;
|
|
306
|
-
}
|
|
307
|
-
// Build gradle task name
|
|
308
|
-
let defaultTask;
|
|
309
|
-
if (module && module.length > 0 && variant && variant.length > 0) {
|
|
310
|
-
// Bitrise android-build: :module:assembleVariant (e.g., :app:assembleDebug)
|
|
311
|
-
const variantCapitalized = variant.charAt(0).toUpperCase() + variant.slice(1).toLowerCase();
|
|
312
|
-
defaultTask = `:${module}:assemble${variantCapitalized}`;
|
|
313
|
-
}
|
|
314
|
-
else {
|
|
315
|
-
// gradle-build: assembleRelease/assembleDebug
|
|
316
|
-
defaultTask = finalBuildType.toLowerCase() === 'debug' ? 'assembleDebug' : 'assembleRelease';
|
|
317
|
-
}
|
|
318
|
-
const gradleTask = this.getInput(inputs, 'gradle_task', defaultTask);
|
|
319
|
-
// Get gradle options - optional
|
|
320
|
-
const gradleOptions = this.getInput(inputs, 'gradle_options', '');
|
|
321
|
-
const commands = [];
|
|
322
|
-
commands.push('# Gradle Build');
|
|
323
|
-
commands.push('');
|
|
324
|
-
// Add JAVA_HOME validation and auto-detection
|
|
325
|
-
commands.push('# Validate and auto-detect JAVA_HOME if needed');
|
|
326
|
-
commands.push('if [ -n "$JAVA_HOME" ] && [ ! -d "$JAVA_HOME" ]; then');
|
|
327
|
-
commands.push(' echo "⚠️ JAVA_HOME is set but points to invalid directory: $JAVA_HOME"');
|
|
328
|
-
commands.push(' ');
|
|
329
|
-
commands.push(' # Extract Java version from invalid path (e.g., "11" from /usr/lib/jvm/java-11-openjdk-amd64)');
|
|
330
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "java-[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
331
|
-
commands.push(' if [ -z "$REQUESTED_VERSION" ]; then');
|
|
332
|
-
commands.push(' # Try alternative patterns (e.g., openjdk@17, openjdk-17)');
|
|
333
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "(openjdk[@-])[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
334
|
-
commands.push(' fi');
|
|
335
|
-
commands.push(' ');
|
|
336
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
337
|
-
commands.push(' echo "Detected requested Java version: $REQUESTED_VERSION"');
|
|
338
|
-
commands.push(' echo "Attempting to find Java $REQUESTED_VERSION on this system..."');
|
|
339
|
-
commands.push(' else');
|
|
340
|
-
commands.push(' echo "Could not detect Java version from path, will try to find any Java..."');
|
|
341
|
-
commands.push(' fi');
|
|
342
|
-
commands.push(' echo ""');
|
|
343
|
-
commands.push(' ');
|
|
344
|
-
commands.push(' # Try to auto-detect Java for the requested version');
|
|
345
|
-
commands.push(' DETECTED_JAVA_HOME=""');
|
|
346
|
-
commands.push(' ');
|
|
347
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
348
|
-
commands.push(' # Check Homebrew installation paths for specific version (Apple Silicon)');
|
|
349
|
-
commands.push(' if [ -d "/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
350
|
-
commands.push(' DETECTED_JAVA_HOME="/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}"');
|
|
351
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Apple Silicon)"');
|
|
352
|
-
commands.push(' # Check Homebrew installation paths (Intel Mac)');
|
|
353
|
-
commands.push(' elif [ -d "/usr/local/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
354
|
-
commands.push(' DETECTED_JAVA_HOME="/usr/local/opt/openjdk@${REQUESTED_VERSION}"');
|
|
355
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Intel)"');
|
|
356
|
-
commands.push(' # Check Android Studio JBR');
|
|
357
|
-
commands.push(' elif [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then');
|
|
358
|
-
commands.push(' JBR_PATH="/Applications/Android Studio.app/Contents/jbr/Contents/Home"');
|
|
359
|
-
commands.push(' JBR_MAJOR=$(grep "^JAVA_VERSION=" "$JBR_PATH/release" 2>/dev/null | grep -oE \'"[0-9]+\' | tr -d \'"\' || echo "")');
|
|
360
|
-
commands.push(' if [ "$JBR_MAJOR" = "$REQUESTED_VERSION" ]; then');
|
|
361
|
-
commands.push(' DETECTED_JAVA_HOME="$JBR_PATH"');
|
|
362
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Android Studio JBR)"');
|
|
363
|
-
commands.push(' fi');
|
|
364
|
-
commands.push(' # Try macOS java_home utility for specific version');
|
|
365
|
-
commands.push(' elif [ -x "/usr/libexec/java_home" ]; then');
|
|
366
|
-
commands.push(' # java_home names Java 8 as 1.8, and answers an unmatched request');
|
|
367
|
-
commands.push(' # with the newest JDK rather than failing -- ask the right way or');
|
|
368
|
-
commands.push(' # silently get the wrong JDK.');
|
|
369
|
-
commands.push(' REQ_SPEC="$REQUESTED_VERSION"');
|
|
370
|
-
commands.push(' case "$REQUESTED_VERSION" in 1|2|3|4|5|6|7|8) REQ_SPEC="1.$REQUESTED_VERSION" ;; esac');
|
|
371
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "$REQ_SPEC" 2>/dev/null || true)');
|
|
372
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
373
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "${REQ_SPEC}.*" 2>/dev/null || true)');
|
|
374
|
-
commands.push(' fi');
|
|
375
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
376
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (java_home utility)"');
|
|
377
|
-
commands.push(' fi');
|
|
378
|
-
commands.push(' fi');
|
|
379
|
-
commands.push(' fi');
|
|
380
|
-
commands.push(' ');
|
|
381
|
-
commands.push(' # If specific version not found, try any Java as fallback');
|
|
382
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
383
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
384
|
-
commands.push(' echo "⚠️ Java $REQUESTED_VERSION not found, checking for other versions..."');
|
|
385
|
-
commands.push(' fi');
|
|
386
|
-
commands.push(' ');
|
|
387
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
388
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home 2>/dev/null || true)');
|
|
389
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
390
|
-
commands.push(' FALLBACK_VERSION=$("$DETECTED_JAVA_HOME/bin/java" -version 2>&1 | head -n 1 | grep -oE "[0-9]+" | head -n 1)');
|
|
391
|
-
commands.push(' echo "⚠️ Found Java $FALLBACK_VERSION instead of requested version $REQUESTED_VERSION"');
|
|
392
|
-
commands.push(' echo " Location: $DETECTED_JAVA_HOME"');
|
|
393
|
-
commands.push(' echo " ⚠️ WARNING: This may cause build issues if Java $REQUESTED_VERSION is required"');
|
|
394
|
-
commands.push(' fi');
|
|
395
|
-
commands.push(' fi');
|
|
396
|
-
commands.push(' fi');
|
|
397
|
-
commands.push(' ');
|
|
398
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ] && [ -d "$DETECTED_JAVA_HOME" ]; then');
|
|
399
|
-
commands.push(' export JAVA_HOME="$DETECTED_JAVA_HOME"');
|
|
400
|
-
commands.push(' echo "✅ Auto-corrected JAVA_HOME to: $JAVA_HOME"');
|
|
401
|
-
commands.push(' echo ""');
|
|
402
|
-
commands.push(' else');
|
|
403
|
-
commands.push(' echo ""');
|
|
404
|
-
commands.push(' echo "❌ Could not auto-detect valid Java installation"');
|
|
405
|
-
commands.push(' echo ""');
|
|
406
|
-
commands.push(' echo "JAVA_HOME is set to: $JAVA_HOME"');
|
|
407
|
-
commands.push(' echo "But this directory does not exist on your system."');
|
|
408
|
-
commands.push(' echo ""');
|
|
409
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
410
|
-
commands.push(' echo "Required Java version: $REQUESTED_VERSION"');
|
|
411
|
-
commands.push(' echo ""');
|
|
412
|
-
commands.push(' fi');
|
|
413
|
-
commands.push(' echo "To fix this issue:"');
|
|
414
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
415
|
-
commands.push(' echo " 1. Check available Java versions:"');
|
|
416
|
-
commands.push(' echo " /usr/libexec/java_home -V"');
|
|
417
|
-
commands.push(' echo ""');
|
|
418
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
419
|
-
commands.push(' echo " 2. Install Java $REQUESTED_VERSION via Homebrew:"');
|
|
420
|
-
commands.push(' echo " brew install openjdk@$REQUESTED_VERSION"');
|
|
421
|
-
commands.push(' else');
|
|
422
|
-
commands.push(' echo " 2. Install Java via Homebrew:"');
|
|
423
|
-
commands.push(' echo " brew install openjdk@17"');
|
|
424
|
-
commands.push(' fi');
|
|
425
|
-
commands.push(' echo ""');
|
|
426
|
-
commands.push(' echo " 3. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
427
|
-
commands.push(' else');
|
|
428
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
429
|
-
commands.push(' echo " 1. Install Java $REQUESTED_VERSION (Ubuntu/Debian):"');
|
|
430
|
-
commands.push(' echo " sudo apt-get install openjdk-${REQUESTED_VERSION}-jdk"');
|
|
431
|
-
commands.push(' else');
|
|
432
|
-
commands.push(' echo " 1. Install Java (Ubuntu/Debian):"');
|
|
433
|
-
commands.push(' echo " sudo apt-get install openjdk-17-jdk"');
|
|
434
|
-
commands.push(' fi');
|
|
435
|
-
commands.push(' echo ""');
|
|
436
|
-
commands.push(' echo " 2. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
437
|
-
commands.push(' fi');
|
|
438
|
-
commands.push(' echo ""');
|
|
439
|
-
commands.push(' exit 1');
|
|
440
|
-
commands.push(' fi');
|
|
441
|
-
commands.push('fi');
|
|
442
|
-
commands.push('');
|
|
443
|
-
// Determine project location at runtime: explicit > CIBUILD_SOURCE_DIR > current dir
|
|
444
|
-
if (explicitLocation && explicitLocation !== '.') {
|
|
445
|
-
commands.push(`PROJECT_DIR='${this.escapeBash(explicitLocation)}'`);
|
|
446
|
-
}
|
|
447
|
-
else {
|
|
448
|
-
commands.push('PROJECT_DIR="${CIBUILD_SOURCE_DIR:-.}"');
|
|
449
|
-
}
|
|
450
|
-
commands.push('echo "Building Android project: $PROJECT_DIR"');
|
|
451
|
-
commands.push(`echo "Build type: ${this.escapeBash(finalBuildType)}"`);
|
|
452
|
-
if (module) {
|
|
453
|
-
commands.push(`echo "Module: ${this.escapeBash(module)}"`);
|
|
454
|
-
}
|
|
455
|
-
commands.push(`echo "Gradle task: ${this.escapeBash(gradleTask)}"`);
|
|
456
|
-
// Change to project directory
|
|
457
|
-
commands.push('');
|
|
458
|
-
commands.push('if [ "$PROJECT_DIR" != "." ]; then');
|
|
459
|
-
commands.push(' cd "$PROJECT_DIR"');
|
|
460
|
-
commands.push('fi');
|
|
461
|
-
// Make gradlew executable
|
|
462
|
-
commands.push('');
|
|
463
|
-
commands.push('# Make gradlew executable');
|
|
464
|
-
commands.push('if [ -f "./gradlew" ]; then');
|
|
465
|
-
commands.push(' chmod +x ./gradlew');
|
|
466
|
-
commands.push(' GRADLE_CMD="./gradlew"');
|
|
467
|
-
commands.push('elif command -v gradle &> /dev/null; then');
|
|
468
|
-
commands.push(' GRADLE_CMD="gradle"');
|
|
469
|
-
commands.push('else');
|
|
470
|
-
commands.push(' echo "Error: Neither ./gradlew nor gradle command found"');
|
|
471
|
-
commands.push(' exit 1');
|
|
472
|
-
commands.push('fi');
|
|
473
|
-
commands.push(...gradleMemoryCommands(this.getInput(inputs, 'jvmargs', ''), (v) => this.escapeBash(v), String(this.getInput(inputs, 'max_workers', '')).trim()));
|
|
474
|
-
commands.push(...gradleSdkCmakeCommands());
|
|
475
|
-
// Build gradle command
|
|
476
|
-
commands.push('');
|
|
477
|
-
commands.push('# Timestamp marker — used to collect only artifacts from this build');
|
|
478
|
-
commands.push('touch /tmp/.cibuild-build-marker');
|
|
479
|
-
commands.push('');
|
|
480
|
-
commands.push('# Run Gradle build');
|
|
481
|
-
let gradleArgs = this.escapeBash(gradleTask);
|
|
482
|
-
if (gradleOptions && gradleOptions.trim() !== '') {
|
|
483
|
-
gradleArgs += ` ${gradleOptions}`;
|
|
484
|
-
}
|
|
485
|
-
if (isDebugAssembleTask(gradleTask)) {
|
|
486
|
-
// A debug assemble may carry the Invarn capture agent; see capture-injection.ts.
|
|
487
|
-
commands.push(...captureSetupCommands(appProjectOfTask(gradleTask), (v) => `'${this.escapeBash(v)}'`));
|
|
488
|
-
commands.push(...captureAssembleCommands(gradleArgs));
|
|
489
|
-
}
|
|
490
|
-
else {
|
|
491
|
-
commands.push(`$GRADLE_CMD ${gradleArgs}`);
|
|
492
|
-
}
|
|
493
|
-
commands.push('');
|
|
494
|
-
commands.push('# Build completed');
|
|
495
|
-
commands.push('echo "Gradle build completed successfully"');
|
|
496
|
-
commands.push('');
|
|
497
|
-
// Copy artifacts to artifacts directory for deploy step
|
|
498
|
-
commands.push('# Copy build artifacts to artifacts directory');
|
|
499
|
-
commands.push('ARTIFACTS_DIR="${CIBUILD_ARTIFACTS_DIR:-.ci/artifacts}"');
|
|
500
|
-
commands.push('mkdir -p "$ARTIFACTS_DIR"');
|
|
501
|
-
commands.push('');
|
|
502
|
-
commands.push('# Find and copy only APK/AAB files produced by this build (newer than marker)');
|
|
503
|
-
commands.push('echo "Collecting build artifacts..."');
|
|
504
|
-
commands.push('if find . -newer /tmp/.cibuild-build-marker \\( -path "*/build/outputs/apk/*/*.apk" -o -path "*/build/outputs/bundle/*/*.aab" \\) 2>/dev/null | grep -q .; then');
|
|
505
|
-
commands.push(' find . -newer /tmp/.cibuild-build-marker \\( -path "*/build/outputs/apk/*/*.apk" -o -path "*/build/outputs/bundle/*/*.aab" \\) 2>/dev/null | while read -r artifact; do');
|
|
506
|
-
commands.push(' ARTIFACT_NAME=$(basename "$artifact")');
|
|
507
|
-
commands.push(' cp "$artifact" "$ARTIFACTS_DIR/$ARTIFACT_NAME"');
|
|
508
|
-
commands.push(' echo " → Copied: $ARTIFACT_NAME"');
|
|
509
|
-
commands.push(' echo " From: $artifact"');
|
|
510
|
-
commands.push(' echo " To: $ARTIFACTS_DIR/$ARTIFACT_NAME"');
|
|
511
|
-
commands.push(' done');
|
|
512
|
-
commands.push(' echo ""');
|
|
513
|
-
commands.push(' echo "✅ Artifacts copied to: $ARTIFACTS_DIR"');
|
|
514
|
-
commands.push(' ls -lh "$ARTIFACTS_DIR"');
|
|
515
|
-
commands.push('else');
|
|
516
|
-
commands.push(' echo "⚠️ No APK or AAB files found in build/outputs/"');
|
|
517
|
-
commands.push('fi');
|
|
518
|
-
commands.push('rm -f /tmp/.cibuild-build-marker');
|
|
519
|
-
commands.push('');
|
|
520
|
-
commands.push('# Export artifact paths for subsequent steps (e.g. google-play-deploy)');
|
|
521
|
-
commands.push('FIRST_APK=$(find "$ARTIFACTS_DIR" -name "*.apk" -type f | sort | head -n 1)');
|
|
522
|
-
commands.push('FIRST_AAB=$(find "$ARTIFACTS_DIR" -name "*.aab" -type f | sort | head -n 1)');
|
|
523
|
-
commands.push('if [ -n "$FIRST_APK" ]; then');
|
|
524
|
-
commands.push(' envman add --key CIBUILD_APK_PATH --value "$FIRST_APK"');
|
|
525
|
-
commands.push(' echo "Exported CIBUILD_APK_PATH=$FIRST_APK"');
|
|
526
|
-
commands.push('fi');
|
|
527
|
-
commands.push('if [ -n "$FIRST_AAB" ]; then');
|
|
528
|
-
commands.push(' envman add --key CIBUILD_AAB_PATH --value "$FIRST_AAB"');
|
|
529
|
-
commands.push(' echo "Exported CIBUILD_AAB_PATH=$FIRST_AAB"');
|
|
530
|
-
commands.push('fi');
|
|
531
|
-
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
532
|
-
return this.createScriptStep(script, stepName);
|
|
533
|
-
}
|
|
534
|
-
}
|
|
535
|
-
/**
|
|
536
|
-
* Android lint step executor
|
|
537
|
-
* Runs Android lint checks
|
|
538
|
-
*/
|
|
539
|
-
/**
|
|
540
|
-
* Bash that picks a real variant task out of Gradle's own ambiguity error.
|
|
541
|
-
*
|
|
542
|
-
* `android/nowinandroid` declares its product flavors as an enum in
|
|
543
|
-
* `build-logic/convention/…/NiaFlavor.kt` and applies them through a
|
|
544
|
-
* convention plugin, so `app/build.gradle.kts` has no `productFlavors {}`
|
|
545
|
-
* block for the literal scan to find. `VARIANT` stayed `debug` and Gradle
|
|
546
|
-
* refused the very first Android step:
|
|
547
|
-
*
|
|
548
|
-
* Cannot locate tasks that match ':app:lintDebug' as task 'lintDebug' is
|
|
549
|
-
* ambiguous in project ':app'. Candidates are: 'lintDemoDebug',
|
|
550
|
-
* 'lintProdDebug', …
|
|
551
|
-
*
|
|
552
|
-
* Gradle has just listed the answer. Reading it back costs one extra
|
|
553
|
-
* invocation on the failing case and nothing at all on a flavourless project,
|
|
554
|
-
* which is why this is the fallback rather than an up-front `tasks --all`.
|
|
555
|
-
*
|
|
556
|
-
* Written as a shell function so what ships is what the test runs.
|
|
557
|
-
*/
|
|
558
|
-
export const PICK_VARIANT_TASK_FUNCTION = `cibuild_pick_variant_task() {
|
|
559
|
-
# $1 task prefix (lint, test), $2 task suffix (empty, UnitTest),
|
|
560
|
-
# $3 the build type to prefer (Debug). Gradle's output arrives on stdin.
|
|
561
|
-
awk '/Candidates are:/ { sub(/.*Candidates are:/, ""); print; exit }' |
|
|
562
|
-
tr ',' '\\n' |
|
|
563
|
-
tr -d " '\\"." |
|
|
564
|
-
grep -E "^\${1}[A-Za-z0-9]*\${3}\${2}$" |
|
|
565
|
-
head -1
|
|
566
|
-
}`;
|
|
567
|
-
/**
|
|
568
|
-
* Whether a `module` input names the root project. Gradle's own path for the
|
|
569
|
-
* root is `:`; an explicit empty string is taken to mean the same, since it
|
|
570
|
-
* would otherwise compose `::<task>`. An absent input never reaches here —
|
|
571
|
-
* the steps default it to `app`.
|
|
572
|
-
*/
|
|
573
|
-
function isRootProject(module) {
|
|
574
|
-
return module === ':' || module === '';
|
|
575
|
-
}
|
|
576
|
-
/**
|
|
577
|
-
* The Gradle path of a task in a module: `:app:lintDebug`, or `:lintDebug`
|
|
578
|
-
* for an app whose root project is the application. The leading `:` keeps it
|
|
579
|
-
* the root project's own task rather than every project's task of that name.
|
|
580
|
-
*/
|
|
581
|
-
export function gradleTaskPath(module, task) {
|
|
582
|
-
return isRootProject(module) ? `:${task}` : `:${module}:${task}`;
|
|
583
|
-
}
|
|
584
|
-
/** A module's directory with a trailing slash, or `''` for the root project. */
|
|
585
|
-
export function gradleProjectDir(module) {
|
|
586
|
-
return isRootProject(module) ? '' : `${module}/`;
|
|
587
|
-
}
|
|
588
|
-
/** How a log line names the project a step runs on. */
|
|
589
|
-
function gradleProjectLabel(module) {
|
|
590
|
-
return isRootProject(module) ? 'the root project' : `module: ${module}`;
|
|
591
|
-
}
|
|
592
|
-
/**
|
|
593
|
-
* The commands that run a variant-specific Gradle task and, if the variant
|
|
594
|
-
* turns out to be a guess Gradle cannot resolve, resolve it and retry once.
|
|
595
|
-
*
|
|
596
|
-
* The resolved variant is exported with `envman`, so the *other*
|
|
597
|
-
* variant-specific step in the same pipeline does not repeat the discovery —
|
|
598
|
-
* whichever of lint and unit tests runs first pays for it.
|
|
599
|
-
*/
|
|
600
|
-
export function variantTaskCommands(options) {
|
|
601
|
-
const { module, variant, prefix, suffix, gradleArgs = '', escape } = options;
|
|
602
|
-
const capitalized = variant.charAt(0).toUpperCase() + variant.slice(1);
|
|
603
|
-
const task = gradleTaskPath(escape(module), `${prefix}${capitalized}${suffix}`);
|
|
604
|
-
const args = gradleArgs === '' ? '' : ` ${gradleArgs}`;
|
|
605
|
-
return [
|
|
606
|
-
'',
|
|
607
|
-
PICK_VARIANT_TASK_FUNCTION,
|
|
608
|
-
'',
|
|
609
|
-
`VARIANT_LOG=$(mktemp)`,
|
|
610
|
-
'set +e',
|
|
611
|
-
`$GRADLE_CMD ${task}${args} 2>&1 | tee "$VARIANT_LOG"`,
|
|
612
|
-
'VARIANT_STATUS=${PIPESTATUS[0]}',
|
|
613
|
-
'set -e',
|
|
614
|
-
'',
|
|
615
|
-
'if [ "$VARIANT_STATUS" -ne 0 ] && grep -q "is ambiguous in project" "$VARIANT_LOG"; then',
|
|
616
|
-
` echo ""`,
|
|
617
|
-
` echo "Gradle says ${task} is ambiguous, so this project has product flavors the pipeline did not know about."`,
|
|
618
|
-
` BUILD_TYPE_WANTED="\${BUILD_TYPE:-${capitalized}}"`,
|
|
619
|
-
` RESOLVED_TASK=$(cibuild_pick_variant_task "${prefix}" "${suffix}" "$BUILD_TYPE_WANTED" < "$VARIANT_LOG")`,
|
|
620
|
-
' if [ -z "$RESOLVED_TASK" ]; then',
|
|
621
|
-
' echo "None of the candidates Gradle listed ends in $BUILD_TYPE_WANTED, so there is nothing safe to retry with."',
|
|
622
|
-
' rm -f "$VARIANT_LOG"',
|
|
623
|
-
' exit "$VARIANT_STATUS"',
|
|
624
|
-
' fi',
|
|
625
|
-
` RESOLVED_VARIANT=\${RESOLVED_TASK#${prefix}}`,
|
|
626
|
-
...(suffix === '' ? [] : [` RESOLVED_VARIANT=\${RESOLVED_VARIANT%${suffix}}`]),
|
|
627
|
-
` RESOLVED_VARIANT="$(echo "\${RESOLVED_VARIANT:0:1}" | tr '[:upper:]' '[:lower:]')\${RESOLVED_VARIANT:1}"`,
|
|
628
|
-
` echo "Using ${gradleTaskPath(escape(module), '$RESOLVED_TASK')} — resolved VARIANT=$RESOLVED_VARIANT"`,
|
|
629
|
-
// Best-effort: the discovery is worth having even where envman is not.
|
|
630
|
-
' envman add --key VARIANT --value "$RESOLVED_VARIANT" || true',
|
|
631
|
-
` $GRADLE_CMD ${gradleTaskPath(escape(module), '$RESOLVED_TASK')}${args}`,
|
|
632
|
-
'elif [ "$VARIANT_STATUS" -ne 0 ]; then',
|
|
633
|
-
' rm -f "$VARIANT_LOG"',
|
|
634
|
-
' exit "$VARIANT_STATUS"',
|
|
635
|
-
'fi',
|
|
636
|
-
'rm -f "$VARIANT_LOG"',
|
|
637
|
-
];
|
|
638
|
-
}
|
|
639
|
-
export class AndroidLintStepExecutor extends BaseStepExecutor {
|
|
640
|
-
getValidationRequirements(_inputs, env, _config) {
|
|
641
|
-
return [
|
|
642
|
-
this.requireEnvVar('JAVA_HOME', 'Java installation directory', env, 'Add a set-java-version step before android-lint, or set JAVA_HOME env var'),
|
|
643
|
-
this.runtimeRequirement('gradlew', 'Gradle wrapper (./gradlew) or gradle command', 'file', 'the checkout'),
|
|
644
|
-
];
|
|
645
|
-
}
|
|
646
|
-
async execute(inputs, env, config) {
|
|
647
|
-
const stepName = 'android-lint';
|
|
648
|
-
// Get project location from YAML input (if explicitly specified)
|
|
649
|
-
const explicitLocation = this.getInput(inputs, 'project_location', '');
|
|
650
|
-
// Get module - defaults to app
|
|
651
|
-
const module = this.getInput(inputs, 'module', 'app');
|
|
652
|
-
// Get variant - defaults to debug
|
|
653
|
-
const variant = this.getInput(inputs, 'variant', 'debug');
|
|
654
|
-
const commands = [];
|
|
655
|
-
commands.push('# Android Lint');
|
|
656
|
-
commands.push('');
|
|
657
|
-
// Add JAVA_HOME validation and auto-detection
|
|
658
|
-
commands.push('# Validate and auto-detect JAVA_HOME if needed');
|
|
659
|
-
commands.push('if [ -n "$JAVA_HOME" ] && [ ! -d "$JAVA_HOME" ]; then');
|
|
660
|
-
commands.push(' echo "⚠️ JAVA_HOME is set but points to invalid directory: $JAVA_HOME"');
|
|
661
|
-
commands.push(' ');
|
|
662
|
-
commands.push(' # Extract Java version from invalid path (e.g., "11" from /usr/lib/jvm/java-11-openjdk-amd64)');
|
|
663
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "java-[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
664
|
-
commands.push(' if [ -z "$REQUESTED_VERSION" ]; then');
|
|
665
|
-
commands.push(' # Try alternative patterns (e.g., openjdk@17, openjdk-17)');
|
|
666
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "(openjdk[@-])[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
667
|
-
commands.push(' fi');
|
|
668
|
-
commands.push(' ');
|
|
669
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
670
|
-
commands.push(' echo "Detected requested Java version: $REQUESTED_VERSION"');
|
|
671
|
-
commands.push(' echo "Attempting to find Java $REQUESTED_VERSION on this system..."');
|
|
672
|
-
commands.push(' else');
|
|
673
|
-
commands.push(' echo "Could not detect Java version from path, will try to find any Java..."');
|
|
674
|
-
commands.push(' fi');
|
|
675
|
-
commands.push(' echo ""');
|
|
676
|
-
commands.push(' ');
|
|
677
|
-
commands.push(' # Try to auto-detect Java for the requested version');
|
|
678
|
-
commands.push(' DETECTED_JAVA_HOME=""');
|
|
679
|
-
commands.push(' ');
|
|
680
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
681
|
-
commands.push(' # Check Homebrew installation paths for specific version (Apple Silicon)');
|
|
682
|
-
commands.push(' if [ -d "/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
683
|
-
commands.push(' DETECTED_JAVA_HOME="/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}"');
|
|
684
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Apple Silicon)"');
|
|
685
|
-
commands.push(' # Check Homebrew installation paths (Intel Mac)');
|
|
686
|
-
commands.push(' elif [ -d "/usr/local/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
687
|
-
commands.push(' DETECTED_JAVA_HOME="/usr/local/opt/openjdk@${REQUESTED_VERSION}"');
|
|
688
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Intel)"');
|
|
689
|
-
commands.push(' # Check Android Studio JBR');
|
|
690
|
-
commands.push(' elif [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then');
|
|
691
|
-
commands.push(' JBR_PATH="/Applications/Android Studio.app/Contents/jbr/Contents/Home"');
|
|
692
|
-
commands.push(' JBR_MAJOR=$(grep "^JAVA_VERSION=" "$JBR_PATH/release" 2>/dev/null | grep -oE \'"[0-9]+\' | tr -d \'"\' || echo "")');
|
|
693
|
-
commands.push(' if [ "$JBR_MAJOR" = "$REQUESTED_VERSION" ]; then');
|
|
694
|
-
commands.push(' DETECTED_JAVA_HOME="$JBR_PATH"');
|
|
695
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Android Studio JBR)"');
|
|
696
|
-
commands.push(' fi');
|
|
697
|
-
commands.push(' # Try macOS java_home utility for specific version');
|
|
698
|
-
commands.push(' elif [ -x "/usr/libexec/java_home" ]; then');
|
|
699
|
-
commands.push(' # java_home names Java 8 as 1.8, and answers an unmatched request');
|
|
700
|
-
commands.push(' # with the newest JDK rather than failing -- ask the right way or');
|
|
701
|
-
commands.push(' # silently get the wrong JDK.');
|
|
702
|
-
commands.push(' REQ_SPEC="$REQUESTED_VERSION"');
|
|
703
|
-
commands.push(' case "$REQUESTED_VERSION" in 1|2|3|4|5|6|7|8) REQ_SPEC="1.$REQUESTED_VERSION" ;; esac');
|
|
704
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "$REQ_SPEC" 2>/dev/null || true)');
|
|
705
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
706
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "${REQ_SPEC}.*" 2>/dev/null || true)');
|
|
707
|
-
commands.push(' fi');
|
|
708
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
709
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (java_home utility)"');
|
|
710
|
-
commands.push(' fi');
|
|
711
|
-
commands.push(' fi');
|
|
712
|
-
commands.push(' fi');
|
|
713
|
-
commands.push(' ');
|
|
714
|
-
commands.push(' # If specific version not found, try any Java as fallback');
|
|
715
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
716
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
717
|
-
commands.push(' echo "⚠️ Java $REQUESTED_VERSION not found, checking for other versions..."');
|
|
718
|
-
commands.push(' fi');
|
|
719
|
-
commands.push(' ');
|
|
720
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
721
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home 2>/dev/null || true)');
|
|
722
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
723
|
-
commands.push(' FALLBACK_VERSION=$("$DETECTED_JAVA_HOME/bin/java" -version 2>&1 | head -n 1 | grep -oE "[0-9]+" | head -n 1)');
|
|
724
|
-
commands.push(' echo "⚠️ Found Java $FALLBACK_VERSION instead of requested version $REQUESTED_VERSION"');
|
|
725
|
-
commands.push(' echo " Location: $DETECTED_JAVA_HOME"');
|
|
726
|
-
commands.push(' echo " ⚠️ WARNING: This may cause build issues if Java $REQUESTED_VERSION is required"');
|
|
727
|
-
commands.push(' fi');
|
|
728
|
-
commands.push(' fi');
|
|
729
|
-
commands.push(' fi');
|
|
730
|
-
commands.push(' ');
|
|
731
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ] && [ -d "$DETECTED_JAVA_HOME" ]; then');
|
|
732
|
-
commands.push(' export JAVA_HOME="$DETECTED_JAVA_HOME"');
|
|
733
|
-
commands.push(' echo "✅ Auto-corrected JAVA_HOME to: $JAVA_HOME"');
|
|
734
|
-
commands.push(' echo ""');
|
|
735
|
-
commands.push(' else');
|
|
736
|
-
commands.push(' echo ""');
|
|
737
|
-
commands.push(' echo "❌ Could not auto-detect valid Java installation"');
|
|
738
|
-
commands.push(' echo ""');
|
|
739
|
-
commands.push(' echo "JAVA_HOME is set to: $JAVA_HOME"');
|
|
740
|
-
commands.push(' echo "But this directory does not exist on your system."');
|
|
741
|
-
commands.push(' echo ""');
|
|
742
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
743
|
-
commands.push(' echo "Required Java version: $REQUESTED_VERSION"');
|
|
744
|
-
commands.push(' echo ""');
|
|
745
|
-
commands.push(' fi');
|
|
746
|
-
commands.push(' echo "To fix this issue:"');
|
|
747
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
748
|
-
commands.push(' echo " 1. Check available Java versions:"');
|
|
749
|
-
commands.push(' echo " /usr/libexec/java_home -V"');
|
|
750
|
-
commands.push(' echo ""');
|
|
751
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
752
|
-
commands.push(' echo " 2. Install Java $REQUESTED_VERSION via Homebrew:"');
|
|
753
|
-
commands.push(' echo " brew install openjdk@$REQUESTED_VERSION"');
|
|
754
|
-
commands.push(' else');
|
|
755
|
-
commands.push(' echo " 2. Install Java via Homebrew:"');
|
|
756
|
-
commands.push(' echo " brew install openjdk@17"');
|
|
757
|
-
commands.push(' fi');
|
|
758
|
-
commands.push(' echo ""');
|
|
759
|
-
commands.push(' echo " 3. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
760
|
-
commands.push(' else');
|
|
761
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
762
|
-
commands.push(' echo " 1. Install Java $REQUESTED_VERSION (Ubuntu/Debian):"');
|
|
763
|
-
commands.push(' echo " sudo apt-get install openjdk-${REQUESTED_VERSION}-jdk"');
|
|
764
|
-
commands.push(' else');
|
|
765
|
-
commands.push(' echo " 1. Install Java (Ubuntu/Debian):"');
|
|
766
|
-
commands.push(' echo " sudo apt-get install openjdk-17-jdk"');
|
|
767
|
-
commands.push(' fi');
|
|
768
|
-
commands.push(' echo ""');
|
|
769
|
-
commands.push(' echo " 2. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
770
|
-
commands.push(' fi');
|
|
771
|
-
commands.push(' echo ""');
|
|
772
|
-
commands.push(' exit 1');
|
|
773
|
-
commands.push(' fi');
|
|
774
|
-
commands.push('fi');
|
|
775
|
-
commands.push('');
|
|
776
|
-
// Determine project location at runtime: explicit > CIBUILD_SOURCE_DIR > current dir
|
|
777
|
-
if (explicitLocation && explicitLocation !== '.') {
|
|
778
|
-
commands.push(`PROJECT_DIR='${this.escapeBash(explicitLocation)}'`);
|
|
779
|
-
}
|
|
780
|
-
else {
|
|
781
|
-
commands.push('PROJECT_DIR="${CIBUILD_SOURCE_DIR:-.}"');
|
|
782
|
-
}
|
|
783
|
-
commands.push('echo "Project directory: $PROJECT_DIR"');
|
|
784
|
-
commands.push(`echo "Running lint on ${gradleProjectLabel(this.escapeBash(module))}"`);
|
|
785
|
-
commands.push(`echo "Variant: ${this.escapeBash(variant)}"`);
|
|
786
|
-
// Change to project directory
|
|
787
|
-
commands.push('');
|
|
788
|
-
commands.push('if [ "$PROJECT_DIR" != "." ]; then');
|
|
789
|
-
commands.push(' cd "$PROJECT_DIR"');
|
|
790
|
-
commands.push('fi');
|
|
791
|
-
// Make gradlew executable
|
|
792
|
-
commands.push('');
|
|
793
|
-
commands.push('# Make gradlew executable');
|
|
794
|
-
commands.push('if [ -f "./gradlew" ]; then');
|
|
795
|
-
commands.push(' chmod +x ./gradlew');
|
|
796
|
-
commands.push(' GRADLE_CMD="./gradlew"');
|
|
797
|
-
commands.push('elif command -v gradle &> /dev/null; then');
|
|
798
|
-
commands.push(' GRADLE_CMD="gradle"');
|
|
799
|
-
commands.push('else');
|
|
800
|
-
commands.push(' echo "Error: Neither ./gradlew nor gradle command found"');
|
|
801
|
-
commands.push(' exit 1');
|
|
802
|
-
commands.push('fi');
|
|
803
|
-
commands.push(...gradleMemoryCommands(this.getInput(inputs, 'jvmargs', ''), (v) => this.escapeBash(v), String(this.getInput(inputs, 'max_workers', '')).trim()));
|
|
804
|
-
commands.push(...gradleSdkCmakeCommands());
|
|
805
|
-
// Build lint task name
|
|
806
|
-
commands.push('');
|
|
807
|
-
commands.push('# Run lint');
|
|
808
|
-
const variantCapitalized = variant.charAt(0).toUpperCase() + variant.slice(1);
|
|
809
|
-
commands.push(...variantTaskCommands({
|
|
810
|
-
module,
|
|
811
|
-
variant,
|
|
812
|
-
prefix: 'lint',
|
|
813
|
-
suffix: '',
|
|
814
|
-
escape: (value) => this.escapeBash(value),
|
|
815
|
-
}));
|
|
816
|
-
commands.push('');
|
|
817
|
-
commands.push('# Lint completed');
|
|
818
|
-
commands.push('echo "Lint analysis completed successfully"');
|
|
819
|
-
commands.push(`echo "Lint report location: ${gradleProjectDir(this.escapeBash(module))}build/reports/lint-results-${this.escapeBash(variant)}.html"`);
|
|
820
|
-
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
821
|
-
return this.createScriptStep(script, stepName);
|
|
822
|
-
}
|
|
823
|
-
}
|
|
824
|
-
/**
|
|
825
|
-
* Android unit test step executor
|
|
826
|
-
* Runs Android unit tests
|
|
827
|
-
*/
|
|
828
|
-
export class AndroidUnitTestStepExecutor extends BaseStepExecutor {
|
|
829
|
-
getValidationRequirements(_inputs, env, _config) {
|
|
830
|
-
return [
|
|
831
|
-
this.requireEnvVar('JAVA_HOME', 'Java installation directory', env, 'Add a set-java-version step before android-unit-test, or set JAVA_HOME env var'),
|
|
832
|
-
this.runtimeRequirement('gradlew', 'Gradle wrapper (./gradlew) or gradle command', 'file', 'the checkout'),
|
|
833
|
-
];
|
|
834
|
-
}
|
|
835
|
-
async execute(inputs, env, config) {
|
|
836
|
-
const stepName = 'android-unit-test';
|
|
837
|
-
// Get project location from YAML input (if explicitly specified)
|
|
838
|
-
const explicitLocation = this.getInput(inputs, 'project_location', '');
|
|
839
|
-
// Get module - defaults to app
|
|
840
|
-
const module = this.getInput(inputs, 'module', 'app');
|
|
841
|
-
// Get variant - defaults to debug
|
|
842
|
-
const variant = this.getInput(inputs, 'variant', 'debug');
|
|
843
|
-
// Get test filter - optional
|
|
844
|
-
const testFilter = this.getInput(inputs, 'test_filter', '');
|
|
845
|
-
const commands = [];
|
|
846
|
-
commands.push('# Android Unit Tests');
|
|
847
|
-
commands.push('');
|
|
848
|
-
// Add JAVA_HOME validation and auto-detection
|
|
849
|
-
commands.push('# Validate and auto-detect JAVA_HOME if needed');
|
|
850
|
-
commands.push('if [ -n "$JAVA_HOME" ] && [ ! -d "$JAVA_HOME" ]; then');
|
|
851
|
-
commands.push(' echo "⚠️ JAVA_HOME is set but points to invalid directory: $JAVA_HOME"');
|
|
852
|
-
commands.push(' ');
|
|
853
|
-
commands.push(' # Extract Java version from invalid path (e.g., "11" from /usr/lib/jvm/java-11-openjdk-amd64)');
|
|
854
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "java-[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
855
|
-
commands.push(' if [ -z "$REQUESTED_VERSION" ]; then');
|
|
856
|
-
commands.push(' # Try alternative patterns (e.g., openjdk@17, openjdk-17)');
|
|
857
|
-
commands.push(' REQUESTED_VERSION=$(echo "$JAVA_HOME" | grep -oE "(openjdk[@-])[0-9]+" | grep -oE "[0-9]+" || echo "")');
|
|
858
|
-
commands.push(' fi');
|
|
859
|
-
commands.push(' ');
|
|
860
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
861
|
-
commands.push(' echo "Detected requested Java version: $REQUESTED_VERSION"');
|
|
862
|
-
commands.push(' echo "Attempting to find Java $REQUESTED_VERSION on this system..."');
|
|
863
|
-
commands.push(' else');
|
|
864
|
-
commands.push(' echo "Could not detect Java version from path, will try to find any Java..."');
|
|
865
|
-
commands.push(' fi');
|
|
866
|
-
commands.push(' echo ""');
|
|
867
|
-
commands.push(' ');
|
|
868
|
-
commands.push(' # Try to auto-detect Java for the requested version');
|
|
869
|
-
commands.push(' DETECTED_JAVA_HOME=""');
|
|
870
|
-
commands.push(' ');
|
|
871
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
872
|
-
commands.push(' # Check Homebrew installation paths for specific version (Apple Silicon)');
|
|
873
|
-
commands.push(' if [ -d "/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
874
|
-
commands.push(' DETECTED_JAVA_HOME="/opt/homebrew/opt/openjdk@${REQUESTED_VERSION}"');
|
|
875
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Apple Silicon)"');
|
|
876
|
-
commands.push(' # Check Homebrew installation paths (Intel Mac)');
|
|
877
|
-
commands.push(' elif [ -d "/usr/local/opt/openjdk@${REQUESTED_VERSION}" ]; then');
|
|
878
|
-
commands.push(' DETECTED_JAVA_HOME="/usr/local/opt/openjdk@${REQUESTED_VERSION}"');
|
|
879
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Homebrew Intel)"');
|
|
880
|
-
commands.push(' # Check Android Studio JBR');
|
|
881
|
-
commands.push(' elif [ -d "/Applications/Android Studio.app/Contents/jbr/Contents/Home" ]; then');
|
|
882
|
-
commands.push(' JBR_PATH="/Applications/Android Studio.app/Contents/jbr/Contents/Home"');
|
|
883
|
-
commands.push(' JBR_MAJOR=$(grep "^JAVA_VERSION=" "$JBR_PATH/release" 2>/dev/null | grep -oE \'"[0-9]+\' | tr -d \'"\' || echo "")');
|
|
884
|
-
commands.push(' if [ "$JBR_MAJOR" = "$REQUESTED_VERSION" ]; then');
|
|
885
|
-
commands.push(' DETECTED_JAVA_HOME="$JBR_PATH"');
|
|
886
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (Android Studio JBR)"');
|
|
887
|
-
commands.push(' fi');
|
|
888
|
-
commands.push(' # Try macOS java_home utility for specific version');
|
|
889
|
-
commands.push(' elif [ -x "/usr/libexec/java_home" ]; then');
|
|
890
|
-
commands.push(' # java_home names Java 8 as 1.8, and answers an unmatched request');
|
|
891
|
-
commands.push(' # with the newest JDK rather than failing -- ask the right way or');
|
|
892
|
-
commands.push(' # silently get the wrong JDK.');
|
|
893
|
-
commands.push(' REQ_SPEC="$REQUESTED_VERSION"');
|
|
894
|
-
commands.push(' case "$REQUESTED_VERSION" in 1|2|3|4|5|6|7|8) REQ_SPEC="1.$REQUESTED_VERSION" ;; esac');
|
|
895
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "$REQ_SPEC" 2>/dev/null || true)');
|
|
896
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
897
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home -v "${REQ_SPEC}.*" 2>/dev/null || true)');
|
|
898
|
-
commands.push(' fi');
|
|
899
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
900
|
-
commands.push(' echo "✅ Found Java $REQUESTED_VERSION at: $DETECTED_JAVA_HOME (java_home utility)"');
|
|
901
|
-
commands.push(' fi');
|
|
902
|
-
commands.push(' fi');
|
|
903
|
-
commands.push(' fi');
|
|
904
|
-
commands.push(' ');
|
|
905
|
-
commands.push(' # If specific version not found, try any Java as fallback');
|
|
906
|
-
commands.push(' if [ -z "$DETECTED_JAVA_HOME" ]; then');
|
|
907
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
908
|
-
commands.push(' echo "⚠️ Java $REQUESTED_VERSION not found, checking for other versions..."');
|
|
909
|
-
commands.push(' fi');
|
|
910
|
-
commands.push(' ');
|
|
911
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
912
|
-
commands.push(' DETECTED_JAVA_HOME=$(/usr/libexec/java_home 2>/dev/null || true)');
|
|
913
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ]; then');
|
|
914
|
-
commands.push(' FALLBACK_VERSION=$("$DETECTED_JAVA_HOME/bin/java" -version 2>&1 | head -n 1 | grep -oE "[0-9]+" | head -n 1)');
|
|
915
|
-
commands.push(' echo "⚠️ Found Java $FALLBACK_VERSION instead of requested version $REQUESTED_VERSION"');
|
|
916
|
-
commands.push(' echo " Location: $DETECTED_JAVA_HOME"');
|
|
917
|
-
commands.push(' echo " ⚠️ WARNING: This may cause build issues if Java $REQUESTED_VERSION is required"');
|
|
918
|
-
commands.push(' fi');
|
|
919
|
-
commands.push(' fi');
|
|
920
|
-
commands.push(' fi');
|
|
921
|
-
commands.push(' ');
|
|
922
|
-
commands.push(' if [ -n "$DETECTED_JAVA_HOME" ] && [ -d "$DETECTED_JAVA_HOME" ]; then');
|
|
923
|
-
commands.push(' export JAVA_HOME="$DETECTED_JAVA_HOME"');
|
|
924
|
-
commands.push(' echo "✅ Auto-corrected JAVA_HOME to: $JAVA_HOME"');
|
|
925
|
-
commands.push(' echo ""');
|
|
926
|
-
commands.push(' else');
|
|
927
|
-
commands.push(' echo ""');
|
|
928
|
-
commands.push(' echo "❌ Could not auto-detect valid Java installation"');
|
|
929
|
-
commands.push(' echo ""');
|
|
930
|
-
commands.push(' echo "JAVA_HOME is set to: $JAVA_HOME"');
|
|
931
|
-
commands.push(' echo "But this directory does not exist on your system."');
|
|
932
|
-
commands.push(' echo ""');
|
|
933
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
934
|
-
commands.push(' echo "Required Java version: $REQUESTED_VERSION"');
|
|
935
|
-
commands.push(' echo ""');
|
|
936
|
-
commands.push(' fi');
|
|
937
|
-
commands.push(' echo "To fix this issue:"');
|
|
938
|
-
commands.push(' if [ -x "/usr/libexec/java_home" ]; then');
|
|
939
|
-
commands.push(' echo " 1. Check available Java versions:"');
|
|
940
|
-
commands.push(' echo " /usr/libexec/java_home -V"');
|
|
941
|
-
commands.push(' echo ""');
|
|
942
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
943
|
-
commands.push(' echo " 2. Install Java $REQUESTED_VERSION via Homebrew:"');
|
|
944
|
-
commands.push(' echo " brew install openjdk@$REQUESTED_VERSION"');
|
|
945
|
-
commands.push(' else');
|
|
946
|
-
commands.push(' echo " 2. Install Java via Homebrew:"');
|
|
947
|
-
commands.push(' echo " brew install openjdk@17"');
|
|
948
|
-
commands.push(' fi');
|
|
949
|
-
commands.push(' echo ""');
|
|
950
|
-
commands.push(' echo " 3. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
951
|
-
commands.push(' else');
|
|
952
|
-
commands.push(' if [ -n "$REQUESTED_VERSION" ]; then');
|
|
953
|
-
commands.push(' echo " 1. Install Java $REQUESTED_VERSION (Ubuntu/Debian):"');
|
|
954
|
-
commands.push(' echo " sudo apt-get install openjdk-${REQUESTED_VERSION}-jdk"');
|
|
955
|
-
commands.push(' else');
|
|
956
|
-
commands.push(' echo " 1. Install Java (Ubuntu/Debian):"');
|
|
957
|
-
commands.push(' echo " sudo apt-get install openjdk-17-jdk"');
|
|
958
|
-
commands.push(' fi');
|
|
959
|
-
commands.push(' echo ""');
|
|
960
|
-
commands.push(' echo " 2. Update JAVA_HOME in your secrets or add set-java-version step"');
|
|
961
|
-
commands.push(' fi');
|
|
962
|
-
commands.push(' echo ""');
|
|
963
|
-
commands.push(' exit 1');
|
|
964
|
-
commands.push(' fi');
|
|
965
|
-
commands.push('fi');
|
|
966
|
-
commands.push('');
|
|
967
|
-
// Determine project location at runtime: explicit > CIBUILD_SOURCE_DIR > current dir
|
|
968
|
-
if (explicitLocation && explicitLocation !== '.') {
|
|
969
|
-
commands.push(`PROJECT_DIR='${this.escapeBash(explicitLocation)}'`);
|
|
970
|
-
}
|
|
971
|
-
else {
|
|
972
|
-
commands.push('PROJECT_DIR="${CIBUILD_SOURCE_DIR:-.}"');
|
|
973
|
-
}
|
|
974
|
-
commands.push('echo "Project directory: $PROJECT_DIR"');
|
|
975
|
-
commands.push(`echo "Running unit tests on ${gradleProjectLabel(this.escapeBash(module))}"`);
|
|
976
|
-
commands.push(`echo "Variant: ${this.escapeBash(variant)}"`);
|
|
977
|
-
// Change to project directory
|
|
978
|
-
commands.push('');
|
|
979
|
-
commands.push('if [ "$PROJECT_DIR" != "." ]; then');
|
|
980
|
-
commands.push(' cd "$PROJECT_DIR"');
|
|
981
|
-
commands.push('fi');
|
|
982
|
-
// Make gradlew executable
|
|
983
|
-
commands.push('');
|
|
984
|
-
commands.push('# Make gradlew executable');
|
|
985
|
-
commands.push('if [ -f "./gradlew" ]; then');
|
|
986
|
-
commands.push(' chmod +x ./gradlew');
|
|
987
|
-
commands.push(' GRADLE_CMD="./gradlew"');
|
|
988
|
-
commands.push('elif command -v gradle &> /dev/null; then');
|
|
989
|
-
commands.push(' GRADLE_CMD="gradle"');
|
|
990
|
-
commands.push('else');
|
|
991
|
-
commands.push(' echo "Error: Neither ./gradlew nor gradle command found"');
|
|
992
|
-
commands.push(' exit 1');
|
|
993
|
-
commands.push('fi');
|
|
994
|
-
commands.push(...gradleMemoryCommands(this.getInput(inputs, 'jvmargs', ''), (v) => this.escapeBash(v), String(this.getInput(inputs, 'max_workers', '')).trim()));
|
|
995
|
-
commands.push(...gradleSdkCmakeCommands());
|
|
996
|
-
// Build test task name
|
|
997
|
-
commands.push('');
|
|
998
|
-
commands.push('# Run unit tests');
|
|
999
|
-
const variantCapitalized = variant.charAt(0).toUpperCase() + variant.slice(1);
|
|
1000
|
-
// Add test filter if specified
|
|
1001
|
-
let gradleArgs = '';
|
|
1002
|
-
if (testFilter && testFilter.trim() !== '') {
|
|
1003
|
-
gradleArgs = `--tests '${this.escapeBash(testFilter)}'`;
|
|
1004
|
-
}
|
|
1005
|
-
commands.push(...variantTaskCommands({
|
|
1006
|
-
module,
|
|
1007
|
-
variant,
|
|
1008
|
-
prefix: 'test',
|
|
1009
|
-
suffix: 'UnitTest',
|
|
1010
|
-
gradleArgs,
|
|
1011
|
-
escape: (value) => this.escapeBash(value),
|
|
1012
|
-
}));
|
|
1013
|
-
commands.push('');
|
|
1014
|
-
commands.push('# Tests completed');
|
|
1015
|
-
commands.push('echo "Unit tests completed successfully"');
|
|
1016
|
-
commands.push(`echo "Test report location: ${gradleProjectDir(this.escapeBash(module))}build/reports/tests/test${variantCapitalized}UnitTest/index.html"`);
|
|
1017
|
-
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
1018
|
-
return this.createScriptStep(script, stepName);
|
|
1019
|
-
}
|
|
1020
|
-
}
|
|
1021
|
-
/**
|
|
1022
|
-
* Builds app APK and test APK for Android instrumented (UI) tests.
|
|
1023
|
-
* Runs assembleVariant and assembleVariantAndroidTest gradle tasks.
|
|
1024
|
-
*/
|
|
1025
|
-
export class AndroidBuildForUITestingStepExecutor extends BaseStepExecutor {
|
|
1026
|
-
getValidationRequirements(_inputs, env, _config) {
|
|
1027
|
-
return [
|
|
1028
|
-
this.requireEnvVar('JAVA_HOME', 'Java installation directory', env, 'Add a set-java-version step before this step'),
|
|
1029
|
-
];
|
|
1030
|
-
}
|
|
1031
|
-
getOutputs() {
|
|
1032
|
-
return [
|
|
1033
|
-
{ name: 'CIBUILD_APK_PATH', type: 'environment', description: 'Path to the app APK' },
|
|
1034
|
-
{ name: 'CIBUILD_TEST_APK_PATH', type: 'environment', description: 'Path to the test APK' },
|
|
1035
|
-
];
|
|
1036
|
-
}
|
|
1037
|
-
async execute(inputs, _env, _config) {
|
|
1038
|
-
const stepName = 'android-build-for-ui-testing';
|
|
1039
|
-
const projectLocation = this.getInput(inputs, 'project_location', '.');
|
|
1040
|
-
const module = this.getInput(inputs, 'module', 'app');
|
|
1041
|
-
const variant = this.getInput(inputs, 'variant', 'Debug');
|
|
1042
|
-
const extraArgs = this.getInput(inputs, 'arguments', '');
|
|
1043
|
-
const variantCap = variant.charAt(0).toUpperCase() + variant.slice(1);
|
|
1044
|
-
const commands = [];
|
|
1045
|
-
commands.push('# android-build-for-ui-testing');
|
|
1046
|
-
commands.push('echo "🧪 Building for UI testing..."');
|
|
1047
|
-
commands.push('');
|
|
1048
|
-
// Navigate to project
|
|
1049
|
-
if (projectLocation !== '.') {
|
|
1050
|
-
commands.push(`cd '${this.escapeBash(projectLocation)}'`);
|
|
1051
|
-
}
|
|
1052
|
-
else {
|
|
1053
|
-
commands.push('if [ -n "$CIBUILD_SOURCE_DIR" ]; then cd "$CIBUILD_SOURCE_DIR"; fi');
|
|
1054
|
-
}
|
|
1055
|
-
commands.push('');
|
|
1056
|
-
// gradlew
|
|
1057
|
-
commands.push('if [ -f "./gradlew" ]; then');
|
|
1058
|
-
commands.push(' chmod +x ./gradlew');
|
|
1059
|
-
commands.push(' GRADLE_CMD="./gradlew"');
|
|
1060
|
-
commands.push('else');
|
|
1061
|
-
commands.push(' GRADLE_CMD="gradle"');
|
|
1062
|
-
commands.push('fi');
|
|
1063
|
-
commands.push(...gradleMemoryCommands(this.getInput(inputs, 'jvmargs', ''), (v) => this.escapeBash(v), String(this.getInput(inputs, 'max_workers', '')).trim()));
|
|
1064
|
-
commands.push(...gradleSdkCmakeCommands());
|
|
1065
|
-
commands.push('');
|
|
1066
|
-
// Build both app and test APKs
|
|
1067
|
-
const appTask = gradleTaskPath(this.escapeBash(module), `assemble${variantCap}`);
|
|
1068
|
-
const testTask = gradleTaskPath(this.escapeBash(module), `assemble${variantCap}AndroidTest`);
|
|
1069
|
-
let cmd = `$GRADLE_CMD ${appTask} ${testTask}`;
|
|
1070
|
-
if (extraArgs) {
|
|
1071
|
-
cmd += ` ${extraArgs}`;
|
|
1072
|
-
}
|
|
1073
|
-
commands.push(`echo "Running: ${cmd}"`);
|
|
1074
|
-
commands.push(cmd);
|
|
1075
|
-
commands.push('');
|
|
1076
|
-
// Locate APKs
|
|
1077
|
-
commands.push('# Locate generated APKs');
|
|
1078
|
-
commands.push(`APP_APK=$(find . -path "*/${gradleProjectDir(this.escapeBash(module))}build/outputs/apk/*/*.apk" ! -name "*androidTest*" | head -1)`);
|
|
1079
|
-
commands.push(`TEST_APK=$(find . -path "*/${gradleProjectDir(this.escapeBash(module))}build/outputs/apk/*/*.apk" -name "*androidTest*" | head -1)`);
|
|
1080
|
-
commands.push('');
|
|
1081
|
-
commands.push('if [ -z "$APP_APK" ]; then');
|
|
1082
|
-
commands.push(' echo "⚠️ App APK not found"');
|
|
1083
|
-
commands.push('else');
|
|
1084
|
-
commands.push(' echo "App APK: $APP_APK"');
|
|
1085
|
-
commands.push(' envman add --key CIBUILD_APK_PATH --value "$APP_APK"');
|
|
1086
|
-
commands.push('fi');
|
|
1087
|
-
commands.push('');
|
|
1088
|
-
commands.push('if [ -z "$TEST_APK" ]; then');
|
|
1089
|
-
commands.push(' echo "⚠️ Test APK not found"');
|
|
1090
|
-
commands.push('else');
|
|
1091
|
-
commands.push(' echo "Test APK: $TEST_APK"');
|
|
1092
|
-
commands.push(' envman add --key CIBUILD_TEST_APK_PATH --value "$TEST_APK"');
|
|
1093
|
-
commands.push('fi');
|
|
1094
|
-
commands.push('');
|
|
1095
|
-
commands.push('echo "✅ UI testing build complete"');
|
|
1096
|
-
const script = this.createBashScriptFromCommands(commands, stepName);
|
|
1097
|
-
return this.createScriptStep(script, stepName);
|
|
1098
|
-
}
|
|
1099
|
-
}
|
|
1100
|
-
//# sourceMappingURL=android.js.map
|