Skip to content

Commit 3ba0942

Browse files
set some logs to debug only
1 parent b11b96e commit 3ba0942

3 files changed

Lines changed: 46 additions & 31 deletions

File tree

dist/index.js

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -58572,14 +58572,15 @@ async function GetOrSetXcodeVersion() {
5857258572
}
5857358573
async function GetProjectDetails(credential, xcodeVersion) {
5857458574
const projectPathInput = core.getInput('project-path') || `${WORKSPACE}/**/*.xcodeproj`;
58575-
core.info(`Project path input: ${projectPathInput}`);
58575+
core.debug(`Project path input: ${projectPathInput}`);
5857658576
let projectPath = undefined;
5857758577
const globber = await glob.create(projectPathInput);
5857858578
const files = await globber.glob();
5857958579
if (!files || files.length === 0) {
5858058580
throw new Error(`No project found at: ${projectPathInput}`);
5858158581
}
58582-
core.info(`Files found during search: ${files.join(', ')}`);
58582+
core.debug(`Files found during search:`);
58583+
files.forEach(file => core.debug(` > ${file}`));
5858358584
const excludedProjects = ['GameAssembly', 'UnityFramework', 'Pods'];
5858458585
for (const file of files) {
5858558586
if (file.includes('DerivedData')) {
@@ -58590,20 +58591,22 @@ async function GetProjectDetails(credential, xcodeVersion) {
5859058591
if (excludedProjects.includes(projectBaseName)) {
5859158592
continue;
5859258593
}
58593-
core.info(`Found Xcode project: ${file}`);
58594+
core.debug(`Found Xcode project: ${file}`);
5859458595
projectPath = file;
5859558596
break;
5859658597
}
5859758598
}
5859858599
if (!projectPath) {
5859958600
throw new Error(`Invalid project-path! Unable to find .xcodeproj in ${projectPathInput}. ${files.length} files were found but none matched.\n${files.join(', ')}`);
5860058601
}
58601-
core.info(`Resolved Project path: ${projectPath}`);
58602+
core.info(`Xcode Project: ${projectPath}`);
5860258603
await fs.promises.access(projectPath, fs.constants.R_OK);
5860358604
const projectDirectory = path.dirname(projectPath);
58604-
core.info(`Project directory: ${projectDirectory}`);
58605-
const projectFiles = await fs.promises.readdir(projectDirectory);
58606-
projectFiles.forEach(file => core.info(` > ${file}`));
58605+
if (core.isDebug()) {
58606+
core.debug(`Project directory: ${projectDirectory}`);
58607+
const projectFiles = await fs.promises.readdir(projectDirectory);
58608+
projectFiles.forEach(file => core.debug(` > ${file}`));
58609+
}
5860758610
const projectName = path.basename(projectPath, '.xcodeproj');
5860858611
const buildSettings = await getBuildSettings(projectPath);
5860958612
const scheme = await getProjectScheme(projectPath);
@@ -58615,7 +58618,7 @@ async function GetProjectDetails(credential, xcodeVersion) {
5861558618
if (!sdkInfo) {
5861658619
await downloadPlatformSdk(platform, platformSdkVersion);
5861758620
}
58618-
await execXcRun(['simctl', 'list', 'runtimes']);
58621+
await execXcRun(['simctl', 'list', 'runtimes', '--output-format', 'json']);
5861958622
}
5862058623
const configuration = core.getInput('configuration') || 'Release';
5862158624
core.info(`Configuration: ${configuration}`);
@@ -58802,11 +58805,7 @@ async function getDestination(projectPath, scheme, platform) {
5880258805
}
5880358806
}
5880458807
async function getBuildSettings(projectPath) {
58805-
return await execXcodeBuild([
58806-
'build',
58807-
'-project', projectPath,
58808-
'-showBuildSettings'
58809-
]);
58808+
return await execXcodeBuild(['build', '-project', projectPath, '-showBuildSettings']);
5881058809
}
5881158810
function getBundleId(buildSettingsOutput) {
5881258811
const bundleId = core.getInput('bundle-id') || (0, utilities_1.matchRegexPattern)(buildSettingsOutput, /\s+PRODUCT_BUNDLE_IDENTIFIER = (?<bundleId>[\w.-]+)/, 'bundleId');
@@ -59481,20 +59480,26 @@ async function getWhatsNew() {
5948159480
}
5948259481
async function execXcodeBuild(xcodeBuildArgs) {
5948359482
let exitCode = 1;
59483+
let errorOutput = '';
5948459484
let output = '';
59485+
const silenceOutput = xcodeBuildArgs.includes('-json') && !core.isDebug();
59486+
if (silenceOutput) {
59487+
core.info(`[command]${xcodebuild} ${xcodeBuildArgs.join(' ')}`);
59488+
}
5948559489
exitCode = await (0, exec_1.exec)(xcodebuild, xcodeBuildArgs, {
5948659490
listeners: {
5948759491
stdout: (data) => {
5948859492
output += data.toString();
5948959493
},
5949059494
stderr: (data) => {
59491-
output += data.toString();
59495+
errorOutput += data.toString();
5949259496
},
5949359497
},
59498+
silent: silenceOutput,
5949459499
ignoreReturnCode: true
5949559500
});
5949659501
if (exitCode !== 0) {
59497-
await parseBundleLog(output);
59502+
await parseBundleLog(errorOutput);
5949859503
throw new Error(`xcodebuild exited with code: ${exitCode}`);
5949959504
}
5950059505
return output;

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/xcode.ts

Lines changed: 25 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -118,7 +118,7 @@ export async function GetOrSetXcodeVersion(): Promise<SemVer> {
118118

119119
export async function GetProjectDetails(credential: AppleCredential, xcodeVersion: SemVer): Promise<XcodeProject> {
120120
const projectPathInput = core.getInput('project-path') || `${WORKSPACE}/**/*.xcodeproj`;
121-
core.info(`Project path input: ${projectPathInput}`);
121+
core.debug(`Project path input: ${projectPathInput}`);
122122
let projectPath = undefined;
123123
const globber = await glob.create(projectPathInput);
124124
const files = await globber.glob();
@@ -127,7 +127,9 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
127127
throw new Error(`No project found at: ${projectPathInput}`);
128128
}
129129

130-
core.info(`Files found during search: ${files.join(', ')}`);
130+
core.debug(`Files found during search:`);
131+
files.forEach(file => core.debug(` > ${file}`));
132+
131133
const excludedProjects = ['GameAssembly', 'UnityFramework', 'Pods'];
132134

133135
for (const file of files) {
@@ -139,7 +141,7 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
139141
continue;
140142
}
141143

142-
core.info(`Found Xcode project: ${file}`);
144+
core.debug(`Found Xcode project: ${file}`);
143145
projectPath = file;
144146
break;
145147
}
@@ -149,12 +151,17 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
149151
throw new Error(`Invalid project-path! Unable to find .xcodeproj in ${projectPathInput}. ${files.length} files were found but none matched.\n${files.join(', ')}`);
150152
}
151153

152-
core.info(`Resolved Project path: ${projectPath}`);
154+
core.info(`Xcode Project: ${projectPath}`);
153155
await fs.promises.access(projectPath, fs.constants.R_OK);
156+
154157
const projectDirectory = path.dirname(projectPath);
155-
core.info(`Project directory: ${projectDirectory}`);
156-
const projectFiles = await fs.promises.readdir(projectDirectory);
157-
projectFiles.forEach(file => core.info(` > ${file}`));
158+
159+
if (core.isDebug()) {
160+
core.debug(`Project directory: ${projectDirectory}`);
161+
const projectFiles = await fs.promises.readdir(projectDirectory);
162+
projectFiles.forEach(file => core.debug(` > ${file}`));
163+
}
164+
158165
const projectName = path.basename(projectPath, '.xcodeproj');
159166
const buildSettings = await getBuildSettings(projectPath);
160167
const scheme = await getProjectScheme(projectPath);
@@ -169,7 +176,7 @@ export async function GetProjectDetails(credential: AppleCredential, xcodeVersio
169176
await downloadPlatformSdk(platform, platformSdkVersion);
170177
}
171178

172-
await execXcRun(['simctl', 'list', 'runtimes']);
179+
await execXcRun(['simctl', 'list', 'runtimes', '--output-format', 'json']);
173180
}
174181

175182
const configuration = core.getInput('configuration') || 'Release';
@@ -398,11 +405,7 @@ async function getDestination(projectPath: string, scheme: string, platform: str
398405
}
399406

400407
async function getBuildSettings(projectPath: string): Promise<string> {
401-
return await execXcodeBuild([
402-
'build',
403-
'-project', projectPath,
404-
'-showBuildSettings'
405-
]);
408+
return await execXcodeBuild(['build', '-project', projectPath, '-showBuildSettings']);
406409
}
407410

408411
function getBundleId(buildSettingsOutput: string) {
@@ -1225,22 +1228,29 @@ async function getWhatsNew(): Promise<string> {
12251228

12261229
async function execXcodeBuild(xcodeBuildArgs: string[]): Promise<string> {
12271230
let exitCode: number = 1;
1231+
let errorOutput: string = '';
12281232
let output: string = '';
1233+
const silenceOutput = xcodeBuildArgs.includes('-json') && !core.isDebug();
1234+
1235+
if (silenceOutput) {
1236+
core.info(`[command]${xcodebuild} ${xcodeBuildArgs.join(' ')}`);
1237+
}
12291238

12301239
exitCode = await exec(xcodebuild, xcodeBuildArgs, {
12311240
listeners: {
12321241
stdout: (data: Buffer) => {
12331242
output += data.toString();
12341243
},
12351244
stderr: (data: Buffer) => {
1236-
output += data.toString();
1245+
errorOutput += data.toString();
12371246
},
12381247
},
1248+
silent: silenceOutput,
12391249
ignoreReturnCode: true
12401250
});
12411251

12421252
if (exitCode !== 0) {
1243-
await parseBundleLog(output);
1253+
await parseBundleLog(errorOutput);
12441254
throw new Error(`xcodebuild exited with code: ${exitCode}`);
12451255
}
12461256

0 commit comments

Comments
 (0)