public SelfCompilingExecutable(string executable, string cacheRoot = null) { if (cacheRoot == null) { cacheRoot = Path.Combine(Path.GetTempPath(), "sce"); } this.executable = Path.GetFullPath(executable); this.cacheDir = Path.Combine(cacheRoot, Util.GetDigest(this.executable)); this.sourceDir = this.executable + ".src"; repository = new Nuget.Repository(Path.Combine(cacheRoot, "packages")); FS.EnsureDirectoryExists(this.cacheDir); }
public async Task <InstalledPackage> Install(ISource source, PackageSpec package) { var pdir = GetPackageDir(package); if (Directory.Exists(pdir)) { throw new Exception("Package already installed."); } FS.EnsureDirectoryExists(pdir); var nupkgDest = GetNupkgPath(package); FS.EnsureParentDirectoryExists(nupkgDest); await source.Download(package, nupkgDest); ZipFile.ExtractToDirectory(nupkgDest, pdir); return(new InstalledPackage(this, package)); }
async Task <int> RunImpl() { // locate compiled assembly FS.EnsureDirectoryExists(cacheDir); log(cacheDir); var sourceDir = GetSourceDir(); EnsureSourceDirectoryExists(sourceDir); // still up-to-date ? if (IsBuildRequired(sourceDir, OutputFile)) { await Build(sourceDir, OutputFile, repository); } // run var a = Assembly.LoadFrom(OutputFile); return(Run(a)); }