Skip to content

Commit

Permalink
Merge pull request #209 from mhutch/javascript-project-system
Browse files Browse the repository at this point in the history
Add support for JavaScript projects
  • Loading branch information
mhutch authored Apr 19, 2024
2 parents 8b8cf9f + af10044 commit 21b91d4
Show file tree
Hide file tree
Showing 9 changed files with 65 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ namespace MonoDevelop.MSBuild.Editor.VisualStudio
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.xproj)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.vcxproj)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.sfxproj)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.esproj)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.proj)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.user)]
[ProvideLanguageExtension (typeof (MSBuildLanguageService), MSBuildFileExtension.pubxml)]
Expand All @@ -67,6 +68,7 @@ namespace MonoDevelop.MSBuild.Editor.VisualStudio
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.xproj, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.vcxproj, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.sfxproj, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.esproj, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.proj, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.user, 65535)]
[ProvideEditorExtension (typeof (MSBuildEditorFactory), MSBuildFileExtension.pubxml, 65535)]
Expand Down
6 changes: 6 additions & 0 deletions MonoDevelop.MSBuild.Editor.VisualStudio/languages.pkgdef
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,12 @@
[$RootKey$\XmlChooserFactory\MSBuild\vcxproj]
"Extension"="vcxproj"

[$RootKey$\XmlChooserFactory\MSBuild\sfxproj]
"Extension"="sfxproj"

[$RootKey$\XmlChooserFactory\MSBuild\esproj]
"Extension"="esproj"

[$RootKey$\XmlChooserFactory\MSBuild\proj]
"Extension"="proj"

Expand Down
2 changes: 1 addition & 1 deletion MonoDevelop.MSBuild/MonoDevelop.MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -78,5 +78,5 @@
LogicalName="MonoDevelop.MSBuild.%(Filename).resources" />
</ItemGroup>

<ProjectExtensions><VisualStudio><UserProperties schemas_4aspnetcore_1buildschema_1json__JsonSchema="buildschema.json" schemas_4codeanalysis_1buildschema_1json__JsonSchema="buildschema.json" schemas_4commontargets_1buildschema_1json__JsonSchema="buildschema.json" schemas_4cpp_1buildschema_1json__JsonSchema="buildschema.json" schemas_4csharp_1buildschema_1json__JsonSchema="buildschema.json" schemas_4illink_1buildschema_1json__JsonSchema="buildschema.json" schemas_4netsdk_1buildschema_1json__JsonSchema="buildschema.json" schemas_4nugetpack_1buildschema_1json__JsonSchema="buildschema.json" schemas_4roslyn_1buildschema_1json__JsonSchema="buildschema.json" schemas_4visualbasic_1buildschema_1json__JsonSchema="buildschema.json" /></VisualStudio></ProjectExtensions>
<ProjectExtensions><VisualStudio><UserProperties schemas_4aspnetcore_1buildschema_1json__JsonSchema="buildschema.json" schemas_4buildschema_1json__JsonSchema="https://json-schema.org/draft-04/schema#" schemas_4codeanalysis_1buildschema_1json__JsonSchema="buildschema.json" schemas_4commontargets_1buildschema_1json__JsonSchema="buildschema.json" schemas_4cpp_1buildschema_1json__JsonSchema="buildschema.json" schemas_4csharp_1buildschema_1json__JsonSchema="buildschema.json" schemas_4illink_1buildschema_1json__JsonSchema="buildschema.json" schemas_4javascript_1buildschema_1json__JsonSchema="buildschema.json" schemas_4netsdk_1buildschema_1json__JsonSchema="buildschema.json" schemas_4nugetpack_1buildschema_1json__JsonSchema="buildschema.json" schemas_4roslyn_1buildschema_1json__JsonSchema="buildschema.json" schemas_4visualbasic_1buildschema_1json__JsonSchema="buildschema.json" /></VisualStudio></ProjectExtensions>
</Project>
1 change: 1 addition & 0 deletions MonoDevelop.MSBuild/Schema/BuiltInSchema.cs
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ static MSBuildSchema Load (BuiltInSchemaId[] schemaIds, out IList<MSBuildSchemaL
BuiltInSchemaId.AnalyzerWarningCodes,
BuiltInSchemaId.StyleRuleCodes], null, "Microsoft.CSharp.CurrentVersion.targets"),
([ BuiltInSchemaId.ILLink ], null, "Microsoft.NET.ILLink.targets"),
([ BuiltInSchemaId.JavaScript ], "Microsoft.VisualStudio.JavaScript.Sdk", sdkTargets),
([ BuiltInSchemaId.NetSdk ], "Microsoft.NET.Sdk", sdkTargets),
([ BuiltInSchemaId.NuGet ], null, "NuGet.targets"),
([ BuiltInSchemaId.NuGetPack ], null, "NuGet.Build.Tasks.Pack.targets"),
Expand Down
1 change: 1 addition & 0 deletions MonoDevelop.MSBuild/Schema/BuiltInSchemaId.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ enum BuiltInSchemaId
AnalyzerWarningCodes,
StyleRuleCodes,
ILLink,
JavaScript,
NetSdk,
NuGet,
NuGetPack,
Expand Down
42 changes: 42 additions & 0 deletions MonoDevelop.MSBuild/Schemas/JavaScript.buildschema.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
{
"license": "Copyright (c) Microsoft. All rights reserved. Licensed under the MIT license. See LICENSE file in the project root for full license information.",
"properties": {
"ShouldRunNpmInstall": {
"description": "Whether to run `npm install` on *Build* and *Restore* commands.",
"type": "bool",
"defaultValue": "true",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#shouldrunnpminstall"
},
"ShouldRunBuildScript": {
"description": "Whether to run `npm run build` on *Build* commands.",
"type": "bool",
"defaultValue": "true",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#shouldrunbuildscript"
},
"BuildCommand": {
"description": "Set or override the CLI command to run for `dotnet build` and the Visual Studio *Build* command. Defaults to running the `build` or `compile` script in the NPM `package.json`.",
"type": "string",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#buildcommand"
},
"StartupCommand": {
"description": "Set or override the CLI command to run for `dotnet run` and the Visual Studio *Run* command. Defaults to running the `start`, `server` or `dev` script in the NPM `package.json`.",
"type": "string",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#startupcommand"
},
"TestCommand": {
"description": "Set or override the CLI command to run for `dotnet test` and the Visual Studio *Run Tests* command. Defaults to running the `test` script in the NPM `package.json`.",
"type": "string",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#testcommand"
},
"CleanCommand": {
"description": "Set or override the CLI command to run for `dotnet clean` and the Visual Studio *Clean* command. Defaults to running the `clean` script in the NPM `package.json`.",
"type": "string",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#cleancommand"
},
"PublisjCommand": {
"description": "Set or override the CLI command to run for `dotnet publish` and the Visual Studio *Publish* command. Defaults to running the `publish` script in the NPM `package.json`.",
"type": "string",
"helpUrl": "https://learn.microsoft.com/en-us/visualstudio/javascript/javascript-project-system-msbuild-reference#publishcommand"
}
}
}
5 changes: 3 additions & 2 deletions MonoDevelop.MSBuild/Workspace/MSBuildFileExtension.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,12 @@ class MSBuildFileExtension
public const string fsproj = ".fsproj";
public const string xproj = ".xproj";
public const string vcxproj = ".vcxproj";
public const string sfxproj = ".sfxproj";
public const string esproj = ".esproj";
public const string proj = ".proj";
public const string user = ".user";
public const string sfxproj = ".sfxproj";
public const string pubxml = ".pubxml";

