Skip to content

Commit f80cde9

Browse files
committed
add platform override properties
1 parent a1eef20 commit f80cde9

3 files changed

Lines changed: 398 additions & 3 deletions

File tree

Extension/.scripts/generateOptionsSchema.ts

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,8 +85,13 @@ function replaceReferences(definitions: any, objects: any): any {
8585
objects[key].anyOf = replaceReferences(definitions, objects[key].anyOf);
8686
}
8787

88-
// Recursively replace references if this object has properties.
89-
if (objects[key].hasOwnProperty('type') && objects[key].type === 'object' && objects[key].properties !== null) {
88+
// Handle 'oneOf' with references
89+
if (objects[key].hasOwnProperty('oneOf')) {
90+
objects[key].oneOf = replaceReferences(definitions, objects[key].oneOf);
91+
}
92+
93+
// Recursively replace references if this schema node has properties.
94+
if (objects[key].hasOwnProperty('properties') && objects[key].properties !== null) {
9095
objects[key].properties = replaceReferences(definitions, objects[key].properties);
9196
objects[key].properties = updateDefaults(objects[key].properties, objects[key].default);
9297
}
@@ -117,11 +122,13 @@ function mergeReferences(baseDefinitions: any, additionalDefinitions: any): void
117122
export async function main() {
118123
const packageJSON: any = JSON.parse(await read(resolve($root, 'package.json')));
119124
const schemaJSON: any = JSON.parse(await read(resolve($root, 'tools/OptionsSchema.json')));
125+
const taskDefinitionsJSON: any = JSON.parse(await read(resolve($root, 'tools/TaskDefinitionsSchema.json')));
120126
const symbolSettingsJSON: any = JSON.parse(await read(resolve($root, 'tools/VSSymbolSettings.json')));
121127

122128
mergeReferences(schemaJSON.definitions, symbolSettingsJSON.definitions);
123129

124130
schemaJSON.definitions = replaceReferences(schemaJSON.definitions, schemaJSON.definitions);
131+
taskDefinitionsJSON.definitions = replaceReferences(taskDefinitionsJSON.definitions, taskDefinitionsJSON.definitions);
125132

126133
// Hard Code adding in configurationAttributes launch and attach.
127134
// cppdbg
@@ -132,6 +139,9 @@ export async function main() {
132139
packageJSON.contributes.debuggers[1].configurationAttributes.launch = schemaJSON.definitions.CppvsdbgLaunchOptions;
133140
packageJSON.contributes.debuggers[1].configurationAttributes.attach = schemaJSON.definitions.CppvsdbgAttachOptions;
134141

142+
// task definitions
143+
packageJSON.contributes.taskDefinitions = [taskDefinitionsJSON.definitions.CppBuildTaskDefinition];
144+
135145
let content: string = JSON.stringify(packageJSON, null, 4);
136146

137147
// We use '\u200b' (unicode zero-length space character) to break VS Code's URL detection regex for URLs that are examples. This process will

Extension/package.json

Lines changed: 268 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -532,6 +532,273 @@
532532
"detail": {
533533
"type": "string",
534534
"description": "%c_cpp.taskDefinitions.detail.description%"
535+
},
536+
"windows": {
537+
"type": "object",
538+
"properties": {
539+
"command": {
540+
"oneOf": [
541+
{
542+
"type": "string"
543+
},
544+
{
545+
"type": "object",
546+
"required": [
547+
"value",
548+
"quoting"
549+
],
550+
"properties": {
551+
"value": {
552+
"type": "string",
553+
"description": "%c_cpp.taskDefinitions.args.value.description%"
554+
},
555+
"quoting": {
556+
"type": "string",
557+
"enum": [
558+
"escape",
559+
"strong",
560+
"weak"
561+
],
562+
"enumDescriptions": [
563+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
564+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
565+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
566+
],
567+
"default": "strong",
568+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
569+
}
570+
}
571+
}
572+
]
573+
},
574+
"args": {
575+
"type": "array",
576+
"description": "%c_cpp.taskDefinitions.args.description%",
577+
"items": {
578+
"oneOf": [
579+
{
580+
"type": "string"
581+
},
582+
{
583+
"type": "object",
584+
"required": [
585+
"value",
586+
"quoting"
587+
],
588+
"properties": {
589+
"value": {
590+
"type": "string",
591+
"description": "%c_cpp.taskDefinitions.args.value.description%"
592+
},
593+
"quoting": {
594+
"type": "string",
595+
"enum": [
596+
"escape",
597+
"strong",
598+
"weak"
599+
],
600+
"enumDescriptions": [
601+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
602+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
603+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
604+
],
605+
"default": "strong",
606+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
607+
}
608+
}
609+
}
610+
]
611+
}
612+
},
613+
"options": {
614+
"type": "object",
615+
"description": "%c_cpp.taskDefinitions.options.description%",
616+
"properties": {
617+
"cwd": {
618+
"type": "string",
619+
"description": "%c_cpp.taskDefinitions.options.cwd.description%"
620+
}
621+
}
622+
}
623+
}
624+
},
625+
"linux": {
626+
"type": "object",
627+
"properties": {
628+
"command": {
629+
"oneOf": [
630+
{
631+
"type": "string"
632+
},
633+
{
634+
"type": "object",
635+
"required": [
636+
"value",
637+
"quoting"
638+
],
639+
"properties": {
640+
"value": {
641+
"type": "string",
642+
"description": "%c_cpp.taskDefinitions.args.value.description%"
643+
},
644+
"quoting": {
645+
"type": "string",
646+
"enum": [
647+
"escape",
648+
"strong",
649+
"weak"
650+
],
651+
"enumDescriptions": [
652+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
653+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
654+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
655+
],
656+
"default": "strong",
657+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
658+
}
659+
}
660+
}
661+
]
662+
},
663+
"args": {
664+
"type": "array",
665+
"description": "%c_cpp.taskDefinitions.args.description%",
666+
"items": {
667+
"oneOf": [
668+
{
669+
"type": "string"
670+
},
671+
{
672+
"type": "object",
673+
"required": [
674+
"value",
675+
"quoting"
676+
],
677+
"properties": {
678+
"value": {
679+
"type": "string",
680+
"description": "%c_cpp.taskDefinitions.args.value.description%"
681+
},
682+
"quoting": {
683+
"type": "string",
684+
"enum": [
685+
"escape",
686+
"strong",
687+
"weak"
688+
],
689+
"enumDescriptions": [
690+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
691+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
692+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
693+
],
694+
"default": "strong",
695+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
696+
}
697+
}
698+
}
699+
]
700+
}
701+
},
702+
"options": {
703+
"type": "object",
704+
"description": "%c_cpp.taskDefinitions.options.description%",
705+
"properties": {
706+
"cwd": {
707+
"type": "string",
708+
"description": "%c_cpp.taskDefinitions.options.cwd.description%"
709+
}
710+
}
711+
}
712+
}
713+
},
714+
"osx": {
715+
"type": "object",
716+
"properties": {
717+
"command": {
718+
"oneOf": [
719+
{
720+
"type": "string"
721+
},
722+
{
723+
"type": "object",
724+
"required": [
725+
"value",
726+
"quoting"
727+
],
728+
"properties": {
729+
"value": {
730+
"type": "string",
731+
"description": "%c_cpp.taskDefinitions.args.value.description%"
732+
},
733+
"quoting": {
734+
"type": "string",
735+
"enum": [
736+
"escape",
737+
"strong",
738+
"weak"
739+
],
740+
"enumDescriptions": [
741+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
742+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
743+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
744+
],
745+
"default": "strong",
746+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
747+
}
748+
}
749+
}
750+
]
751+
},
752+
"args": {
753+
"type": "array",
754+
"description": "%c_cpp.taskDefinitions.args.description%",
755+
"items": {
756+
"oneOf": [
757+
{
758+
"type": "string"
759+
},
760+
{
761+
"type": "object",
762+
"required": [
763+
"value",
764+
"quoting"
765+
],
766+
"properties": {
767+
"value": {
768+
"type": "string",
769+
"description": "%c_cpp.taskDefinitions.args.value.description%"
770+
},
771+
"quoting": {
772+
"type": "string",
773+
"enum": [
774+
"escape",
775+
"strong",
776+
"weak"
777+
],
778+
"enumDescriptions": [
779+
"%c_cpp.taskDefinitions.args.quoting.escape.description%",
780+
"%c_cpp.taskDefinitions.args.quoting.strong.description%",
781+
"%c_cpp.taskDefinitions.args.quoting.weak.description%"
782+
],
783+
"default": "strong",
784+
"description": "%c_cpp.taskDefinitions.args.quoting.description%"
785+
}
786+
}
787+
}
788+
]
789+
}
790+
},
791+
"options": {
792+
"type": "object",
793+
"description": "%c_cpp.taskDefinitions.options.description%",
794+
"properties": {
795+
"cwd": {
796+
"type": "string",
797+
"description": "%c_cpp.taskDefinitions.options.cwd.description%"
798+
}
799+
}
800+
}
801+
}
535802
}
536803
}
537804
}
@@ -6944,4 +7211,4 @@
69447211
"uuid": "^11.1.1",
69457212
"undici": "^7.28.0"
69467213
}
6947-
}
7214+
}

0 commit comments

Comments
 (0)