Skip to content

Commit

Permalink
Fix iproxy tool invocation on Linux
Browse files Browse the repository at this point in the history
nikita.romanov committed Nov 2, 2024
1 parent 8472500 commit 90c1c3d
Showing 5 changed files with 22 additions and 10 deletions.
14 changes: 9 additions & 5 deletions src/DotNet.Meteor.Common/Apple/IDeviceTool.cs
Original file line number Diff line number Diff line change
@@ -39,11 +39,15 @@ public static IEnumerable<DeviceData> Info() {
}
public static Process Proxy(string serial, int port, IProcessLogger? logger = null) {
var tool = new FileInfo(Path.Combine(AppleSdkLocator.IDeviceLocation(), "iproxy" + RuntimeSystem.ExecExtension));
var separator = RuntimeSystem.IsWindows ? ' ' : ':';
return new ProcessRunner(tool, new ProcessArgumentBuilder()
.Append($"{port}{separator}{port}")
.Append(serial), logger)
.Start();
return RuntimeSystem.IsWindows
? new ProcessRunner(tool, new ProcessArgumentBuilder()
.Append($"{port} {port}")
.Append(serial), logger)
.Start()
: new ProcessRunner(tool, new ProcessArgumentBuilder()
.Append($"{port}:{port}")
.Append("-u", serial), logger)
.Start();
}


10 changes: 8 additions & 2 deletions src/VSCode.Extension/controllers/configurationController.ts
Original file line number Diff line number Diff line change
@@ -14,6 +14,10 @@ export class ConfigurationController {
public static device: Device | undefined;
public static configuration: string | undefined;

public static onWindows: boolean = process.platform === 'win32';
public static onLinux: boolean = process.platform === 'linux';
public static onMac: boolean = process.platform === 'darwin';

public static activate(context: ExtensionContext) {
ConfigurationController.androidSdkDirectory = InteropController.getAndroidSdk();
}
@@ -56,7 +60,9 @@ export class ConfigurationController {
return ConfigurationController.getSetting(res.configIdMonoSdbDebuggerPortAndroid, res.configDefaultMonoSdbDebuggerPortAndroid);

if (ConfigurationController.isAppleMobile() && !ConfigurationController.device?.is_emulator)
return ConfigurationController.getSetting(res.configIdMonoSdbDebuggerPortApple, res.configDefaultMonoSdbDebuggerPortApple);
return ConfigurationController.onMac
? ConfigurationController.getSetting(res.configIdMonoSdbDebuggerPortApple, res.configDefaultMonoSdbDebuggerPortApple)
: 10000; /* We can't specify the port on Windows or Linux, so we use the default one */

return 0;
}
@@ -127,7 +133,7 @@ export class ConfigurationController {
if (ConfigurationController.isAppleMobile() || ConfigurationController.isMacCatalyst()) {
const outDir = path.dirname(targetPath);
const bundleName = InteropController.getPropertyValue('_AppBundleName', project, configuration, device);
const bundleExt = process.platform === 'darwin' ? '.app' : '.ipa';
const bundleExt = ConfigurationController.onMac ? '.app' : '.ipa';
if (bundleName !== undefined)
return path.join(outDir, bundleName + bundleExt);
}
3 changes: 2 additions & 1 deletion src/VSCode.Extension/controllers/interopController.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import { ConfigurationController } from './configurationController';
import { ProcessArgumentBuilder } from '../interop/processArgumentBuilder';
import { ProcessRunner } from '../interop/processRunner';
import { Project } from '../models/project';
@@ -10,7 +11,7 @@ export class InteropController {
private static workspaceToolPath: string;

public static activate(context: vscode.ExtensionContext) {
const executableExtension = process.platform === 'win32' ? '.exe' : '';
const executableExtension = ConfigurationController.onWindows ? '.exe' : '';
InteropController.workspaceToolPath = path.join(context.extensionPath, "extension", "bin", "Workspace", "DotNet.Meteor.Workspace" + executableExtension);
}

4 changes: 2 additions & 2 deletions src/VSCode.Extension/features/mauiEssentials.ts
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ export class MauiEssentials {

public async activate(context: vscode.ExtensionContext): Promise<void> {
const agentExecutable = path.join(context.extensionPath, "extension", "bin", "HotReload", "DotNet.Meteor.HotReload");
const agentExtension = process.platform === 'win32' ? '.exe' : '';
const agentExtension = ConfigurationController.onWindows ? '.exe' : '';
MauiEssentials.reloadAgentPath = agentExecutable + agentExtension;

context.subscriptions.push(vscode.commands.registerCommand(res.commandIdXamlReplaceCode, async (edit) => {
@@ -67,7 +67,7 @@ export class MauiEssentials {
private activateServer(context: vscode.ExtensionContext) {
const extensionPath = context.extensionPath;
const serverExecutable = path.join(extensionPath, "extension", "bin", "Xaml", "DotNet.Meteor.Xaml.LanguageServer");
const serverExtension = process.platform === 'win32' ? '.exe' : '';
const serverExtension = ConfigurationController.onWindows ? '.exe' : '';
MauiEssentials.languageServerPath = serverExecutable + serverExtension;

this.startServer();
1 change: 1 addition & 0 deletions src/VSCode.Extension/providers/dotnetTaskProvider.ts
Original file line number Diff line number Diff line change
@@ -31,6 +31,7 @@ export class DotNetTaskProvider implements vscode.TaskProvider {
// builder.conditional('-p:_BundlerDebug=true', () => !ConfigurationController.profiler);
// builder.conditional('-p:MtouchProfiling=true', () => ConfigurationController.profiler);
builder.append('-p:MtouchDebug=true');
builder.conditional('-p:BuildIpa=true', () => !ConfigurationController.onMac);
}
if (ConfigurationController.isMacCatalyst()) {
builder.conditional('-p:_BundlerDebug=true', () => !ConfigurationController.profiler);

0 comments on commit 90c1c3d

Please sign in to comment.