Merge branch 'master' into vbe-multiboot-non-lfb

This commit is contained in:
Quajak 2021-01-13 10:11:39 +01:00 committed by GitHub
commit 8e724641ed
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 101 additions and 10 deletions

View file

@ -8,8 +8,7 @@
https://www.myget.org/F/cosmos/api/v3/index.json;
https://ci.appveyor.com/nuget/cosmos-common;
https://ci.appveyor.com/nuget/il2cpu;
https://ci.appveyor.com/nuget/xsharp;
https://dotnet.myget.org/F/roslyn-tools/api/v3/index.json
https://ci.appveyor.com/nuget/xsharp
</RestoreSources>
<RestoreSources Condition="Exists($(DefaultPackageOutputPath))">$(RestoreSources);$(DefaultPackageOutputPath)</RestoreSources>

9
readme-IT.md Normal file
View file

@ -0,0 +1,9 @@
# Cosmos
[![Build status](https://ci.appveyor.com/api/projects/status/kust7g5dlnykhkaf/branch/master?svg=true)](https://ci.appveyor.com/project/CosmosOS/cosmos/branch/master)
Cosmos è un "kit di costruzione" per SO. Fai il tuo sistema operativo con linguaggi gestiti come C#, VB.NET, e altri!
Per avere informazioni su come usare Cosmos, visita il [sito web di Cosmos](http://www.gocosmos.org).
Per documentazione e informazioni tecniche, visita la [documentazione di Cosmos](https://cosmosos.github.io).

View file

@ -14,6 +14,12 @@ namespace Cosmos.Build.Builder.Dependencies
private const string InnoSetupInstallerUrl = "http://www.jrsoftware.org/download.php/is.exe";
public string Name => "Inno Setup";
public bool ShouldInstallByDefault => true;
public string OtherDependencysThatAreMissing
{
get { return Name; }
}
private readonly IInnoSetupService _innoSetupService;

View file

@ -13,6 +13,28 @@ namespace Cosmos.Build.Builder.Dependencies
internal class ReposDependency : IDependency
{
public string Name => "Repos: IL2CPU, XSharp and Common";
public bool ShouldInstallByDefault => true;
public string OtherDependencysThatAreMissing
{
get
{
string result = "";
if (!Directory.Exists(Path.GetFullPath(Path.Combine(_cosmosDir, "..", "IL2CPU"))))
{
result += "IL2CPU Repo, ";
}
if (!Directory.Exists(Path.GetFullPath(Path.Combine(_cosmosDir, "..", "XSharp"))))
{
result += "XSharp Repo, ";
}
if (!Directory.Exists(Path.GetFullPath(Path.Combine(_cosmosDir, "..", "Common"))))
{
result += "Common Repo";
}
return result;
}
}
private readonly string _cosmosDir;
private readonly IEnumerable<Repo> _repos;

View file

@ -9,11 +9,16 @@ namespace Cosmos.Build.Builder.Dependencies
internal class VisualStudioDependency : IDependency
{
private static readonly Version MinimumVsVersion = new Version(15, 9);
public bool ShouldInstallByDefault => true;
public string Name => $"Visual Studio {MinimumVsVersion.Major}.{MinimumVsVersion.Minor}+";
public string OtherDependencysThatAreMissing
{
get { return Name+"+"; }
}
private readonly ISetupInstance2 _visualStudioInstance;
public VisualStudioDependency(ISetupInstance2 visualStudioInstance)
{
_visualStudioInstance = visualStudioInstance;

View file

@ -17,9 +17,33 @@ namespace Cosmos.Build.Builder.Dependencies
NetCoreToolsWorkload,
VisualStudioExtensionsWorkload
};
public bool ShouldInstallByDefault => false;
public string Name => "Visual Studio Workloads";
public string OtherDependencysThatAreMissing
{
get
{
var missingPackages = ((string[])RequiredPackages.Clone()).ToList();
foreach (var item in RequiredPackages)
{
if (IsPackageInstalled(item))
{
missingPackages.Remove(item);
}
}
//Add the missing packages together
string missingPackages_proper = "";
foreach (var item in missingPackages)
{
missingPackages_proper += GetProperName(item) + ", ";
}
return missingPackages_proper;
}
}
private readonly ISetupInstance2 _visualStudioInstance;
public VisualStudioWorkloadsDependency(ISetupInstance2 visualStudioInstance)
@ -32,7 +56,19 @@ namespace Cosmos.Build.Builder.Dependencies
var installedPackages = _visualStudioInstance.GetPackages();
return Task.FromResult(RequiredPackages.All(p => IsPackageInstalled(p)));
}
private string GetProperName(string packageId)
{
if (packageId == NetCoreToolsWorkload)
{
return ".NET Core cross-platform development";
}
else if (packageId == VisualStudioExtensionsWorkload)
{
return "Visual Studio Extension development";
}
return "Unknown Workload: " + packageId;
}
public async Task InstallAsync(CancellationToken cancellationToken)
{
var vsInstallerPath = Environment.ExpandEnvironmentVariables(

View file

@ -6,7 +6,9 @@ namespace Cosmos.Build.Builder
internal interface IDependency
{
string Name { get; }
bool ShouldInstallByDefault { get; }
string OtherDependencysThatAreMissing { get; }
Task<bool> IsInstalledAsync(CancellationToken cancellationToken);
Task InstallAsync(CancellationToken cancellationToken);
}

View file

@ -107,17 +107,29 @@ namespace Cosmos.Build.Builder.ViewModels
}
else
{
_logger.LogMessage($"{dependency.Name} not found.");
_logger.LogMessage($"{dependency.Name} not found. Install {dependency.OtherDependencysThatAreMissing}");
using (var viewModel = new DependencyInstallationDialogViewModel(dependency))
if (dependency.ShouldInstallByDefault)
{
_dependencyInstallationDialogService.ShowDialog(viewModel);
if (!viewModel.InstallationSucceeded)
using (var viewModel = new DependencyInstallationDialogViewModel(dependency))
{
throw new Exception($"Dependency installation failed! Dependency name: {dependency.Name}");
_dependencyInstallationDialogService.ShowDialog(viewModel);
if (!viewModel.InstallationSucceeded)
{
throw new Exception($"Dependency installation failed! Dependency name: {dependency.Name}");
}
}
}
else
{
MessageBox.Show($"{dependency.Name} is not installed. Please install {dependency.OtherDependencysThatAreMissing}");
_logger.SetError();
_logger.NewSection("Error");
_logger.LogMessage($"{dependency.Name} not found.");
_logger.SetError();
return;
}
}
}