예제 #1
0
파일: Equality.cs 프로젝트: liszto/NiceIO
 public void OneRootedOneNonRooted()
 {
     var path1 = new NPath(@"\mydir\myfile");
     var path2 = new NPath(@"mydir\myfile");
     Assert.IsFalse(path1.Equals(path2));
     Assert.IsFalse(path1 == path2);
 }
예제 #2
0
파일: Equality.cs 프로젝트: liszto/NiceIO
 public void OneWithTrailingSlash()
 {
     var path1 = new NPath(@"mydir/mydir2");
     var path2 = new NPath(@"mydir/mydir2/");
     Assert.IsTrue(path1.Equals(path2));
     Assert.IsTrue(path1 == path2);
 }
예제 #3
0
        public void Test()
        {
            var p1 = new NPath("/b/c");
            var p2 = new NPath("c/d");

            Assert.AreNotEqual(p1.GetHashCode(), p2.GetHashCode());
        }
예제 #4
0
파일: Equality.cs 프로젝트: liszto/NiceIO
 public void InFolderButDifferentSlashes()
 {
     var path1 = new NPath(@"mydir/myfile");
     var path2 = new NPath(@"mydir\myfile");
     Assert.IsTrue(path1.Equals(path2));
     Assert.IsTrue(path1 == path2);
 }
예제 #5
0
파일: Equality.cs 프로젝트: liszto/NiceIO
 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);
 }
예제 #6
0
파일: Equality.cs 프로젝트: liszto/NiceIO
 public void SingleFile()
 {
     var path1 = new NPath("myfile");
     var path2 = new NPath("myfile");
     Assert.IsTrue(path1.Equals(path2));
     Assert.IsTrue(path1 == path2);
 }
예제 #7
0
 public void FromStringWithTrailingSlash()
 {
     var path = new NPath("/mydir/myotherdir/");
     Assert.AreEqual("/mydir/myotherdir", path.ToString(SlashMode.Forward));
     Assert.AreEqual("myotherdir", path.FileName);
 }
예제 #8
0
 public void FromStringWithForwardSlash()
 {
     var path = new NPath("mydir/myfile.exe");
     Assert.AreEqual("mydir/myfile.exe", path.ToString(SlashMode.Forward));
 }
예제 #9
0
파일: RelativeTo.cs 프로젝트: liszto/NiceIO
 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);
 }
예제 #10
0
파일: Parent.cs 프로젝트: liszto/NiceIO
 public void ParentFromFileInRoot()
 {
     var path = new NPath("/myfile.exe").Parent;
     Assert.AreEqual("/", path.ToString(SlashMode.Forward));
 }
예제 #11
0
파일: Parent.cs 프로젝트: liszto/NiceIO
 public void ParentFromFile()
 {
     var path = new NPath("myfile.exe").Parent;
     Assert.AreEqual("", path.ToString());
 }
예제 #12
0
파일: Parent.cs 프로젝트: shana/NiceIO
        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 }));
        }
예제 #13
0
 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());
    }
예제 #16
0
 public CSharpProgramForCollections(bool forceExe, JObject json, NPath asmDef, bool tinyCorlib) : base(forceExe, json, asmDef, tinyCorlib)
 {
 }
예제 #17
0
    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) }
        }
예제 #18
0
		public void Setup()
		{
			_tempPath = NPath.CreateTempDirectory("NiceIOTest");
		}
예제 #19
0
파일: Parent.cs 프로젝트: shana/NiceIO
        public void RecursiveParentsStartFromRoot()
        {
            var path = new NPath("C:\\");

            Assert.That(path.RecursiveParents, Is.EqualTo(new NPath[] {}));
        }
예제 #20
0
파일: Parent.cs 프로젝트: shana/NiceIO
        public void ParentFromFileInRoot()
        {
            var path = new NPath("/myfile.exe").Parent;

            Assert.AreEqual("/", path.ToString(SlashMode.Forward));
        }
예제 #21
0
 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);
 }
예제 #22
0
파일: TempDir.cs 프로젝트: liszto/NiceIO
 public TempDir(string prefix)
 {
     _path = NPath.CreateTempDirectory(prefix);
 }
예제 #23
0
 public TestCaseSandbox(TestCase testCase, NPath rootTemporaryDirectory)
     : this(testCase, rootTemporaryDirectory, string.Empty)
 {
 }
예제 #24
0
파일: Parent.cs 프로젝트: shana/NiceIO
 public void ParentFromEmpty()
 {
     Assert.Throws <InvalidOperationException>(() => { var p = new NPath("/").Parent; });
 }
예제 #25
0
 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);
 }
예제 #26
0
 public static void AddExternalTraceEventFile(NPath traceEventsFile)
 {
     s_ExternalTraceEventsFiles.Add(traceEventsFile);
 }
예제 #27
0
파일: Parent.cs 프로젝트: liszto/NiceIO
 public void ParentFromEmpty()
 {
     Assert.Throws<InvalidOperationException>(() => { var p = new NPath ("/").Parent; });
 }
예제 #28
0
 // 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;
 }
예제 #29
0
파일: Parent.cs 프로젝트: liszto/NiceIO
 public void ParentFromFileInDirectory()
 {
     var path = new NPath("mydir/myotherdir/myfile.exe").Parent;
     Assert.AreEqual("mydir/myotherdir", path.ToString(SlashMode.Forward));
 }
예제 #30
0
    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:" });
    }
예제 #31
0
파일: Delete.cs 프로젝트: liszto/NiceIO
 public void DeleteRelativePath()
 {
     var path = new NPath("mydir/myfile.txt");
     Assert.Throws<ArgumentException>(() => path.Delete());
 }
예제 #32
0
 public void Setup()
 {
     _tempPath = NPath.CreateTempDirectory("NiceIOTest");
 }
예제 #33
0
 public void FromRootedString()
 {
     var path = new NPath(@"/mydir/myfile.exe");
     Assert.AreEqual("/mydir/myfile.exe", path.ToString(SlashMode.Forward));
 }
예제 #34
0
 public void OnlyFileName()
 {
     var path = new NPath("myfile.exe");
     Assert.AreEqual("myfile.exe", path.ToString());
 }
예제 #35
0
 public void FromStringWithMultipleSlashes()
 {
     var path = new NPath("///mydir////myfile.txt");
     Assert.AreEqual("/mydir/myfile.txt", path.ToString(SlashMode.Forward));
 }
예제 #36
0
파일: Parent.cs 프로젝트: shana/NiceIO
        public void ParentFromFileInDirectory()
        {
            var path = new NPath("mydir/myotherdir/myfile.exe").Parent;

            Assert.AreEqual("mydir/myotherdir", path.ToString(SlashMode.Forward));
        }
예제 #37
0
 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);
 }
예제 #38
0
파일: Parent.cs 프로젝트: shana/NiceIO
        public void ParentFromFile()
        {
            var path = new NPath("myfile.exe").Parent;

            Assert.AreEqual(".", path.ToString());
        }
예제 #39
0
 public void WithDotDotInStartOfRelativePath()
 {
     var path = new NPath("../../myotherdir/myfile.txt");
     Assert.AreEqual("../../myotherdir/myfile.txt", path.ToString(SlashMode.Forward));
 }
예제 #40
0
        public IProcessEnvironment CreateProcessEnvironment(NPath root)
        {
            var processEnvironment = Substitute.For <IProcessEnvironment>();

            return(processEnvironment);
        }