示例#1
0
        protected async Task <IPackage> CreatePackage(PackageDescriptor descriptor, PackageTool tool)
        {
            await tool.Prepare();

            try
            {
                var projectAsset = await tool.LocateProjectAsset();

                var package = new Package2(descriptor.Name, tool.DirectoryAccessor);
                package.Add(projectAsset);
                try
                {
                    var wasmAsset = await tool.LocateWasmAsset();

                    package.Add(wasmAsset);
                }
                catch (WasmAssetNotFoundException)
                {
                }

                return(package);
            }
            catch (ProjectAssetNotFoundException)
            {
                return(null);
            }
        }
        public async Task <IEnumerable <PackageAsset> > LoadAsync(Package2 package)
        {
            var directory = package.DirectoryAccessor;

            if (directory.DirectoryExists(".store"))
            {
                var exeName = package.Name.ExecutableName();

                if (directory.FileExists(exeName))
                {
                    var tool = PackageTool.TryCreateFromDirectory(package.Name, directory);

                    if (tool != null)
                    {
                        var toolDirectory = await _toolPackageLocator.PrepareToolAndLocateAssetDirectory(tool);

                        return(new PackageAsset[]
                        {
                            new WebAssemblyAsset(directory.GetDirectoryAccessorFor(toolDirectory))
                        });
                    }
                }
            }

            return(Enumerable.Empty <PackageAsset>());
        }
示例#3
0
        public Task <IEnumerable <PackageAsset> > LoadAsync(Package2 package)
        {
            var assets = new List <PackageAsset>();

            var directory = package.DirectoryAccessor;

            foreach (var csproj in directory.GetAllFilesRecursively()
                     .Where(f => f.Extension == ".csproj"))
            {
                assets.Add(new ProjectAsset(directory.GetDirectoryAccessorForRelativePath(csproj.Directory), csproj.FileName));
            }

            return
                (Task.FromResult <IEnumerable <PackageAsset> >(assets));
        }
示例#4
0
        protected async Task <IPackage> CreatePackage(PackageDescriptor descriptor, PackageTool tool)
        {
            await tool.Prepare();

            var wasmAsset = await tool.LocateWasmAsset();

            if (wasmAsset != null)
            {
                var package = new Package2(descriptor.Name, new FileSystemDirectoryAccessor(wasmAsset.DirectoryAccessor.GetFullyQualifiedRoot().Parent));
                package.Add(wasmAsset);
                return(package);
            }

            return(null);
        }
示例#5
0
        protected async Task <IPackage> CreatePackage(PackageDescriptor descriptor, PackageTool tool)
        {
            await tool.Prepare();

            var projectAsset = await tool.LocateProjectAsset();

            if (projectAsset != null)
            {
                var package = new Package2(descriptor.Name, tool.DirectoryAccessor);
                package.Add(projectAsset);

                var wasmAsset = await tool.LocateWasmAsset();

                if (wasmAsset != null)
                {
                    package.Add(wasmAsset);
                    return(package);
                }
            }

            return(null);
        }
        public async Task <IEnumerable <PackageAsset> > LoadAsync(Package2 package)
        {
            var directory = package.DirectoryAccessor;

            if (directory.DirectoryExists(".store"))
            {
                var exeName = package.Name.ExecutableName();

                if (directory.FileExists(exeName))
                {
                    var tool    = new PackageTool(package.Name, directory.GetFullyQualifiedRoot());
                    var exePath = directory.GetFullyQualifiedFilePath(exeName);

                    var toolDirectory = await _toolPackageLocator.PrepareToolAndLocateAssetDirectory(tool);

                    return(new PackageAsset[]
                    {
                        new WebAssemblyAsset(directory.GetDirectoryAccessorFor(toolDirectory))
                    });
                }
            }

            return(Enumerable.Empty <PackageAsset>());
        }