Skip to content

Commit 96799b2

Browse files
logging
1 parent 775f2cf commit 96799b2

File tree

4 files changed

+17
-23
lines changed

4 files changed

+17
-23
lines changed

dist/index.js

Lines changed: 8 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -34970,7 +34970,7 @@ async function getAvailableWindowsSDKVersion() {
3497034970
const entries = await fs.promises.readdir(basePath);
3497134971
const versions = entries.filter(entry => /^10\.0\.\d+\.\d+$/.test(entry));
3497234972
allVersions.push(...versions);
34973-
core.debug(`Found Windows SDK versions in ${basePath}:`);
34973+
core.debug(`Found Windows SDK versions in "${basePath}"`);
3497434974
versions.forEach(version => core.debug(` - ${version}`));
3497534975
}
3497634976
catch (error) {
@@ -35001,7 +35001,7 @@ async function isWindowsSDKVersionAvailable(version) {
3500135001
try {
3500235002
const versionPath = path.join(basePath, version);
3500335003
await fs.promises.access(versionPath, fs.constants.R_OK);
35004-
core.info(`Found Windows SDK version ${version} at: ${versionPath}`);
35004+
core.info(`Found Windows SDK version ${version} at: "${versionPath}"`);
3500535005
return true;
3500635006
}
3500735007
catch (error) {
@@ -35049,17 +35049,14 @@ async function printFileContents(filePath) {
3504935049
}
3505035050
async function removeWindowsMobileSDKReference(vcxprojPath) {
3505135051
let vcxprojContent = await fs.promises.readFile(vcxprojPath, 'utf8');
35052-
const itemGroupRegex = /([ \t]*<ItemGroup>\r?\n[ \t]*<SDKReference Include="WindowsMobile, Version=10.0.26100.0" \/>\r?\n[ \t]*<\/ItemGroup>\r?\n)/;
35052+
const itemGroupRegex = /([ \t]*<ItemGroup>\r?\n[ \t]*<SDKReference Include="WindowsMobile, Version=[^"\s]+" \/>\r?\n[ \t]*<\/ItemGroup>\r?\n)/;
3505335053
const found = itemGroupRegex.test(vcxprojContent);
3505435054
if (found) {
35055-
core.info(`Removing WindowsMobile SDKReference ItemGroup from ${vcxprojPath}...`);
35055+
core.info(`Removing WindowsMobile SDKReference ItemGroup from "${vcxprojPath}"`);
3505635056
vcxprojContent = vcxprojContent.replace(itemGroupRegex, '');
3505735057
await fs.promises.writeFile(vcxprojPath, vcxprojContent, 'utf8');
3505835058
await printFileContents(vcxprojPath);
3505935059
}
35060-
else {
35061-
core.info(`No WindowsMobile SDKReference ItemGroup found in ${vcxprojPath}`);
35062-
}
3506335060
return found;
3506435061
}
3506535062
async function associateAppWithStore(vcxprojPath, sourcePackageAssociationFilePath) {
@@ -35084,7 +35081,7 @@ async function associateAppWithStore(vcxprojPath, sourcePackageAssociationFilePa
3508435081
}
3508535082
}
3508635083
await writeXml(appxManifestPath, appxManifestXml);
35087-
core.info(`Updated Package.appxmanifest with identity information from ${packageStoreAssociationFilePath}`);
35084+
core.info(`Updated Package.appxmanifest with identity information from "${packageStoreAssociationFilePath}"`);
3508835085
await printFileContents(appxManifestPath);
3508935086
}
3509035087
async function copyPackageStoreAssociationFile(vcxprojPath, sourcePackageAssociationFilePath) {
@@ -35099,13 +35096,13 @@ async function copyPackageStoreAssociationFile(vcxprojPath, sourcePackageAssocia
3509935096
}
3510035097
if (!/<None[^>]*Include="Package\.StoreAssociation\.xml"/.test(vcxprojContent)) {
3510135098
const itemGroup = ' <ItemGroup>\n <None Include="Package.StoreAssociation.xml" />\n </ItemGroup>\n';
35102-
vcxprojContent = vcxprojContent.replace(/([ \t]*<\/ItemGroup>\r?\n)([ \t]*<Import Project="\$\(VCTargetsPath\)\\Microsoft\.Cpp\.targets" \/>)/, '$1' + itemGroup + '$2');
35099+
vcxprojContent = vcxprojContent.replace(/([ \t]*<\/ItemGroup>\r?\n)([ \t]*<Import Project="\$\(VCTargetsPath\)\\Microsoft\.Cpp\.targets" \/>)/, `$1${itemGroup}$2`);
3510335100
updated = true;
3510435101
}
3510535102
if (updated) {
3510635103
await fs.promises.writeFile(vcxprojPath, vcxprojContent, 'utf8');
35104+
await printFileContents(vcxprojPath);
3510735105
}
35108-
await printFileContents(vcxprojPath);
3510935106
return packageStoreAssociationFilePath;
3511035107
}
3511135108

@@ -37108,7 +37105,7 @@ const main = async () => {
3710837105
catch (error) {
3710937106
throw new Error(`Output directory not found: "${outputDirectory}".`);
3711037107
}
37111-
core.info(`outputDirectory: ${outputDirectory}`);
37108+
core.info(`outputDirectory: "${outputDirectory}"`);
3711237109
core.setOutput(`output-directory`, outputDirectory);
3711337110
const allGlobber = await glob.create(path.join(outputDirectory, '**/*'));
3711437111
const allFiles = await allGlobber.glob();

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/index.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ const main = async () => {
8484
} catch (error) {
8585
throw new Error(`Output directory not found: "${outputDirectory}".`);
8686
}
87-
core.info(`outputDirectory: ${outputDirectory}`);
87+
core.info(`outputDirectory: "${outputDirectory}"`);
8888
core.setOutput(`output-directory`, outputDirectory);
8989
const allGlobber = await glob.create(path.join(outputDirectory, '**/*'));
9090
const allFiles = await allGlobber.glob();

src/utils.ts

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ export async function getAvailableWindowsSDKVersion(): Promise<string | null> {
2121
const entries = await fs.promises.readdir(basePath);
2222
const versions = entries.filter(entry => /^10\.0\.\d+\.\d+$/.test(entry));
2323
allVersions.push(...versions);
24-
core.debug(`Found Windows SDK versions in ${basePath}:`);
24+
core.debug(`Found Windows SDK versions in "${basePath}"`);
2525
versions.forEach(version => core.debug(` - ${version}`));
2626
} catch (error) {
2727
continue;
@@ -55,7 +55,7 @@ export async function isWindowsSDKVersionAvailable(version: string): Promise<boo
5555
try {
5656
const versionPath = path.join(basePath, version);
5757
await fs.promises.access(versionPath, fs.constants.R_OK);
58-
core.info(`Found Windows SDK version ${version} at: ${versionPath}`);
58+
core.info(`Found Windows SDK version ${version} at: "${versionPath}"`);
5959
return true;
6060
} catch (error) {
6161
continue;
@@ -117,16 +117,13 @@ export async function printFileContents(filePath: string): Promise<void> {
117117
*/
118118
export async function removeWindowsMobileSDKReference(vcxprojPath: string): Promise<boolean> {
119119
let vcxprojContent = await fs.promises.readFile(vcxprojPath, 'utf8');
120-
// Match the exact ItemGroup block for WindowsMobile SDKReference as in the diff, preserving whitespace
121-
const itemGroupRegex = /([ \t]*<ItemGroup>\r?\n[ \t]*<SDKReference Include="WindowsMobile, Version=10.0.26100.0" \/>\r?\n[ \t]*<\/ItemGroup>\r?\n)/;
120+
const itemGroupRegex = /([ \t]*<ItemGroup>\r?\n[ \t]*<SDKReference Include="WindowsMobile, Version=[^"\s]+" \/>\r?\n[ \t]*<\/ItemGroup>\r?\n)/;
122121
const found = itemGroupRegex.test(vcxprojContent);
123122
if (found) {
124-
core.info(`Removing WindowsMobile SDKReference ItemGroup from ${vcxprojPath}...`);
123+
core.info(`Removing WindowsMobile SDKReference ItemGroup from "${vcxprojPath}"`);
125124
vcxprojContent = vcxprojContent.replace(itemGroupRegex, '');
126125
await fs.promises.writeFile(vcxprojPath, vcxprojContent, 'utf8');
127126
await printFileContents(vcxprojPath);
128-
} else {
129-
core.info(`No WindowsMobile SDKReference ItemGroup found in ${vcxprojPath}`);
130127
}
131128
return found;
132129
}
@@ -163,7 +160,7 @@ export async function associateAppWithStore(vcxprojPath: string, sourcePackageAs
163160
}
164161
}
165162
await writeXml(appxManifestPath, appxManifestXml);
166-
core.info(`Updated Package.appxmanifest with identity information from ${packageStoreAssociationFilePath}`);
163+
core.info(`Updated Package.appxmanifest with identity information from "${packageStoreAssociationFilePath}"`);
167164
await printFileContents(appxManifestPath);
168165
}
169166
/**
@@ -189,12 +186,12 @@ export async function copyPackageStoreAssociationFile(vcxprojPath: string, sourc
189186
// Insert before </Project>, on a new line, matching the expected diff formatting
190187
const itemGroup = ' <ItemGroup>\n <None Include="Package.StoreAssociation.xml" />\n </ItemGroup>\n';
191188
// Find the last closing ItemGroup and ensure the new ItemGroup is on its own line
192-
vcxprojContent = vcxprojContent.replace(/([ \t]*<\/ItemGroup>\r?\n)([ \t]*<Import Project="\$\(VCTargetsPath\)\\Microsoft\.Cpp\.targets" \/>)/, '$1' + itemGroup + '$2');
189+
vcxprojContent = vcxprojContent.replace(/([ \t]*<\/ItemGroup>\r?\n)([ \t]*<Import Project="\$\(VCTargetsPath\)\\Microsoft\.Cpp\.targets" \/>)/, `$1${itemGroup}$2`);
193190
updated = true;
194191
}
195192
if (updated) {
196193
await fs.promises.writeFile(vcxprojPath, vcxprojContent, 'utf8');
194+
await printFileContents(vcxprojPath);
197195
}
198-
await printFileContents(vcxprojPath);
199196
return packageStoreAssociationFilePath;
200197
}

0 commit comments

Comments
 (0)