Skip to content

Commit 73298df

Browse files
authored
Merge pull request #67 from noelmcloughlin/fix3
feat(makefile): support custom generator config
2 parents 110f17a + 51f2f80 commit 73298df

File tree

4 files changed

+58
-10
lines changed

4 files changed

+58
-10
lines changed

README.md

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -109,13 +109,10 @@ For more docs, see
109109

110110
### Step 4: Setup the LinkML project
111111

112-
Optionally set project generation environment variables
113-
(see `gen-doc --help` and `gen-project --help`):
112+
Optionally, pass custom configuration to linkml generators by tuning the global configuration file 'config.yaml' with preferred options. An example file is supplied by the project to illustrate interface and defaults.
113+
114+
Additionally, pass command-line arguments to linkml generators inside the Makefile via environment variables in 'config.env' file. An example file is supplied by the project, passing '--config-file config.yaml' to gen-project.
114115

115-
```bash
116-
export LINKML_COOKIECUTTER_GEN_DOC_ARGS=--no-mergeimports # example
117-
export LINKML_COOKIECUTTER_GEN_PROJECT_ARGS=--no-mergeimports # example
118-
```
119116

120117
Change to the folder your generated project is in
121118

{{cookiecutter.project_name}}/Makefile

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,16 @@ SHEET_TABS = $(shell ${SHELL} ./utils/get-value.sh google_sheet_tabs)
2222
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml
2323

2424
# environment variables
25+
include config.env
26+
2527
GEN_PARGS =
26-
ifdef LINKML_COOKIECUTTER_GEN_PROJECT_ARGS
27-
GEN_PARGS = ${LINKML_COOKIECUTTER_GEN_PROJECT_ARGS}
28+
ifdef LINKML_GENERATORS_PROJECT_ARGS
29+
GEN_PARGS = ${LINKML_GENERATORS_PROJECT_ARGS}
2830
endif
2931

3032
GEN_DARGS =
31-
ifdef LINKML_COOKIECUTTER_GEN_DOC_ARGS
32-
GEN_DARGS = ${LINKML_COOKIECUTTER_GEN_DOC_ARGS}
33+
ifdef LINKML_GENERATORS_MARKDOWN_ARGS
34+
GEN_DARGS = ${LINKML_GENERATORS_MARKDOWN_ARGS}
3335
endif
3436

3537

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
LINKML_GENERATORS_PROJECT_ARGS=--config-file config.yaml
2+
3+
### Extra layer of configuration for Makefile beyond
4+
### what 'gen-project --config-file config.yaml' provides.
5+
### Uncomment and set environment variables as needed.
6+
7+
# LINKML_GENERATORS_MARKDOWN_ARGS=--no-mergeimports
8+
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# Configuration of generators (defaults illustrated)
2+
---
3+
generator_args:
4+
excel:
5+
mergeimports: true
6+
owl:
7+
mergeimports: true
8+
metaclasses: true
9+
type_objects: true
10+
# throws 'Cannot handle metadata profile: rdfs'
11+
# metadata_profile: rdfs
12+
markdown:
13+
mergeimports: true
14+
graphql:
15+
mergeimports: true
16+
java:
17+
mergeimports: true
18+
metadata: true
19+
jsonld:
20+
mergeimports: true
21+
jsonschema:
22+
mergeimports: true
23+
jsonldcontext:
24+
mergeimports: true
25+
python:
26+
mergeimports: true
27+
prefixmap:
28+
mergeimports: true
29+
proto:
30+
mergeimports: true
31+
shacl:
32+
mergeimports: true
33+
shex:
34+
mergeimports: true
35+
sqlddl:
36+
mergeimports: true
37+
typescript:
38+
mergeimports: true
39+
metadata: true
40+
41+
...

0 commit comments

Comments
 (0)