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

Builder improvements #2826

Merged
merged 8 commits into from
Nov 29, 2023
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
2 changes: 1 addition & 1 deletion Build/Targets/PackageVersions.targets
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup>
<ApprovalTestsVersion>3.0.18</ApprovalTestsVersion>
<AvaloniaVersion>0.7.0</AvaloniaVersion>
<NuGetVersion>5.9.1</NuGetVersion>
<NuGetVersion>6.8.0</NuGetVersion>
<NUnitVersion>3.11.0</NUnitVersion>
<NUnit3TestAdapterVersion>3.12.0</NUnit3TestAdapterVersion>
<RoslynAnalyzersVersion>2.6.2</RoslynAnalyzersVersion>
Expand Down
6 changes: 4 additions & 2 deletions Setup/Cosmos.iss
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ FlatComponentsList=False
AlwaysShowComponentsList=False
ShowComponentSizes=False
LicenseFile=LICENSE.txt
DisableDirPage=no
DisableDirPage=no
WizardStyle=modern

[Messages]
SelectDirDesc=If the user installing the Cosmos User Kit is not the admin, please choose the users AppData/Roaming directory
Expand Down Expand Up @@ -143,12 +144,13 @@ UseRelativePaths=True
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Remove -Name ""Cosmos Local Package Feed"""; WorkingDir: "{app}"; Description: "Uninstall Kernel Packages"; StatusMsg: "Uninstalling Kernel Packages"
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Add -Name ""Cosmos Local Package Feed"" -Source ""{app}\packages\\"""; WorkingDir: "{app}"; Description: "Install Kernel Packages"; StatusMsg: "Installing Kernel Packages"
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "nuget locals all -Clear"; WorkingDir: "{app}"; Description: "Install Kernel Packages"; StatusMsg: "Clearing nuget cache"

#ifndef DoNotInstallExtensions
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.ProjectSystem"; Description: "Remove Cosmos Project System"; StatusMsg: "Removing Visual Studio Extension: Cosmos Project System"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q /u:Cosmos.VS.DebugEngine"; Description: "Remove Cosmos Debug Engine"; StatusMsg: "Removing Visual Studio Extension: Cosmos Debug Engine"

Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q Cosmos.VS.DebugEngine.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos Debug Engine"; StatusMsg: "Installing Visual Studio Extension: Cosmos Debug Engine"
Filename: "{app}\Build\Tools\VSIXBootstrapper.exe"; Parameters: "/q Cosmos.VS.ProjectSystem.vsix"; WorkingDir: "{app}\VSIX\"; Description: "Install Cosmos Project System"; StatusMsg: "Installing Visual Studio Extension: Cosmos Project System"
#endif

[UninstallRun]
Filename: "{app}\Build\Tools\nuget.exe"; Parameters: "sources Remove -Name ""Cosmos Local Package Feed"""; WorkingDir: "{app}"; StatusMsg: "Uninstalling Kernel Packages"
Expand Down
2 changes: 1 addition & 1 deletion install-VS2022.bat
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if %ERRORLEVEL% neq 0 (
exit /b %ERRORLEVEL%
)

start "Cosmos Builder" "source\Cosmos.Build.Builder\bin\Debug\Cosmos.Build.Builder.exe" "-VSPATH=%InstallDir%" %*
start "Cosmos Builder" "source\Cosmos.Build.Builder\bin\Debug\Cosmos.Build.Builder.exe"
exit

:seven
Expand Down
24 changes: 10 additions & 14 deletions source/Cosmos.Build.Builder/App.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
using Cosmos.Build.Builder.Services;
using Cosmos.Build.Builder.ViewModels;
using Cosmos.Build.Builder.Views;
using System.Text;

namespace Cosmos.Build.Builder
{
Expand All @@ -23,14 +24,18 @@ protected override void OnStartup(StartupEventArgs e)
Current.Shutdown();
return;
}

Encoding.RegisterProvider(CodePagesEncodingProvider.Instance);
MainWindow = new MainWindow();

// ask for build configuration
OptionsDialog options = new();
options.ShowDialog();

var configuration = new CommandLineBuilderConfiguration(e.Args);

BuilderConfiguration = configuration;
BuilderConfiguration = options.BuildOptions;

MainWindow = new MainWindow();

