diff --git a/build/azure-pipelines/darwin/product-build-darwin.yml b/build/azure-pipelines/darwin/product-build-darwin.yml
index e77000d431b..bd37d675aa2 100644
--- a/build/azure-pipelines/darwin/product-build-darwin.yml
+++ b/build/azure-pipelines/darwin/product-build-darwin.yml
@@ -121,6 +121,11 @@ steps:
- template: ../common/install-builtin-extensions.yml@self
+ - ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
+ - script: node build/lib/policies darwin
+ displayName: Generate policy definitions
+ retryCountOnTaskFailure: 3
+
- ${{ if ne(parameters.VSCODE_QUALITY, 'oss') }}:
- script: |
set -e
diff --git a/build/azure-pipelines/win32/product-build-win32.yml b/build/azure-pipelines/win32/product-build-win32.yml
index f7389943dc7..6251417f193 100644
--- a/build/azure-pipelines/win32/product-build-win32.yml
+++ b/build/azure-pipelines/win32/product-build-win32.yml
@@ -124,7 +124,7 @@ steps:
- template: ../common/install-builtin-extensions.yml@self
- ${{ if and(ne(parameters.VSCODE_CIBUILD, true), ne(parameters.VSCODE_QUALITY, 'oss')) }}:
- - powershell: node build\lib\policies
+ - powershell: node build\lib\policies win32
displayName: Generate Group Policy definitions
retryCountOnTaskFailure: 3
diff --git a/build/darwin/create-universal-app.js b/build/darwin/create-universal-app.js
index 535d46eb174..7d3f9164d5f 100644
--- a/build/darwin/create-universal-app.js
+++ b/build/darwin/create-universal-app.js
@@ -27,6 +27,7 @@ async function main(buildDir) {
const filesToSkip = [
'**/CodeResources',
'**/Credits.rtf',
+ '**/policies/{*.mobileconfig,**/*.plist}',
// TODO: Should we consider expanding this to other files in this area?
'**/node_modules/@parcel/node-addon-api/nothing.target.mk'
];
diff --git a/build/darwin/create-universal-app.ts b/build/darwin/create-universal-app.ts
index 9e013cdb10c..7872eccc63e 100644
--- a/build/darwin/create-universal-app.ts
+++ b/build/darwin/create-universal-app.ts
@@ -28,6 +28,7 @@ async function main(buildDir?: string) {
const filesToSkip = [
'**/CodeResources',
'**/Credits.rtf',
+ '**/policies/{*.mobileconfig,**/*.plist}',
// TODO: Should we consider expanding this to other files in this area?
'**/node_modules/@parcel/node-addon-api/nothing.target.mk'
];
diff --git a/build/gulpfile.vscode.js b/build/gulpfile.vscode.js
index a63f693c95a..0624f5f5a67 100644
--- a/build/gulpfile.vscode.js
+++ b/build/gulpfile.vscode.js
@@ -372,8 +372,9 @@ function packageTask(platform, arch, sourceFolderName, destinationFolderName, op
const shortcut = gulp.src('resources/darwin/bin/code.sh')
.pipe(replace('@@APPNAME@@', product.applicationName))
.pipe(rename('bin/code'));
-
- all = es.merge(all, shortcut);
+ const policyDest = gulp.src('.build/policies/darwin/**', { base: '.build/policies/darwin' })
+ .pipe(rename(f => f.dirname = `policies/${f.dirname}`));
+ all = es.merge(all, shortcut, policyDest);
}
let result = all
diff --git a/build/lib/policies.js b/build/lib/policies.js
index 847ef5c8e47..bb7e45c1873 100644
--- a/build/lib/policies.js
+++ b/build/lib/policies.js
@@ -46,6 +46,19 @@ function renderADMLString(prefix, moduleName, nlsString, translations) {
}
return `${value}`;
}
+function renderProfileString(_prefix, moduleName, nlsString, translations) {
+ let value;
+ if (translations) {
+ const moduleTranslations = translations[moduleName];
+ if (moduleTranslations) {
+ value = moduleTranslations[nlsString.nlsKey];
+ }
+ }
+ if (!value) {
+ value = nlsString.value;
+ }
+ return value;
+}
class BasePolicy {
type;
name;
@@ -84,6 +97,14 @@ class BasePolicy {
renderADMLPresentation() {
return `${this.renderADMLPresentationContents()}`;
}
+ renderProfile() {
+ return [`${this.name}`, this.renderProfileValue()];
+ }
+ renderProfileManifest(translations) {
+ return `
+${this.renderProfileManifestValue(translations)}
+`;
+ }
}
class BooleanPolicy extends BasePolicy {
static from(name, category, minimumVersion, description, moduleName, settingNode) {
@@ -106,6 +127,21 @@ class BooleanPolicy extends BasePolicy {
renderADMLPresentationContents() {
return `${this.name}`;
}
+ renderProfileValue() {
+ return ``;
+ }
+ renderProfileManifestValue(translations) {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+boolean`;
+ }
}
class ParseError extends Error {
constructor(message, moduleName, node) {
@@ -138,6 +174,21 @@ class NumberPolicy extends BasePolicy {
renderADMLPresentationContents() {
return `${this.name}`;
}
+ renderProfileValue() {
+ return `${this.defaultValue}`;
+ }
+ renderProfileManifestValue(translations) {
+ return `pfm_default
+${this.defaultValue}
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+integer`;
+ }
}
class StringPolicy extends BasePolicy {
static from(name, category, minimumVersion, description, moduleName, settingNode) {
@@ -156,6 +207,21 @@ class StringPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+ renderProfileValue() {
+ return ``;
+ }
+ renderProfileManifestValue(translations) {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string`;
+ }
}
class ObjectPolicy extends BasePolicy {
static from(name, category, minimumVersion, description, moduleName, settingNode) {
@@ -174,6 +240,22 @@ class ObjectPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+ renderProfileValue() {
+ return ``;
+ }
+ renderProfileManifestValue(translations) {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string
+`;
+ }
}
class StringEnumPolicy extends BasePolicy {
enum_;
@@ -220,6 +302,25 @@ class StringEnumPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+ renderProfileValue() {
+ return `${this.enum_[0]}`;
+ }
+ renderProfileManifestValue(translations) {
+ return `pfm_default
+${this.enum_[0]}
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string
+pfm_range_list
+
+ ${this.enum_.map(e => `${e}`).join('\n ')}
+`;
+ }
}
const NumberQ = {
Q: `(number) @value`,
@@ -425,6 +526,186 @@ function renderADML(appName, versions, categories, policies, translations) {
`;
}
+function renderProfileManifest(appName, bundleIdentifier, _versions, _categories, policies, translations) {
+ const requiredPayloadFields = `
+
+ pfm_default
+ Configure ${appName}
+ pfm_name
+ PayloadDescription
+ pfm_title
+ Payload Description
+ pfm_type
+ string
+
+
+ pfm_default
+ ${appName}
+ pfm_name
+ PayloadDisplayName
+ pfm_require
+ always
+ pfm_title
+ Payload Display Name
+ pfm_type
+ string
+
+
+ pfm_default
+ ${bundleIdentifier}
+ pfm_name
+ PayloadIdentifier
+ pfm_require
+ always
+ pfm_title
+ Payload Identifier
+ pfm_type
+ string
+
+
+ pfm_default
+ ${bundleIdentifier}
+ pfm_name
+ PayloadType
+ pfm_require
+ always
+ pfm_title
+ Payload Type
+ pfm_type
+ string
+
+
+ pfm_default
+
+ pfm_name
+ PayloadUUID
+ pfm_require
+ always
+ pfm_title
+ Payload UUID
+ pfm_type
+ string
+
+
+ pfm_default
+ 1
+ pfm_name
+ PayloadVersion
+ pfm_range_list
+
+ 1
+
+ pfm_require
+ always
+ pfm_title
+ Payload Version
+ pfm_type
+ integer
+
+
+ pfm_default
+ Microsoft
+ pfm_name
+ PayloadOrganization
+ pfm_title
+ Payload Organization
+ pfm_type
+ string
+ `;
+ const profileManifestSubkeys = policies.map(policy => {
+ return policy.renderProfileManifest(translations);
+ }).join('');
+ return `
+
+
+
+ pfm_app_url
+ https://code.visualstudio.com/
+ pfm_description
+ ${appName} Managed Settings
+ pfm_documentation_url
+ https://code.visualstudio.com/docs/setup/enterprise
+ pfm_domain
+ ${bundleIdentifier}
+ pfm_format_version
+ 1
+ pfm_interaction
+ combined
+ pfm_last_modified
+ ${new Date().toISOString().replace(/\.\d+Z$/, 'Z')}
+ pfm_platforms
+
+ macOS
+
+ pfm_subkeys
+
+ ${requiredPayloadFields}
+ ${profileManifestSubkeys}
+
+ pfm_title
+ ${appName}
+ pfm_unique
+
+ pfm_version
+ 1
+
+`;
+}
+function renderMacOSPolicy(policies, translations) {
+ const appName = product.nameLong;
+ const bundleIdentifier = product.darwinBundleIdentifier;
+ const payloadUUID = product.darwinProfilePayloadUUID;
+ const UUID = product.darwinProfileUUID;
+ const versions = [...new Set(policies.map(p => p.minimumVersion)).values()].sort();
+ const categories = [...new Set(policies.map(p => p.category))];
+ const policyEntries = policies.map(policy => policy.renderProfile())
+ .flat()
+ .map(entry => `\t\t\t\t${entry}`)
+ .join('\n');
+ return {
+ profile: `
+
+
+
+ PayloadContent
+
+
+ PayloadDisplayName
+ ${appName}
+ PayloadIdentifier
+ ${bundleIdentifier}.${UUID}
+ PayloadType
+ ${bundleIdentifier}
+ PayloadUUID
+ ${UUID}
+ PayloadVersion
+ 1
+${policyEntries}
+
+
+ PayloadDescription
+ This profile manages ${appName}. For more information see https://code.visualstudio.com/docs/setup/enterprise
+ PayloadDisplayName
+ ${appName}
+ PayloadIdentifier
+ ${bundleIdentifier}
+ PayloadOrganization
+ Microsoft
+ PayloadType
+ Configuration
+ PayloadUUID
+ ${payloadUUID}
+ PayloadVersion
+ 1
+ TargetDeviceType
+ 5
+
+`,
+ manifests: [{ languageId: 'en-us', contents: renderProfileManifest(appName, bundleIdentifier, versions, categories, policies) },
+ ...translations.map(({ languageId, languageTranslations }) => ({ languageId, contents: renderProfileManifest(appName, bundleIdentifier, versions, categories, policies, languageTranslations) }))
+ ]
+ };
+}
function renderGP(policies, translations) {
const appName = product.nameLong;
const regKey = product.win32RegValueName;
@@ -540,14 +821,9 @@ async function getTranslations() {
return await Promise.all(languageIds.map(languageId => getNLS(extensionGalleryServiceUrl, resourceUrlTemplate, languageId, version)
.then(languageTranslations => ({ languageId, languageTranslations }))));
}
-async function main() {
- const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
- console.log(`Found ${policies.length} policies:`);
- for (const policy of policies) {
- console.log(`- ${policy.name} (${policy.type})`);
- }
- const { admx, adml } = await renderGP(policies, translations);
+async function windowsMain(policies, translations) {
const root = '.build/policies/win32';
+ const { admx, adml } = await renderGP(policies, translations);
await fs_1.promises.rm(root, { recursive: true, force: true });
await fs_1.promises.mkdir(root, { recursive: true });
await fs_1.promises.writeFile(path_1.default.join(root, `${product.win32RegValueName}.admx`), admx.replace(/\r?\n/g, '\n'));
@@ -557,6 +833,36 @@ async function main() {
await fs_1.promises.writeFile(path_1.default.join(languagePath, `${product.win32RegValueName}.adml`), contents.replace(/\r?\n/g, '\n'));
}
}
+async function darwinMain(policies, translations) {
+ const bundleIdentifier = product.darwinBundleIdentifier;
+ if (!bundleIdentifier || !product.darwinProfilePayloadUUID || !product.darwinProfileUUID) {
+ throw new Error(`Missing required product information.`);
+ }
+ const root = '.build/policies/darwin';
+ const { profile, manifests } = await renderMacOSPolicy(policies, translations);
+ await fs_1.promises.rm(root, { recursive: true, force: true });
+ await fs_1.promises.mkdir(root, { recursive: true });
+ await fs_1.promises.writeFile(path_1.default.join(root, `${bundleIdentifier}.mobileconfig`), profile.replace(/\r?\n/g, '\n'));
+ for (const { languageId, contents } of manifests) {
+ const languagePath = path_1.default.join(root, languageId === 'en-us' ? 'en-us' : Languages[languageId]);
+ await fs_1.promises.mkdir(languagePath, { recursive: true });
+ await fs_1.promises.writeFile(path_1.default.join(languagePath, `${bundleIdentifier}.plist`), contents.replace(/\r?\n/g, '\n'));
+ }
+}
+async function main() {
+ const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
+ const platform = process.argv[2];
+ if (platform === 'darwin') {
+ await darwinMain(policies, translations);
+ }
+ else if (platform === 'win32') {
+ await windowsMain(policies, translations);
+ }
+ else {
+ console.error(`Usage: node build/lib/policies `);
+ process.exit(1);
+ }
+}
if (require.main === module) {
main().catch(err => {
if (err instanceof ParseError) {
diff --git a/build/lib/policies.ts b/build/lib/policies.ts
index e5d06887071..cf16ca2d511 100644
--- a/build/lib/policies.ts
+++ b/build/lib/policies.ts
@@ -48,6 +48,9 @@ interface Policy {
renderADMX(regKey: string): string[];
renderADMLStrings(translations?: LanguageTranslations): string[];
renderADMLPresentation(): string;
+ renderProfile(): string[];
+ // https://github.com/ProfileManifests/ProfileManifests/wiki/Manifest-Format
+ renderProfileManifest(translations?: LanguageTranslations): string;
}
function renderADMLString(prefix: string, moduleName: string, nlsString: NlsString, translations?: LanguageTranslations): string {
@@ -68,6 +71,24 @@ function renderADMLString(prefix: string, moduleName: string, nlsString: NlsStri
return `${value}`;
}
+function renderProfileString(_prefix: string, moduleName: string, nlsString: NlsString, translations?: LanguageTranslations): string {
+ let value: string | undefined;
+
+ if (translations) {
+ const moduleTranslations = translations[moduleName];
+
+ if (moduleTranslations) {
+ value = moduleTranslations[nlsString.nlsKey];
+ }
+ }
+
+ if (!value) {
+ value = nlsString.value;
+ }
+
+ return value;
+}
+
abstract class BasePolicy implements Policy {
constructor(
readonly type: PolicyType,
@@ -108,6 +129,19 @@ abstract class BasePolicy implements Policy {
}
protected abstract renderADMLPresentationContents(): string;
+
+ renderProfile() {
+ return [`${this.name}`, this.renderProfileValue()];
+ }
+
+ renderProfileManifest(translations?: LanguageTranslations): string {
+ return `
+${this.renderProfileManifestValue(translations)}
+`;
+ }
+
+ abstract renderProfileValue(): string;
+ abstract renderProfileManifestValue(translations?: LanguageTranslations): string;
}
class BooleanPolicy extends BasePolicy {
@@ -150,6 +184,23 @@ class BooleanPolicy extends BasePolicy {
renderADMLPresentationContents() {
return `${this.name}`;
}
+
+ renderProfileValue(): string {
+ return ``;
+ }
+
+ renderProfileManifestValue(translations?: LanguageTranslations): string {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+boolean`;
+ }
}
class ParseError extends Error {
@@ -204,6 +255,23 @@ class NumberPolicy extends BasePolicy {
renderADMLPresentationContents() {
return `${this.name}`;
}
+
+ renderProfileValue() {
+ return `${this.defaultValue}`;
+ }
+
+ renderProfileManifestValue(translations?: LanguageTranslations) {
+ return `pfm_default
+${this.defaultValue}
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+integer`;
+ }
}
class StringPolicy extends BasePolicy {
@@ -242,6 +310,23 @@ class StringPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+
+ renderProfileValue(): string {
+ return ``;
+ }
+
+ renderProfileManifestValue(translations?: LanguageTranslations): string {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string`;
+ }
}
class ObjectPolicy extends BasePolicy {
@@ -280,6 +365,24 @@ class ObjectPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+
+ renderProfileValue(): string {
+ return ``;
+ }
+
+ renderProfileManifestValue(translations?: LanguageTranslations): string {
+ return `pfm_default
+
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string
+`;
+ }
}
class StringEnumPolicy extends BasePolicy {
@@ -349,6 +452,27 @@ class StringEnumPolicy extends BasePolicy {
renderADMLPresentationContents() {
return ``;
}
+
+ renderProfileValue() {
+ return `${this.enum_[0]}`;
+ }
+
+ renderProfileManifestValue(translations?: LanguageTranslations): string {
+ return `pfm_default
+${this.enum_[0]}
+pfm_description
+${renderProfileString(this.name, this.moduleName, this.description, translations)}
+pfm_name
+${this.name}
+pfm_title
+${this.name}
+pfm_type
+string
+pfm_range_list
+
+ ${this.enum_.map(e => `${e}`).join('\n ')}
+`;
+ }
}
interface QType {
@@ -606,6 +730,197 @@ function renderADML(appName: string, versions: string[], categories: Category[],
`;
}
+function renderProfileManifest(appName: string, bundleIdentifier: string, _versions: string[], _categories: Category[], policies: Policy[], translations?: LanguageTranslations) {
+
+ const requiredPayloadFields = `
+
+ pfm_default
+ Configure ${appName}
+ pfm_name
+ PayloadDescription
+ pfm_title
+ Payload Description
+ pfm_type
+ string
+
+
+ pfm_default
+ ${appName}
+ pfm_name
+ PayloadDisplayName
+ pfm_require
+ always
+ pfm_title
+ Payload Display Name
+ pfm_type
+ string
+
+
+ pfm_default
+ ${bundleIdentifier}
+ pfm_name
+ PayloadIdentifier
+ pfm_require
+ always
+ pfm_title
+ Payload Identifier
+ pfm_type
+ string
+
+
+ pfm_default
+ ${bundleIdentifier}
+ pfm_name
+ PayloadType
+ pfm_require
+ always
+ pfm_title
+ Payload Type
+ pfm_type
+ string
+
+
+ pfm_default
+
+ pfm_name
+ PayloadUUID
+ pfm_require
+ always
+ pfm_title
+ Payload UUID
+ pfm_type
+ string
+
+
+ pfm_default
+ 1
+ pfm_name
+ PayloadVersion
+ pfm_range_list
+
+ 1
+
+ pfm_require
+ always
+ pfm_title
+ Payload Version
+ pfm_type
+ integer
+
+
+ pfm_default
+ Microsoft
+ pfm_name
+ PayloadOrganization
+ pfm_title
+ Payload Organization
+ pfm_type
+ string
+ `;
+
+ const profileManifestSubkeys = policies.map(policy => {
+ return policy.renderProfileManifest(translations);
+ }).join('');
+
+ return `
+
+
+
+ pfm_app_url
+ https://code.visualstudio.com/
+ pfm_description
+ ${appName} Managed Settings
+ pfm_documentation_url
+ https://code.visualstudio.com/docs/setup/enterprise
+ pfm_domain
+ ${bundleIdentifier}
+ pfm_format_version
+ 1
+ pfm_interaction
+ combined
+ pfm_last_modified
+ ${new Date().toISOString().replace(/\.\d+Z$/, 'Z')}
+ pfm_platforms
+
+ macOS
+
+ pfm_subkeys
+
+ ${requiredPayloadFields}
+ ${profileManifestSubkeys}
+
+ pfm_title
+ ${appName}
+ pfm_unique
+
+ pfm_version
+ 1
+
+`;
+}
+
+function renderMacOSPolicy(policies: Policy[], translations: Translations) {
+ const appName = product.nameLong;
+ const bundleIdentifier = product.darwinBundleIdentifier;
+ const payloadUUID = product.darwinProfilePayloadUUID;
+ const UUID = product.darwinProfileUUID;
+
+ const versions = [...new Set(policies.map(p => p.minimumVersion)).values()].sort();
+ const categories = [...new Set(policies.map(p => p.category))];
+
+ const policyEntries =
+ policies.map(policy => policy.renderProfile())
+ .flat()
+ .map(entry => `\t\t\t\t${entry}`)
+ .join('\n');
+
+
+ return {
+ profile: `
+
+
+
+ PayloadContent
+
+
+ PayloadDisplayName
+ ${appName}
+ PayloadIdentifier
+ ${bundleIdentifier}.${UUID}
+ PayloadType
+ ${bundleIdentifier}
+ PayloadUUID
+ ${UUID}
+ PayloadVersion
+ 1
+${policyEntries}
+
+
+ PayloadDescription
+ This profile manages ${appName}. For more information see https://code.visualstudio.com/docs/setup/enterprise
+ PayloadDisplayName
+ ${appName}
+ PayloadIdentifier
+ ${bundleIdentifier}
+ PayloadOrganization
+ Microsoft
+ PayloadType
+ Configuration
+ PayloadUUID
+ ${payloadUUID}
+ PayloadVersion
+ 1
+ TargetDeviceType
+ 5
+
+`,
+ manifests: [{ languageId: 'en-us', contents: renderProfileManifest(appName, bundleIdentifier, versions, categories, policies) },
+ ...translations.map(({ languageId, languageTranslations }) =>
+ ({ languageId, contents: renderProfileManifest(appName, bundleIdentifier, versions, categories, policies, languageTranslations) }))
+ ]
+ };
+}
+
function renderGP(policies: Policy[], translations: Translations) {
const appName = product.nameLong;
const regKey = product.win32RegValueName;
@@ -751,18 +1066,10 @@ async function getTranslations(): Promise {
));
}
-async function main() {
- const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
-
- console.log(`Found ${policies.length} policies:`);
-
- for (const policy of policies) {
- console.log(`- ${policy.name} (${policy.type})`);
- }
-
+async function windowsMain(policies: Policy[], translations: Translations) {
+ const root = '.build/policies/win32';
const { admx, adml } = await renderGP(policies, translations);
- const root = '.build/policies/win32';
await fs.rm(root, { recursive: true, force: true });
await fs.mkdir(root, { recursive: true });
@@ -775,6 +1082,39 @@ async function main() {
}
}
+async function darwinMain(policies: Policy[], translations: Translations) {
+ const bundleIdentifier = product.darwinBundleIdentifier;
+ if (!bundleIdentifier || !product.darwinProfilePayloadUUID || !product.darwinProfileUUID) {
+ throw new Error(`Missing required product information.`);
+ }
+ const root = '.build/policies/darwin';
+ const { profile, manifests } = await renderMacOSPolicy(policies, translations);
+
+ await fs.rm(root, { recursive: true, force: true });
+ await fs.mkdir(root, { recursive: true });
+ await fs.writeFile(path.join(root, `${bundleIdentifier}.mobileconfig`), profile.replace(/\r?\n/g, '\n'));
+
+ for (const { languageId, contents } of manifests) {
+ const languagePath = path.join(root, languageId === 'en-us' ? 'en-us' : Languages[languageId as keyof typeof Languages]);
+ await fs.mkdir(languagePath, { recursive: true });
+ await fs.writeFile(path.join(languagePath, `${bundleIdentifier}.plist`), contents.replace(/\r?\n/g, '\n'));
+ }
+}
+
+async function main() {
+ const [policies, translations] = await Promise.all([parsePolicies(), getTranslations()]);
+ const platform = process.argv[2];
+
+ if (platform === 'darwin') {
+ await darwinMain(policies, translations);
+ } else if (platform === 'win32') {
+ await windowsMain(policies, translations);
+ } else {
+ console.error(`Usage: node build/lib/policies `);
+ process.exit(1);
+ }
+}
+
if (require.main === module) {
main().catch(err => {
if (err instanceof ParseError) {
diff --git a/package.json b/package.json
index fc59723d77d..5f0138ef2a2 100644
--- a/package.json
+++ b/package.json
@@ -1,7 +1,7 @@
{
"name": "code-oss-dev",
"version": "1.99.0",
- "distro": "034ea95a21e3eb734fd22bf565a1e2e80d62ea9b",
+ "distro": "c3ec5ba4852b5682b94358c92bf31484d2739db9",
"author": {
"name": "Microsoft Corporation"
},
diff --git a/product.json b/product.json
index 873ea0eaa13..1d4dca8fc3f 100644
--- a/product.json
+++ b/product.json
@@ -25,6 +25,8 @@
"win32TunnelServiceMutex": "vscodeoss-tunnelservice",
"win32TunnelMutex": "vscodeoss-tunnel",
"darwinBundleIdentifier": "com.visualstudio.code.oss",
+ "darwinProfileUUID": "47827DD9-4734-49A0-AF80-7E19B11495CC",
+ "darwinProfilePayloadUUID": "CF808BE7-53F3-46C6-A7E2-7EDB98A5E959",
"linuxIconName": "code-oss",
"licenseFileName": "LICENSE.txt",
"reportIssueUrl": "https://github.com/microsoft/vscode/issues/new",