Skip to content

Commit

Permalink
Adds Pre-Processing feature. Related issue #40
Browse files Browse the repository at this point in the history
  • Loading branch information
3F committed Apr 28, 2020
1 parent 2131353 commit 4108ebc
Show file tree
Hide file tree
Showing 12 changed files with 890 additions and 85 deletions.
5 changes: 5 additions & 0 deletions Wizard/IUserConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,11 @@ public interface IUserConfig
/// </summary>
CompilerCfg Compiler { get; set; }

/// <summary>
/// Access to Pre-Processing.
/// </summary>
PreProc PreProc { get; set; }

/// <summary>
/// Adds to top new namespace into Namespaces property.
/// </summary>
Expand Down
23 changes: 23 additions & 0 deletions Wizard/MSBuildProperties.cs
Original file line number Diff line number Diff line change
Expand Up @@ -117,5 +117,28 @@ public struct MSBuildProperties
/// Platform for DllExport tool.
/// </summary>
public const string DXP_PLATFORM = "DllExportPlatform";

/// <summary>
/// Used Pre-Processing type.
/// </summary>
public const string DXP_PRE_PROC_TYPE = "DllExportPreProcType";

/// <summary>
/// List of modules for ILMerge if used.
/// </summary>
public const string DXP_ILMERGE = "DllExportILMerge";

/// <summary>
/// Meta library full path to file.
/// </summary>
public const string DXP_METALIB_FPATH = "DllExportMetaLibFullPath";

public const string PRJ_TARGET_DIR = "TargetDir";

public const string PRJ_TARGET_F = "TargetFileName";

public const string PRJ_DBG_TYPE = "DebugType";

public const string SLN_DIR = "SolutionDir";
}
}
60 changes: 60 additions & 0 deletions Wizard/MSBuildTargets.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2020 Denis Kuzmin < x-3F@outlook.com > GitHub/3F
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

namespace net.r_eg.DllExport.Wizard
{
internal struct MSBuildTargets
{
/// <summary>
/// The name of target to restore package.
/// </summary>
internal const string DXP_PKG_R = "DllExportRestorePkg";

/// <summary>
/// Pre-Processing.
/// </summary>
internal const string DXP_PRE_PROC = "DllExportPreProc";

/// <summary>
/// Post-Actions of the main Pre-Processing.
/// </summary>
internal const string DXP_PRE_PROC_AFTER = "DllExportPreProcAfter";

/// <summary>
/// To support dynamic `import` section.
/// https://github.com/3F/DllExport/issues/62
/// </summary>
internal const string DXP_R_DYN = "DllExportRPkgDynamicImport";

/// <summary>
/// The entry point of the main task.
/// </summary>
internal const string DXP_MAIN = "DllExportMod";

/// <summary>
/// Flag when imported the {DXP_MAIN} target.
/// </summary>
internal const string DXP_MAIN_FLAG = "DllExportModImported";
}
}
68 changes: 68 additions & 0 deletions Wizard/PreProc.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2020 Denis Kuzmin < x-3F@outlook.com > GitHub/3F
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in
* all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE.
*/

namespace net.r_eg.DllExport.Wizard
{
public sealed class PreProc
{
/// <summary>
/// Never null command.
/// </summary>
public string Cmd
{
get;
private set;
}

public CmdType Type
{
get;
private set;
}

[System.Flags]
public enum CmdType: long
{
None = 0x0,

ILMerge = 0x1,

Conari = 0x2,

Exec = 0x4,

DebugInfo = 0x8,

IgnoreErr = 0x10,
}

public PreProc Configure(CmdType type = CmdType.None, string cmd = null)
{
Type = type;
Cmd = (type == CmdType.None || cmd == null) ? string.Empty : cmd;

return this;
}
}
}
Loading

0 comments on commit 4108ebc

Please sign in to comment.