Implement #7 - [n.sourcefile] section, add nimclipboard

This commit is contained in:
Ganesh Viswanathan 2018-07-13 00:19:50 -05:00
commit e46d3b2332
4 changed files with 21 additions and 10 deletions

View file

@ -46,6 +46,8 @@ To see examples of nimgen in action check out the following wrappers:-
* git sparse checkout
* [nimbigwig](https://github.com/genotrance/nimbigwig) - libbigWig wrapper: [docs](http://nimgen.genotrance.com/nimbigwig)
* git checkout
* [nimclipboard](https://github.com/genotrance/nimclipboard) - libclipboard wrapper: [docs](http://nimgen.genotrance.com/nimclipboard)
* git checkout
* [nimfuzz](https://github.com/genotrance/nimfuzz) - fts_fuzzy_match wrapper: [docs](http://nimgen.genotrance.com/nimfuzz)
* download header file
* [nimkerberos](https://github.com/genotrance/nimkerberos) - WinKerberos wrapper: [docs](http://nimgen.genotrance.com/nimkerberos)
@ -134,6 +136,10 @@ File wildcards such as *.nim, ssl*.h, etc. can be used to perform tasks across a
```wildcard``` = pattern to match against. All keys following the wildcard declaration will apply to matched files
_[n.sourcefile]_
This section allows selection of multiple sourcefiles without requiring a detailed section for each file. Each specific file can be listed one line at a time and file wildcards can be used to include multiple source files. E.g. `$output/include/*/h`. `[n.wildcard]` definitions can be used to perform common operations on these source files if required.
_[sourcefile]_
The following keys apply to library source code and help with generating the .nim files. -win, -lin and -osx can be used for OS specific tasks. E.g. dynlib-win, pragma-win

View file

@ -61,6 +61,8 @@ for:
on_finish:
- 7z a -r buildlogs-win.zip %USERPROFILE%\.nimble\pkgs
- appveyor PushArtifact buildlogs-win.zip
- 7z a -r nimgen-docs.zip %BASE_DIR%\nimgen\web
- appveyor PushArtifact nimgen-docs.zip
cache:
- c:\projects\i686-8.1.0-release-posix-dwarf-rt_v6-rev0.7z

View file

@ -19,15 +19,15 @@ proc getKey(ukey: string): tuple[key: string, val: bool] =
return (kv[0], false)
proc runFile*(file: string, cfgin: OrderedTableRef) =
proc runFile*(file: string, cfgin: OrderedTableRef = newOrderedTable[string, string]()) =
var
cfg = cfgin
sfile = search(file)
for pattern in gWildcards.keys():
var match: RegexMatch
var m: RegexMatch
let pat = pattern.replace(".", "\\.").replace("*", ".*").replace("?", ".?")
if file.find(toPattern(pat), match):
if file.find(toPattern(pat), m):
echo "Appending " & file & " " & pattern
for key in gWildcards[pattern].keys():
cfg[key & "." & pattern] = gWildcards[pattern][key]
@ -224,7 +224,12 @@ proc runCfg*(cfg: string) =
"n.prepare", "n.wildcard", "n.post"]:
continue
runFile(file, gConfig[file])
if file == "n.sourcefile":
for pattern in gConfig["n.sourcefile"].keys():
for file in walkFiles(pattern.addEnv):
runFile(file)
else:
runFile(file, gConfig[file])
if gConfig.hasKey("n.post"):
for post in gConfig["n.post"].keys():

View file

@ -1,11 +1,9 @@
import distros
import ospaths
import strutils
import distros, ospaths, strutils
var
full = false
comps = @["libsvm", "nim7z", "nimarchive", "nimbass", "nimbigwig", "nimfuzz",
"nimpcre", "nimrax", "nimssl", "nimssh2"]
full = true
comps = @["libsvm", "nim7z", "nimarchive", "nimbass", "nimbigwig", "nimclipboard",
"nimfuzz", "nimpcre", "nimrax", "nimssl", "nimssh2"]
if detectOs(Windows):
comps.add("nimkerberos")