public PublishedToolchainSettingsViewModel(IProject model) : base("Platform", model)
        {
            _settings = model.GetToolchainSettings <PublishedGCCToolchainSettings>();

            Dispatcher.UIThread.InvokeAsync(async() =>
            {
                AvailableToolchains = new ObservableCollection <PackageMetaData>(await GccConfigurationsManager.GetRemotePackagesAsync());

                if (!string.IsNullOrEmpty(_settings.Toolchain))
                {
                    SelectedPackage = AvailableToolchains.FirstOrDefault(tc => tc.Title == _settings.Toolchain);

                    await LoadVersions();

                    if (!string.IsNullOrEmpty(_settings.Version))
                    {
                        SelectedVersion = Versions.FirstOrDefault(v => v == _settings.Version);

                        if (SelectedVersion == null)
                        {
                            SelectedVersion = Versions.FirstOrDefault();
                        }
                    }
                    else
                    {
                        SelectedVersion = Versions.FirstOrDefault();
                    }
                }
                _initialised = true;
                Save();
            });
        }
예제 #2
0
        public override IEnumerable <string> GetToolchainIncludes(ISourceFile file)
        {
            if (_gccConfig == null && file != null)
            {
                _settings = file.Project.Solution.StartupProject.GetToolchainSettings <PublishedGCCToolchainSettings>();

                var manifest = PackageManager.GetPackageManifest(_settings.Toolchain, _settings.Version);

                _gccConfig = GccConfiguration.FromManifest(manifest);

                _gccConfig.ResolveAsync().GetAwaiter().GetResult();

                //_gccConfig = GccConfigurationsManager.GetConfiguration(_settings.Toolchain, _settings.Version);

                //_gccConfig?.ResolveAsync().GetAwaiter().GetResult();
            }

            var result = base.GetToolchainIncludes(file);

            if (_gccConfig != null && _gccConfig.SystemIncludePaths != null)
            {
                result = result.Concat(_gccConfig.SystemIncludePaths);
            }

            return(result);
        }
예제 #3
0
        public PublishedToolchainSettingsViewModel(IProject model) : base("Platform", model)
        {
            _settings = model.GetToolchainSettings <PublishedGCCToolchainSettings>();

            Dispatcher.UIThread.InvokeAsync(async() =>
            {
                try
                {
                    var packages = await PackageManager.ListToolchains();

                    AvailableToolchains = new ObservableCollection <string>(packages);
                }
                catch (System.Exception)
                {
                    AvailableToolchains = new ObservableCollection <string>();
                }

                if (!string.IsNullOrEmpty(_settings.Toolchain))
                {
                    SelectedPackage = AvailableToolchains.FirstOrDefault((tc => tc == _settings.Toolchain));

                    await LoadVersions();

                    if (!string.IsNullOrEmpty(_settings.Version))
                    {
                        SelectedVersion = Versions?.FirstOrDefault(v => v.Version == Version.Parse(_settings.Version));

                        if (SelectedVersion == null)
                        {
                            SelectedVersion = Versions?.FirstOrDefault();
                        }
                    }
                    else
                    {
                        SelectedVersion = Versions?.FirstOrDefault();
                    }
                }
                _initialised = true;
                Save();
            });
        }
        public override async Task <bool> InstallAsync(IConsole console, IProject project)
        {
            bool result = true;

            _settings = project.GetToolchainSettings <PublishedGCCToolchainSettings>();

            if (_settings.Toolchain != null)
            {
                await PackageManager.EnsurePackage(_settings.Toolchain, _settings.Version, IoC.Get <IConsole>(), ignoreRid : true);

                _gccConfig = GccConfigurationsManager.GetConfiguration(_settings.Toolchain, _settings.Version);

                result = await _gccConfig.ResolveAsync();
            }

            if (result)
            {
                result = await base.InstallAsync(console, project);
            }

            return(result);
        }
예제 #5
0
        public override async Task <bool> InstallAsync(IConsole console, IProject project)
        {
            bool result = true;

            _settings = project.GetToolchainSettings <PublishedGCCToolchainSettings>();

            if (_settings.Toolchain != null)
            {
                var packageStatus = await PackageManager.EnsurePackage(_settings.Toolchain, _settings.Version, IoC.Get <IConsole>());

                result = packageStatus == PackageEnsureStatus.Found || packageStatus == PackageEnsureStatus.Installed;

                if (result)
                {
                    var manifest = PackageManager.GetPackageManifest(_settings.Toolchain, _settings.Version);

                    if (manifest != null)
                    {
                        _gccConfig = GccConfiguration.FromManifest(manifest);

                        result = await _gccConfig.ResolveAsync();
                    }
                    else
                    {
                        console.WriteLine($"Toolchain: {_settings.Toolchain} v{_settings.Version} does not include a manifest with a valid gcc configuration.");
                        result = false;
                    }
                }
            }

            if (result)
            {
                result = await base.InstallAsync(console, project);
            }

            return(result);
        }