Skip to content

Commit 1480bfb

Browse files
committed
Builder improvements.
1 parent 956c9e9 commit 1480bfb

25 files changed

+222
-496
lines changed

Builder.sln

+4-7
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00
33
# Visual Studio 15
44
VisualStudioVersion = 15.0.26228.9
55
MinimumVisualStudioVersion = 10.0.40219.1
6-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Build.Builder", "source\Cosmos.Build.Builder\Cosmos.Build.Builder.csproj", "{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}"
7-
EndProject
8-
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Cosmos.Build.Installer", "source\Cosmos.Build.Installer\Cosmos.Build.Installer.csproj", "{27D94586-FE88-4203-BE6A-C99013FD5018}"
6+
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Cosmos.Build.Builder", "source\Cosmos.Build.Builder\Cosmos.Build.Builder.csproj", "{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}"
97
EndProject
108
Global
119
GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -17,12 +15,11 @@ Global
1715
{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
1816
{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}.Release|Any CPU.ActiveCfg = Debug|Any CPU
1917
{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}.Release|Any CPU.Build.0 = Debug|Any CPU
20-
{27D94586-FE88-4203-BE6A-C99013FD5018}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21-
{27D94586-FE88-4203-BE6A-C99013FD5018}.Debug|Any CPU.Build.0 = Debug|Any CPU
22-
{27D94586-FE88-4203-BE6A-C99013FD5018}.Release|Any CPU.ActiveCfg = Debug|Any CPU
23-
{27D94586-FE88-4203-BE6A-C99013FD5018}.Release|Any CPU.Build.0 = Debug|Any CPU
2418
EndGlobalSection
2519
GlobalSection(SolutionProperties) = preSolution
2620
HideSolutionNode = FALSE
2721
EndGlobalSection
22+
GlobalSection(ExtensibilityGlobals) = postSolution
23+
SolutionGuid = {B29ACE62-94D5-4A06-A6C9-608A199BE0E3}
24+
EndGlobalSection
2825
EndGlobal

install-VS2017.bat

+3-2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ if not exist "%MSBuild%" (
2828
goto:eof
2929
)
3030

31-
"%MSBuild%" Builder.sln /nologo /maxcpucount /nodeReuse:false /t:Restore;Build
31+
echo Building Builder.sln
32+
"%MSBuild%" Builder.sln /nologo /maxcpucount /nodeReuse:false /verbosity:minimal /t:Restore;Build
3233

33-
start "Cosmos Builder" "source\Cosmos.Build.Builder\bin\Debug\Cosmos.Build.Builder.exe" "-VSPATH=%InstallDir%" %*
34+
start "Cosmos Builder" "source\Cosmos.Build.Builder\bin\Debug\net471\Cosmos.Build.Builder.exe" "-VSPATH=%InstallDir%" %*

source/Cosmos.Build.Builder/.editorconfig

-2
This file was deleted.

source/Cosmos.Build.Builder/App.xaml

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
<Application x:Class="Cosmos.Build.Builder.App"
22
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
33
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
4-
StartupUri="MainWindow.xaml">
4+
xmlns:vm="clr-namespace:Cosmos.Build.Builder.ViewModels"
5+
StartupUri="Views/MainWindow.xaml">
56
<Application.Resources>
6-
7+
<vm:MainWindowViewModel x:Key="MainWindowViewModel" />
78
</Application.Resources>
89
</Application>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
using System;
2+
using System.Collections;
3+
using System.Collections.Generic;
4+
using System.Collections.Specialized;
5+
6+
namespace Cosmos.Build.Builder.Collections
7+
{
8+
internal class ObservableFixedSizeStack<T> : IEnumerable<T>, INotifyCollectionChanged
9+
{
10+
public event NotifyCollectionChangedEventHandler CollectionChanged;
11+
12+
private T[] _items;
13+
14+
public ObservableFixedSizeStack(int size)
15+
{
16+
if (size < 1)
17+
{
18+
throw new ArgumentOutOfRangeException(nameof(size));
19+
}
20+
21+
_items = new T[size];
22+
}
23+
24+
public void Push(T item)
25+
{
26+
Array.Copy(_items, 1, _items, 0, _items.Length - 1);
27+
_items[_items.Length - 1] = item;
28+
29+
OnCollectionChanged();
30+
}
31+
32+
public void Clear() => Array.Clear(_items, 0, _items.Length);
33+
34+
private void OnCollectionChanged() => CollectionChanged?.Invoke(
35+
this, new NotifyCollectionChangedEventArgs(NotifyCollectionChangedAction.Reset));
36+
37+
public IEnumerator<T> GetEnumerator() => ((IEnumerable<T>)_items).GetEnumerator();
38+
IEnumerator IEnumerable.GetEnumerator() => _items.GetEnumerator();
39+
}
40+
}
Original file line numberDiff line numberDiff line change
@@ -1,123 +1,31 @@
1-
<?xml version="1.0" encoding="utf-8"?>
2-
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
3-
<PropertyGroup>
4-
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
5-
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
6-
<ProductVersion>8.0.30703</ProductVersion>
7-
<SchemaVersion>2.0</SchemaVersion>
8-
<ProjectGuid>{74A9329A-2B0B-4C0A-976C-E4FB7228D8B2}</ProjectGuid>
9-
<OutputType>WinExe</OutputType>
10-
<AppDesignerFolder>Properties</AppDesignerFolder>
11-
<RootNamespace>Cosmos.Build.Builder</RootNamespace>
12-
<AssemblyName>Cosmos.Build.Builder</AssemblyName>
13-
<TargetFrameworkVersion>v4.7.1</TargetFrameworkVersion>
14-
<FileAlignment>512</FileAlignment>
15-
<ProjectTypeGuids>{60dc8134-eba5-43b8-bcc9-bb4bc16c2548};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
16-
<WarningLevel>4</WarningLevel>
17-
<TargetFrameworkProfile />
18-
</PropertyGroup>
19-
<PropertyGroup>
20-
<ApplicationIcon>Cosmos.ico</ApplicationIcon>
21-
</PropertyGroup>
22-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
23-
<DebugSymbols>true</DebugSymbols>
24-
<OutputPath>bin\Debug\</OutputPath>
25-
<DefineConstants>DEBUG;TRACE</DefineConstants>
26-
<DebugType>full</DebugType>
27-
<PlatformTarget>AnyCPU</PlatformTarget>
28-
<ErrorReport>prompt</ErrorReport>
29-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
30-
<Prefer32Bit>true</Prefer32Bit>
31-
</PropertyGroup>
32-
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
33-
<OutputPath>bin\Release\</OutputPath>
34-
<DefineConstants>TRACE</DefineConstants>
35-
<Optimize>true</Optimize>
36-
<DebugType>pdbonly</DebugType>
37-
<PlatformTarget>AnyCPU</PlatformTarget>
38-
<ErrorReport>prompt</ErrorReport>
39-
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
40-
<Prefer32Bit>false</Prefer32Bit>
41-
</PropertyGroup>
42-
<ItemGroup>
43-
<Reference Include="Microsoft.VisualBasic" />
44-
<Reference Include="NuGet.Common, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
45-
<HintPath>..\..\packages\NuGet.Common.4.2.0\lib\net45\NuGet.Common.dll</HintPath>
46-
</Reference>
47-
<Reference Include="NuGet.Configuration, Version=4.2.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35, processorArchitecture=MSIL">
48-
<HintPath>..\..\packages\NuGet.Configuration.4.2.0\lib\net45\NuGet.Configuration.dll</HintPath>
49-
</Reference>
50-
<Reference Include="System" />
51-
<Reference Include="System.Data" />
52-
<Reference Include="System.Drawing" />
53-
<Reference Include="System.IO.Compression" />
54-
<Reference Include="System.Security" />
55-
<Reference Include="System.Xml" />
56-
<Reference Include="Microsoft.CSharp" />
57-
<Reference Include="System.Core" />
58-
<Reference Include="System.Xml.Linq" />
59-
<Reference Include="System.Data.DataSetExtensions" />
60-
<Reference Include="System.Xaml">
61-
<RequiredTargetFramework>4.0</RequiredTargetFramework>
62-
</Reference>
63-
<Reference Include="WindowsBase" />
64-
<Reference Include="PresentationCore" />
65-
<Reference Include="PresentationFramework" />
66-
</ItemGroup>
67-
<ItemGroup>
68-
<ApplicationDefinition Include="App.xaml">
69-
<Generator>MSBuild:Compile</Generator>
70-
<SubType>Designer</SubType>
71-
</ApplicationDefinition>
72-
<Compile Include="FileMgr.cs" />
73-
<Compile Include="Properties\Settings.Designer.cs">
74-
<AutoGen>True</AutoGen>
75-
<DesignTimeSharedInput>True</DesignTimeSharedInput>
76-
<DependentUpon>Settings.settings</DependentUpon>
77-
</Compile>
78-
<Page Include="MainWindow.xaml">
79-
<Generator>MSBuild:Compile</Generator>
80-
<SubType>Designer</SubType>
81-
</Page>
82-
<Compile Include="App.xaml.cs">
83-
<DependentUpon>App.xaml</DependentUpon>
84-
<SubType>Code</SubType>
85-
</Compile>
86-
<Compile Include="BuildState.cs" />
87-
<Compile Include="CosmosTask.cs" />
88-
<Compile Include="MainWindow.xaml.cs">
89-
<DependentUpon>MainWindow.xaml</DependentUpon>
90-
<SubType>Code</SubType>
91-
</Compile>
92-
</ItemGroup>
93-
<ItemGroup>
94-
<Compile Include="Properties\AssemblyInfo.cs">
95-
<SubType>Code</SubType>
96-
</Compile>
97-
<None Include=".editorconfig" />
98-
<None Include="App.config" />
99-
<AppDesigner Include="Properties\" />
100-
<None Include="packages.config" />
101-
<None Include="Properties\Settings.settings">
102-
<Generator>SettingsSingleFileGenerator</Generator>
103-
<LastGenOutput>Settings.Designer.cs</LastGenOutput>
104-
</None>
105-
</ItemGroup>
106-
<ItemGroup>
107-
<Resource Include="Cosmos.ico" />
108-
</ItemGroup>
109-
<ItemGroup>
110-
<ProjectReference Include="..\Cosmos.Build.Installer\Cosmos.Build.Installer.csproj">
111-
<Project>{27d94586-fe88-4203-be6a-c99013fd5018}</Project>
112-
<Name>Cosmos.Build.Installer</Name>
113-
</ProjectReference>
114-
</ItemGroup>
115-
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
116-
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
117-
Other similar extension points exist, see Microsoft.Common.targets.
118-
<Target Name="BeforeBuild">
119-
</Target>
120-
<Target Name="AfterBuild">
121-
</Target>
122-
-->
123-
</Project>
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>net471</TargetFramework>
5+
<OutputType>WinExe</OutputType>
6+
<ApplicationIcon>Resources\Cosmos.ico</ApplicationIcon>
7+
</PropertyGroup>
8+
9+
<ItemGroup>
10+
<ApplicationDefinition Include="App.xaml" SubType="Designer" Generator="MSBuild:Compile" />
11+
<Page Include="**\*.xaml" Exclude="App.xaml" SubType="Designer" Generator="MSBuild:Compile" />
12+
<Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />
13+
<Resource Include="Resources\**" />
14+
<UpToDateCheckInput Include="@(ApplicationDefinition)" />
15+
<UpToDateCheckInput Include="@(Page)" />
16+
</ItemGroup>
17+
18+
<ItemGroup>
19+
<Reference Include="System.Xaml" />
20+
<Reference Include="WindowsBase" />
21+
<Reference Include="PresentationCore" />
22+
<Reference Include="PresentationFramework" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.8.24" />
27+
<PackageReference Include="NuGet.Common" Version="4.2.0" />
28+
<PackageReference Include="NuGet.Configuration" Version="4.2.0" />
29+
</ItemGroup>
30+
31+
</Project>

source/Cosmos.Build.Builder/CosmosTask.cs

+13-11
Original file line numberDiff line numberDiff line change
@@ -205,17 +205,19 @@ private void CheckForRepos()
205205

206206
private void CheckForInno() {
207207
Log.WriteLine("Check for Inno Setup");
208-
using (var xKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", false)) {
209-
if (xKey == null) {
210-
mExceptionList.Add("Cannot find Inno Setup.");
211-
mBuildState = BuildState.PrerequisiteMissing;
212-
return;
213-
}
214-
mInnoPath = (string)xKey.GetValue("InstallLocation");
215-
if (string.IsNullOrWhiteSpace(mInnoPath)) {
216-
mExceptionList.Add("Cannot find Inno Setup.");
217-
mBuildState = BuildState.PrerequisiteMissing;
218-
return;
208+
using (var xLocalMachineKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32)) {
209+
using (var xKey = xLocalMachineKey.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Uninstall\Inno Setup 5_is1", false)) {
210+
if (xKey == null) {
211+
mExceptionList.Add("Cannot find Inno Setup.");
212+
mBuildState = BuildState.PrerequisiteMissing;
213+
return;
214+
}
215+
mInnoPath = (string)xKey.GetValue("InstallLocation");
216+
if (string.IsNullOrWhiteSpace(mInnoPath)) {
217+
mExceptionList.Add("Cannot find Inno Setup.");
218+
mBuildState = BuildState.PrerequisiteMissing;
219+
return;
220+
}
219221
}
220222
}
221223

File renamed without changes.

source/Cosmos.Build.Builder/MainWindow.xaml

-18
This file was deleted.
File renamed without changes.

source/Cosmos.Build.Builder/Properties/AssemblyInfo.cs

-55
This file was deleted.

0 commit comments

Comments
 (0)