Skip to content

Commit

Permalink
Merge pull request #67 from noelmcloughlin/fix3
Browse files Browse the repository at this point in the history
feat(makefile): support custom generator config
  • Loading branch information
sierra-moxon committed May 15, 2023
2 parents 110f17a + 51f2f80 commit 73298df
Show file tree
Hide file tree
Showing 4 changed files with 58 additions and 10 deletions.
9 changes: 3 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,13 +109,10 @@ For more docs, see

### Step 4: Setup the LinkML project

Optionally set project generation environment variables
(see `gen-doc --help` and `gen-project --help`):
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.

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.

```bash
export LINKML_COOKIECUTTER_GEN_DOC_ARGS=--no-mergeimports # example
export LINKML_COOKIECUTTER_GEN_PROJECT_ARGS=--no-mergeimports # example
```

Change to the folder your generated project is in

Expand Down
10 changes: 6 additions & 4 deletions {{cookiecutter.project_name}}/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,16 @@ SHEET_TABS = $(shell ${SHELL} ./utils/get-value.sh google_sheet_tabs)
SHEET_MODULE_PATH = $(SOURCE_SCHEMA_DIR)/$(SHEET_MODULE).yaml

# environment variables
include config.env

GEN_PARGS =
ifdef LINKML_COOKIECUTTER_GEN_PROJECT_ARGS
GEN_PARGS = ${LINKML_COOKIECUTTER_GEN_PROJECT_ARGS}
ifdef LINKML_GENERATORS_PROJECT_ARGS
GEN_PARGS = ${LINKML_GENERATORS_PROJECT_ARGS}
endif

GEN_DARGS =
ifdef LINKML_COOKIECUTTER_GEN_DOC_ARGS
GEN_DARGS = ${LINKML_COOKIECUTTER_GEN_DOC_ARGS}
ifdef LINKML_GENERATORS_MARKDOWN_ARGS
GEN_DARGS = ${LINKML_GENERATORS_MARKDOWN_ARGS}
endif


Expand Down
8 changes: 8 additions & 0 deletions {{cookiecutter.project_name}}/config.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
LINKML_GENERATORS_PROJECT_ARGS=--config-file config.yaml

### Extra layer of configuration for Makefile beyond
### what 'gen-project --config-file config.yaml' provides.
### Uncomment and set environment variables as needed.

# LINKML_GENERATORS_MARKDOWN_ARGS=--no-mergeimports

41 changes: 41 additions & 0 deletions {{cookiecutter.project_name}}/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# Configuration of generators (defaults illustrated)
---
generator_args:
excel:
mergeimports: true
owl:
mergeimports: true
metaclasses: true
type_objects: true
# throws 'Cannot handle metadata profile: rdfs'
# metadata_profile: rdfs
markdown:
mergeimports: true
graphql:
mergeimports: true
java:
mergeimports: true
metadata: true
jsonld:
mergeimports: true
jsonschema:
mergeimports: true
jsonldcontext:
mergeimports: true
python:
mergeimports: true
prefixmap:
mergeimports: true
proto:
mergeimports: true
shacl:
mergeimports: true
shex:
mergeimports: true
sqlddl:
mergeimports: true
typescript:
mergeimports: true
metadata: true

...

0 comments on commit 73298df

Please sign in to comment.