-
Notifications
You must be signed in to change notification settings - Fork 32
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
Use bundle and add proper logging for pod installation #617
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
1a17a06
Stashing work
kmagiera 696ac74
Cleanup
kmagiera 8a1387d
Stashing work
kmagiera d751f19
Install pods along with clean build
kmagiera fcc39e0
Fix startup message logic and display 'open logs' message there
kmagiera d3d66f4
Merge remote-tracking branch 'origin/main' into kmagiera/bundle-pods-…
kmagiera f6b07bc
Reset unintended changes
kmagiera 5e69f2c
Output
kmagiera 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,11 @@ | ||
import fs from "fs"; | ||
import path from "path"; | ||
import { EventEmitter } from "stream"; | ||
import { Disposable } from "vscode"; | ||
import { Disposable, OutputChannel } from "vscode"; | ||
import semver, { SemVer } from "semver"; | ||
import { Logger } from "../Logger"; | ||
import { EMULATOR_BINARY } from "../devices/AndroidEmulatorDevice"; | ||
import { command } from "../utilities/subprocess"; | ||
import { command, lineReader } from "../utilities/subprocess"; | ||
import { extensionContext, getAppRootFolder } from "../utilities/extensionContext"; | ||
import { getIosSourceDir } from "../builders/buildIOS"; | ||
import { isExpoGoProject } from "../builders/expoGo"; | ||
|
@@ -155,7 +155,7 @@ export class DependencyManager implements Disposable, DependencyManagerInterface | |
return true; | ||
} | ||
|
||
public async installPods(cancelToken: CancelToken) { | ||
public async installPods(buildOutpuChannel: OutputChannel, cancelToken: CancelToken) { | ||
const appRootFolder = getAppRootFolder(); | ||
const iosDirPath = getIosSourceDir(appRootFolder); | ||
|
||
|
@@ -164,16 +164,15 @@ export class DependencyManager implements Disposable, DependencyManagerInterface | |
throw new Error("ios directory was not found inside the workspace."); | ||
} | ||
|
||
const commandInIosDir = (args: string) => { | ||
try { | ||
const env = getLaunchConfiguration().env; | ||
return command(args, { | ||
const shouldUseBundle = await this.shouldUseBundleCommand(); | ||
const process = command(shouldUseBundle ? "bundle exec pod install" : "pod install", { | ||
cwd: iosDirPath, | ||
env: { ...env, LANG: "en_US.UTF-8" }, | ||
}); | ||
}; | ||
|
||
try { | ||
await cancelToken.adapt(commandInIosDir("pod install")); | ||
lineReader(process).onLineRead((line) => buildOutpuChannel.appendLine(line)); | ||
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. typo: |
||
await cancelToken.adapt(process); | ||
} catch (e) { | ||
Logger.error("Pods not installed", e); | ||
this.emitEvent("pods", { status: "notInstalled", isOptional: false }); | ||
|
@@ -219,8 +218,21 @@ export class DependencyManager implements Disposable, DependencyManagerInterface | |
}); | ||
} | ||
|
||
private async shouldUseBundleCommand() { | ||
const gemfile = path.join(getAppRootFolder(), "Gemfile"); | ||
try { | ||
await fs.promises.access(gemfile); | ||
return true; | ||
} catch (e) { | ||
return false; | ||
} | ||
} | ||
|
||
private async checkPodsCommandStatus() { | ||
const installed = await testCommand("pod --version"); | ||
const shouldUseBundle = await this.shouldUseBundleCommand(); | ||
const installed = await testCommand( | ||
shouldUseBundle ? "bundle exec pod --version" : "pod --version" | ||
); | ||
this.emitEvent("cocoaPods", { | ||
status: installed ? "installed" : "notInstalled", | ||
isOptional: !(await projectRequiresNativeBuild()), | ||
|
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
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.
typo:
buildOutpuChannel -> buildOutputChannel