@expo/build-tools 0.1.103 → 0.1.104

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.
@@ -0,0 +1,3 @@
1
+ import { Android } from '@expo/eas-build-job';
2
+ import { BuildContext } from '../context';
3
+ export declare function configureBuildGradle(ctx: BuildContext<Android.Job>): Promise<void>;
@@ -0,0 +1,45 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.configureBuildGradle = void 0;
7
+ const path_1 = __importDefault(require("path"));
8
+ const config_plugins_1 = require("@expo/config-plugins");
9
+ const fs_extra_1 = __importDefault(require("fs-extra"));
10
+ const EAS_BUILD_GRADLE_TEMPLATE_PATH = path_1.default.join(__dirname, '../../templates/eas-build.gradle');
11
+ const APPLY_EAS_BUILD_GRADLE_LINE = 'apply from: "./eas-build.gradle"';
12
+ async function configureBuildGradle(ctx) {
13
+ ctx.logger.info('Injecting signing config into build.gradle');
14
+ await deleteEasBuildGradle(ctx.reactNativeProjectDirectory);
15
+ await createEasBuildGradle(ctx.reactNativeProjectDirectory);
16
+ await addApplyToBuildGradle(ctx.reactNativeProjectDirectory);
17
+ }
18
+ exports.configureBuildGradle = configureBuildGradle;
19
+ async function deleteEasBuildGradle(projectRoot) {
20
+ const easBuildGradlePath = getEasBuildGradlePath(projectRoot);
21
+ await fs_extra_1.default.remove(easBuildGradlePath);
22
+ }
23
+ function getEasBuildGradlePath(projectRoot) {
24
+ return path_1.default.join(projectRoot, 'android/app/eas-build.gradle');
25
+ }
26
+ async function createEasBuildGradle(projectRoot) {
27
+ const easBuildGradlePath = getEasBuildGradlePath(projectRoot);
28
+ await fs_extra_1.default.copy(EAS_BUILD_GRADLE_TEMPLATE_PATH, easBuildGradlePath);
29
+ }
30
+ async function addApplyToBuildGradle(projectRoot) {
31
+ const buildGradlePath = config_plugins_1.AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);
32
+ const buildGradleContents = await fs_extra_1.default.readFile(path_1.default.join(buildGradlePath), 'utf8');
33
+ if (hasLine(buildGradleContents, APPLY_EAS_BUILD_GRADLE_LINE)) {
34
+ return;
35
+ }
36
+ await fs_extra_1.default.writeFile(buildGradlePath, `${buildGradleContents.trim()}\n${APPLY_EAS_BUILD_GRADLE_LINE}\n`);
37
+ }
38
+ function hasLine(haystack, needle) {
39
+ return (haystack
40
+ .replace(/\r\n/g, '\n')
41
+ .split('\n')
42
+ // Check for both single and double quotes
43
+ .some((line) => line === needle || line === needle.replace(/"/g, "'")));
44
+ }
45
+ //# sourceMappingURL=gradleConfig.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"gradleConfig.js","sourceRoot":"","sources":["../../src/android/gradleConfig.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AAExB,yDAAqD;AAErD,wDAA0B;AAI1B,MAAM,8BAA8B,GAAG,cAAI,CAAC,IAAI,CAAC,SAAS,EAAE,kCAAkC,CAAC,CAAC;AAChG,MAAM,2BAA2B,GAAG,kCAAkC,CAAC;AAEhE,KAAK,UAAU,oBAAoB,CAAC,GAA8B;IACvE,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,4CAA4C,CAAC,CAAC;IAC9D,MAAM,oBAAoB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC5D,MAAM,oBAAoB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;IAC5D,MAAM,qBAAqB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AAC/D,CAAC;AALD,oDAKC;AAED,KAAK,UAAU,oBAAoB,CAAC,WAAmB;IACrD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,kBAAE,CAAC,MAAM,CAAC,kBAAkB,CAAC,CAAC;AACtC,CAAC;AAED,SAAS,qBAAqB,CAAC,WAAmB;IAChD,OAAO,cAAI,CAAC,IAAI,CAAC,WAAW,EAAE,8BAA8B,CAAC,CAAC;AAChE,CAAC;AAED,KAAK,UAAU,oBAAoB,CAAC,WAAmB;IACrD,MAAM,kBAAkB,GAAG,qBAAqB,CAAC,WAAW,CAAC,CAAC;IAC9D,MAAM,kBAAE,CAAC,IAAI,CAAC,8BAA8B,EAAE,kBAAkB,CAAC,CAAC;AACpE,CAAC;AAED,KAAK,UAAU,qBAAqB,CAAC,WAAmB;IACtD,MAAM,eAAe,GAAG,8BAAa,CAAC,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;IACnF,MAAM,mBAAmB,GAAG,MAAM,kBAAE,CAAC,QAAQ,CAAC,cAAI,CAAC,IAAI,CAAC,eAAe,CAAC,EAAE,MAAM,CAAC,CAAC;IAElF,IAAI,OAAO,CAAC,mBAAmB,EAAE,2BAA2B,CAAC,EAAE;QAC7D,OAAO;KACR;IAED,MAAM,kBAAE,CAAC,SAAS,CAChB,eAAe,EACf,GAAG,mBAAmB,CAAC,IAAI,EAAE,KAAK,2BAA2B,IAAI,CAClE,CAAC;AACJ,CAAC;AAED,SAAS,OAAO,CAAC,QAAgB,EAAE,MAAc;IAC/C,OAAO,CACL,QAAQ;SACL,OAAO,CAAC,OAAO,EAAE,IAAI,CAAC;SACtB,KAAK,CAAC,IAAI,CAAC;QACZ,0CAA0C;SACzC,IAAI,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,KAAK,MAAM,IAAI,IAAI,KAAK,MAAM,CAAC,OAAO,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC,CACzE,CAAC;AACJ,CAAC","sourcesContent":["import path from 'path';\n\nimport { AndroidConfig } from '@expo/config-plugins';\nimport { Android } from '@expo/eas-build-job';\nimport fs from 'fs-extra';\n\nimport { BuildContext } from '../context';\n\nconst EAS_BUILD_GRADLE_TEMPLATE_PATH = path.join(__dirname, '../../templates/eas-build.gradle');\nconst APPLY_EAS_BUILD_GRADLE_LINE = 'apply from: \"./eas-build.gradle\"';\n\nexport async function configureBuildGradle(ctx: BuildContext<Android.Job>): Promise<void> {\n ctx.logger.info('Injecting signing config into build.gradle');\n await deleteEasBuildGradle(ctx.reactNativeProjectDirectory);\n await createEasBuildGradle(ctx.reactNativeProjectDirectory);\n await addApplyToBuildGradle(ctx.reactNativeProjectDirectory);\n}\n\nasync function deleteEasBuildGradle(projectRoot: string): Promise<void> {\n const easBuildGradlePath = getEasBuildGradlePath(projectRoot);\n await fs.remove(easBuildGradlePath);\n}\n\nfunction getEasBuildGradlePath(projectRoot: string): string {\n return path.join(projectRoot, 'android/app/eas-build.gradle');\n}\n\nasync function createEasBuildGradle(projectRoot: string): Promise<void> {\n const easBuildGradlePath = getEasBuildGradlePath(projectRoot);\n await fs.copy(EAS_BUILD_GRADLE_TEMPLATE_PATH, easBuildGradlePath);\n}\n\nasync function addApplyToBuildGradle(projectRoot: string): Promise<void> {\n const buildGradlePath = AndroidConfig.Paths.getAppBuildGradleFilePath(projectRoot);\n const buildGradleContents = await fs.readFile(path.join(buildGradlePath), 'utf8');\n\n if (hasLine(buildGradleContents, APPLY_EAS_BUILD_GRADLE_LINE)) {\n return;\n }\n\n await fs.writeFile(\n buildGradlePath,\n `${buildGradleContents.trim()}\\n${APPLY_EAS_BUILD_GRADLE_LINE}\\n`\n );\n}\n\nfunction hasLine(haystack: string, needle: string): boolean {\n return (\n haystack\n .replace(/\\r\\n/g, '\\n')\n .split('\\n')\n // Check for both single and double quotes\n .some((line) => line === needle || line === needle.replace(/\"/g, \"'\"))\n );\n}\n"]}
@@ -1,6 +1,5 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- const config_plugins_1 = require("@expo/config-plugins");
4
3
  const eas_build_job_1 = require("@expo/eas-build-job");
5
4
  const context_1 = require("../context");
6
5
  const expoUpdates_1 = require("../utils/expoUpdates");
@@ -9,6 +8,7 @@ const project_1 = require("../utils/project");
9
8
  const buildArtifacts_1 = require("../utils/buildArtifacts");
10
9
  const hooks_1 = require("../utils/hooks");
11
10
  const credentials_1 = require("../android/credentials");
11
+ const gradleConfig_1 = require("../android/gradleConfig");
12
12
  async function androidBuilder(ctx) {
13
13
  await project_1.setup(ctx);
14
14
  const hasNativeCode = ctx.job.type === eas_build_job_1.Workflow.GENERIC;
@@ -19,7 +19,7 @@ async function androidBuilder(ctx) {
19
19
  }
20
20
  else {
21
21
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREBUILD, async () => {
22
- await ejectProject(ctx);
22
+ await ctx.ejectProvider.runEject(ctx);
23
23
  });
24
24
  }
25
25
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.RESTORE_CACHE, async () => {
@@ -32,6 +32,7 @@ async function androidBuilder(ctx) {
32
32
  if (ctx.job.secrets.buildCredentials) {
33
33
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.PREPARE_CREDENTIALS, async () => {
34
34
  await credentials_1.restoreCredentials(ctx);
35
+ await gradleConfig_1.configureBuildGradle(ctx);
35
36
  });
36
37
  }
37
38
  await ctx.runBuildPhase(eas_build_job_1.BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {
@@ -76,8 +77,4 @@ function resolveGradleCommand(job) {
76
77
  return ':app:bundleRelease';
77
78
  }
78
79
  }
79
- async function ejectProject(ctx) {
80
- await ctx.ejectProvider.runEject(ctx);
81
- await config_plugins_1.AndroidConfig.EasBuild.configureEasBuildAsync(ctx.reactNativeProjectDirectory);
82
- }
83
80
  //# sourceMappingURL=android.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,yDAAqD;AACrD,uDAAoE;AAEpE,wCAAgE;AAChE,sDAA4E;AAC5E,8CAAyF;AACzF,8CAAyC;AACzC,4DAA6D;AAC7D,0CAAwD;AACxD,wDAA4D;AAE7C,KAAK,UAAU,cAAc,CAAC,GAA8B;IACzE,MAAM,eAAK,CAAC,GAAG,CAAC,CAA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AE;QAChC,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;QACzB,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,GAAG,CAAC,SAAS,KAAK,uBAAO,CAAC,SAAS,CAAC,GAAG,EAAE;QAClD,OAAO,sBAAsB,CAAC;KAC/B;SAAM;QACL,OAAO,oBAAoB,CAAC;KAC7B;AACH,CAAC;AAED,KAAK,UAAU,YAAY,CAAC,GAA8B;IACxD,MAAM,GAAG,CAAC,aAAa,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;IACtC,MAAM,8BAAa,CAAC,QAAQ,CAAC,sBAAsB,CAAC,GAAG,CAAC,2BAA2B,CAAC,CAAC;AACvF,CAAC","sourcesContent":["import { AndroidConfig } from '@expo/config-plugins';\nimport { Android, BuildPhase, Workflow } from '@expo/eas-build-job';\n\nimport { BuildContext, SkipNativeBuildError } from '../context';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { runGradleCommand, ensureLFLineEndingsInGradlewScript } from '../android/gradle';\nimport { setup } from '../utils/project';\nimport { findBuildArtifacts } from '../utils/buildArtifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { restoreCredentials } from '../android/credentials';\n\nexport default async function androidBuilder(ctx: BuildContext<Android.Job>): Promise<string[]> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n if (hasNativeCode) {\n await ctx.runBuildPhase(BuildPhase.FIX_GRADLEW, async () => {\n await ensureLFLineEndingsInGradlewScript(ctx);\n });\n } else {\n await ctx.runBuildPhase(BuildPhase.PREBUILD, async () => {\n await ejectProject(ctx);\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n if (ctx.job.secrets.buildCredentials) {\n await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n await restoreCredentials(ctx);\n });\n }\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n if (ctx.skipNativeBuild) {\n throw new SkipNativeBuildError('Skipping Gradle build');\n }\n await ctx.runBuildPhase(BuildPhase.RUN_GRADLEW, async () => {\n const gradleCommand = resolveGradleCommand(ctx.job);\n await runGradleCommand(ctx, gradleCommand);\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n return await ctx.runBuildPhase(\n BuildPhase.UPLOAD_ARTIFACTS,\n async () => {\n const buildArtifacts = await findBuildArtifacts(\n ctx.reactNativeProjectDirectory,\n ctx.job.artifactPath ?? 'android/app/build/outputs/**/*.{apk,aab}',\n ctx.logger\n );\n ctx.logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n return buildArtifacts;\n },\n { doNotMarkEnd: true }\n );\n}\n\nfunction resolveGradleCommand(job: Android.Job): string {\n if (job.gradleCommand) {\n return job.gradleCommand;\n } else if (job.developmentClient) {\n return ':app:assembleDebug';\n } else if (!job.buildType) {\n return ':app:bundleRelease';\n } else if (job.buildType === Android.BuildType.APK) {\n return ':app:assembleRelease';\n } else {\n return ':app:bundleRelease';\n }\n}\n\nasync function ejectProject(ctx: BuildContext<Android.Job>): Promise<void> {\n await ctx.ejectProvider.runEject(ctx);\n await AndroidConfig.EasBuild.configureEasBuildAsync(ctx.reactNativeProjectDirectory);\n}\n"]}
1
+ {"version":3,"file":"android.js","sourceRoot":"","sources":["../../src/builders/android.ts"],"names":[],"mappings":";;AAAA,uDAAoE;AAEpE,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C;QACjE,OAAO,cAAc,CAAC;IACxB,CAAC,EACD,EAAE,YAAY,EAAE,IAAI,EAAE,CACvB,CAAC;AACJ,CAAC;AA7DD,iCA6DC;AAED,SAAS,oBAAoB,CAAC,GAAgB;IAC5C,IAAI,GAAG,CAAC,aAAa,EAAE;QACrB,OAAO,GAAG,CAAC,aAAa,CAAC;KAC1B;SAAM,IAAI,GAAG,CAAC,iBAAiB,EAAE;QAChC,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE;QACzB,OAAO,oBAAoB,CAAC;KAC7B;SAAM,IAAI,GAAG,CAAC,SAAS,KAAK,uBAAO,CAAC,SAAS,CAAC,GAAG,EAAE;QAClD,OAAO,sBAAsB,CAAC;KAC/B;SAAM;QACL,OAAO,oBAAoB,CAAC;KAC7B;AACH,CAAC","sourcesContent":["import { Android, BuildPhase, Workflow } from '@expo/eas-build-job';\n\nimport { BuildContext, SkipNativeBuildError } from '../context';\nimport { configureExpoUpdatesIfInstalledAsync } from '../utils/expoUpdates';\nimport { runGradleCommand, ensureLFLineEndingsInGradlewScript } from '../android/gradle';\nimport { setup } from '../utils/project';\nimport { findBuildArtifacts } from '../utils/buildArtifacts';\nimport { Hook, runHookIfPresent } from '../utils/hooks';\nimport { restoreCredentials } from '../android/credentials';\nimport { configureBuildGradle } from '../android/gradleConfig';\n\nexport default async function androidBuilder(ctx: BuildContext<Android.Job>): Promise<string[]> {\n await setup(ctx);\n const hasNativeCode = ctx.job.type === Workflow.GENERIC;\n\n if (hasNativeCode) {\n await ctx.runBuildPhase(BuildPhase.FIX_GRADLEW, async () => {\n await ensureLFLineEndingsInGradlewScript(ctx);\n });\n } else {\n await ctx.runBuildPhase(BuildPhase.PREBUILD, async () => {\n await ctx.ejectProvider.runEject(ctx);\n });\n }\n\n await ctx.runBuildPhase(BuildPhase.RESTORE_CACHE, async () => {\n await ctx.cacheManager?.restoreCache(ctx);\n });\n\n await ctx.runBuildPhase(BuildPhase.POST_INSTALL_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.POST_INSTALL);\n });\n\n if (ctx.job.secrets.buildCredentials) {\n await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {\n await restoreCredentials(ctx);\n await configureBuildGradle(ctx);\n });\n }\n await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {\n await configureExpoUpdatesIfInstalledAsync(ctx);\n });\n\n if (ctx.skipNativeBuild) {\n throw new SkipNativeBuildError('Skipping Gradle build');\n }\n await ctx.runBuildPhase(BuildPhase.RUN_GRADLEW, async () => {\n const gradleCommand = resolveGradleCommand(ctx.job);\n await runGradleCommand(ctx, gradleCommand);\n });\n\n await ctx.runBuildPhase(BuildPhase.PRE_UPLOAD_ARTIFACTS_HOOK, async () => {\n await runHookIfPresent(ctx, Hook.PRE_UPLOAD_ARTIFACTS);\n });\n\n await ctx.runBuildPhase(BuildPhase.SAVE_CACHE, async () => {\n await ctx.cacheManager?.saveCache(ctx);\n });\n\n return await ctx.runBuildPhase(\n BuildPhase.UPLOAD_ARTIFACTS,\n async () => {\n const buildArtifacts = await findBuildArtifacts(\n ctx.reactNativeProjectDirectory,\n ctx.job.artifactPath ?? 'android/app/build/outputs/**/*.{apk,aab}',\n ctx.logger\n );\n ctx.logger.info(`Build artifacts: ${buildArtifacts.join(', ')}`);\n return buildArtifacts;\n },\n { doNotMarkEnd: true }\n );\n}\n\nfunction resolveGradleCommand(job: Android.Job): string {\n if (job.gradleCommand) {\n return job.gradleCommand;\n } else if (job.developmentClient) {\n return ':app:assembleDebug';\n } else if (!job.buildType) {\n return ':app:bundleRelease';\n } else if (job.buildType === Android.BuildType.APK) {\n return ':app:assembleRelease';\n } else {\n return ':app:bundleRelease';\n }\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@expo/build-tools",
3
- "version": "0.1.103",
3
+ "version": "0.1.104",
4
4
  "main": "dist/index.js",
5
5
  "types": "dist/index.d.ts",
6
6
  "files": [
@@ -0,0 +1,51 @@
1
+ // Build integration with EAS
2
+
3
+ import java.nio.file.Paths
4
+
5
+ android {
6
+ signingConfigs {
7
+ release {
8
+ // This is necessary to avoid needing the user to define a release signing config manually
9
+ // If no release config is defined, and this is not present, build for assembleRelease will crash
10
+ }
11
+ }
12
+
13
+ buildTypes {
14
+ release {
15
+ // This is necessary to avoid needing the user to define a release build type manually
16
+ }
17
+ debug {
18
+ // This is necessary to avoid needing the user to define a debug build type manually
19
+ }
20
+ }
21
+ }
22
+
23
+ tasks.whenTaskAdded {
24
+ android.signingConfigs.release {
25
+ def credentialsJson = rootProject.file("../credentials.json");
26
+ def credentials = new groovy.json.JsonSlurper().parse(credentialsJson)
27
+ def keystorePath = Paths.get(credentials.android.keystore.keystorePath);
28
+ def storeFilePath = keystorePath.isAbsolute()
29
+ ? keystorePath
30
+ : rootProject.file("..").toPath().resolve(keystorePath);
31
+
32
+ storeFile storeFilePath.toFile()
33
+ storePassword credentials.android.keystore.keystorePassword
34
+ keyAlias credentials.android.keystore.keyAlias
35
+ if (credentials.android.keystore.containsKey("keyPassword")) {
36
+ keyPassword credentials.android.keystore.keyPassword
37
+ } else {
38
+ // key password is required by Gradle, but PKCS keystores don't have one
39
+ // using the keystore password seems to satisfy the requirement
40
+ keyPassword credentials.android.keystore.keystorePassword
41
+ }
42
+ }
43
+
44
+ android.buildTypes.release {
45
+ signingConfig android.signingConfigs.release
46
+ }
47
+
48
+ android.buildTypes.debug {
49
+ signingConfig android.signingConfigs.release
50
+ }
51
+ }