예제 #1
0
 // Add a range of source files to compile
 public static void AddSourceFiles(string[] sourceFiles)
 {
     foreach (string src in sourceFiles)
     {
         SourceFiles.Add(OutputDirectory + src);
     }
 }
예제 #2
0
 // Add sources files for platform specific Dear ImGui backend (OS/Renderer support)
 public void AddImguiBackendSources()
 {
     SourceFiles.Add(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath) + @"\backends\imgui_impl_dx11.h");
     SourceFiles.Add(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath) + @"\backends\imgui_impl_dx11.cpp");
     SourceFiles.Add(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath) + @"\backends\imgui_impl_win32.h");
     SourceFiles.Add(NetImguiTarget.GetPath(ProjectImgui.sDefaultPath) + @"\backends\imgui_impl_win32.cpp");
 }
예제 #3
0
 public Catch2()
 {
     Name           = "Catch2";
     SourceRootPath = "[project.BasePath]/single_include";
     SourceFilesBlobExcludeRegex.Add("[project.BasePath]/include/*");
     SourceFiles.Add("[project.BasePath]/single_include/catch2/catch.hpp");
 }
예제 #4
0
        private void btnBrowse_Click(object sender, EventArgs e)
        {
            FolderBrowserDialog fwd = new FolderBrowserDialog();

            fwd.RootFolder = Environment.SpecialFolder.MyComputer;
            if (fwd.ShowDialog() == DialogResult.OK)
            {
                clbCppFilesList.Items.Clear();
                string[] fileNames  = Directory.GetFiles(fwd.SelectedPath).Where(x => x.EndsWith(".cpp") || x.EndsWith(".h")).ToArray();
                int      filesCount = 0;
                int      totalFiles = fileNames.Length;
                foreach (string f in fileNames)
                {
                    FileObject fo = new FileObject();
                    fo.fileName      = Path.GetFileName(f);
                    fo.fileExtension = Path.GetExtension(fo.fileName);
                    fo.filePath      = f;
                    fo.cppCode       = File.ReadAllText(f);
                    fo.srcML         = GenerateSrcMl(f);
                    clbCppFilesList.Items.Add(fo);
                    SourceFiles.Add(fo);

                    filesCount++;
                    lbl_SrcMLFiles.Text = $"Source Files ({filesCount}/{totalFiles})";
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Adds a file to this project, ignoring dupes
        /// </summary>
        /// <param name="FilePath">Path to the file on disk</param>
        /// <param name="RelativeBaseFolder">The directory the path within the project will be relative to</param>
        public void AddFileToProject(string FilePath, string RelativeBaseFolder)
        {
            // Don't add duplicates
            SourceFile ExistingFile = null;

            if (SourceFileMap.TryGetValue(FilePath, out ExistingFile))
            {
                if (ExistingFile.RelativeBaseFolder != RelativeBaseFolder)
                {
                    if ((ExistingFile.RelativeBaseFolder != null) != (RelativeBaseFolder != null) ||
                        !ExistingFile.RelativeBaseFolder.Equals(RelativeBaseFolder, StringComparison.InvariantCultureIgnoreCase))
                    {
                        throw new BuildException("Trying to add file '" + FilePath + "' to project '" + ProjectFilePath + "' when the file already exists, but with a different relative base folder '" + RelativeBaseFolder + "' is different than the current file's '" + ExistingFile.RelativeBaseFolder + "'!");
                    }
                    else
                    {
                        throw new BuildException("Trying to add file '" + FilePath + "' to project '" + ProjectFilePath + "' when the file already exists, but the specified project relative base folder is different than the current file's!");
                    }
                }
            }
            else
            {
                SourceFile File = AllocSourceFile(FilePath, RelativeBaseFolder);
                if (File != null)
                {
                    SourceFileMap[FilePath] = File;
                    SourceFiles.Add(File);
                }
            }
        }
예제 #6
0
        internal void MergeFromFile(string fileName)
        {
            if (!File.Exists(fileName))
            {
                return;
            }

            MutationTestingReport otherReport;

            using (var streamReader = File.OpenText(fileName))
            {
                otherReport = (MutationTestingReport) new XmlSerializer(typeof(MutationTestingReport)).Deserialize(streamReader);
            }

            foreach (var sourceFile in otherReport.SourceFiles)
            {
                if (SourceFiles.All(s => s.Url != sourceFile.Url))
                {
                    SourceFiles.Add(sourceFile);
                }
                else
                {
                    SourceFiles.First(s => s.Url == sourceFile.Url).MergeFrom(sourceFile);
                }
            }
        }
예제 #7
0
        void Parse(XElement element, string filterBase, string prepend)
        {
            foreach (var child in element.Elements())
            {
                if (child.Name == "Filter")
                {
                    string filter = (string.IsNullOrEmpty(filterBase) ? "" : filterBase + "\\") + (string)child.Attribute("Name");
                    Filters.Add(filter, "");

                    Parse(child, filter, prepend);
                }
                else
                {
                    string path      = Path.Combine(prepend, (string)child.Attribute("RelativePath"));
                    string extension = Path.GetExtension(path);

                    if (extension == ".h")
                    {
                        IncludeFiles.Add(path, filterBase);
                    }
                    else if (extension == ".cpp")
                    {
                        SourceFiles.Add(path, filterBase);
                    }
                    else if (extension == ".resx")
                    {
                        ResourceFiles.Add(path, filterBase);
                    }
                    else
                    {
                        OtherFiles.Add(path, filterBase);
                    }
                }
            }
        }
예제 #8
0
        internal void RegisterMethod(MethodDefinition method)
        {
            if (method.Body.Instructions.All(i => i.SequencePoint == null))
            {
                return;
            }
            string sourceFileUrl =
                method.Body.Instructions.First(i => i.SequencePoint != null).SequencePoint.Document.Url;

            _readerWriterLock.EnterUpgradeableReadLock();
            try
            {
                if (SourceFiles.All(s => s.Url != sourceFileUrl))
                {
                    _readerWriterLock.EnterWriteLock();
                    var newSourceFile = new SourceFile();
                    newSourceFile.SetUrl(sourceFileUrl);
                    SourceFiles.Add(newSourceFile);
                    _readerWriterLock.ExitWriteLock();
                }
            }
            finally
            {
                _readerWriterLock.ExitUpgradeableReadLock();
            }
            var sourceFile     = SourceFiles.First(s => s.Url == sourceFileUrl);
            var sequencePoints = method.Body.Instructions
                                 .Where(i => i.SequencePoint != null && i.ShouldReportSequencePoint())
                                 .Select(i => i.SequencePoint).Distinct();

            foreach (var point in sequencePoints)
            {
                sourceFile.AddSequencePoint(point);
            }
        }
예제 #9
0
        internal void AddResult(Mono.Cecil.Cil.SequencePoint sequencePoint, MutantMetaData mutantMetaData, bool mutantKilled)
        {
            if (sequencePoint == null || sequencePoint.Document == null)
            {
                return;
            }
            _mutantsCount++;
            _mutantsKilledCount += (mutantKilled ? 1 : 0);
            string sourceFileUrl = sequencePoint.Document.Url;

            _readerWriterLock.EnterUpgradeableReadLock();
            try
            {
                if (SourceFiles.All(s => s.Url != sourceFileUrl))
                {
                    _readerWriterLock.EnterWriteLock();
                    var newSourceFile = new SourceFile();
                    newSourceFile.SetUrl(sourceFileUrl);
                    SourceFiles.Add(newSourceFile);
                    _readerWriterLock.ExitWriteLock();
                }
            }
            finally
            {
                _readerWriterLock.ExitUpgradeableReadLock();
            }
            var sourceFile = SourceFiles.First(s => s.Url == sourceFileUrl);

            sourceFile.AddResult(sequencePoint, mutantMetaData, mutantKilled);
        }
예제 #10
0
        public DemoProject()
        {
            Name           = "DearWidgetsDemo";
            SourceRootPath = RootPath + @"\src\demo";

            SourceFiles.Add("[project.ExternPath]/glad/src/glad.c");
            SourceFiles.Add("[project.ExternPath]/imgui/imgui.cpp");
            SourceFiles.Add("[project.ExternPath]/imgui/imgui_tables.cpp");
            SourceFiles.Add("[project.ExternPath]/imgui/imgui_widgets.cpp");
            SourceFiles.Add("[project.ExternPath]/imgui/misc/cpp/imgui_stdlib.cpp");
            SourceFiles.Add("[project.ExternPath]/imgui/imgui_draw.cpp");

            // Mains
            SourceFiles.Add(@"[project.RootPath]/src/demo/main_dx11.cpp");
            SourceFiles.Add(@"[project.RootPath]/src/demo/main_dx12.cpp");

            // Backend
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_win32.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_win32.cpp");

            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_dx11.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_dx11.cpp");

            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_dx12.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_dx12.cpp");

            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_opengl3.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_opengl3.cpp");

            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_vulkan.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_vulkan.cpp");

            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_wgpu.h");
            SourceFiles.Add("[project.ExternPath]/imgui/backends/imgui_impl_wgpu.cpp");
        }
예제 #11
0
        public SourceFile CreateNewFile(string fileName)
        {
            SourceFile sourceFile = new SourceFile(Path.GetFileName(fileName));

            SourceFiles.Add(sourceFile);
            return(sourceFile);
        }
예제 #12
0
파일: JobInfo.cs 프로젝트: playkk/clawPDF
        private void ReadInf(string infFile, TitleReplacer titleReplacer)
        {
            InfFile = infFile;
            var infData = Data.CreateDataStorage();
            var ini     = new IniStorage(Helper.EncodingHelper.GetEncoding(infFile));

            ini.SetData(infData);
            ini.ReadData(infFile);

            foreach (var section in infData.GetSections())
            {
                var sfi = SourceFileInfo.ReadSourceFileInfo(infFile, infData, section);
                if (sfi != null)
                {
                    SourceFiles.Add(sfi);
                }
            }

            Metadata = new Metadata();

            if (SourceFiles.Count > 0)
            {
                Metadata.PrintJobAuthor = SourceFiles[0].Author;
                Metadata.PrintJobName   = titleReplacer.Replace(SourceFiles[0].DocumentTitle);
                Metadata.Title          = ""; //Set to avoid null exception when replacing tokens
                Metadata.Author         = "";

                JobType = SourceFiles[0].Type;
            }
        }
예제 #13
0
        /// <summary>
        /// Adds a file to this project, ignoring dupes
        /// </summary>
        /// <param name="FilePath">Path to the file on disk</param>
        /// <param name="BaseFolder">The directory the path within the project will be relative to</param>
        public void AddFileToProject(FileReference FilePath, DirectoryReference BaseFolder)
        {
            // Check if hasn't already been added as an aliased file
            if (AliasedFilesSet.Contains(FilePath))
            {
                return;
            }

            // Don't add duplicates
            SourceFile ExistingFile = null;

            if (SourceFileMap.TryGetValue(FilePath, out ExistingFile))
            {
                if (ExistingFile.BaseFolder != BaseFolder)
                {
                    throw new BuildException("Trying to add file '" + FilePath + "' to project '" + ProjectFilePath + "' when the file already exists, but with a different relative base folder '" + BaseFolder + "' is different than the current file's '" + ExistingFile.BaseFolder + "'!");
                }
            }
            else
            {
                SourceFile File = AllocSourceFile(FilePath, BaseFolder);
                if (File != null)
                {
                    SourceFileMap[FilePath] = File;
                    SourceFiles.Add(File);
                }
            }
        }
예제 #14
0
파일: Assembler.cs 프로젝트: twglhk/Mirage
 // Add a range of source files to compile
 public static void AddSourceFiles(string[] sourceFiles)
 {
     foreach (string src in sourceFiles)
     {
         SourceFiles.Add(Path.Combine(OutputDirectory, src));
     }
 }
예제 #15
0
 public ProjectNetImgui(string version)
     : base(false)
 {
     mVersion       = version;
     Name           = "netImguiLib (" + version + ")";
     SourceRootPath = @"[project.SharpmakeCsPath]\..\Code\Client";
     SourceFiles.Add(@"[project.SharpmakeCsPath]\..\Code\ThirdParty\" + SolutionAll.sDefaultImguiVersion + @"\imgui.h");
 }
예제 #16
0
 /// <summary>
 /// Adds the source files.
 /// </summary>
 /// <param name="files">The files.</param>
 public void AddSourceFiles(IEnumerable <string> files)
 {
     foreach (string file in files)
     {
         SourceFile sourceFile = new SourceFile(file);
         SourceFiles.Add(sourceFile);
     }
 }
예제 #17
0
 public ProjectNetImgui(string imguiFullPath)
     : base(false)
 {
     mVersion       = Path.GetFileName(imguiFullPath);
     mImguiPath     = imguiFullPath;
     Name           = "NetImguiLib (" + mVersion + ")";
     SourceRootPath = NetImguiTarget.GetPath(@"\Code\Client");
     SourceFiles.Add(mImguiPath + @"\imgui.h");
 }
예제 #18
0
 public SpanMultipleSrcDirs()
 {
     SourceRootPath = @"[project.RootPath]\codebase\SpanMultipleSrcDirs\main_dir";
     AdditionalSourceRootPaths.Add(@"[project.RootPath]\codebase\SpanMultipleSrcDirs\additional_dir");
     SourceFiles.Add(
         @"..\dir_individual_files\floating_class.cpp",
         @"..\dir_individual_files\floating_class.h",
         @"..\dir_individual_files\floating_file.cpp"
         );
 }
예제 #19
0
        /// <summary>
        /// Adds new files to the current list of input files.
        /// </summary>
        /// <param name="fileNames"></param>
        public void AddSourceFiles(IEnumerable <string> fileNames)
        {
            var sourceFiles = fileNames.Select(f => new SourceFile(f));

            foreach (var sf in sourceFiles)
            {
                SourceFiles.Add(sf);
            }

            SourceFilesChanged = true;
        }
예제 #20
0
        public void AddFile(string path)
        {
            SourceFile file = new SourceFile(path);

            if (SourceFiles.Contains(file))
            {
                return;
            }

            SourceFiles.Add(file);
        }
예제 #21
0
        /// <summary>
        /// Adds all the values to the <see cref="SourceFiles"/> collection property and
        /// returns this command instance.
        /// </summary>
        /// <param name="values">
        /// An array of values to add to the <see cref="SourceFiles"/> collection property.
        /// </param>
        /// <returns>
        /// This command instance.
        /// </returns>
        /// <remarks>
        /// This method is part of the fluent interface.
        /// </remarks>
        public T WithSourceFiles(params string[] values)
        {
            if (values != null)
            {
                foreach (string value in values)
                {
                    SourceFiles.Add(value);
                }
            }

            return((T)this);
        }
        public override void Do()
        {
            SourceFiles.Clear();
            foreach (var dir in SourceDirectories)
            {
                foreach (var file in FileSystemCommands.DirectoryGetFiles(dir))
                {
                    SourceFiles.Add(file);
                }
            }

            base.Do();
        }
예제 #23
0
파일: JobInfo.cs 프로젝트: playkk/clawPDF
        /// <summary>
        ///     Merge this JobInfo with another
        /// </summary>
        /// <param name="jobInfo">The JobInfo to merge with. Its source files will be added at the end of the source file list</param>
        public void Merge(IJobInfo jobInfo)
        {
            if (jobInfo.JobType != JobType)
            {
                return;
            }

            foreach (var sourceFile in jobInfo.SourceFiles)
            {
                SourceFiles.Add(sourceFile);
            }

            jobInfo.Delete(false);
        }
예제 #24
0
        public TextWriter CreateCodeFile(BuildProvider buildProvider)
        {
            if (buildProvider == null)
            {
                throw new ArgumentNullException("buildProvider");
            }

            // Generate a file name with the correct source language extension
            string filename = GetTempFilePhysicalPath(provider.FileExtension);

            SourceFiles.Add(filename);
            AddPathToBuilderMap(filename, buildProvider);
            return(new StreamWriter(File.OpenWrite(filename)));
        }
예제 #25
0
    public GTestProject()
    {
        Name           = "GTest";
        SourceRootPath = @"[project.SharpmakeCsPath]";

        SourceFilesExcludeRegex.Add(
            Regex.Escape(
                ResolveString(@"[project.SourceRootPath]\src\gtest\src")));
        SourceFilesExcludeRegex.Add(
            Regex.Escape(
                ResolveString(@"[project.SourceRootPath]\src\gmock\src")));

        SourceFiles.Add(@"[project.SourceRootPath]\src\gtest\gtest-all.cc");
        SourceFiles.Add(@"[project.SourceRootPath]\src\gmock\gmock-all.cc");
    }
예제 #26
0
 private void ExtractSourceFiles(IReadOnlyCollection <ClInclude> itemGroup)
 {
     if (itemGroup != null && itemGroup.Count > 0)
     {
         foreach (var compile in itemGroup)
         {
             if (string.IsNullOrWhiteSpace(compile.Include))
             {
                 continue;
             }
             var path = ProcessPath(compile.Include);
             SourceFiles.Add(new ProjectFile(path, ResourceType.SourceFile, this));
         }
     }
 }
예제 #27
0
 //This methods adds a single source file to the source file list that will be compiled when the compile methods is called.
 //In order to successfully add a file, it must exist.
 public bool AddSourceFile(string file)
 {
     if (File.Exists(file))
     {
         if (SourceFiles.Contains(file))
         {
             SourceFiles.Remove(file);
         }
         SourceFiles.Add(file);
         return(true);
     }
     else
     {
         return(false);
     }
 }
예제 #28
0
        public CustomBuildStepProject()
        {
            Name           = "CustomBuildStep";
            SourceRootPath = @"[project.SharpmakeCsPath]\codebase";
            SourceFilesExtensions.Add(".bat");

            // need to add it explicitly since it's gonna be generated it doesn't exist yet
            SourceFiles.Add(@"[project.SourceRootPath]\main.cpp");

            AddTargets(
                new Target(
                    Platform.win64,
                    DevEnv.vs2017,
                    Optimization.Debug | Optimization.Release,
                    OutputType.Lib,
                    Blob.NoBlob,
                    BuildSystem.MSBuild | BuildSystem.FastBuild
                    )
                );
        }
예제 #29
0
        public void Merge(SourceFileCollection other)
        {
            foreach (var sourceFile in other.SourceFiles)
            {
                var inContent = SourceFiles.Any(e => string.Equals(e, sourceFile, StringComparison.InvariantCultureIgnoreCase));
                if (!inContent)
                {
                    SourceFiles.Add(sourceFile);
                }
            }

            foreach (var destFile in other.DestFiles)
            {
                var inContent = DestFiles.Any(e => string.Equals(e, destFile, StringComparison.InvariantCultureIgnoreCase));
                if (!inContent)
                {
                    DestFiles.Add(destFile);
                }
            }
        }
예제 #30
0
        public virtual IProjectBase Add([NotNull] string absoluteFileName)
        {
            if (Locking == Locking.ReadOnly)
            {
                throw new InvalidOperationException("Project is locked");
            }

            if (string.IsNullOrEmpty(ProjectDirectory))
            {
                throw new InvalidOperationException(Texts.Project_has_not_been_loaded__Call_Load___first);
            }

            var sourceFile = Factory.SourceFile(absoluteFileName);

            lock (_sourceFilesSyncObject)
            {
                SourceFiles.Add(absoluteFileName.ToUpperInvariant(), sourceFile);
            }

            Parse(sourceFile);

            return(this);
        }
예제 #31
0
파일: Parser.cs 프로젝트: davetayls/rivet
        private SourceFiles ParseSourceFilesInternal(IEnumerable<SourceFile> sourceFiles, ParserOptions parserOptions)
        {
            IEnumerable<SourceFile> rivetFiles = sourceFiles.Where(IsRivetFile);
            var outputFiles = new SourceFiles();

            foreach (var markedFile in rivetFiles)
            {
                var outputFile = ParseSourceFile(markedFile, sourceFiles, parserOptions);
                outputFiles.Add(outputFile);
            }

            return outputFiles;
        }