mirror of
https://github.com/danbulant/Cosmos
synced 2026-05-22 22:09:12 +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 Cosmos.Compiler.Builder;
|
||||
|
||||
namespace Cosmos.MSBuild.Tasks
|
||||
{
|
||||
public class BuildOSImage : Task
|
||||
{
|
||||
namespace Cosmos.MSBuild.Tasks {
|
||||
|
||||
public class BuildOSImage : Task {
|
||||
|
||||
private Boolean buildFailed;
|
||||
public override bool Execute()
|
||||
{
|
||||
|
||||
public override bool Execute() {
|
||||
buildFailed = false;
|
||||
Log.LogMessage(MessageImportance.High, "Building Cosmos System Image");
|
||||
return true;
|
||||
|
||||
this.KernelAssemblyFile = (new System.IO.FileInfo(this.KernelAssemblyFile)).FullName;
|
||||
|
||||
|
|
|
|||
|
|
@ -78,6 +78,7 @@
|
|||
<Compile Include="PropPageEnvironment.Designer.cs">
|
||||
<DependentUpon>PropPageEnvironment.cs</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="PropPageTest.cs" />
|
||||
<Compile Include="Resources.Designer.cs">
|
||||
<AutoGen>True</AutoGen>
|
||||
<DesignTime>True</DesignTime>
|
||||
|
|
|
|||
|
|
@ -13,9 +13,7 @@ using Help = Microsoft.VisualStudio.VSHelp.Help;
|
|||
using IServiceProvider = System.IServiceProvider;
|
||||
|
||||
namespace Cosmos.VS.Package {
|
||||
[ComVisible(true)]
|
||||
public partial class CustomPropertyPage : UserControl, IPropertyPage
|
||||
{
|
||||
public partial class CustomPropertyPage : UserControl, IPropertyPage {
|
||||
private ProjectNode _projectMgr;
|
||||
private ProjectConfig[] _projectConfigs;
|
||||
private IPropertyPageSite _site;
|
||||
|
|
@ -23,10 +21,7 @@ namespace Cosmos.VS.Package {
|
|||
private string _title;
|
||||
private string _helpKeyword;
|
||||
|
||||
#region Constructors
|
||||
|
||||
public CustomPropertyPage()
|
||||
{
|
||||
public CustomPropertyPage() {
|
||||
_projectMgr = null;
|
||||
_projectConfigs = null;
|
||||
_site = null;
|
||||
|
|
@ -35,11 +30,6 @@ namespace Cosmos.VS.Package {
|
|||
_helpKeyword = string.Empty;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Properties
|
||||
|
||||
public virtual string Title
|
||||
{
|
||||
get
|
||||
|
|
@ -107,11 +97,7 @@ namespace Cosmos.VS.Package {
|
|||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region Methods
|
||||
|
||||
|
||||
protected virtual void FillProperties()
|
||||
{}
|
||||
|
||||
|
|
@ -161,12 +147,6 @@ namespace Cosmos.VS.Package {
|
|||
return defaultValue;
|
||||
}
|
||||
|
||||
|
||||
#endregion
|
||||
|
||||
|
||||
#region IPropertyPage Members
|
||||
|
||||
void IPropertyPage.SetPageSite(IPropertyPageSite pPageSite)
|
||||
{
|
||||
_site = pPageSite;
|
||||
|
|
@ -198,32 +178,22 @@ namespace Cosmos.VS.Package {
|
|||
pPageInfo[0] = info;
|
||||
}
|
||||
|
||||
void IPropertyPage.SetObjects(uint count, object[] punk)
|
||||
{
|
||||
if (count > 0)
|
||||
{
|
||||
if (punk[0] is ProjectConfig)
|
||||
{
|
||||
void IPropertyPage.SetObjects(uint count, object[] punk) {
|
||||
if (count > 0) {
|
||||
if (punk[0] is ProjectConfig) {
|
||||
ArrayList configs = new ArrayList();
|
||||
|
||||
for(int i = 0; i < count; i++)
|
||||
{
|
||||
for(int i = 0; i < count; i++) {
|
||||
ProjectConfig config = (ProjectConfig)punk[i];
|
||||
|
||||
if (_projectMgr == null)
|
||||
{
|
||||
if (_projectMgr == null) {
|
||||
_projectMgr = config.ProjectMgr;
|
||||
}
|
||||
|
||||
configs.Add(config);
|
||||
}
|
||||
|
||||
_projectConfigs = (ProjectConfig[])configs.ToArray(typeof(ProjectConfig));
|
||||
}
|
||||
else if (punk[0] is NodeProperties)
|
||||
{
|
||||
if (_projectMgr == null)
|
||||
{
|
||||
|
||||
// For ProjectNodes we will get one of these
|
||||
} else if (punk[0] is NodeProperties) {
|
||||
if (_projectMgr == null) {
|
||||
_projectMgr = (punk[0] as NodeProperties).Node.ProjectMgr;
|
||||
}
|
||||
|
||||
|
|
@ -242,28 +212,22 @@ namespace Cosmos.VS.Package {
|
|||
uint[] actual = new uint[1];
|
||||
provider.GetCfgs(expected[0], configs, actual, null);
|
||||
|
||||
foreach(ProjectConfig config in configs)
|
||||
{
|
||||
if (!configsMap.ContainsKey(config.ConfigName))
|
||||
{
|
||||
foreach(ProjectConfig config in configs) {
|
||||
if (!configsMap.ContainsKey(config.ConfigName)) {
|
||||
configsMap.Add(config.ConfigName, config);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (configsMap.Count > 0)
|
||||
{
|
||||
if (_projectConfigs == null)
|
||||
{
|
||||
if (configsMap.Count > 0) {
|
||||
if (_projectConfigs == null) {
|
||||
_projectConfigs = new ProjectConfig[configsMap.Keys.Count];
|
||||
}
|
||||
configsMap.Values.CopyTo(_projectConfigs, 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
_projectMgr = null;
|
||||
}
|
||||
|
||||
|
|
@ -343,7 +307,6 @@ namespace Cosmos.VS.Package {
|
|||
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>
|
||||
|
||||
<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>
|
||||
|
|
@ -48,6 +48,7 @@ namespace Cosmos.VS.Package {
|
|||
|
||||
// Property Pages
|
||||
[ProvideObject(typeof(PropPageEnvironment), RegisterUsing = RegistrationMethod.CodeBase)]
|
||||
[ProvideObject(typeof(PropPageTest), RegisterUsing = RegistrationMethod.CodeBase)]
|
||||
|
||||
[Guid(Guids.guidProjectPkgString)]
|
||||
public sealed class VSProject : ProjectPackage {
|
||||
|
|
@ -64,7 +65,7 @@ namespace Cosmos.VS.Package {
|
|||
|
||||
// This is used in the MSBuild files to locate Cosmos tasks
|
||||
// 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;
|
||||
int xPos = xPath.LastIndexOf(@"\source2\", StringComparison.InvariantCultureIgnoreCase);
|
||||
xPath = xPath.Substring(0, xPos);
|
||||
|
|
|
|||
|
|
@ -38,6 +38,7 @@ namespace Cosmos.VS.Package {
|
|||
//1E78F8DB-6C07-4D61-A18F-7514010ABD56 - Build Events
|
||||
return new Guid[] {
|
||||
typeof(PropPageEnvironment).GUID,
|
||||
typeof(PropPageTest).GUID,
|
||||
};
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Reference in a new issue