Skip to content

Commit 9cf3f65

Browse files
committed
Merge branch 'hotfix-0.14.6'
2 parents de84348 + 0508243 commit 9cf3f65

File tree

17 files changed

+818
-559
lines changed

17 files changed

+818
-559
lines changed

Sharpmake.Application/CommandLineArguments.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,7 @@ public enum InputType
4646
public string[] Assemblies = new string[0];
4747
public HashSet<string> Defines = new HashSet<string>();
4848
public InputType Input = InputType.Undefined;
49+
public string ProfileFile = null;
4950
public bool Exit = false;
5051
public bool BlobOnly = false;
5152
public bool CleanBlobsOnly = false;
@@ -95,6 +96,12 @@ public void SetDefines(params string[] defines)
9596
DebugWriteLine(" " + define);
9697
}
9798

99+
[CommandLine.Option("profile", @"Profile file used to activate and output profiling: ex: /profile( @""D:\profile.json"" )")]
100+
public void SetProfileFile(string profileFile)
101+
{
102+
ProfileFile = profileFile;
103+
}
104+
98105
[CommandLine.Option("projectlogfiles", @"log files contained in a project for debug purpose: ex: /projectlogfiles( ""s:\p4\ac\dev\sharpmake\projects\win32\system\system.vcproj"" )")]
99106
public void ProjectLogFiles(string projectFile)
100107
{

Sharpmake.Application/Program.cs

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -444,16 +444,19 @@ private static void CreateBuilderAndGenerate(BuildContext.BaseBuildContext build
444444
}
445445
else
446446
{
447-
if (parameters.GenerateDebugSolution)
448-
LogWriteLine("Generate debug solution...");
447+
IDictionary<Type, GenerationOutput> outputs;
448+
using (Builder.Instance.CreateProfilingScope("Generate"))
449+
outputs = builder.Generate();
449450

450-
var outputs = builder.Generate();
451451
foreach (var output in outputs)
452452
{
453453
if (output.Value.Exception != null)
454454
throw new Error(output.Value.Exception, "Error encountered while generating {0}", output.Key);
455455
}
456456

457+
if (!string.IsNullOrEmpty(parameters.ProfileFile))
458+
builder.DumpTraceFile(parameters.ProfileFile);
459+
457460
if (parameters.DumpDependency)
458461
DependencyTracker.Instance.DumpGraphs(outputs);
459462

@@ -598,28 +601,38 @@ public static Builder CreateBuilder(BuildContext.BaseBuildContext context, Argum
598601
if (parameters.ProfileOutput)
599602
builder.EventOutputProfile += LogWrite;
600603

604+
if (!string.IsNullOrEmpty(parameters.ProfileFile))
605+
builder.EnableProfiling();
606+
601607
try
602608
{
603609
// Generate debug solution
604-
if (generateDebugSolution)
610+
using (Builder.Instance.CreateProfilingScope("Debug solution"))
605611
{
606-
DebugProjectGenerator.GenerateDebugSolution(parameters.Sources, builder.Arguments, parameters.DebugSolutionStartArguments, parameters.Defines.ToArray());
607-
builder.BuildProjectAndSolution();
608-
return builder;
612+
if (generateDebugSolution)
613+
{
614+
LogWriteLine("Generate debug solution...");
615+
DebugProjectGenerator.GenerateDebugSolution(parameters.Sources, builder.Arguments, parameters.DebugSolutionStartArguments, parameters.Defines.ToArray());
616+
builder.BuildProjectAndSolution();
617+
return builder;
618+
}
609619
}
610620

611621
// Load user input (either files or pre-built assemblies)
612-
switch (parameters.Input)
622+
using (Builder.Instance.CreateProfilingScope("EntryPoints"))
613623
{
614-
case Argument.InputType.File:
615-
builder.ExecuteEntryPointInAssemblies<Main>(builder.LoadSharpmakeFiles(parameters.Sources));
616-
break;
617-
case Argument.InputType.Assembly:
618-
builder.ExecuteEntryPointInAssemblies<Main>(builder.LoadAssemblies(parameters.Assemblies));
619-
break;
620-
case Argument.InputType.Undefined:
621-
default:
622-
throw new Error("Sharpmake input missing, use /sources() or /assemblies()");
624+
switch (parameters.Input)
625+
{
626+
case Argument.InputType.File:
627+
builder.ExecuteEntryPointInAssemblies<Main>(builder.LoadSharpmakeFiles(parameters.Sources));
628+
break;
629+
case Argument.InputType.Assembly:
630+
builder.ExecuteEntryPointInAssemblies<Main>(builder.LoadAssemblies(parameters.Assemblies));
631+
break;
632+
case Argument.InputType.Undefined:
633+
default:
634+
throw new Error("Sharpmake input missing, use /sources() or /assemblies()");
635+
}
623636
}
624637

625638
if (builder.Arguments.TypesToGenerate.Count == 0)
@@ -628,7 +641,8 @@ public static Builder CreateBuilder(BuildContext.BaseBuildContext context, Argum
628641
builder.Context.ConfigureOrder = builder.Arguments.ConfigureOrder;
629642

630643
// Call all configuration's methods and resolve project/solution member's values
631-
builder.BuildProjectAndSolution();
644+
using (Builder.Instance.CreateProfilingScope("Build"))
645+
builder.BuildProjectAndSolution();
632646

633647
return builder;
634648
}

Sharpmake.Application/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,4 +43,4 @@
4343
//
4444
// You can specify all the values or you can default the Build and Revision Numbers
4545
// by using the '*' as shown below:
46-
[assembly: AssemblyVersion("0.14.5.0")]
46+
[assembly: AssemblyVersion("0.14.6.0")]

Sharpmake.Generators/FastBuild/Bff.cs

Lines changed: 32 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -206,36 +206,46 @@ List<string> skipFiles
206206
string projectBffFile = Bff.GetBffFileName(projectPath, firstConf.BffFileName); // TODO: bff file name could be different per conf, hence we would generate more than one file
207207
string fastBuildClrSupport = Util.IsDotNet(firstConf) ? "/clr" : FileGeneratorUtilities.RemoveLineTag;
208208
List<Vcxproj.ProjectFile> filesInNonDefaultSection;
209-
var confSourceFiles = GetGeneratedFiles(context, configurations, out filesInNonDefaultSection);
209+
Dictionary<Project.Configuration, Dictionary<Tuple<bool, bool, bool, bool, bool, bool, Options.Vc.Compiler.Exceptions, Tuple<bool>>, List<Vcxproj.ProjectFile>>> confSourceFiles;
210+
using (builder.CreateProfilingScope("BffGenerator.Generate:GetGeneratedFiles"))
211+
{
212+
confSourceFiles = GetGeneratedFiles(context, configurations, out filesInNonDefaultSection);
213+
}
210214

211215
// Generate all configuration options onces...
212216
var options = new Dictionary<Project.Configuration, Options.ExplicitOptions>();
213217
var cmdLineOptions = new Dictionary<Project.Configuration, ProjectOptionsGenerator.VcxprojCmdLineOptions>();
214218
var additionalDependenciesPerConf = new Dictionary<Project.Configuration, OrderableStrings>();
215-
var projectOptionsGen = new ProjectOptionsGenerator();
216-
foreach (Project.Configuration conf in configurations)
219+
ProjectOptionsGenerator projectOptionsGen;
220+
using (builder.CreateProfilingScope("BffGenerator.Generate:ProjectOptionsGenerator()"))
221+
{
222+
projectOptionsGen = new ProjectOptionsGenerator();
223+
}
224+
using (builder.CreateProfilingScope("BffGenerator.Generate:confs1"))
217225
{
218-
context.Options = new Options.ExplicitOptions();
219-
context.CommandLineOptions = new ProjectOptionsGenerator.VcxprojCmdLineOptions();
220-
context.Configuration = conf;
226+
foreach (Project.Configuration conf in configurations)
227+
{
228+
context.Options = new Options.ExplicitOptions();
229+
context.CommandLineOptions = new ProjectOptionsGenerator.VcxprojCmdLineOptions();
230+
context.Configuration = conf;
221231

222-
GenerateBffOptions(projectOptionsGen, context, additionalDependenciesPerConf);
232+
GenerateBffOptions(projectOptionsGen, context, additionalDependenciesPerConf);
223233

224-
options.Add(conf, context.Options);
225-
cmdLineOptions.Add(conf, (ProjectOptionsGenerator.VcxprojCmdLineOptions)context.CommandLineOptions);
234+
options.Add(conf, context.Options);
235+
cmdLineOptions.Add(conf, (ProjectOptionsGenerator.VcxprojCmdLineOptions)context.CommandLineOptions);
226236

227-
// Validation of unsupported cases
228-
if (conf.EventPreLink.Count > 0)
229-
throw new Error("Sharpmake-FastBuild : Pre-Link Events not yet supported.");
230-
if (context.Options["IgnoreImportLibrary"] == "true")
231-
throw new Error("Sharpmake-FastBuild : IgnoreImportLibrary not yet supported.");
237+
// Validation of unsupported cases
238+
if (conf.EventPreLink.Count > 0)
239+
throw new Error("Sharpmake-FastBuild : Pre-Link Events not yet supported.");
240+
if (context.Options["IgnoreImportLibrary"] == "true")
241+
throw new Error("Sharpmake-FastBuild : IgnoreImportLibrary not yet supported.");
232242

233-
if (conf.Output != Project.Configuration.OutputType.None && conf.FastBuildBlobbed)
234-
{
235-
ConfigureUnities(context, confSourceFiles);
243+
if (conf.Output != Project.Configuration.OutputType.None && conf.FastBuildBlobbed)
244+
{
245+
ConfigureUnities(context, confSourceFiles);
246+
}
236247
}
237248
}
238-
239249
ResolveUnities(project, projectPath);
240250

241251
// Start writing Bff
@@ -1453,10 +1463,11 @@ private static void FillLinkerOptions(BffGenerationContext context)
14531463
private static Strings CollectNatvisFiles(BffGenerationContext context)
14541464
{
14551465
Project.Configuration projectConfig = context.Configuration;
1466+
1467+
var natvisFiles = new Strings(projectConfig.Project.NatvisFiles);
14561468
if (projectConfig.Output == Project.Configuration.OutputType.Dll || projectConfig.Output == Project.Configuration.OutputType.Exe)
14571469
{
1458-
Strings natvisFiles = new Strings(projectConfig.Project.NatvisFiles);
1459-
HashSet<Project> visitedProjects = new HashSet<Project>();
1470+
var visitedProjects = new HashSet<Project>();
14601471
foreach (Project.Configuration resolvedDepConfig in projectConfig.ResolvedDependencies)
14611472
{
14621473
if (resolvedDepConfig.Output != Project.Configuration.OutputType.Dll && resolvedDepConfig.Output != Project.Configuration.OutputType.Exe)
@@ -1471,13 +1482,8 @@ private static Strings CollectNatvisFiles(BffGenerationContext context)
14711482
}
14721483
}
14731484
}
1474-
1475-
return natvisFiles;
1476-
}
1477-
else
1478-
{
1479-
return projectConfig.Project.NatvisFiles;
14801485
}
1486+
return natvisFiles;
14811487
}
14821488

14831489
private static void FillEmbeddedNatvisOptions(BffGenerationContext context)

Sharpmake.Generators/Properties/AssemblyInfo.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,6 @@
4444
//
4545
// You can specify all the values or you can default the Build and Revision Numbers
4646
// by using the '*' as shown below:
47-
[assembly: AssemblyVersion("0.14.5.0")]
47+
[assembly: AssemblyVersion("0.14.6.0")]
4848

4949
[assembly: InternalsVisibleTo("Sharpmake")]

Sharpmake.Generators/VisualStudio/Csproj.Template.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,7 @@ public static class Project
145145
<LangVersion>[options.LanguageVersion]</LangVersion>
146146
<CopyVsixExtensionFiles>[options.CopyVsixExtensionFiles]</CopyVsixExtensionFiles>
147147
<CopyVsixExtensionLocation>[options.CopyVsixExtensionLocation]</CopyVsixExtensionLocation>
148+
<ProduceReferenceAssembly>[options.ProduceReferenceAssembly]</ProduceReferenceAssembly>
148149
</PropertyGroup>
149150
";
150151

Sharpmake.Generators/VisualStudio/Csproj.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1447,6 +1447,12 @@ List<string> skipFiles
14471447

14481448
project.AddCSharpSpecificImportProjects(importProjects, devenv);
14491449

1450+
// Add custom .targets files as import projects.
1451+
foreach (string targetsFile in project.CustomTargetsFiles)
1452+
{
1453+
importProjects.AddRange(targetsFile.Select(f => new ImportProject() { Project = targetsFile }));
1454+
}
1455+
14501456
WriteImportProjects(importProjects.Distinct(EqualityComparer<ImportProject>.Default), project, configurations.First(), writer, resolver);
14511457

14521458
foreach (var element in project.UsingTasks)
@@ -3321,6 +3327,12 @@ private Options.ExplicitOptions GenerateOptions(CSharpProject project, Project.C
33213327
Options.Option(Options.CSharp.SonarQubeExclude.Enabled, () => { options["SonarQubeExclude"] = "True"; })
33223328
);
33233329

3330+
SelectOption
3331+
(
3332+
Options.Option(Options.CSharp.ProduceReferenceAssembly.Enabled, () => { options["ProduceReferenceAssembly"] = "True"; }),
3333+
Options.Option(Options.CSharp.ProduceReferenceAssembly.Disabled, () => { options["ProduceReferenceAssembly"] = RemoveLineTag; })
3334+
);
3335+
33243336
options["AssemblyOriginatorKeyFile"] = Options.PathOption.Get<Options.CSharp.AssemblyOriginatorKeyFile>(conf, RemoveLineTag, _projectPath);
33253337
options["MinimumVisualStudioVersion"] = Options.StringOption.Get<Options.CSharp.MinimumVisualStudioVersion>(conf);
33263338
options["OldToolsVersion"] = Options.StringOption.Get<Options.CSharp.OldToolsVersion>(conf);

0 commit comments

Comments
 (0)