Example #1
0
        public void TestRemoteSpawnCommandOutput()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{BB42A922-ED1B-4837-98D2-189EFAF6BF42}");
            Utils.GenerateSourceFile("input2", "{8B212FA9-5F0D-4D29-A68B-01D87FF04AF4}");

            var builder = Utils.CreateBuilder();
            var command = new InputOutputCommand { Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1", ExecuteRemotely = true };
            command.CommandsToSpawn.Add(new InputOutputCommand { Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input2")), OutputUrl = "/db/url2" });
            CommandBuildStep step = builder.Root.Add(command);
            builder.Run(Builder.Mode.Build);
            builder.WriteIndexFile(false);

            Assert.That(step.SpawnedSteps.Count(), Is.EqualTo(1));

            var indexMap = AssetIndexMap.Load();
            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId outputId;
            bool objectIdFound = indexMap.TryGetValue("/db/url2", out outputId);
            Assert.IsTrue(objectIdFound);
            Assert.That(step.SpawnedSteps.First().Result.OutputObjects[new ObjectUrl(UrlType.Internal, "/db/url2")], Is.EqualTo(outputId));
        }
Example #2
0
        public void TestInputDependencies()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{A7246DF6-3A68-40E2-BA58-6C9A0EFF552B}");
            Utils.GenerateSourceFile("inputDeps", "{8EE7A4BC-88E1-4CC8-B03F-1E6EA8B23955}");

            var builder = Utils.CreateBuilder();
            var inputDep = new ObjectUrl(UrlType.File, Utils.GetSourcePath("inputDeps"));
            var command = new InputOutputCommand { Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1" };
            command.InputDependencies.Add(inputDep);
            CommandBuildStep step = builder.Root.Add(command);
            builder.Run(Builder.Mode.Build);

            var indexMap = AssetIndexMap.Load();
            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId inputDepId;
            bool inputDepFound = step.Result.InputDependencyVersions.TryGetValue(inputDep, out inputDepId);
            Assert.IsTrue(inputDepFound);
        }
Example #3
0
        public void TestSpawnCommandOutput()
        {
            Utils.CleanContext();
            Utils.GenerateSourceFile("input1", "{05D6BCFA-B1FE-4AD1-920F-0352A6DEC02D}");
            Utils.GenerateSourceFile("input2", "{B9D01D6C-4048-4814-A2DF-9D317A492B10}");

            var builder = Utils.CreateBuilder();
            var command = new InputOutputCommand { Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input1")), OutputUrl = "/db/url1" };
            command.CommandsToSpawn.Add(new InputOutputCommand { Delay = 100, Source = new ObjectUrl(UrlType.File, Utils.GetSourcePath("input2")), OutputUrl = "/db/url2" });
            CommandBuildStep step = builder.Root.Add(command);
            builder.Run(Builder.Mode.Build);
            builder.WriteIndexFile(false);

            Assert.That(step.SpawnedSteps.Count(), Is.EqualTo(1));

            var indexMap = AssetIndexMap.Load();
            indexMap.UseTransaction = true;
            indexMap.LoadNewValues();

            ObjectId outputId;
            bool objectIdFound = indexMap.TryGetValue("/db/url2", out outputId);
            Assert.IsTrue(objectIdFound);
            Assert.That(step.SpawnedSteps.First().Result.OutputObjects[new ObjectUrl(UrlType.Internal, "/db/url2")], Is.EqualTo(outputId));
        }