Пример #1
0
        /// <summary>
        /// Build the dependecies for the provided recipe recursively
        /// </summary>
        private async Task BuildAllDependenciesRecursivelyAsync(
            string path,
            Recipe recipe,
            bool force)
        {
            Log.Info($"Searching Dependencies: {recipe.Name}.");
            foreach (var dependecy in recipe.Dependencies)
            {
                // Load this package recipe
                var packagePath     = VerifyDependencyPath(path, dependecy);
                var dependecyRecipe = await RecipeManager.LoadFromFileAsync(packagePath);

                if (dependecyRecipe == null)
                {
                    Log.Error($"Failed to load the dependency package: {packagePath}");
                    throw new InvalidOperationException();
                }

                // Build all recursive dependencies
                await BuildAllDependenciesRecursivelyAsync(packagePath, dependecyRecipe, force);

                // Build this dependecy
                await CoreBuildAsync(packagePath, dependecyRecipe, force);
            }
        }
Пример #2
0
        /// <summary>
        /// Build the recursive dependencies
        /// </summary>
        public static async Task <List <PackageReference> > BuildRecursiveDependeciesAsync(LocalUserConfig config, Recipe recipe)
        {
            List <PackageReference> result = new List <PackageReference>();

            foreach (var dependency in recipe.Dependencies)
            {
                result.Add(dependency);
                var dependencyPackagePath = BuildKitchenPackagePath(config, dependency);
                var dependencyRecipe      = await RecipeManager.LoadFromFileAsync(dependencyPackagePath);

                var transsitiveDependencies = await BuildRecursiveDependeciesAsync(config, dependencyRecipe);

                result.AddRange(transsitiveDependencies);
            }

            return(result);
        }
Пример #3
0
        private async Task GenerateDependencyLibrarySetAsync(
            string path,
            string binaryDirectory,
            Recipe recipe,
            HashSet <string> set)
        {
            foreach (var dependecy in recipe.Dependencies)
            {
                // Load this package recipe
                var packagePath     = VerifyDependencyPath(path, dependecy);
                var dependecyRecipe = await RecipeManager.LoadFromFileAsync(packagePath);

                // Get recursive dependencies
                await GenerateDependencyLibrarySetAsync(packagePath, binaryDirectory, dependecyRecipe, set);

                set.Add(Path.Combine(packagePath, binaryDirectory, $"{dependecyRecipe.Name}.{_compiler.StaticLibraryFileExtension}").ToLower());
            }
        }
Пример #4
0
        /// <summary>
        /// Verify the archive
        /// </summary>
        public static async Task <Recipe> VerifyArchiveAsync(Stream stream)
        {
            using (var gzipStream = new GZipStream(stream, CompressionMode.Decompress, true))
                using (var archive = new TarInputStream(gzipStream))
                {
                    Recipe   recipe = null;
                    TarEntry entry  = archive.GetNextEntry();
                    while (entry != null)
                    {
                        if (string.Compare(entry.Name, Constants.RecipeFileName, true) == 0)
                        {
                            recipe = await RecipeManager.LoadFromStreamAsync(archive);

                            break;
                        }

                        entry = archive.GetNextEntry();
                    }

                    return(recipe);
                }
        }
Пример #5
0
        private async Task BuildDependencyModuleReferences(
            string path,
            string binaryDirectory,
            Recipe recipe,
            IList <string> modules,
            IList <string> defines,
            bool isRecursive)
        {
            foreach (var dependecy in recipe.Dependencies)
            {
                // Load this package recipe
                var packagePath     = VerifyDependencyPath(path, dependecy);
                var dependecyRecipe = await RecipeManager.LoadFromFileAsync(packagePath);

                modules.Add(Path.Combine(packagePath, binaryDirectory, BuildRecipeModuleFilename(dependecyRecipe)));
                defines.Add(BuildRecipeNamespaceDefine(dependecyRecipe));

                if (isRecursive)
                {
                    await BuildDependencyModuleReferences(packagePath, binaryDirectory, dependecyRecipe, modules, defines, isRecursive);
                }
            }
        }