Skip to content

fix(cli): adjust SPM parameters for build and run commands #7342

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

Merged
merged 9 commits into from
Mar 15, 2024
Merged
Show file tree
Hide file tree
Changes from 8 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
18 changes: 16 additions & 2 deletions cli/src/ios/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { runTask } from '../common';
import type { Config } from '../definitions';
import { logSuccess } from '../log';
import type { BuildCommandOptions } from '../tasks/build';
import { checkPackageManager } from '../util/spm';
import { runCommand } from '../util/subprocess';

export async function buildiOS(
Expand All @@ -14,12 +15,25 @@ export async function buildiOS(
): Promise<void> {
const theScheme = buildOptions.scheme ?? 'App';

const packageManager = await checkPackageManager(config);

let typeOfBuild: string;
let projectName: string;

if (packageManager == 'Cocoapods') {
typeOfBuild = '-workspace';
projectName = basename(await config.ios.nativeXcodeWorkspaceDirAbs);
} else {
typeOfBuild = '-project';
projectName = basename(await config.ios.nativeXcodeProjDirAbs);
}

await runTask('Building xArchive', async () =>
runCommand(
'xcodebuild',
[
'-workspace',
basename(await config.ios.nativeXcodeWorkspaceDirAbs),
typeOfBuild,
projectName,
'-scheme',
`${theScheme}`,
'-destination',
Expand Down
18 changes: 16 additions & 2 deletions cli/src/ios/run.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import { promptForPlatformTarget, runTask } from '../common';
import type { Config } from '../definitions';
import type { RunCommandOptions } from '../tasks/run';
import { runNativeRun, getPlatformTargets } from '../util/native-run';
import { checkPackageManager } from '../util/spm';
import { runCommand } from '../util/subprocess';

const debug = Debug('capacitor:ios:run');
Expand All @@ -32,9 +33,22 @@ export async function runIOS(
target.id,
);

const packageManager = await checkPackageManager(config);

let typeOfBuild: string;
let projectName: string;

if (packageManager == 'Cocoapods') {
typeOfBuild = '-workspace';
projectName = basename(await config.ios.nativeXcodeWorkspaceDirAbs);
} else {
typeOfBuild = '-project';
projectName = basename(await config.ios.nativeXcodeProjDirAbs);
}

const xcodebuildArgs = [
'-workspace',
basename(await config.ios.nativeXcodeWorkspaceDirAbs),
typeOfBuild,
projectName,
'-scheme',
runScheme,
'-configuration',
Expand Down
12 changes: 5 additions & 7 deletions core/http.md
Original file line number Diff line number Diff line change
Expand Up @@ -267,9 +267,9 @@ https://nodejs.org/api/buffer.html#class-blob

#### ArrayBuffer

Represents a raw buffer of binary data, which is used to store data for the
different typed arrays. ArrayBuffers cannot be read from or written to directly,
but can be passed to a typed array or DataView Object to interpret the raw
Represents a raw buffer of binary data, which is used to store data for the
different typed arrays. ArrayBuffers cannot be read from or written to directly,
but can be passed to a typed array or DataView Object to interpret the raw
buffer as needed.

| Prop | Type | Description |
Expand Down Expand Up @@ -530,7 +530,7 @@ https://nodejs.org/api/url.html#class-urlsearchparams

#### Uint8Array

A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
A typed array of 8-bit unsigned integer values. The contents are initialized to 0. If the
requested number of bytes could not be allocated an exception is raised.

| Prop | Type | Description |
Expand Down Expand Up @@ -644,9 +644,7 @@ This Fetch API interface allows you to perform various actions on HTTP request a

Construct a type with a set of properties K of type T

<code>{
[P in K]: T;
}</code>
<code>{ [P in K]: T; }</code>


#### RequestMode
Expand Down
18 changes: 9 additions & 9 deletions ios/Capacitor/Capacitor/KeyValueStore.swift
Original file line number Diff line number Diff line change
Expand Up @@ -232,13 +232,13 @@ private class FileStore: KeyValueStoreBackend {
static func with(name: String) -> FileStore {
if let existing = instances[name] { return existing }
guard let library = try? FileManager
.default
.url(
for: .libraryDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true
)
.default
.url(
for: .libraryDirectory,
in: .userDomainMask,
appropriateFor: nil,
create: true
)
else { fatalError("⚡️ ❌ Library URL unable to be accessed or created by the current application. This is an impossible state.") }

let url = library.appendingPathComponent("kvstore").appendingPathComponent(name)
Expand All @@ -257,12 +257,12 @@ private class InMemoryStore: KeyValueStoreBackend {
private let decoder = JSONDecoder()
private let encoder = JSONEncoder()

func get<T>(_ key: String, as type: T.Type) throws -> T? where T : Decodable {
func get<T>(_ key: String, as type: T.Type) throws -> T? where T: Decodable {
guard let data = storage[key] else { return nil }
return try decoder.decode(type, from: data)
}

func set<T>(_ key: String, value: T) throws where T : Encodable {
func set<T>(_ key: String, value: T) throws where T: Encodable {
let data = try encoder.encode(value)
storage[key] = data
}
Expand Down