UNPKG

eas-cli

Version:
42 lines (41 loc) 2.06 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.resolveGradleBuildContextAsync = void 0; const tslib_1 = require("tslib"); const eas_build_job_1 = require("@expo/eas-build-job"); const gradleUtils = tslib_1.__importStar(require("./gradleUtils")); const log_1 = tslib_1.__importDefault(require("../../log")); const workflow_1 = require("../../project/workflow"); async function resolveGradleBuildContextAsync(projectDir, buildProfile, vcsClient) { const workflow = await (0, workflow_1.resolveWorkflowAsync)(projectDir, eas_build_job_1.Platform.ANDROID, vcsClient); if (workflow === eas_build_job_1.Workflow.GENERIC) { try { if (buildProfile.gradleCommand) { const buildGradle = await gradleUtils.getAppBuildGradleAsync(projectDir); const parsedGradleCommand = buildProfile.gradleCommand ? gradleUtils.parseGradleCommand(buildProfile.gradleCommand, buildGradle) : undefined; if (parsedGradleCommand?.moduleName && parsedGradleCommand.moduleName !== gradleUtils.DEFAULT_MODULE_NAME) { log_1.default.warn(`Building modules different than "${gradleUtils.DEFAULT_MODULE_NAME}" might result in unexpected behavior.`); } return { moduleName: parsedGradleCommand?.moduleName ?? gradleUtils.DEFAULT_MODULE_NAME, flavor: parsedGradleCommand?.flavor, }; } else { return { moduleName: gradleUtils.DEFAULT_MODULE_NAME }; } } catch (err) { log_1.default.warn(`Unable to read gradle project config: ${err.message}.`); log_1.default.warn('Values from app/build.gradle might be resolved incorrectly.'); return undefined; } } else { return { moduleName: gradleUtils.DEFAULT_MODULE_NAME }; } } exports.resolveGradleBuildContextAsync = resolveGradleBuildContextAsync;