Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* MvsSln up to rev `9c39498` due to 3F/MvsSln#25 Part of #144 * Post-Processing #148: Implemented backend logic with configurable environment: Format: $(SolutionPath);$(MSBuildThisFileFullPath);...populated property names...;.... ``` <Target Name="DllExportPostProc"> <!-- Now we can access the following properties and items: $(DllExport) - version $(DllExportSln) - full path to .sln which controls current project $(DllExportPrj) - full path to current project where processed .NET DllExport @(DllExportDirX64) - $(TargetDir)x64\*.* @(DllExportDirX86) - $(TargetDir)x86\*.* @(DllExportDirBefore) - $(TargetDir)Before\*.* @(DllExportDirAfter) - $(TargetDir)After\*.* @(DllExportDependents + populated property name) - each populated properties from DllExportInvokedPoint, e.g. DllExportDependentsTargetDir @(DllExportDependencies + populated property name) - each populated properties from DllExportInvokedPoint, e.g. DllExportDependenciesTargetDir --> </Target> ``` * Post-Proc. Added support of external .net.dllexport.targets * PostProc usage has been moved into ExportTaskImplementation * Fixed MSB4094 when using the same properties +Checking the existence of our entry point * `DllExportInvokedPoint` renamed as `DllExportProcEnv` * Basic GUI support for predefined options in Post-Proc feature That is, *! Some Post-Proc features are not yet available in GUI. But you can already configure it with msbuild. * cleanup * Updated data in SimpleConfFormater.Parse() +PostProc +PreProc * MvsSln up to rev `838fab00dd` /? #148 (comment) * MvsSln up to rev `e07c5806dd`: +`ProjectReference` support without obsolete projectguid * Updated MvsSln 2.5.2 * Added multiple destination support via derivative targets: #148 (comment) * +`DllExportSeqDependents...` Includes sequential referencing through other projects
- Loading branch information
Showing
35 changed files
with
1,520 additions
and
46 deletions.
There are no files selected for viewing
Submodule MvsSln
updated
43 files
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
//# Author of original code ([Decompiled] MIT-License): Copyright (c) 2009-2015 Robert Giesecke | ||
//# Use Readme & LICENSE files for details. | ||
|
||
//# Modifications: Copyright (c) 2016-2020 Denis Kuzmin < x-3F@outlook.com > GitHub/3F | ||
//$ Distributed under the MIT License (MIT) | ||
|
||
using System; | ||
using System.Collections.Generic; | ||
using Microsoft.Build.Execution; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
using net.r_eg.DllExport; | ||
using net.r_eg.MvsSln.Core; | ||
|
||
namespace RGiesecke.DllExport.MSBuild | ||
{ | ||
internal class Executor: IPostProcExecutor | ||
{ | ||
private readonly TaskLoggingHelper log; | ||
|
||
/// <summary> | ||
/// Executes IXProject through MSBuild engine. | ||
/// </summary> | ||
/// <param name="xp"></param> | ||
/// <param name="entrypoint">Initial target.</param> | ||
/// <param name="properties">Additional properties that will be available when executing code.</param> | ||
/// <returns>True if request was a complete success.</returns> | ||
public bool Execute(IXProject xp, string entrypoint, IDictionary<string, string> properties = null) | ||
{ | ||
if(xp == null) { | ||
throw new ArgumentNullException(nameof(xp)); | ||
} | ||
|
||
UpdateGlobalProperties(xp, properties); | ||
|
||
var request = new BuildRequestData | ||
( | ||
xp.Project.CreateProjectInstance(), | ||
new string[] { entrypoint ?? throw new ArgumentNullException(nameof(entrypoint)) }, | ||
new HostServices() | ||
); | ||
|
||
#if !NET40 | ||
|
||
using(BuildManager manager = new BuildManager(DllExportVersion.DXP)) { | ||
return Build(manager, request, false); | ||
} | ||
|
||
#else | ||
|
||
// 4.0.30319 | ||
return Build(new BuildManager(DllExportVersion.DXP), request, false); | ||
|
||
#endif | ||
} | ||
|
||
public Executor(TaskLoggingHelper log) | ||
{ | ||
this.log = log ?? throw new ArgumentNullException(nameof(log)); | ||
} | ||
|
||
protected bool Build(BuildManager manager, BuildRequestData request, bool silent) | ||
{ | ||
BuildResult result = manager.Build | ||
( | ||
new BuildParameters() | ||
{ | ||
MaxNodeCount = 4, | ||
Loggers = new List<ILogger>() | ||
{ | ||
new ExecutorLogger(log) { | ||
Verbosity = silent ? LoggerVerbosity.Quiet : LoggerVerbosity.Normal | ||
} | ||
} | ||
}, | ||
request | ||
); | ||
|
||
return result.OverallResult == BuildResultCode.Success; | ||
} | ||
|
||
private void UpdateGlobalProperties(IXProject xp, IDictionary<string, string> properties) | ||
{ | ||
if(properties == null) { | ||
return; | ||
} | ||
|
||
foreach(var prop in properties) | ||
{ | ||
xp.Project.SetGlobalProperty(prop.Key, prop.Value); | ||
log.LogMessage(MessageImportance.Low, Resources._0_is_configured_as_1, prop.Key, prop.Value); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
//# Author of original code ([Decompiled] MIT-License): Copyright (c) 2009-2015 Robert Giesecke | ||
//# Use Readme & LICENSE files for details. | ||
|
||
//# Modifications: Copyright (c) 2016-2020 Denis Kuzmin < x-3F@outlook.com > GitHub/3F | ||
//$ Distributed under the MIT License (MIT) | ||
|
||
using System; | ||
using Microsoft.Build.Framework; | ||
using Microsoft.Build.Utilities; | ||
|
||
namespace RGiesecke.DllExport.MSBuild | ||
{ | ||
internal class ExecutorLogger: ILogger | ||
{ | ||
private readonly TaskLoggingHelper log; | ||
|
||
public string Parameters { get; set; } | ||
|
||
public LoggerVerbosity Verbosity { get; set; } | ||
|
||
public void Shutdown() | ||
{ | ||
|
||
} | ||
|
||
public void Initialize(IEventSource eventSource) | ||
{ | ||
eventSource.WarningRaised += (sender, e) => log.LogWarning($"[{e.LineNumber}]: {e.Code} - '{e.Message}'"); | ||
eventSource.ErrorRaised += (sender, e) => log.LogError($"[{e.LineNumber}]: {e.Code} - '{e.Message}'"); | ||
|
||
if(Verbosity != LoggerVerbosity.Quiet) { | ||
eventSource.AnyEventRaised += (sender, e) => log.LogMessage(MessageImportance.Low, $"{nameof(ExecutorLogger)}: {e.Message}"); | ||
} | ||
} | ||
|
||
public ExecutorLogger(TaskLoggingHelper log) => this.log = log ?? throw new ArgumentNullException(nameof(log)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
//# Author of original code ([Decompiled] MIT-License): Copyright (c) 2009-2015 Robert Giesecke | ||
//# Use Readme & LICENSE files for details. | ||
|
||
//# Modifications: Copyright (c) 2016-2020 Denis Kuzmin < x-3F@outlook.com > GitHub/3F | ||
//$ Distributed under the MIT License (MIT) | ||
|
||
using System.Collections.Generic; | ||
using net.r_eg.MvsSln.Core; | ||
|
||
namespace RGiesecke.DllExport.MSBuild | ||
{ | ||
internal interface IPostProcExecutor | ||
{ | ||
/// <summary> | ||
/// Executes IXProject through MSBuild engine. | ||
/// </summary> | ||
/// <param name="xp"></param> | ||
/// <param name="entrypoint">Initial target.</param> | ||
/// <param name="properties">Additional properties that will be available when executing code.</param> | ||
/// <returns>True if request was a complete success.</returns> | ||
bool Execute(IXProject xp, string entrypoint, IDictionary<string, string> properties = null); | ||
} | ||
} |
Oops, something went wrong.