Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set Android versions even if no credentials are being provided #425

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 0 additions & 59 deletions packages/build-tools/src/android/gradleConfig.ts

This file was deleted.

21 changes: 19 additions & 2 deletions packages/build-tools/src/builders/android.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,13 @@ import {
import { uploadApplicationArchive } from '../utils/artifacts';
import { Hook, runHookIfPresent } from '../utils/hooks';
import { restoreCredentials } from '../android/credentials';
import { configureBuildGradle } from '../android/gradleConfig';
import { setupAsync } from '../common/setup';
import { prebuildAsync } from '../common/prebuild';
import { prepareExecutableAsync } from '../utils/prepareBuildExecutable';
import {
injectConfigureVersionGradleConfig,
injectCredentialsGradleConfig,
} from '../steps/utils/android/gradleConfig';

import { runBuilderWithHooksAsync } from './common';
import { runCustomBuildAsync } from './custom';
Expand Down Expand Up @@ -88,9 +91,23 @@ async function buildAsync(ctx: BuildContext<Android.Job>): Promise<void> {
) {
await ctx.runBuildPhase(BuildPhase.PREPARE_CREDENTIALS, async () => {
await restoreCredentials(ctx);
await configureBuildGradle(ctx);
await injectCredentialsGradleConfig(ctx.logger, ctx.getReactNativeProjectDirectory());
});
}

if (Boolean(ctx.job.version?.versionCode) || Boolean(ctx.job.version?.versionName)) {
await ctx.runBuildPhase(
BuildPhase.CUSTOM,
async () => {
await injectConfigureVersionGradleConfig(ctx.logger, ctx.getReactNativeProjectDirectory(), {
versionCode: ctx.job.version?.versionCode,
versionName: ctx.job.version?.versionName,
});
},
{}
);
}

await ctx.runBuildPhase(BuildPhase.CONFIGURE_EXPO_UPDATES, async () => {
await configureExpoUpdatesIfInstalledAsync(ctx, {
resolvedRuntimeVersion: resolvedExpoUpdatesRuntimeVersion?.runtimeVersion ?? null,
Expand Down
16 changes: 13 additions & 3 deletions packages/build-tools/src/context.ts
Original file line number Diff line number Diff line change
Expand Up @@ -178,14 +178,16 @@ export class BuildContext<TJob extends Job = Job> {
{
doNotMarkStart = false,
doNotMarkEnd = false,
phaseDisplayName,
}: {
doNotMarkStart?: boolean;
doNotMarkEnd?: boolean;
phaseDisplayName?: string;
} = {}
): Promise<T> {
let startTimestamp = Date.now();
try {
this.setBuildPhase(buildPhase, { doNotMarkStart });
this.setBuildPhase(buildPhase, { doNotMarkStart, phaseDisplayName });
startTimestamp = Date.now();
const result = await phase();
const durationMs = Date.now() - startTimestamp;
Expand Down Expand Up @@ -286,7 +288,13 @@ export class BuildContext<TJob extends Job = Job> {
return path.join(baseDirectory, this.job.projectRootDirectory ?? '.');
}

private setBuildPhase(buildPhase: BuildPhase, { doNotMarkStart = false } = {}): void {
private setBuildPhase(
buildPhase: BuildPhase,
{
doNotMarkStart = false,
phaseDisplayName,
}: { doNotMarkStart?: boolean; phaseDisplayName?: string } = {}
): void {
if (this.buildPhase) {
if (this.buildPhase === buildPhase) {
return;
Expand All @@ -299,7 +307,9 @@ export class BuildContext<TJob extends Job = Job> {
}
}
this.buildPhase = buildPhase;
this.logger = this.defaultLogger.child({ phase: buildPhase });
this.logger = this.defaultLogger.child({
phase: phaseDisplayName ?? buildPhase,
});
if (!doNotMarkStart) {
this.logger.info({ marker: LogMarker.START_PHASE }, `Start phase: ${this.buildPhase}`);
}
Expand Down
54 changes: 0 additions & 54 deletions packages/build-tools/templates/eas-build.gradle

This file was deleted.

Loading