Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MvsSln Integration. Back to parent. #53

Merged
merged 5 commits into from
Aug 4, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "MvsSln"]
path = MvsSln
url = https://github.com/3F/MvsSln.git
40 changes: 39 additions & 1 deletion .vssbe
Original file line number Diff line number Diff line change
Expand Up @@ -129,7 +129,7 @@
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command": "#[\"\n Prepares data - version, revBuild & information from git\n\"]\n\n#[var tBase = $([System.DateTime]::Parse('$(revDeltaBase)').ToBinary())]\n#[var tNow = $([System.DateTime]::UtcNow.Ticks)]\n#[var revBuild = $([System.TimeSpan]::FromTicks('$([MSBuild]::Subtract($(tNow), $(tBase)))').TotalMinutes.ToString('0'))]\n#[var revBuild = $([MSBuild]::Add($(revDeltaMin), $([MSBuild]::Modulo($(revBuild), $([MSBuild]::Subtract($(revDeltaMax), $(revDeltaMin)))))))]\n\n#[var tplVersion = #[File get(\"Version.tpl\")]]\n\n#[var pDir = vsSolutionBuildEvent/]\n#[var pDirBridge = Bridge/]\n#[var pDirCIM = CI.MSBuild/]\n#[var pDirDevenv = Devenv\\]\n#[var pDirProvider = Provider/]\n\n#[var numSBE = #[File get(\".version\")]]\n#[var numBridge = #[File get(\"#[var pDirBridge].version\")]]\n#[var numCIM = #[File get(\"#[var pDirCIM].version\")]]\n#[var numDevenv = #[File get(\"#[var pDirDevenv].version\")]]\n#[var numProvider = #[File get(\"#[var pDirProvider].version\")]]\n\n#[\" the 0 number is reserved for patches from external assemblies /see AssemblyInfo \"]\n\n#[var num0Bridge = #[var numBridge].0]\n#[var num0CIM = #[var numCIM].0]\n#[var num0Devenv = #[var numDevenv].0]\n#[var num0Provider = #[var numProvider].0]\n\n#[var libCore = #[var numSBE]]\n#[var libCoreInt = $([System.Convert]::ToInt32(\"$(libCore.Replace('.', '0'))\"))]#[\" v0.12.5 -> 1205 \"]\n\n#[var cfgSDK = #[( $(Configuration) =^ \"_SDK15\" ) {15} else {10} ]]",
"Command": "#[\"\n Prepares data - version, revBuild & information from git\n\"]\n\n#[var tBase = $([System.DateTime]::Parse('$(revDeltaBase)').ToBinary())]\n#[var tNow = $([System.DateTime]::UtcNow.Ticks)]\n#[var revBuild = $([System.TimeSpan]::FromTicks('$([MSBuild]::Subtract($(tNow), $(tBase)))').TotalMinutes.ToString('0'))]\n#[var revBuild = $([MSBuild]::Add($(revDeltaMin), $([MSBuild]::Modulo($(revBuild), $([MSBuild]::Subtract($(revDeltaMax), $(revDeltaMin)))))))]\n\n#[var tplVersion = #[File get(\"Version.tpl\")]]\n\n#[var pDir = vsSolutionBuildEvent/]\n#[var pDirBridge = Bridge/]\n#[var pDirCIM = CI.MSBuild/]\n#[var pDirDevenv = Devenv\\]\n#[var pDirProvider = Provider/]\n#[var pMvsSln = MvsSln/]\n\n#[var numSBE = #[File get(\".version\")]]\n#[var numBridge = #[File get(\"#[var pDirBridge].version\")]]\n#[var numCIM = #[File get(\"#[var pDirCIM].version\")]]\n#[var numDevenv = #[File get(\"#[var pDirDevenv].version\")]]\n#[var numProvider = #[File get(\"#[var pDirProvider].version\")]]\n\n#[\" the 0 number is reserved for patches from external assemblies /see AssemblyInfo \"]\n\n#[var num0Bridge = #[var numBridge].0]\n#[var num0CIM = #[var numCIM].0]\n#[var num0Devenv = #[var numDevenv].0]\n#[var num0Provider = #[var numProvider].0]\n\n#[var libCore = #[var numSBE]]\n#[var libCoreInt = $([System.Convert]::ToInt32(\"$(libCore.Replace('.', '0'))\"))]#[\" v0.12.5 -> 1205 \"]\n\n#[var cfgSDK = #[( $(Configuration) =^ \"_SDK15\" ) {15} else {10} ]]",
"Command__": [
"#[\"",
" Prepares data - version, revBuild & information from git",
Expand All @@ -147,6 +147,7 @@
"#[var pDirCIM = CI.MSBuild/]",
"#[var pDirDevenv = Devenv\\]",
"#[var pDirProvider = Provider/]",
"#[var pMvsSln = MvsSln/]",
"",
"#[var numSBE = #[File get(\".version\")]]",
"#[var numBridge = #[File get(\"#[var pDirBridge].version\")]]",
Expand All @@ -168,6 +169,43 @@
]
}
},
{
"Enabled": true,
"Name": "ModulesAndPkg",
"Caption": "Submodules and dep packages",
"SupportMSBuild": true,
"SupportSBEScripts": true,
"IgnoreIfBuildFailed": false,
"BuildType": "Common",
"Confirmation": false,
"ToConfiguration": [],
"ExecutionOrder": {
"$type": "net.r_eg.vsSBE.Events.ExecutionOrder[], vsSolutionBuildEvent",
"$values": []
},
"Process": {
"$type": "net.r_eg.vsSBE.Events.EventProcess, vsSolutionBuildEvent",
"Waiting": true,
"Hidden": true,
"TimeLimit": 30
},
"Mode": {
"$type": "net.r_eg.vsSBE.Events.ModeScript, vsSolutionBuildEvent",
"Type": "Script",
"Command": "\r\n#[File call(\"submodules.bat\", \"$(pMvsSln)/MvsSln.sln\", 2000)]\r\n\r\n#[\" Packages \"]\r\n\r\n#[( !(#[IO exists.directory(\"packages\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )\r\n{\r\n #[File call(\"packages.cmd\", \"\", 2000)]\r\n}]",
"Command__": [
"",
"#[File call(\"submodules.bat\", \"$(pMvsSln)/MvsSln.sln\", 2000)]",
"",
"#[\" Packages \"]",
"",
"#[( !(#[IO exists.directory(\"packages\")]) || !(#[IO exists.directory(\"$(pMvsSln)/packages\")]) )",
"{",
" #[File call(\"packages.cmd\", \"\", 2000)]",
"}]"
]
}
},
{
"Enabled": true,
"Name": "Version",
Expand Down
8 changes: 6 additions & 2 deletions CI.MSBuild/CI.MSBuild.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,8 @@
<TargetFrameworkVersion>v4.6</TargetFrameworkVersion>
<NetTargetVName>net45</NetTargetVName>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants></DefineConstants>
<DefineConstants>
</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
Expand Down Expand Up @@ -74,14 +75,17 @@
<Compile Include="ILog.cs" />
<Compile Include="Project.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
<Compile Include="SolutionProperties.cs" />
<Compile Include="Version.cs" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Bridge\Bridge.csproj">
<Project>{73919171-44B6-4536-B892-F1FCA653887C}</Project>
<Name>Bridge</Name>
</ProjectReference>
<ProjectReference Include="..\MvsSln\MvsSln\MvsSln.csproj">
<Project>{F905DFB2-2E67-4FF7-9001-924F6F2D645D}</Project>
<Name>MvsSln</Name>
</ProjectReference>
<ProjectReference Include="..\Provider\Provider.csproj">
<Project>{4F8BB8CD-1116-4F07-9B8F-06D69FB8589B}</Project>
<Name>Provider</Name>
Expand Down
30 changes: 14 additions & 16 deletions CI.MSBuild/EventManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,10 @@
using System.Linq;
using Microsoft.Build.Framework;
using Microsoft.Build.Utilities;
using net.r_eg.vsSBE.Bridge;
using net.r_eg.MvsSln;
using net.r_eg.vsSBE.Bridge.CoreCommand;
using net.r_eg.vsSBE.Provider;
using BuildType = net.r_eg.vsSBE.Bridge.BuildType;

namespace net.r_eg.vsSBE.CI.MSBuild
{
Expand All @@ -49,7 +50,7 @@ public string SolutionFile
/// <summary>
/// Our the vsSolutionBuildEvent library
/// </summary>
public Provider.ILibrary library;
public ILibrary library;

/// <summary>
/// Internal logging
Expand All @@ -69,7 +70,7 @@ public string SolutionFile
/// <summary>
/// About projects by ident
/// </summary>
protected Dictionary<int, Project> projects = new Dictionary<int, Project>();
protected IDictionary<int, Project> projects = new Dictionary<int, Project>();

/// <summary>
/// All received CoreCommand from library.
Expand All @@ -84,18 +85,14 @@ public string SolutionFile
/// <summary>
/// Reserved for future use with IVsSolutionEvents
/// </summary>
private object pUnkReserved = new object();
private readonly object pUnkReserved = new object();

/// <summary>
/// To abort all processes as soon as possible
/// </summary>
private volatile bool abort = false;

/// <summary>
/// Object synch.
/// </summary>
private Object _lock = new Object();

private readonly object _sync = new object();

/// <summary>
/// Initializer of the Build.Framework.ILogger objects.
Expand Down Expand Up @@ -152,11 +149,12 @@ protected void onProjectStarted(object sender, ProjectStartedEventArgs e)
return;
}

Dictionary<object, string> properties = e.Properties.OfType<DictionaryEntry>().ToDictionary(k => k.Key, v => v.Value.ToString());
if(properties.ContainsKey("ProjectName"))
var properties = e.Properties.OfType<DictionaryEntry>().ToDictionary(k => k.Key, v => v.Value.ToString());

if(properties.ContainsKey(PropertyNames.PRJ_NAME))
{
projects[e.ProjectId] = new Project() {
Name = properties["ProjectName"],
Name = properties[PropertyNames.PRJ_NAME],
File = e.ProjectFile,
Properties = properties
};
Expand Down Expand Up @@ -251,7 +249,7 @@ protected void onBuildFinished(object sender, BuildFinishedEventArgs e)
if(!e.Succeeded) {
library.Event.onCancel();
}
library.Event.onPost((e.Succeeded)? 1 : 0, 0, 0);
library.Event.onPost((e.Succeeded ? 1 : 0), 0, 0);
}

/// <summary>
Expand Down Expand Up @@ -333,7 +331,7 @@ protected bool attachCoreCommandListener(ILibrary library)
return false;
}

lock(_lock) {
lock(_sync) {
detachCoreCommandListener(library);
library.EntryPoint.CoreCommand += command;
}
Expand All @@ -346,7 +344,7 @@ protected bool detachCoreCommandListener(ILibrary library)
return false;
}

lock(_lock) {
lock(_sync) {
library.EntryPoint.CoreCommand -= command;
}
return true;
Expand Down Expand Up @@ -419,7 +417,7 @@ protected void setPropertiesByDefault()
/// <returns></returns>
protected virtual string formatEW(string type, string code, string msg, string file, int line)
{
return String.Format("{0}({1}): {2} {3}: {4}", file, line, type, code, msg);
return $"{file}({line}): {type} {code}: {msg}";
}

private void msg(string data, params object[] args)
Expand Down
Loading