public void OneRootedOneNonRooted() { var path1 = new NPath(@"\mydir\myfile"); var path2 = new NPath(@"mydir\myfile"); Assert.IsFalse(path1.Equals(path2)); Assert.IsFalse(path1 == path2); }
public void OneWithTrailingSlash() { var path1 = new NPath(@"mydir/mydir2"); var path2 = new NPath(@"mydir/mydir2/"); Assert.IsTrue(path1.Equals(path2)); Assert.IsTrue(path1 == path2); }
public void Test() { var p1 = new NPath("/b/c"); var p2 = new NPath("c/d"); Assert.AreNotEqual(p1.GetHashCode(), p2.GetHashCode()); }
public void InFolderButDifferentSlashes() { var path1 = new NPath(@"mydir/myfile"); var path2 = new NPath(@"mydir\myfile"); Assert.IsTrue(path1.Equals(path2)); Assert.IsTrue(path1 == path2); }
public void WithDifferentDriveLetters() { var path1 = new NPath(@"c:\mydir\myfile"); var path2 = new NPath(@"e:\mydir\myfile"); Assert.IsFalse(path1.Equals(path2)); Assert.IsFalse(path1 == path2); }
public void SingleFile() { var path1 = new NPath("myfile"); var path2 = new NPath("myfile"); Assert.IsTrue(path1.Equals(path2)); Assert.IsTrue(path1 == path2); }
public void FromStringWithTrailingSlash() { var path = new NPath("/mydir/myotherdir/"); Assert.AreEqual("/mydir/myotherdir", path.ToString(SlashMode.Forward)); Assert.AreEqual("myotherdir", path.FileName); }
public void FromStringWithForwardSlash() { var path = new NPath("mydir/myfile.exe"); Assert.AreEqual("mydir/myfile.exe", path.ToString(SlashMode.Forward)); }
public void ToBaseDirectory() { var relative = new NPath("/mydir1/mydir2/myfile").RelativeTo(new NPath("/mydir1")); Assert.AreEqual("mydir2/myfile", relative.ToString(SlashMode.Forward)); Assert.IsTrue(relative.IsRelative); }
public void ParentFromFileInRoot() { var path = new NPath("/myfile.exe").Parent; Assert.AreEqual("/", path.ToString(SlashMode.Forward)); }
public void ParentFromFile() { var path = new NPath("myfile.exe").Parent; Assert.AreEqual("", path.ToString()); }
public void RecursiveParentsStartFromFileAllTheWayToRoot() { var path = new NPath("C:\\mydir\\myotherdir\\myfile.exe"); Assert.That(path.RecursiveParents, Is.EqualTo(new[] { path.Parent, path.Parent.Parent, path.Parent.Parent.Parent })); }
protected void CopyToInputAndExpectations(NPath source) { source.Copy(InputDirectory); source.Copy(ExpectationsDirectory); }
public ToolchainWindowsX86_64LinuxX86_64() { _payloadDir = $"windows-x86_64-linux-x86_64/{_payloadVersion}"; RegisterPayload(_packageName, _payloadDir); _toolchainPath = PayloadInstallDirectory(_payloadDir); }
static void SetupCompileEditorTools(NPath rootPath) { // since this target and `get-editor-tools` target outputs the same files // we cannot have these two targets side by side in the dag. // We need this to generate the only correct target if (!CompileEditorToolsFromSourceFileFlag.FileExists()) { return; } var editorToolsSourceDirectory = rootPath.Combine("EditorTools/Src"); Backend.Current.Register(Node); var env = new Dictionary <string, string>() { { "PATH", $"{NodeDirectory.ToString()}{PathSeparator}{Environment.GetEnvironmentVariable("PATH")}" } }; var dependencies = new List <NPath>(); // Iterate all folders in Tools and process them foreach (var toolDir in editorToolsSourceDirectory.Contents()) { if (toolDir.FileExists("package.json")) { var packageLockJsonFilePath = toolDir.Combine("package-lock.json"); var packageJsonFilePath = toolDir.Combine("package.json"); // Run npm install Backend.Current.AddAction($"npm install", targetFiles: new[] { packageLockJsonFilePath }, inputs: new[] { Node.Path, packageJsonFilePath }, executableStringFor: $"cd {toolDir.InQuotes()} && npm install", commandLineArguments: Array.Empty <string>(), environmentVariables: env, allowUnwrittenOutputFiles: true); dependencies.Add(packageLockJsonFilePath); // Run package var inputs = new List <NPath> { Node.Path, packageLockJsonFilePath }; var indexJsNotInModules = toolDir.Files("index.js", true).Where(p => !p.IsChildOf(toolDir.Combine("node_modules"))); inputs.AddRange(indexJsNotInModules); var toolInstallDir = InstallationDirectory.Combine(toolDir.FileName); Backend.Current.AddAction($"package", targetFiles: new[] { toolInstallDir.Combine($"DotsEditorTools-win.exe"), toolInstallDir.Combine($"DotsEditorTools-macos") }, inputs: inputs.ToArray(), executableStringFor: $"cd {toolDir.InQuotes()} && npm run package -- --out-path {toolInstallDir.InQuotes()} --targets win-x64,macos-x64 .", commandLineArguments: Array.Empty <string>(), environmentVariables: env, allowUnwrittenOutputFiles: true); dependencies.Add(toolInstallDir.Combine($"DotsEditorTools-win.exe")); dependencies.Add(toolInstallDir.Combine($"DotsEditorTools-macos")); } else // Not a node tool, just copy files recursively { foreach (var file in toolDir.Files(true)) { if (file.FileName == "extrabeetmpfile") { continue; } var target = file.ToString().Replace(editorToolsSourceDirectory.ToString(), InstallationDirectory.ToString()); CopyTool.Instance().Setup(target, file); dependencies.Add(target); } } } Backend.Current.AddAliasDependency("compile-editor-tools", dependencies.ToArray()); }
public CSharpProgramForCollections(bool forceExe, JObject json, NPath asmDef, bool tinyCorlib) : base(forceExe, json, asmDef, tinyCorlib) { }
static string[] GetBurstCommandLineArgs(BurstCompiler compiler, NPath outputPrefixForObjectFile, NPath outputDirForPatchedAssemblies, string pinvokeName, DotNetAssembly[] inputAssemblies) { var commandLineArguments = new[] { $"--platform={compiler.TargetPlatform}", $"--target={compiler.TargetArchitecture}", $"--mintarget={compiler.MinTargetArch}", $"--format={compiler.ObjectFormat}", compiler.SafetyChecks ? "--safety-checks" : "", $"--dump=\"None\"", compiler.DisableVectors ? "--disable-vectors" : "", compiler.Link ? "" : "--nolink", $"--float-precision={compiler.FloatPrecision}", $"--keep-intermediate-files", compiler.Verbose ? "--verbose" : "", $"--patch-assemblies-into={outputDirForPatchedAssemblies}", $"--output={outputPrefixForObjectFile}", compiler.OnlyStaticMethods ? "--only-static-methods": "", "--method-prefix=burstedmethod_", $"--pinvoke-name={pinvokeName}", $"--execute-method-name={compiler.ExecuteMethodName}", "--debug", compiler.DisableOpt ? "--disable-opt" : "", $"--threads={compiler.Threads}", compiler.EnableGuard ? "--enable-guard" : "" }.Concat(inputAssemblies.Select(asm => $"--root-assembly={asm.Path}")); if (!compiler.UseOwnToolchain) { commandLineArguments = commandLineArguments.Concat(new[] { "--no-native-toolchain" }); } if (!HostPlatform.IsWindows) { commandLineArguments = new[] { BurstExecutable.ToString(SlashMode.Native) } }
public void Setup() { _tempPath = NPath.CreateTempDirectory("NiceIOTest"); }
public void RecursiveParentsStartFromRoot() { var path = new NPath("C:\\"); Assert.That(path.RecursiveParents, Is.EqualTo(new NPath[] {})); }
public void OnPathWithMultipleDots() { var p1 = new NPath("/my/path/file.something.txt"); var p2 = new NPath("/my/path/file.something.mp4").ChangeExtension(".txt"); Assert.AreEqual(p1, p2); }
public TempDir(string prefix) { _path = NPath.CreateTempDirectory(prefix); }
public TestCaseSandbox(TestCase testCase, NPath rootTemporaryDirectory) : this(testCase, rootTemporaryDirectory, string.Empty) { }
public void ParentFromEmpty() { Assert.Throws <InvalidOperationException>(() => { var p = new NPath("/").Parent; }); }
public void WithoutDot() { var p1 = new NPath("/my/path/file.txt"); var p2 = new NPath("/my/path/file.mp4").ChangeExtension("txt"); Assert.AreEqual(p1, p2); }
public static void AddExternalTraceEventFile(NPath traceEventsFile) { s_ExternalTraceEventsFiles.Add(traceEventsFile); }
public void ParentFromEmpty() { Assert.Throws<InvalidOperationException>(() => { var p = new NPath ("/").Parent; }); }
// report is Google Chrome tracing viewer profiling file public static void ConfigureOutput(NPath reportFileName, string processName = "host", int processSortIndex = 0) { s_Filename = reportFileName; s_ProcessName = processName; s_ProcessSortIndex = processSortIndex; }
public void ParentFromFileInDirectory() { var path = new NPath("mydir/myotherdir/myfile.exe").Parent; Assert.AreEqual("mydir/myotherdir", path.ToString(SlashMode.Forward)); }
private static void AddActions(DotsRuntimeCSharpProgramConfiguration dotsConfig, DotNetAssembly[] inputAssemblies, NPath targetDirectory) { var args = new List <string> { targetDirectory.MakeAbsolute().QuoteForProcessStart(), dotsConfig.NativeProgramConfiguration.ToolChain.Architecture.Bits.ToString(), dotsConfig.ScriptingBackend == ScriptingBackend.Dotnet ? "DOTSDotNet" : "DOTSNative", dotsConfig.UseBurst ? "Bursted" : "Unbursted", dotsConfig.Identifier.Contains("release") ? "release" : "debug", // We check for 'release' so we can generate 'debug' info for both debug and develop configs dotsConfig.MultiThreadedJobs ? "Multithreaded" : "Singlethreaded", inputAssemblies.OrderByDependencies().Select(p => p.Path.MakeAbsolute().QuoteForProcessStart()) }.ToArray(); var inputFiles = inputAssemblies.SelectMany(InputPathsFor) .Concat(new[] { _typeRegRunnableProgram.Path }).ToArray(); var targetFiles = inputAssemblies.SelectMany(i => TargetPathsFor(targetDirectory, i)).ToArray(); Backend.Current.AddAction("TypeRegGen", targetFiles, inputFiles, _typeRegRunnableProgram.InvocationString, args, allowedOutputSubstrings: new[] { "Static Type Registry Generation Time:" }); }
public void DeleteRelativePath() { var path = new NPath("mydir/myfile.txt"); Assert.Throws<ArgumentException>(() => path.Delete()); }
public void FromRootedString() { var path = new NPath(@"/mydir/myfile.exe"); Assert.AreEqual("/mydir/myfile.exe", path.ToString(SlashMode.Forward)); }
public void OnlyFileName() { var path = new NPath("myfile.exe"); Assert.AreEqual("myfile.exe", path.ToString()); }
public void FromStringWithMultipleSlashes() { var path = new NPath("///mydir////myfile.txt"); Assert.AreEqual("/mydir/myfile.txt", path.ToString(SlashMode.Forward)); }
public void FromStringWithWindowsDrive() { var path = new NPath(@"C:\mydir\myfile.exe"); Assert.AreEqual("C:/mydir/myfile.exe", path.ToString(SlashMode.Forward)); Assert.IsFalse(path.IsRelative); }
public void ParentFromFile() { var path = new NPath("myfile.exe").Parent; Assert.AreEqual(".", path.ToString()); }
public void WithDotDotInStartOfRelativePath() { var path = new NPath("../../myotherdir/myfile.txt"); Assert.AreEqual("../../myotherdir/myfile.txt", path.ToString(SlashMode.Forward)); }
public IProcessEnvironment CreateProcessEnvironment(NPath root) { var processEnvironment = Substitute.For <IProcessEnvironment>(); return(processEnvironment); }