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

feat(cli): support manual signing on build command #7769

Open
wants to merge 23 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 9 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
2306058
Adding xcode-signing-style build flag
theproducer Nov 15, 2024
4383b67
Adding singing cert and provisioning profile to cli
theproducer Nov 19, 2024
bc63823
Merge branch 'main' into feat/xcode-signing
theproducer Nov 19, 2024
e96c4f1
updating command line description
theproducer Nov 19, 2024
23300df
fmt
theproducer Nov 19, 2024
bc80d75
Merge branch 'main' into feat/xcode-signing
theproducer Nov 20, 2024
8e50ecb
Making xcodeSigningType optional
theproducer Dec 4, 2024
ab7e9b9
Check for empty signing cert and profile during manual builds
theproducer Dec 4, 2024
e40dd06
Merge branch 'main' into feat/xcode-signing
theproducer Dec 4, 2024
4159a23
Adding iOS build options to cap config
theproducer Dec 12, 2024
936f033
Wiring cap config ios build options into build command
theproducer Dec 12, 2024
b87cd77
Merge branch 'main' into feat/xcode-signing
theproducer Dec 16, 2024
400e01f
Merge branch 'main' into feat/xcode-signing
jcesarmobile Dec 18, 2024
069ab09
Merge branch 'main' into feat/xcode-signing
jcesarmobile Dec 19, 2024
79f401f
Merge branch 'main' into feat/xcode-signing
theproducer Jan 14, 2025
af2f2eb
Adding support for setting export method
theproducer Jan 15, 2025
e2347fe
deleting iOS buildOptions from generated capacitor.config.json
theproducer Jan 15, 2025
e438586
Adding exportMethod to capConfig
theproducer Jan 15, 2025
5858e67
Askings for team id
theproducer Jan 16, 2025
6b28c45
fixing manual build and archive configuration
theproducer Jan 16, 2025
3f648b8
Manual signing should not required for setting the team id
theproducer Jan 16, 2025
a9418ba
fmt
theproducer Jan 16, 2025
a209f6e
Changing xocdeExportMethod default to ‘app-store-connect’
theproducer Jan 20, 2025
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
24 changes: 24 additions & 0 deletions cli/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,24 @@ export function runProgram(config: Config): void {
'jarsigner',
]),
)
.addOption(
new Option(
'--xcode-signing-style <xcodeSigningStyle>',
'The iOS signing style to use when building the app for distribution (default: automatic)',
).choices(['automatic', 'manual']),
)
.addOption(
new Option(
'--xcode-signing-certificate <xcodeSigningCertificate>',
'A certificate name, SHA-1 hash, or automatic selector to use for signing for iOS builds',
),
)
.addOption(
new Option(
'--xcode-provisioning-profile <xcodeProvisioningProfile>',
'A provisioning profile name or UUID for iOS builds',
),
)
.action(
wrapAction(
telemetryAction(
Expand All @@ -163,6 +181,9 @@ export function runProgram(config: Config): void {
androidreleasetype,
signingType,
configuration,
xcodeSigningStyle,
xcodeSigningCertificate,
xcodeProvisioningProfile,
},
) => {
const { buildCommand } = await import('./tasks/build');
Expand All @@ -176,6 +197,9 @@ export function runProgram(config: Config): void {
androidreleasetype,
signingtype: signingType,
configuration,
xcodeSigningType: xcodeSigningStyle,
xcodeSigningCertificate,
xcodeProvisioningProfile,
});
},
),
Expand Down
18 changes: 18 additions & 0 deletions cli/src/ios/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ export async function buildiOS(config: Config, buildOptions: BuildCommandOptions
projectName = basename(await config.ios.nativeXcodeProjDirAbs);
}

if (
buildOptions.xcodeSigningType == 'manual' &&
(!buildOptions.xcodeSigningCertificate || !buildOptions.xcodeProvisioningProfile)
) {
throw 'Manually signed Xcode builds require a signing certificate and provisioning profile.';
}

await runTask('Building xArchive', async () =>
runCommand(
'xcodebuild',
Expand All @@ -45,12 +52,23 @@ export async function buildiOS(config: Config, buildOptions: BuildCommandOptions
),
);

const manualSigningContents = `<key>provisioningProfiles</key>
<dict>
<key>${config.app.appId}</key>
<string>${buildOptions.xcodeProvisioningProfile ?? ''}</string>
</dict>
<key>signingCertificate</key>
<string>${buildOptions.xcodeSigningCertificate ?? ''}</string>`;
Comment on lines +63 to +67
Copy link
Member

Choose a reason for hiding this comment

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

Will these be OK as empty strings, or would it fail the build?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah, that block is only added if signing style is manual, and if that's chosen, presumably, the developer would be supplying a provisioning profile and/or signing certificate. If what they supply is wrong (or if it's empty), then it won't work.

I believe the signing certificate can be optional, so I may push up a change to remove that key and string if the value is empty.


const archivePlistContents = `<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>method</key>
<string>app-store-connect</string>
markemer marked this conversation as resolved.
Show resolved Hide resolved
<key>signingStyle</key>
<string>${buildOptions.xcodeSigningType}</string>
${buildOptions.xcodeSigningType == 'manual' ? manualSigningContents : ''}
</dict>
</plist>`;

Expand Down
6 changes: 6 additions & 0 deletions cli/src/tasks/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ export interface BuildCommandOptions {
androidreleasetype?: 'AAB' | 'APK';
signingtype?: 'apksigner' | 'jarsigner';
configuration: string;
xcodeSigningType?: 'automatic' | 'manual';
xcodeSigningCertificate?: string;
xcodeProvisioningProfile?: string;
}

export async function buildCommand(
Expand Down Expand Up @@ -42,6 +45,9 @@ export async function buildCommand(
androidreleasetype: buildOptions.androidreleasetype || config.android.buildOptions.releaseType || 'AAB',
signingtype: buildOptions.signingtype || config.android.buildOptions.signingType || 'jarsigner',
configuration: buildOptions.configuration || 'Release',
xcodeSigningType: buildOptions.xcodeSigningType || 'automatic',
xcodeSigningCertificate: buildOptions.xcodeSigningCertificate,
xcodeProvisioningProfile: buildOptions.xcodeProvisioningProfile,
};

try {
Expand Down
Loading