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

Add buildScript option #504

Merged
merged 22 commits into from
Oct 3, 2024
Merged

Add buildScript option #504

merged 22 commits into from
Oct 3, 2024

Conversation

jakub-gonet
Copy link
Member

@jakub-gonet jakub-gonet commented Aug 19, 2024

Adds new configuration options to launch config:

  • buildScript – replacing default build process with any script that outputs built app's path as last line of standard output (e.g. fetching app binary from the internet or using built app from local fs). It's an object with ios and android string keys.
  • eas – replacing default build process with fetching app from EAS build service. It's an object with profile, useBuildType, and buildUUID keys. profile is used to select correct build profile from eas.json, useBuildType is either "latest" or "id" used to select either latest suitable build or selecting build via build UUID. buildUUID is required when using useBuildType: "id".

You can't specify both eas and buildScript for one platform.

Test plan

  • buildScript – simple "echo SOME_PATH" script for both platforms.
  • eas – tested both platforms, for "latest" and "id" strategies.

Followups

  • Add "matchAppVersion" option to use builds that match current branch app version for platform.
  • If using EAS, notify the user in the UI and provide a link to monitor build process (or periodically poll API that returns progress if it exists).
  • Consider best location to store build artifacts (right now uses system's temporary directory).
  • Consider allowing drag & drop for built artefacts.
  • Consider building a screen to select builds.

Resolves #150.

Copy link

vercel bot commented Aug 19, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
react-native-ide ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 3, 2024 8:59am

Base automatically changed from jgonet/simplify-build-manager to main August 22, 2024 14:21
Copy link
Collaborator

@filip131311 filip131311 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I left inline comment and question.

await buildProcess;

if (!apkPath || fs.existsSync(apkPath)) {
throw new Error("Build script didn't output any app path");
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that dis error will cause webview to display buildErrorAlert, but this error alert is redirecting the user to build logs, which is not usefull in this case, could you make a special case for external builds that displays appropriate message and redirects to launchConfiguration?

Screenshot 2024-08-23 at 14 24 43

packages/vscode-extension/src/builders/buildAndroid.ts Outdated Show resolved Hide resolved
packages/vscode-extension/package.json Outdated Show resolved Hide resolved
Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added some comments inline

packages/vscode-extension/src/builders/buildAndroid.ts Outdated Show resolved Hide resolved
packages/vscode-extension/package.json Outdated Show resolved Hide resolved
packages/vscode-extension/src/builders/buildAndroid.ts Outdated Show resolved Hide resolved
@jakub-gonet
Copy link
Member Author

Build works correctly, app crashes when launched. Need to investigate.

): Promise<string> {
const { stdout, lastLine: binaryPath } = await runExternalScript(cancelToken, externalCommand);

let easBinaryPath = await downloadAppFromEas(stdout, platform, cancelToken);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I understand this code is generic and not specific to EAS, why we use EAS in the method name then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is specific to EAS, we assume certain JSON structure.

const installApk = (allowDowngrade: boolean) =>
exec(
ADB_PATH,
["-s", this.serial!, "install", ...(allowDowngrade ? ["-d"] : []), "-r", build.apkPath],
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

any reason why we can't just always "allow downgrade" ??

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

adb only allows downgrading debuggable packages. If we assume that every app we install is debuggable then we can always do it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

that's a good point. I think it's ok to assume process is debuggable unless it's expo go

packages/vscode-extension/src/builders/buildAndroid.ts Outdated Show resolved Hide resolved
Copy link
Member

@kmagiera kmagiera left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think we can merge it as is. Would be great to do a quick follow up to add better caching, specifically for the eas builds. Now every fingerprint change will result in us downloading the same EAS build while as long as build ID stays the same, there's no reason to download the file again

@jakub-gonet jakub-gonet merged commit 175ea20 into main Oct 3, 2024
3 checks passed
@jakub-gonet jakub-gonet deleted the jgonet/prebuilt branch October 3, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Ability to use already created builds
3 participants