var visualStudioService = new VisualStudioService();
VisualStudioService visualStudioService = new();

var visualStudioInstances = visualStudioService.GetInstances();

Expand All @@ -42,15 +47,6 @@ protected override void OnStartup(StartupEventArgs e)

ISetupInstance2 visualStudioInstance = null;

if (configuration.VsPath != null)
{
visualStudioInstance = visualStudioInstances.FirstOrDefault(
i => String.Equals(
Path.GetFullPath(configuration.VsPath),
Path.GetFullPath(i.GetInstallationPath()),
StringComparison.Ordinal));
}

if (visualStudioInstance == null)
{
if (visualStudioInstances.Count == 1)
Expand Down
10 changes: 8 additions & 2 deletions source/Cosmos.Build.Builder/BuildTasks/CreateSetupTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ public CreateSetupTask(
IInnoSetupService innoSetupService,
string scriptFilePath,
string configuration,
string releaseVersion)
string releaseVersion,
bool InstallExtensions)
: base(true, false)
{
_innoSetupService = innoSetupService;
Expand All @@ -30,7 +31,12 @@ public CreateSetupTask(
{
["BuildConfiguration"] = configuration,
["ChangeSetVersion"] = releaseVersion,
};
};

if(!InstallExtensions)
{
_defines.Add("DoNotInstallExtensions", "1");
}

// when building the userkit we want to let innosetup determine the installation location
// see https://github.com/CosmosOS/Cosmos/issues/2329
Expand Down
13 changes: 13 additions & 0 deletions source/Cosmos.Build.Builder/BuilderConfiguration.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
using System;
using System.Collections.Generic;
using System.Runtime.CompilerServices;

namespace Cosmos.Build.Builder
{
internal class BuilderConfiguration : IBuilderConfiguration
{
public bool NoVsLaunch { get; set; }
public bool UserKit { get; set; }
public bool BuildExtensions { get; set; }
}
}
50 changes: 0 additions & 50 deletions source/Cosmos.Build.Builder/CommandLineBuilderConfiguration.cs

This file was deleted.

58 changes: 24 additions & 34 deletions source/Cosmos.Build.Builder/Cosmos.Build.Builder.csproj
Original file line number Diff line number Diff line change
@@ -1,34 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>net472</TargetFramework>
<OutputType>WinExe</OutputType>
<ApplicationIcon>Resources\Cosmos.ico</ApplicationIcon>
<IncludeWpfReferences>True</IncludeWpfReferences>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<SignAssembly>False</SignAssembly>
</PropertyGroup>

<ItemGroup>
<ApplicationDefinition Include="App.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Page Include="**\*.xaml" Exclude="App.xaml" SubType="Designer" Generator="MSBuild:Compile" />
<Compile Update="**\*.xaml.cs" SubType="Designer" DependentUpon="%(Filename)" />
<Resource Include="Resources\**" />
<UpToDateCheckInput Include="@(ApplicationDefinition)" />
<UpToDateCheckInput Include="@(Page)" />
</ItemGroup>

<ItemGroup>
<Reference Include="System.Net.Http" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="1.16.30" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.1" />
<PackageReference Include="NuGet.Common" />
<PackageReference Include="NuGet.Configuration" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="4.6.0" />
<PackageReference Include="WPF-UI" Version="2.0.3" />
</ItemGroup>

</Project>
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows7.0</TargetFramework>
<OutputType>WinExe</OutputType>
<ApplicationIcon>Resources\Cosmos.ico</ApplicationIcon>
<UseWPF>True</UseWPF>
<AppendTargetFrameworkToOutputPath>False</AppendTargetFrameworkToOutputPath>
<ApplicationManifest>app.manifest</ApplicationManifest>
<SignAssembly>False</SignAssembly>
</PropertyGroup>
<ItemGroup>
<Resource Include="Resources\**" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Microsoft.VisualStudio.Setup.Configuration.Interop" Version="3.8.2112" />
<PackageReference Include="NuGet.Common" Version="6.8.0" />
<PackageReference Include="NuGet.Configuration" Version="6.8.0" />
<PackageReference Include="NuGet.Frameworks" Version="6.8.0" />
<PackageReference Include="System.Runtime.WindowsRuntime" Version="5.0.0-preview.5.20278.1" />
<PackageReference Include="System.Text.Encoding.CodePages" Version="8.0.0" />
<PackageReference Include="WPF-UI" Version="3.0.0-preview.11" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
</ItemGroup>
</Project>
3 changes: 2 additions & 1 deletion source/Cosmos.Build.Builder/CosmosBuildDefinition.cs
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,8 @@ void CleanPackage(string aPackage)
_innoSetupService,
innoSetupScriptPath,
App.BuilderConfiguration.UserKit ? "UserKit" : "DevKit",
cosmosSetupVersion);
cosmosSetupVersion,
App.BuilderConfiguration.BuildExtensions);

