-
Notifications
You must be signed in to change notification settings - Fork 49
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
Handle eas build locally thorugh buildCommand in launch.json #833
Merged
maciekstosio
merged 8 commits into
main
from
@maciekstosio/Handle-eas-build-output-in-customBuild-command
Jan 14, 2025
+108
−33
Merged
Changes from all commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
44ac004
chore: extract path from eas build
maciekstosio 0663868
chore: handle compressed files
maciekstosio 3ce3cf7
chore: fix lint
maciekstosio c8904a7
feat: relax regex to match any path and take the first one
maciekstosio 8f47423
chore: improve logging and format checking
maciekstosio 600733d
Merge branch 'main' into @maciekstosio/Handle-eas-build-output-in-cus…
maciekstosio beb4e2b
Fix lint
maciekstosio f3d1821
Fix lint
maciekstosio File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
import { readdir } from "fs/promises"; | ||
import path from "path"; | ||
import { Logger } from "../Logger"; | ||
import { exec } from "../utilities/subprocess"; | ||
import { CancelToken } from "./cancelToken"; | ||
import { DevicePlatform } from "../common/DeviceManager"; | ||
|
||
export function isAppFile(name: string) { | ||
return name.endsWith(".app"); | ||
} | ||
|
||
export function isApkFile(name: string) { | ||
return name.endsWith(".apk"); | ||
} | ||
|
||
export async function extractTarApp( | ||
binaryPath: string, | ||
pathToExtract: string, | ||
cancelToken: CancelToken, | ||
platform: DevicePlatform | ||
) { | ||
const { failed } = await cancelToken.adapt( | ||
tarCommand({ archivePath: binaryPath, extractDir: pathToExtract }) | ||
); | ||
|
||
if (failed) { | ||
Logger.error(`Failed to extract archive '${binaryPath}' to '${pathToExtract}'.`); | ||
return undefined; | ||
} | ||
|
||
// assuming that the archive contains only one app file | ||
const appName = (await readdir(pathToExtract)).find( | ||
platform === DevicePlatform.Android ? isApkFile : isAppFile | ||
); | ||
if (!appName) { | ||
Logger.error( | ||
`Failed to find the ${ | ||
platform === DevicePlatform.Android ? ".apk" : ".app" | ||
} file in extracted archive '${binaryPath}'.` | ||
); | ||
return undefined; | ||
} | ||
|
||
const appPath = path.join(pathToExtract, appName); | ||
Logger.debug(`Extracted app archive to '${appPath}'.`); | ||
return appPath; | ||
} | ||
|
||
type TarCommandArgs = { archivePath: string; extractDir: string }; | ||
function tarCommand({ archivePath, extractDir }: TarCommandArgs) { | ||
return exec("tar", ["-xf", archivePath, "-C", extractDir]); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. perhaps would be better to use some existing module like |
||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
instead of having this here both here and in runExternalBuild maybe we should just make this metod return a single extracted file and then only make the file extension checks in
runExternalBuild