public static readonly string[] All = new[] { targets, props, tasks, overridetasks, csproj, vbproj, fsproj, xproj, vcxproj, proj, user, sfxproj, pubxml };
public static readonly string[] All = [ targets, props, tasks, overridetasks, csproj, vbproj, fsproj, xproj, vcxproj, sfxproj, esproj, proj, user, pubxml ];
}
}
5 changes: 5 additions & 0 deletions MonoDevelop.MSBuild/Workspace/MSBuildFileKind.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,11 @@ public enum MSBuildFileKind
// https://github.com/dotnet/arcade/tree/19969f682c8cb42443ade22a42ffee4da7a8c2ca/src/Microsoft.DotNet.SharedFramework.Sdk
SfxProj = Project + 6,

/// <summary>
/// The project is a JavaScript Project System project
/// </summary>
ESProj = Project + 7,

/// <summary>
/// If this flag is set, the file is a <c>.user</c> file used to store user-specific settings and customizations for a project file.
/// </summary>
Expand Down
4 changes: 4 additions & 0 deletions MonoDevelop.MSBuild/Workspace/MSBuildFileKindExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,9 @@ static MSBuildFileKind GetProjectFileKind (string extension)
if (string.Equals (extension, MSBuildFileExtension.sfxproj, StringComparison.OrdinalIgnoreCase)) {
return MSBuildFileKind.SfxProj;
}
if (string.Equals (extension, MSBuildFileExtension.esproj, StringComparison.OrdinalIgnoreCase)) {
return MSBuildFileKind.ESProj;
}
if (string.Equals (extension, MSBuildFileExtension.pubxml, StringComparison.OrdinalIgnoreCase)) {
return MSBuildFileKind.PubXml;
}
Expand Down Expand Up @@ -127,6 +130,7 @@ public static bool IsUserProj (this MSBuildFileKind kind, out MSBuildFileKind pr
MSBuildFileKind.XProj => isUserProj ? "User settings for a generic MonoDevelop project file" : "Generic MonoDevelop project file",
MSBuildFileKind.VcxProj => isUserProj ? "User settings for a C++ project file" : "C++ project file",
MSBuildFileKind.SfxProj => isUserProj ? "User settings for a Shared Framework project file" : "Shared Framework project file",
MSBuildFileKind.ESProj => isUserProj ? "User settings for a JavaScript Project System project file" : "JavaScript Project System project file",
MSBuildFileKind.Project => isUserProj ? "User settings for a project file" : "Project file",
_ => null
};
Expand Down

0 comments on commit 21b91d4

Please sign in to comment.