if (!App.BuilderConfiguration.UserKit)
{
Expand Down
7 changes: 4 additions & 3 deletions source/Cosmos.Build.Builder/Dependencies/ReposDependency.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public string OtherDependencysThatAreMissing
{
get
{
string result = "install ";
string result = "";
if (!Directory.Exists(Path.GetFullPath(Path.Combine(_cosmosDir, "..", "IL2CPU"))))
{
result += "IL2CPU Repo, ";
Expand All @@ -30,8 +30,9 @@ public string OtherDependencysThatAreMissing
}
if (!Directory.Exists(Path.GetFullPath(Path.Combine(_cosmosDir, "..", "Common"))))
{
result += "Common Repo";
}
result += "Common Repo, ";
}
result = result.Substring(0, result.Length - 2);
return result;
}
}
Expand Down
2 changes: 1 addition & 1 deletion source/Cosmos.Build.Builder/IBuilderConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,6 @@ internal interface IBuilderConfiguration
{
bool NoVsLaunch { get; }
bool UserKit { get; }
string VsPath { get; }
bool BuildExtensions { get; }
}
}
8 changes: 4 additions & 4 deletions source/Cosmos.Build.Builder/ViewModels/MainWindowViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Input;

using Cosmos.Build.Builder.BuildTasks;
using Cosmos.Build.Builder.Collections;
using Cosmos.Build.Builder.Models;
using Cosmos.Build.Builder.Services;
Expand Down Expand Up @@ -82,7 +82,8 @@ private void RetryBuildCommand(object obj)
MainWindow win = new();
win.Show();
_dependencyInstallationDialogService.SetAnotherOwner(win);
Window.AppShutdown = false;
Window.AppShutdown = false;
Window.ShowCloseBuilderDialog = false;
Window.Close();
win.DataContext = new MainWindowViewModel(_dependencyInstallationDialogService, _buildDefinition, win);
}
Expand Down Expand Up @@ -154,7 +155,7 @@ private async Task BuildAsync()

if (dependency.ShouldInstallByDefault)
{
using (var viewModel = new DependencyInstallationDialogViewModel(dependency))
using (DependencyInstallationDialogViewModel viewModel = new(dependency))
{
_dependencyInstallationDialogService.ShowDialog(viewModel);

Expand Down Expand Up @@ -189,7 +190,6 @@ private async Task BuildAsync()
if (_buildCancel) { throw new TaskCanceledException(); }

_logger.NewSection(buildTask.Name);

await buildTask.RunAsync(_logger).ConfigureAwait(false);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,6 @@ public partial class DependencyInstallationDialog : Window
public DependencyInstallationDialog()
{
InitializeComponent();
Loaded += (sender, args) =>
{
Wpf.Ui.Appearance.Watcher.Watch(this, Wpf.Ui.Appearance.BackgroundType.Mica, true);
};
}
}
}
6 changes: 3 additions & 3 deletions source/Cosmos.Build.Builder/Views/MainWindow.xaml
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
<ui:UiWindow x:Class="Cosmos.Build.Builder.Views.MainWindow"
<ui:FluentWindow x:Class="Cosmos.Build.Builder.Views.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ui="http://schemas.lepo.co/wpfui/2022/xaml"
mc:Ignorable="d"
Icon="/Cosmos.Build.Builder;component/Resources/Cosmos.ico"
Icon="/Resources/Cosmos.ico"
MinHeight="480"
MinWidth="800"
Title="Cosmos Kit Builder"
Expand Down Expand Up @@ -168,4 +168,4 @@

</DockPanel>
</Grid>
</ui:UiWindow>
</ui:FluentWindow>
Loading