async Task DownloadAndExtractJitBenchRepo(string outputDir, ITestOutputHelper output)
        {
            // If the repo already exists, we delete it and extract it again.
            string jitBenchRepoRootDir = GetJitBenchRepoRootDir(outputDir);

            FileTasks.DeleteDirectory(jitBenchRepoRootDir, output);

            string localJitBenchRepo = GetLocalJitBenchRepoDirectory();

            if (localJitBenchRepo == null)
            {
                var url = $"{JitBenchRepoUrl}/archive/{JitBenchCommitSha1Id}.zip";
                FileTasks.DeleteDirectory(jitBenchRepoRootDir + "_temp", output);
                await FileTasks.DownloadAndUnzip(url, jitBenchRepoRootDir + "_temp", output);

                FileTasks.MoveDirectory(Path.Combine(jitBenchRepoRootDir + "_temp", $"JitBench-{JitBenchCommitSha1Id}"), jitBenchRepoRootDir, output);
            }
            else
            {
                if (!Directory.Exists(localJitBenchRepo))
                {
                    throw new Exception("Local JitBench repo " + localJitBenchRepo + " does not exist");
                }
                FileTasks.DirectoryCopy(localJitBenchRepo, jitBenchRepoRootDir, output);
            }
        }
Beispiel #2
0
        protected void SetupCscBinDir(string sdkDirPath, string runtimeVersion, string intermediateOutputDir, bool useExistingSetup, ITestOutputHelper output)
        {
            // copy the SDK version of csc into a private directory so we can safely retarget it
            string cscBinaryDirPath = Path.Combine(sdkDirPath, "Roslyn", "bincore");
            string localCscDir      = Path.Combine(intermediateOutputDir, "csc");

            ExePath = Path.Combine(localCscDir, "csc.dll");

            if (useExistingSetup)
            {
                return;
            }

            FileTasks.DirectoryCopy(cscBinaryDirPath, localCscDir, output);
            //overwrite csc.runtimeconfig.json to point at the runtime version we want to use
            string runtimeConfigPath = Path.Combine(localCscDir, "csc.runtimeconfig.json");

            File.Delete(runtimeConfigPath);
            File.WriteAllLines(runtimeConfigPath, new string[] {
                "{",
                "  \"runtimeOptions\": {",
                "    \"tfm\": \"netcoreapp2.0\",",
                "    \"framework\": {",
                "        \"name\": \"Microsoft.NETCore.App\",",
                "        \"version\": \"" + runtimeVersion + "\"",
                "    }",
                "  }",
                "}"
            });
        }