Skip to content

Commit

Permalink
[RiderJson] Add DevEnv value for Rider and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
SmelJey committed Aug 1, 2023
1 parent 747f63e commit ed90d61
Show file tree
Hide file tree
Showing 13 changed files with 220 additions and 158 deletions.
9 changes: 0 additions & 9 deletions Sharpmake.Application/CommandLineArguments.cs
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ public enum InputType
public string DebugSolutionStartArguments = string.Empty;
public string DebugSolutionPath = string.Empty;
public DevEnv DebugSolutionDevEnv = DebugProjectGenerator.DefaultDevEnv;
public bool GenerateRdJson = false;

[CommandLine.Option("sources", @"sharpmake sources files: ex: /sources( ""project1.sharpmake"", ""..\..\project2.sharpmake"" )")]
public void SetSources(params string[] files)
Expand Down Expand Up @@ -363,14 +362,6 @@ public void CommandLineForceCleanup(string autocleanupDb)
Exit = true;
}

[CommandLine.Option("rdjson", @"Generate Rider project files")]
public void CommandLineGenerateRdJson(bool minimize = false, bool ignoreDefaults = false)
{
GenerateRdJson = true;
RiderJson.Minimize = minimize;
RiderJson.IgnoreDefaults = ignoreDefaults;
}

public void Validate()
{
if (Assemblies.Length == 0 && Sources.Length == 0)
Expand Down
5 changes: 0 additions & 5 deletions Sharpmake.Application/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -658,11 +658,6 @@ public static Builder CreateBuilder(BuildContext.BaseBuildContext context, Argum
+ $" Make sure to have a static entry point method flagged with [{typeof(Main).FullName}] attribute, and add 'arguments.Generate<[your_class]>();' in it.");
builder.Context.ConfigureOrder = builder.Arguments.ConfigureOrder;

if (parameters.GenerateRdJson)
{
builder.EventPostGenerationReport += RiderJson.PostGenerationCallback;
}

// Call all configuration's methods and resolve project/solution member's values
using (Builder.Instance.CreateProfilingScope("Build"))
builder.BuildProjectAndSolution();
Expand Down
5 changes: 5 additions & 0 deletions Sharpmake.Application/Properties/launchSettings.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,11 @@
"commandLineArgs": "/sources(@\u0027QTFileCustomBuild.sharpmake.cs\u0027)",
"workingDirectory": "$(ProjectDir)\\..\\samples\\QTFileCustomBuild"
},
"Sample (RiderJson)": {
"commandName": "Project",
"commandLineArgs": "/sources(@\u0027RiderJson.sharpmake.cs\u0027)",
"workingDirectory": "$(ProjectDir)\\..\\samples\\RiderJson"
},
"Sample (SimpleExeLibDependency)": {
"commandName": "Project",
"commandLineArgs": "/sources(@\u0027SimpleExeLibDependency.sharpmake.cs\u0027)",
Expand Down
20 changes: 20 additions & 0 deletions Sharpmake.Generators/GeneratorManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
using Sharpmake.Generators.Apple;
using Sharpmake.Generators.FastBuild;
using Sharpmake.Generators.Generic;
using Sharpmake.Generators.Rider;
using Sharpmake.Generators.VisualStudio;

namespace Sharpmake.Generators
Expand All @@ -25,6 +26,9 @@ public class GeneratorManager : IGeneratorManager
private MakeApplication _makeApplicationGenerator = null;
public MakeApplication MakeApplicationGenerator => _makeApplicationGenerator ?? (_makeApplicationGenerator = new MakeApplication());

public RiderJson _riderJsonGenerator = null;
public RiderJson RiderJsonGenerator => _riderJsonGenerator ?? (_riderJsonGenerator = new RiderJson());

// Project generators
private CSproj _csprojGenerator = null;
public CSproj CsprojGenerator => _csprojGenerator ?? (_csprojGenerator = new CSproj());
Expand Down Expand Up @@ -104,6 +108,11 @@ public void Generate(Builder builder,
BffGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
break;
}
case DevEnv.rider:
{
BffGenerator.Generate(builder, project, configurations, projectFile, generatedFiles, skipFiles);
break;
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + devEnv);
Expand Down Expand Up @@ -158,6 +167,17 @@ public void Generate(Builder builder,
SlnGenerator.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
break;
}
case DevEnv.rider:
{
if (UtilityMethods.HasFastBuildConfig(configurations))
{
var masterBff = new MasterBff();
masterBff.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
}

RiderJsonGenerator.Generate(builder, solution, configurations, solutionFile, generatedFiles, skipFiles);
break;
}
default:
{
throw new Error("Generate called with unknown DevEnv: " + devEnv);
Expand Down
5 changes: 4 additions & 1 deletion Sharpmake.Generators/Rider/RiderJson.Template.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
namespace Sharpmake.Generators.Rider
// Copyright (c) Ubisoft. All Rights Reserved.
// Licensed under the Apache 2.0 License. See LICENSE.md in the project root for license information.

namespace Sharpmake.Generators.Rider
{
public partial class RiderJson
{
Expand Down
7 changes: 5 additions & 2 deletions Sharpmake.Generators/Rider/RiderJson.Util.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,7 @@
using System;
// Copyright (c) Ubisoft. All Rights Reserved.
// Licensed under the Apache 2.0 License. See LICENSE.md in the project root for license information.

using System;
using System.Collections;
using System.Linq;
using Sharpmake.Generators.VisualStudio;
Expand Down Expand Up @@ -81,7 +84,7 @@ public static string GetCompiler(this IGenerationContext context)
return Compiler.Clang;
}

switch (context.Configuration.Compiler)
switch (toolset.GetDefaultDevEnvForToolset())
{
case DevEnv.vs2015:
return Compiler.Vs15;
Expand Down
Loading

0 comments on commit ed90d61

Please sign in to comment.