Skip to content

Commit

Permalink
Draft version of the Wizard subproject to implement new distribution -
Browse files Browse the repository at this point in the history
…#38

+GetNuTool project has been added as submodule.
  • Loading branch information
3F committed Jul 15, 2017
1 parent 8f75a86 commit 66b21ec
Show file tree
Hide file tree
Showing 36 changed files with 2,597 additions and 23 deletions.
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
[submodule "coreclr"]
path = coreclr
url = https://github.com/3F/coreclr.git
[submodule "GetNuTool"]
path = GetNuTool
url = https://github.com/3F/GetNuTool.git
105 changes: 95 additions & 10 deletions .vssbe

Large diffs are not rendered by default.

12 changes: 8 additions & 4 deletions Configurator/ConfVersion.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,15 @@ internal struct ConfVersion
public static readonly Version number = new Version(S_NUM_REV);

public const string S_NUM = "1.5.2";
public const string S_REV = "40158";
public const string S_REV = "9361";

public const string S_NUM_REV = S_NUM + "." + S_REV;
public const string BRANCH_SHA1 = "932cd0d";
public const string S_NUM_REV = S_NUM + "." + S_REV;

internal const string S_INFO = S_NUM_REV + " [ " + BRANCH_SHA1 + " ]";
public const string BRANCH_SHA1 = "-";
public const string BRANCH_NAME = "-";
public const string BRANCH_REVC = "-";

internal const string S_INFO = S_NUM_REV + " [ " + BRANCH_SHA1 + " ]";
internal const string S_INFO_FULL = S_INFO + " /'" + BRANCH_NAME + "':" + BRANCH_REVC;
}
}
2 changes: 1 addition & 1 deletion Configurator/Configurator.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@
<Compile Include="GUI\InstallationForm.Designer.cs">
<DependentUpon>InstallationForm.cs</DependentUpon>
</Compile>
<Compile Include="ScriptConfig.cs" />
<Compile Include="IScriptConfig.cs" />
<Compile Include="ResetConfigurationCmdlet.cs" />
<Compile Include="SetConfigurationCmdlet.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
Expand Down
2 changes: 1 addition & 1 deletion Configurator/Dynamic/Project.cs
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ public bool IsDefinedNamespace
{
get {
string vNamespace = MBEProject.GetPropertyValue(NamespacePropertyName);
return String.IsNullOrEmpty(vNamespace);
return !String.IsNullOrEmpty(vNamespace);
}
}

Expand Down
2 changes: 1 addition & 1 deletion Configurator/Executor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public ISender Log

