Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }