From e0b599aea9627f1887237618a9eb41694261c9f6 Mon Sep 17 00:00:00 2001 From: Basile Burg Date: Sun, 3 Jul 2022 12:57:00 +0200 Subject: [PATCH] make project, add an option to filter out by ext files located in the sourceDirectories --- CHANGELOG.md | 11 +++++++++++ src/u_makeproject.pas | 30 +++++++++++++++++++++++++++++- 2 files changed, 40 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3f535f66..cfd16dc4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,14 @@ +# v3.9.22-dev + +## Enhancements + +- Make projects, added the _excludedSourceExtensions_ options. It allows to filter out files that are in the + _sourceDirectories_ from the project inspector or from the list of files used to perform project wide searches. + +## Regressions fixed + +- Editor, line clicked when adding a breakpoint unexpectedly vertically centered ( + # v3.9.21 ## Bugs fixed diff --git a/src/u_makeproject.pas b/src/u_makeproject.pas index 96f01cdf..aa54122d 100644 --- a/src/u_makeproject.pas +++ b/src/u_makeproject.pas @@ -16,14 +16,17 @@ TMakeProjectOptionsBase = class(TWritableLfmTextComponent) strict private fNumThreads: integer; fSourceDirectories: TStringList; + fExcludedSourceExtensions: TStringList; fQuiet: boolean; fKeepGoing: boolean; procedure setSourceDirectories(value: TStringList); + procedure setExcludedSourceExtensions(value: TStringList); published property keepGoing: boolean read fKeepGoing write fKeepGoing default false; property quiet: boolean read fQuiet write fQuiet default false; property numThreads: integer read fNumThreads write fNumThreads default 1; property sourceDirectories: TStringList read fSourceDirectories write setSourceDirectories; + property excludedSourceExtensions: TStringList read fExcludedSourceExtensions write setExcludedSourceExtensions; public constructor create(aOwner: TComponent); override; destructor destroy(); override; @@ -152,11 +155,14 @@ begin fNumThreads := 1; fSourceDirectories := TStringList.Create; fSourceDirectories.AddStrings(['src', 'import', 'include']); + fExcludedSourceExtensions := TStringList.Create; + fExcludedSourceExtensions.AddStrings(['.txt', '.md', '.gcov']); end; destructor TMakeProjectOptionsBase.destroy(); begin fSourceDirectories.Free; + fExcludedSourceExtensions.Free; inherited; end; @@ -165,6 +171,11 @@ begin fSourceDirectories.Assign(value); end; +procedure TMakeProjectOptionsBase.setExcludedSourceExtensions(value: TStringList); +begin + fExcludedSourceExtensions.Assign(value); +end; + procedure TMakeProjectOptionsBase.assign(other: TPersistent); var src: TMakeProjectOptionsBase; @@ -173,6 +184,7 @@ begin begin src := TMakeProjectOptionsBase(other); fSourceDirectories.Assign(src.sourceDirectories); + fExcludedSourceExtensions.Assign(src.excludedSourceExtensions); fQuiet:= src.fQuiet; fKeepGoing:= src.fKeepGoing; fNumThreads:= src.fNumThreads; @@ -291,8 +303,11 @@ var hidden: string = DirectorySeparator + '.'; f: string; p: string; + e: string; + s: string; colPos: integer; i: integer; + badExt: boolean; begin fRules.Clear; fRules.add('default'); @@ -330,8 +345,21 @@ begin begin listFiles(srcs, fBasePath + p, true); for f in srcs do + begin if pos(hidden, f) = 0 then - fSrcs.Add(f[fBasePath.length + 1 .. f.length]); + begin + badExt := false; + s := f.extractFileExt(); + for e in makeProjectOptions.excludedSourceExtensions do + if SameText(e, s) then + begin + badExt := true; + break; + end; + if not badExt then + fSrcs.Add(f[fBasePath.length + 1 .. f.length]); + end; + end; srcs.Clear; end; finally