public void configure()
{
if(project.IsDefinedNamespace)
if(!project.IsDefinedNamespace)
{
config.defnamespaces.Insert(0, project.getPropertyValue("RootNamespace"));

Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions Configurator/Properties/AssemblyInfo.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using net.r_eg.DllExport.Configurator;

// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
Expand Down Expand Up @@ -32,5 +32,5 @@
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
[assembly: AssemblyVersion(ConfVersion.S_NUM_REV)]
//[assembly: AssemblyFileVersion("1.0.0.0")]
12 changes: 10 additions & 2 deletions DllExport.sln
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

Microsoft Visual Studio Solution File, Format Version 11.00
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 15
VisualStudioVersion = 15.0.26430.6
VisualStudioVersion = 15.0.26430.15
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RGiesecke.DllExport", "RGiesecke.DllExport\RGiesecke.DllExport.csproj", "{AC6947C6-0637-429A-A5F1-54447A494E6D}"
EndProject
Expand Down Expand Up @@ -52,6 +52,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Configurator", "Configurato
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NSBinTest", "NSBinTest\NSBinTest.csproj", "{3CFD9EB8-69BC-4B41-9ABA-9C1850BE324A}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wizard", "Wizard\Wizard.csproj", "{D10CF407-4483-4657-9FEA-BDB467391F3A}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Expand Down Expand Up @@ -95,6 +97,12 @@ Global
{3CFD9EB8-69BC-4B41-9ABA-9C1850BE324A}.PublicRelease|Any CPU.Build.0 = Release|Any CPU
{3CFD9EB8-69BC-4B41-9ABA-9C1850BE324A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{3CFD9EB8-69BC-4B41-9ABA-9C1850BE324A}.Release|Any CPU.Build.0 = Release|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.Debug|Any CPU.Build.0 = Debug|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.PublicRelease|Any CPU.ActiveCfg = Release|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.PublicRelease|Any CPU.Build.0 = Release|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{D10CF407-4483-4657-9FEA-BDB467391F3A}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Expand Down
1 change: 1 addition & 0 deletions GetNuTool
Submodule GetNuTool added at 4aaa6d
46 changes: 46 additions & 0 deletions Wizard/ActionType.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Denis Kuzmin < entry.reg@gmail.com > :: github.com/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 enum ActionType: uint
{
Default,

/// <summary>
/// Process of configuration of available projects.
/// Install and Remove operation will be defined by user at runtime.
/// </summary>
Configure,

//TODO: via predefined list etc.
//Install,
//Remove,

/// <summary>
/// To restore already configured environment.
/// </summary>
Restore,
}
}
44 changes: 44 additions & 0 deletions Wizard/CompilerCfg.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Denis Kuzmin < entry.reg@gmail.com > :: github.com/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 struct CompilerCfg
{
/// <summary>
/// Base for ordinals.
/// </summary>
public int ordinalsBase;

/// <summary>
/// Generate .exp + .lib via MS Library Manager.
/// </summary>
public bool genExpLib;

/// <summary>
/// To use our ILAsm / ILDasm if true.
/// </summary>
public bool ourILAsm;
}
}
148 changes: 148 additions & 0 deletions Wizard/DllExportCfgTask.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,148 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2017 Denis Kuzmin < entry.reg@gmail.com > :: github.com/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.
*/

using System;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using net.r_eg.MvsSln.Log;

namespace net.r_eg.DllExport.Wizard
{
public class DllExportCfgTask: Task, ITask, IWizardConfig
{
private object synch = new object();

/// <summary>
/// Path to directory with .sln files to be processed.
/// </summary>
[Required]
public string SlnDir
{
get;
set;
}

/// <summary>
/// Root path of the DllExport package.
/// </summary>
[Required]
public string PkgPath
{
get;
set;
}

/// <summary>
/// Raw type of operation via ActionType.
/// </summary>
[Required]
public string Action
{
set
{
if(String.IsNullOrWhiteSpace(value)) {
Type = ActionType.Default;
}
value = value.Trim();

Type = (ActionType)Enum.Parse(
typeof(ActionType),
char.ToUpperInvariant(value[0]) + value.Substring(1).ToLowerInvariant()
);
}
}

/// <summary>
/// The evaluated type of operation.
/// </summary>
public ActionType Type
{
get;
set;
}

/// <summary>
/// Executes the msbuild task.
/// </summary>
/// <returns>true if the task successfully executed.</returns>
public override bool Execute()
{
if(String.IsNullOrWhiteSpace(SlnDir)) {
throw new ArgumentNullException(nameof(SlnDir));
}

using(IExecutor exec = new Executor(this)) {
return TryExecute(exec, exec.Configure);
}
}

internal bool TryExecute(IExecutor exec, Action act)
{
lock(synch)
{
exec.Log.Received -= OnMsg;
exec.Log.Received += OnMsg;

try
{
act();
return true;
}
catch(Exception ex)
{
LSender.Send(this, $"ERROR-GUI: {ex.Message}");
LSender.Send(this, $"SlnDir: {SlnDir}");
LSender.Send(this, $"PkgPath: {PkgPath}");
LSender.Send(this, $"Action: {Type}");
#if DEBUG
LSender.Send(this, $"Stack trace: {ex.StackTrace}");
#endif
}
finally {
exec.Log.Received -= OnMsg;
}

return false;
}
}

protected virtual void ConWrite(string message, Message.Level level)
{
if(level == Message.Level.Error || level == Message.Level.Fatal) {
Console.ForegroundColor = ConsoleColor.Red;
}
else if(level == Message.Level.Warn) {
Console.ForegroundColor = ConsoleColor.Yellow;
}

Console.WriteLine(message);
Console.ResetColor();
}

private void OnMsg(object sender, Message e)
{
ConWrite(e.content, e.type);
}
}
}
Loading

0 comments on commit 66b21ec

Please sign in to comment.