コード例 #1
0
        public void Create()
        {
            ClearIfExists(IntDir);

            var sourceFile = $@"{CurrentDirectory}\Tests\New Folder\New Text Document.c";
            var objFile    = $@"{CurrentDirectory}\{IntDir}\New Folder\t1.c.o";
            var depFile    = $@"{CurrentDirectory}\{IntDir}\New Folder\t1.c.d";
            var wasmFile   = $@"{CurrentDirectory}\{IntDir}\New Folder\t 1 2.wasm";
            var trackerDir = $@"{CurrentDirectory}\{IntDir}\";

            if (!Directory.Exists(trackerDir))
            {
                Directory.CreateDirectory(trackerDir);
            }

            var be = new EmptyBuildEngine();

            var task = new EmCxx {
                BuildEngine            = be,
                TrackerLogDirectory    = trackerDir,
                ObjectFileName         = objFile,
                DependencyFileName     = depFile,
                GenerateDependencyFile = true,
                Sources = new ITaskItem[] { new TaskItem(sourceFile) },
            };

            for (int i = 0; i < 3; i++)
            {
                Assert.IsTrue(task.Execute());
            }

            var link = new EmLink {
                BuildEngine         = be,
                TrackerLogDirectory = trackerDir,
                OutputFile          = new TaskItem(wasmFile),
                Sources             = new ITaskItem[] { new TaskItem(task.ObjectFileName) },
            };

            Assert.IsTrue(link.Execute());
        }
コード例 #2
0
        private EmCxx[] SetupExecutable(EmptyBuildEngine engine)
        {
            var resultTasks = new List <EmCxx>();

            if (!Directory.Exists(TLogDirectory))
            {
                Directory.CreateDirectory(TLogDirectory);
            }

            var file1 = new EmCxx {
                BuildEngine            = engine,
                TrackerLogDirectory    = TLogDirectory,
                ObjectFileName         = $@"{CurrentDirectory}\{IntDir}\Main1.cpp.o",
                DependencyFileName     = $@"{CurrentDirectory}\{IntDir}\Main1.cpp.d",
                GenerateDependencyFile = true,
                Sources = new ITaskItem[] {
                    new TaskItem($@"{CurrentDirectory}\Tests\MultiDependencyRebuild\Main1.cpp"),
                },
            };

            resultTasks.Add(file1);

            var file2 = new EmCxx {
                BuildEngine            = engine,
                TrackerLogDirectory    = TLogDirectory,
                ObjectFileName         = $@"{CurrentDirectory}\{IntDir}\Main.cpp.o",
                DependencyFileName     = $@"{CurrentDirectory}\{IntDir}\Main.cpp.d",
                GenerateDependencyFile = true,
                Sources = new ITaskItem[] {
                    new TaskItem($@"{CurrentDirectory}\Tests\MultiDependencyRebuild\Main.cpp"),
                },
            };

            resultTasks.Add(file2);

            return(resultTasks.ToArray());
        }
コード例 #3
0
        private EmCxx[] SetupStaticLibrary(EmptyBuildEngine engine)
        {
            var resultTasks = new List <EmCxx>();

            if (!Directory.Exists(TLogDirectory))
            {
                Directory.CreateDirectory(TLogDirectory);
            }

            // The source is modified during The test so,
            // make temporary copies

            File.Copy($@"{CurrentDirectory}\Tests\MultiDependencyRebuild\Input1.cpp",
                      $@"{CurrentDirectory}\{IntDir}\Input1.cpp");
            File.Copy($@"{CurrentDirectory}\Tests\MultiDependencyRebuild\Input2.cpp",
                      $@"{CurrentDirectory}\{IntDir}\Input2.cpp");
            File.Copy($@"{CurrentDirectory}\Tests\MultiDependencyRebuild\Input3.cpp",
                      $@"{CurrentDirectory}\{IntDir}\Input3.cpp");

            var file1 = new EmCxx {
                BuildEngine                  = engine,
                TrackerLogDirectory          = TLogDirectory,
                AdditionalIncludeDirectories = $@"{CurrentDirectory}\Tests\MultiDependencyRebuild\",
                ObjectFileName               = $@"{CurrentDirectory}\{IntDir}\Input1.cpp.o",
                DependencyFileName           = $@"{CurrentDirectory}\{IntDir}\Input1.cpp.d",
                GenerateDependencyFile       = true,
                Sources = new ITaskItem[] {
                    new TaskItem($@"{CurrentDirectory}\{IntDir}\Input1.cpp"),
                },
            };

            resultTasks.Add(file1);

            var file2 = new EmCxx {
                BuildEngine = engine,
                AdditionalIncludeDirectories = $@"{CurrentDirectory}\Tests\MultiDependencyRebuild\",
                TrackerLogDirectory          = TLogDirectory,
                ObjectFileName         = $@"{CurrentDirectory}\{IntDir}\Input2.cpp.o",
                DependencyFileName     = $@"{CurrentDirectory}\{IntDir}\Input2.cpp.d",
                GenerateDependencyFile = true,
                Sources = new ITaskItem[] {
                    new TaskItem($@"{CurrentDirectory}\{IntDir}\Input2.cpp"),
                },
            };

            resultTasks.Add(file2);

            var file3 = new EmCxx {
                BuildEngine                  = engine,
                TrackerLogDirectory          = TLogDirectory,
                AdditionalIncludeDirectories = $@"{CurrentDirectory}\Tests\MultiDependencyRebuild\",
                ObjectFileName               = $@"{CurrentDirectory}\{IntDir}\Input3.cpp.o",
                DependencyFileName           = $@"{CurrentDirectory}\{IntDir}\Input3.cpp.d",
                GenerateDependencyFile       = true,
                Sources = new ITaskItem[] {
                    new TaskItem($@"{CurrentDirectory}\{IntDir}\Input3.cpp"),
                },
            };

            resultTasks.Add(file3);

            return(resultTasks.ToArray());
        }