mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-24 12:35:31 +00:00
This commit is contained in:
parent
e501c227ab
commit
56d48e657c
7 changed files with 85 additions and 61 deletions
|
|
@ -5,14 +5,16 @@ using Microsoft.Build.Framework;
|
||||||
using Microsoft.Build.Utilities;
|
using Microsoft.Build.Utilities;
|
||||||
//using Cosmos.Compiler.Builder;
|
//using Cosmos.Compiler.Builder;
|
||||||
|
|
||||||
namespace Cosmos.MSBuild.Tasks
|
namespace Cosmos.MSBuild.Tasks {
|
||||||
{
|
|
||||||
public class BuildOSImage : Task
|
public class BuildOSImage : Task {
|
||||||
{
|
|
||||||
private Boolean buildFailed;
|
private Boolean buildFailed;
|
||||||
public override bool Execute()
|
|
||||||
{
|
public override bool Execute() {
|
||||||
buildFailed = false;
|
buildFailed = false;
|
||||||
|
Log.LogMessage(MessageImportance.High, "Building Cosmos System Image");
|
||||||
|
return true;
|
||||||
|
|
||||||
this.KernelAssemblyFile = (new System.IO.FileInfo(this.KernelAssemblyFile)).FullName;
|
this.KernelAssemblyFile = (new System.IO.FileInfo(this.KernelAssemblyFile)).FullName;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@
|
||||||
<Compile Include="PropPageEnvironment.Designer.cs">
|
<Compile Include="PropPageEnvironment.Designer.cs">
|
||||||
<DependentUpon>PropPageEnvironment.cs</DependentUpon>
|
<DependentUpon>PropPageEnvironment.cs</DependentUpon>
|
||||||
</Compile>
|
</Compile>
|
||||||
|
<Compile Include="PropPageTest.cs" />
|
||||||
<Compile Include="Resources.Designer.cs">
|
<Compile Include="Resources.Designer.cs">
|
||||||
<AutoGen>True</AutoGen>
|
<AutoGen>True</AutoGen>
|
||||||
<DesignTime>True</DesignTime>
|
<DesignTime>True</DesignTime>
|
||||||
|
|
|
||||||
|
|
@ -13,9 +13,7 @@ using Help = Microsoft.VisualStudio.VSHelp.Help;
|
||||||
using IServiceProvider = System.IServiceProvider;
|
using IServiceProvider = System.IServiceProvider;
|
||||||
|
|
||||||
namespace Cosmos.VS.Package {
|
namespace Cosmos.VS.Package {
|
||||||
[ComVisible(true)]
|
public partial class CustomPropertyPage : UserControl, IPropertyPage {
|
||||||
public partial class CustomPropertyPage : UserControl, IPropertyPage
|
|
||||||
{
|
|
||||||
private ProjectNode _projectMgr;
|
private ProjectNode _projectMgr;
|
||||||
private ProjectConfig[] _projectConfigs;
|
private ProjectConfig[] _projectConfigs;
|
||||||
private IPropertyPageSite _site;
|
private IPropertyPageSite _site;
|
||||||
|
|
@ -23,10 +21,7 @@ namespace Cosmos.VS.Package {
|
||||||
private string _title;
|
private string _title;
|
||||||
private string _helpKeyword;
|
private string _helpKeyword;
|
||||||
|
|
||||||
#region Constructors
|
public CustomPropertyPage() {
|
||||||
|
|
||||||
public CustomPropertyPage()
|
|
||||||
{
|
|
||||||
_projectMgr = null;
|
_projectMgr = null;
|
||||||
_projectConfigs = null;
|
_projectConfigs = null;
|
||||||
_site = null;
|
_site = null;
|
||||||
|
|
@ -35,11 +30,6 @@ namespace Cosmos.VS.Package {
|
||||||
_helpKeyword = string.Empty;
|
_helpKeyword = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Properties
|
|
||||||
|
|
||||||
public virtual string Title
|
public virtual string Title
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
|
@ -107,10 +97,6 @@ namespace Cosmos.VS.Package {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region Methods
|
|
||||||
|
|
||||||
protected virtual void FillProperties()
|
protected virtual void FillProperties()
|
||||||
{}
|
{}
|
||||||
|
|
@ -161,12 +147,6 @@ namespace Cosmos.VS.Package {
|
||||||
return defaultValue;
|
return defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#endregion
|
|
||||||
|
|
||||||
|
|
||||||
#region IPropertyPage Members
|
|
||||||
|
|
||||||
void IPropertyPage.SetPageSite(IPropertyPageSite pPageSite)
|
void IPropertyPage.SetPageSite(IPropertyPageSite pPageSite)
|
||||||
{
|
{
|
||||||
_site = pPageSite;
|
_site = pPageSite;
|
||||||
|
|
@ -198,32 +178,22 @@ namespace Cosmos.VS.Package {
|
||||||
pPageInfo[0] = info;
|
pPageInfo[0] = info;
|
||||||
}
|
}
|
||||||
|
|
||||||
void IPropertyPage.SetObjects(uint count, object[] punk)
|
void IPropertyPage.SetObjects(uint count, object[] punk) {
|
||||||
{
|
if (count > 0) {
|
||||||
if (count > 0)
|
if (punk[0] is ProjectConfig) {
|
||||||
{
|
|
||||||
if (punk[0] is ProjectConfig)
|
|
||||||
{
|
|
||||||
ArrayList configs = new ArrayList();
|
ArrayList configs = new ArrayList();
|
||||||
|
for(int i = 0; i < count; i++) {
|
||||||
for(int i = 0; i < count; i++)
|
|
||||||
{
|
|
||||||
ProjectConfig config = (ProjectConfig)punk[i];
|
ProjectConfig config = (ProjectConfig)punk[i];
|
||||||
|
if (_projectMgr == null) {
|
||||||
if (_projectMgr == null)
|
|
||||||
{
|
|
||||||
_projectMgr = config.ProjectMgr;
|
_projectMgr = config.ProjectMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
configs.Add(config);
|
configs.Add(config);
|
||||||
}
|
}
|
||||||
|
|
||||||
_projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
|
_projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
|
||||||
}
|
|
||||||
else if (punk[0] is NodeProperties)
|
// For ProjectNodes we will get one of these
|
||||||
{
|
} else if (punk[0] is NodeProperties) {
|
||||||
if (_projectMgr == null)
|
if (_projectMgr == null) {
|
||||||
{
|
|
||||||
_projectMgr = (punk[0] as NodeProperties).Node.ProjectMgr;
|
_projectMgr = (punk[0] as NodeProperties).Node.ProjectMgr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -242,28 +212,22 @@ namespace Cosmos.VS.Package {
|
||||||
uint[] actual = new uint[1];
|
uint[] actual = new uint[1];
|
||||||
provider.GetCfgs(expected[0], configs, actual, null);
|
provider.GetCfgs(expected[0], configs, actual, null);
|
||||||
|
|
||||||
foreach(ProjectConfig config in configs)
|
foreach(ProjectConfig config in configs) {
|
||||||
{
|
if (!configsMap.ContainsKey(config.ConfigName)) {
|
||||||
if (!configsMap.ContainsKey(config.ConfigName))
|
|
||||||
{
|
|
||||||
configsMap.Add(config.ConfigName, config);
|
configsMap.Add(config.ConfigName, config);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (configsMap.Count > 0)
|
if (configsMap.Count > 0) {
|
||||||
{
|
if (_projectConfigs == null) {
|
||||||
if (_projectConfigs == null)
|
|
||||||
{
|
|
||||||
_projectConfigs = new ProjectConfig[configsMap.Keys.Count];
|
_projectConfigs = new ProjectConfig[configsMap.Keys.Count];
|
||||||
}
|
}
|
||||||
configsMap.Values.CopyTo(_projectConfigs, 0);
|
configsMap.Values.CopyTo(_projectConfigs, 0);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
_projectMgr = null;
|
_projectMgr = null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -343,7 +307,6 @@ namespace Cosmos.VS.Package {
|
||||||
return (NativeMethods.IsDialogMessageA(Handle, ref msg)) ? 0 : 1;
|
return (NativeMethods.IsDialogMessageA(Handle, ref msg)) ? 0 : 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
37
source2/VSIP/Cosmos.VS.Package/PropPageTest.cs
Normal file
37
source2/VSIP/Cosmos.VS.Package/PropPageTest.cs
Normal file
|
|
@ -0,0 +1,37 @@
|
||||||
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
|
using System.Linq;
|
||||||
|
using System.Text;
|
||||||
|
using Microsoft.VisualStudio.Project;
|
||||||
|
using Microsoft.VisualStudio;
|
||||||
|
using System.ComponentModel;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Cosmos.VS.Package {
|
||||||
|
[Guid("FA935644-BA67-465d-BB88-12997EFA4C21")]
|
||||||
|
public class PropPageTest : SettingsPage {
|
||||||
|
public PropPageTest() {
|
||||||
|
Name = "Test";
|
||||||
|
}
|
||||||
|
|
||||||
|
protected string mTest;
|
||||||
|
[SRCategoryAttribute("Category")]
|
||||||
|
[DisplayName("Property Name")]
|
||||||
|
[SRDescriptionAttribute("Description")]
|
||||||
|
public string Test {
|
||||||
|
get { return mTest; }
|
||||||
|
set {
|
||||||
|
mTest = value;
|
||||||
|
this.IsDirty = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void BindProperties() {
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override int ApplyChanges() {
|
||||||
|
SetConfigProperty("Test", "Hello");
|
||||||
|
return VSConstants.S_OK;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
@ -34,4 +34,23 @@
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
|
||||||
|
|
||||||
|
<Target Name="BeforeBuild">
|
||||||
|
</Target>
|
||||||
|
|
||||||
|
<!--
|
||||||
|
We have to read from registry becasue MSBuild process wont see changes to
|
||||||
|
env variables. But by reading the env var key, we allow support for both env
|
||||||
|
var and registry as some scenarios we can read env var but not registry
|
||||||
|
(ie .bat files)
|
||||||
|
-->
|
||||||
|
<PropertyGroup>
|
||||||
|
<Cosmos>$(Registry:HKEY_CURRENT_USER\Environment@Cosmos)</Cosmos>
|
||||||
|
</PropertyGroup>
|
||||||
|
<UsingTask TaskName="Cosmos.MSBuild.Tasks.BuildOSImage" AssemblyFile="$(Cosmos)\source2\Builder\Cosmos.MSBuild.Tasks\bin\Debug\Cosmos.MSBuild.Tasks.dll" />
|
||||||
|
<Target Name="AfterBuild">
|
||||||
|
<Message Text="Using Cosmos Path: $(Cosmos)" Importance="high" />
|
||||||
|
<BuildOSImage KernelAssemblyFile="$(BaseOutputPath)$(OutputPath)$(AssemblyName).exe" />
|
||||||
|
</Target>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|
@ -48,6 +48,7 @@ namespace Cosmos.VS.Package {
|
||||||
|
|
||||||
// Property Pages
|
// Property Pages
|
||||||
[ProvideObject(typeof(PropPageEnvironment), RegisterUsing = RegistrationMethod.CodeBase)]
|
[ProvideObject(typeof(PropPageEnvironment), RegisterUsing = RegistrationMethod.CodeBase)]
|
||||||
|
[ProvideObject(typeof(PropPageTest), RegisterUsing = RegistrationMethod.CodeBase)]
|
||||||
|
|
||||||
[Guid(Guids.guidProjectPkgString)]
|
[Guid(Guids.guidProjectPkgString)]
|
||||||
public sealed class VSProject : ProjectPackage {
|
public sealed class VSProject : ProjectPackage {
|
||||||
|
|
@ -64,7 +65,7 @@ namespace Cosmos.VS.Package {
|
||||||
|
|
||||||
// This is used in the MSBuild files to locate Cosmos tasks
|
// This is used in the MSBuild files to locate Cosmos tasks
|
||||||
// Will likely be used by other things in the future as well
|
// Will likely be used by other things in the future as well
|
||||||
protected void SetCosmosVar() {
|
private void SetCosmosVar() {
|
||||||
string xPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
string xPath = System.Reflection.Assembly.GetExecutingAssembly().Location;
|
||||||
int xPos = xPath.LastIndexOf(@"\source2\", StringComparison.InvariantCultureIgnoreCase);
|
int xPos = xPath.LastIndexOf(@"\source2\", StringComparison.InvariantCultureIgnoreCase);
|
||||||
xPath = xPath.Substring(0, xPos);
|
xPath = xPath.Substring(0, xPos);
|
||||||
|
|
|
||||||
|
|
@ -38,6 +38,7 @@ namespace Cosmos.VS.Package {
|
||||||
//1E78F8DB-6C07-4D61-A18F-7514010ABD56 - Build Events
|
//1E78F8DB-6C07-4D61-A18F-7514010ABD56 - Build Events
|
||||||
return new Guid[] {
|
return new Guid[] {
|
||||||
typeof(PropPageEnvironment).GUID,
|
typeof(PropPageEnvironment).GUID,
|
||||||
|
typeof(PropPageTest).GUID,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue