@@ -58293,11 +58293,15 @@ async function unlockTemporaryKeychain(keychainPath, tempCredential) {
5829358293Object.defineProperty(exports, "__esModule", ({ value: true }));
5829458294exports.XcodeProject = void 0;
5829558295class XcodeProject {
58296- constructor(projectPath, projectName, platform, destination, bundleId, projectDirectory, versionString, bundleVersion, scheme, credential, xcodeVersion) {
58296+ constructor(projectPath, projectName, platform, destination, configuration, bundleId, projectDirectory, versionString, bundleVersion, scheme, credential, xcodeVersion) {
58297+ this.entitlementsPath = null;
5829758298 this.projectPath = projectPath;
5829858299 this.projectName = projectName;
5829958300 this.platform = platform;
5830058301 this.destination = destination;
58302+ this.configuration = configuration;
58303+ this.archivePath = `${this.projectDirectory}/${this.projectName}.xcarchive`;
58304+ this.exportPath = `${this.projectDirectory}/${this.projectName}`;
5830158305 this.bundleId = bundleId;
5830258306 this.projectDirectory = projectDirectory;
5830358307 this.versionString = versionString;
@@ -58455,6 +58459,7 @@ async function SetupCCache() {
5845558459
5845658460Object.defineProperty(exports, "__esModule", ({ value: true }));
5845758461exports.GetProjectDetails = GetProjectDetails;
58462+ exports.BuildXcodeProject = BuildXcodeProject;
5845858463exports.ArchiveXcodeProject = ArchiveXcodeProject;
5845958464exports.ExportXcodeArchive = ExportXcodeArchive;
5846058465exports.isAppBundleNotarized = isAppBundleNotarized;
@@ -58561,8 +58566,19 @@ async function GetProjectDetails(credential, xcodeVersion) {
5856158566 core.info(`CFBundleShortVersionString: ${cFBundleShortVersionString}`);
5856258567 const cFBundleVersion = infoPlist['CFBundleVersion'];
5856358568 core.info(`CFBundleVersion: ${cFBundleVersion}`);
58564- const projectRef = new XcodeProject_1.XcodeProject(projectPath, projectName, platform, destination, bundleId, projectDirectory, cFBundleShortVersionString, cFBundleVersion, scheme, credential, xcodeVersion);
58569+ const configuration = core.getInput('configuration') || 'Release';
58570+ core.debug(`Configuration: ${configuration}`);
58571+ const projectRef = new XcodeProject_1.XcodeProject(projectPath, projectName, platform, destination, configuration, bundleId, projectDirectory, cFBundleShortVersionString, cFBundleVersion, scheme, credential, xcodeVersion);
5856558572 projectRef.autoIncrementBuildNumber = core.getInput('auto-increment-build-number') === 'true';
58573+ let entitlementsPath = core.getInput('entitlements-plist');
58574+ if (!entitlementsPath) {
58575+ if (projectRef.platform === 'macOS') {
58576+ projectRef.entitlementsPath = await getDefaultEntitlementsMacOS(projectRef);
58577+ }
58578+ }
58579+ else {
58580+ projectRef.entitlementsPath = entitlementsPath;
58581+ }
5856658582 await getExportOptions(projectRef);
5856758583 if (projectRef.isAppStoreUpload()) {
5856858584 projectRef.appId = await (0, AppStoreConnectClient_1.GetAppId)(projectRef);
@@ -58826,31 +58842,54 @@ async function downloadPlatformSdkIfMissing(platform, version) {
5882658842 await (0, exec_1.exec)('xcodes', ['runtimes', 'install', `${platform} ${version}`]);
5882758843 }
5882858844}
58829- async function ArchiveXcodeProject(projectRef) {
58830- const { projectPath, projectName, projectDirectory } = projectRef;
58831- const archivePath = `${projectDirectory}/${projectName}.xcarchive`;
58832- core.debug(`Archive path: ${archivePath}`);
58845+ async function BuildXcodeProject(projectRef) {
58846+ const { projectPath, scheme, destination, platform, projectDirectory } = projectRef;
5883358847 const configuration = core.getInput('configuration') || 'Release';
58834- core.debug(`Configuration: ${configuration}`);
58835- let entitlementsPath = core.getInput('entitlements-plist');
58836- if (!entitlementsPath && projectRef.platform === 'macOS') {
58837- await getDefaultEntitlementsMacOS(projectRef);
58848+ const buildArgs = [
58849+ 'build',
58850+ '-project', projectPath,
58851+ '-scheme', scheme,
58852+ '-destination', destination,
58853+ '-configuration', configuration,
58854+ '-derivedDataPath', `${projectDirectory}/DerivedData`,
58855+ 'CODE_SIGN_IDENTITY=-',
58856+ 'CODE_SIGNING_REQUIRED=NO',
58857+ 'CODE_SIGNING_ALLOWED=NO'
58858+ ];
58859+ if (platform === 'iOS') {
58860+ buildArgs.push('COPY_PHASE_STRIP=NO');
58861+ }
58862+ if (platform === 'macOS' && !projectRef.isAppStoreUpload()) {
58863+ buildArgs.push('ENABLE_HARDENED_RUNTIME=YES');
58864+ }
58865+ if (!core.isDebug()) {
58866+ buildArgs.push('-quiet');
5883858867 }
5883958868 else {
58840- projectRef.entitlementsPath = entitlementsPath;
58869+ buildArgs.push('-verbose');
58870+ }
58871+ if (core.isDebug()) {
58872+ await execXcodeBuild(buildArgs);
5884158873 }
58842- const { teamId, manualSigningIdentity, manualProvisioningProfileUUID, keychainPath } = projectRef.credential;
58874+ else {
58875+ await execWithXcBeautify(buildArgs);
58876+ }
58877+ return projectRef;
58878+ }
58879+ async function ArchiveXcodeProject(projectRef) {
58880+ const { projectPath, scheme, platform, destination, configuration, archivePath, entitlementsPath, projectDirectory, credential } = projectRef;
58881+ const { teamId, manualSigningIdentity, manualProvisioningProfileUUID, keychainPath } = credential;
5884358882 const archiveArgs = [
5884458883 'archive',
5884558884 '-project', projectPath,
58846- '-scheme', projectRef. scheme,
58847- '-destination', projectRef. destination,
58885+ '-scheme', scheme,
58886+ '-destination', destination,
5884858887 '-configuration', configuration,
5884958888 '-archivePath', archivePath,
5885058889 '-derivedDataPath', `${projectDirectory}/DerivedData`,
58851- `-authenticationKeyID`, projectRef. credential.appStoreConnectKeyId,
58852- `-authenticationKeyPath`, projectRef. credential.appStoreConnectKeyPath,
58853- `-authenticationKeyIssuerID`, projectRef. credential.appStoreConnectIssuerId
58890+ `-authenticationKeyID`, credential.appStoreConnectKeyId,
58891+ `-authenticationKeyPath`, credential.appStoreConnectKeyPath,
58892+ `-authenticationKeyIssuerID`, credential.appStoreConnectIssuerId
5885458893 ];
5885558894 if (teamId) {
5885658895 archiveArgs.push(`DEVELOPMENT_TEAM=${teamId}`);
@@ -58868,22 +58907,22 @@ async function ArchiveXcodeProject(projectRef) {
5886858907 else {
5886958908 archiveArgs.push(`AD_HOC_CODE_SIGNING_ALLOWED=YES`, `-allowProvisioningUpdates`);
5887058909 }
58871- if (projectRef. entitlementsPath) {
58872- core.debug(`Entitlements path: ${projectRef. entitlementsPath}`);
58873- const entitlementsHandle = await fs.promises.open(projectRef. entitlementsPath, fs.constants.O_RDONLY);
58910+ if (entitlementsPath) {
58911+ core.debug(`Entitlements path: ${entitlementsPath}`);
58912+ const entitlementsHandle = await fs.promises.open(entitlementsPath, fs.constants.O_RDONLY);
5887458913 try {
5887558914 const entitlementsContent = await fs.promises.readFile(entitlementsHandle, 'utf8');
5887658915 core.info(`----- Entitlements content: -----\n${entitlementsContent}\n-----------------------------------`);
5887758916 }
5887858917 finally {
5887958918 await entitlementsHandle.close();
5888058919 }
58881- archiveArgs.push(`CODE_SIGN_ENTITLEMENTS=${projectRef. entitlementsPath}`);
58920+ archiveArgs.push(`CODE_SIGN_ENTITLEMENTS=${entitlementsPath}`);
5888258921 }
58883- if (projectRef. platform === 'iOS') {
58922+ if (platform === 'iOS') {
5888458923 archiveArgs.push('COPY_PHASE_STRIP=NO');
5888558924 }
58886- if (projectRef. platform === 'macOS' && !projectRef.isAppStoreUpload()) {
58925+ if (platform === 'macOS' && !projectRef.isAppStoreUpload()) {
5888758926 archiveArgs.push('ENABLE_HARDENED_RUNTIME=YES');
5888858927 }
5888958928 if (!core.isDebug()) {
@@ -58898,25 +58937,22 @@ async function ArchiveXcodeProject(projectRef) {
5889858937 else {
5889958938 await execWithXcBeautify(archiveArgs);
5890058939 }
58901- projectRef.archivePath = archivePath;
5890258940 return projectRef;
5890358941}
5890458942async function ExportXcodeArchive(projectRef) {
58905- const { projectName, projectDirectory, archivePath, exportOptionsPath } = projectRef;
58906- projectRef.exportPath = `${projectDirectory}/${projectName}`;
58907- core.debug(`Export path: ${projectRef.exportPath}`);
58908- core.setOutput('output-directory', projectRef.exportPath);
58909- const { manualProvisioningProfileUUID } = projectRef.credential;
58943+ const { platform, archivePath, exportPath, exportOptionsPath, credential } = projectRef;
58944+ core.debug(`Export path: ${exportPath}`);
58945+ core.setOutput('output-directory', exportPath);
5891058946 const exportArgs = [
5891158947 '-exportArchive',
5891258948 '-archivePath', archivePath,
58913- '-exportPath', projectRef. exportPath,
58949+ '-exportPath', exportPath,
5891458950 '-exportOptionsPlist', exportOptionsPath,
58915- `-authenticationKeyID`, projectRef. credential.appStoreConnectKeyId,
58916- `-authenticationKeyPath`, projectRef. credential.appStoreConnectKeyPath,
58917- `-authenticationKeyIssuerID`, projectRef. credential.appStoreConnectIssuerId
58951+ `-authenticationKeyID`, credential.appStoreConnectKeyId,
58952+ `-authenticationKeyPath`, credential.appStoreConnectKeyPath,
58953+ `-authenticationKeyIssuerID`, credential.appStoreConnectIssuerId
5891858954 ];
58919- if (!manualProvisioningProfileUUID) {
58955+ if (!credential. manualProvisioningProfileUUID) {
5892058956 exportArgs.push(`-allowProvisioningUpdates`);
5892158957 }
5892258958 if (!core.isDebug()) {
@@ -58931,15 +58967,15 @@ async function ExportXcodeArchive(projectRef) {
5893158967 else {
5893258968 await execWithXcBeautify(exportArgs);
5893358969 }
58934- if (projectRef. platform === 'macOS') {
58970+ if (platform === 'macOS') {
5893558971 if (!projectRef.isAppStoreUpload()) {
58936- projectRef.executablePath = await getFirstPathWithGlob(`${projectRef. exportPath}/**/*.app`);
58972+ projectRef.executablePath = await getFirstPathWithGlob(`${exportPath}/**/*.app`);
5893758973 if (projectRef.notarize) {
5893858974 await signMacOSAppBundle(projectRef);
5893958975 if (projectRef.isSteamBuild) {
5894058976 const isNotarized = await isAppBundleNotarized(projectRef.executablePath);
5894158977 if (!isNotarized) {
58942- const zipPath = path.join(projectRef. exportPath, projectRef.executablePath.replace('.app', '.zip'));
58978+ const zipPath = path.join(exportPath, projectRef.executablePath.replace('.app', '.zip'));
5894358979 await (0, exec_1.exec)('ditto', ['-c', '-k', '--sequesterRsrc', '--keepParent', projectRef.executablePath, zipPath]);
5894458980 await notarizeArchive(projectRef, zipPath, projectRef.executablePath);
5894558981 }
@@ -58956,11 +58992,11 @@ async function ExportXcodeArchive(projectRef) {
5895658992 }
5895758993 }
5895858994 else {
58959- projectRef.executablePath = await getFirstPathWithGlob(`${projectRef. exportPath}/**/*.pkg`);
58995+ projectRef.executablePath = await getFirstPathWithGlob(`${exportPath}/**/*.pkg`);
5896058996 }
5896158997 }
5896258998 else {
58963- projectRef.executablePath = await getFirstPathWithGlob(`${projectRef. exportPath}/**/*.ipa`);
58999+ projectRef.executablePath = await getFirstPathWithGlob(`${exportPath}/**/*.ipa`);
5896459000 }
5896559001 try {
5896659002 await fs.promises.access(projectRef.executablePath, fs.constants.R_OK);
@@ -59367,11 +59403,10 @@ async function getExportOptions(projectRef) {
5936759403}
5936859404async function getDefaultEntitlementsMacOS(projectRef) {
5936959405 const entitlementsPath = `${projectRef.projectPath}/Entitlements.plist`;
59370- projectRef.entitlementsPath = entitlementsPath;
5937159406 try {
5937259407 await fs.promises.access(entitlementsPath, fs.constants.R_OK);
5937359408 core.debug(`Existing Entitlements.plist found at: ${entitlementsPath}`);
59374- return;
59409+ return entitlementsPath ;
5937559410 }
5937659411 catch (error) {
5937759412 core.warning('Entitlements.plist not found, creating default Entitlements.plist...');
@@ -59397,6 +59432,7 @@ async function getDefaultEntitlementsMacOS(projectRef) {
5939759432 break;
5939859433 }
5939959434 await fs.promises.writeFile(entitlementsPath, plist.build(defaultEntitlements));
59435+ return entitlementsPath;
5940059436}
5940159437async function execXcodeBuild(xcodeBuildArgs) {
5940259438 let output = '';
@@ -61667,6 +61703,7 @@ const main = async () => {
6166761703 throw new Error(`Selected Xcode version ${selectedXcodeVersionString} does not match requested version ${xcodeVersionString}!`);
6166861704 }
6166961705 let projectRef = await (0, xcode_1.GetProjectDetails)(credential, semver.coerce(xcodeVersionString));
61706+ projectRef = await (0, xcode_1.BuildXcodeProject)(projectRef);
6167061707 projectRef = await (0, xcode_1.ArchiveXcodeProject)(projectRef);
6167161708 projectRef = await (0, xcode_1.ExportXcodeArchive)(projectRef);
6167261709 const uploadInput = core.getInput('upload') || projectRef.isAppStoreUpload().toString();
0 commit comments