Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
110 commits
Select commit Hold shift + click to select a range
6090822
Bootstrap preparser. Process all packages and merge duplicates. Remov…
Nov 9, 2022
33cb6b1
updated parser function
vishnukavach Nov 11, 2022
d31f649
Add GraphQlSpec Annotation for TSM DM
vishnukavach Nov 14, 2022
76bafd4
Add GraphQlSpec Annotation Parser function
vishnukavach Nov 14, 2022
2db81b0
Makefile changes
vishnukavach Nov 15, 2022
b6ec9d6
Add support of directive @timeseriesAPI and listobj Args
vishnukavach Nov 16, 2022
5c33c94
Added nullable check for listObjects
vishnukavach Nov 18, 2022
d723e4b
Remove global_ prefix from CRDs and graphql
Nov 22, 2022
1a3bd83
Fix plural namer and graphql schema name method
Nov 24, 2022
ff3f7b8
Render non nexus types to single file
Nov 25, 2022
c4cfc0c
Add graphql schema gen for Array
vishnukavach Nov 28, 2022
d7128e2
Move common file to separate directory
Nov 29, 2022
35caa17
NPT-670 idType support and NPT-691 Enum support
vishnukavach Nov 29, 2022
ee937fe
Parse graphql files in datamodel and add them to generated graphql
Nov 29, 2022
d810f00
Add nexus type string support
vishnukavach Nov 30, 2022
ee67b40
Add new line to customQuery schema and modified maketarget
vishnukavach Dec 2, 2022
885d663
Remove global dir if clause from preparser target
Dec 2, 2022
0f284f5
Fix schema field name for nexus-alias-type. Add different types to no…
Dec 7, 2022
0e20f16
NPT-727: Added new annoation for fieldName alias
vishnukavach Dec 8, 2022
c6f65b8
Update TSM gen template
Dec 8, 2022
d5bfef2
Export non nexus types to a single file
Dec 9, 2022
90f8496
alias type for customQuery arg
vishnukavach Dec 13, 2022
2632343
Bootstrap preparser. Process all packages and merge duplicates. Remov…
Nov 9, 2022
b70a8ac
updated parser function
vishnukavach Nov 11, 2022
29b6fbf
Add GraphQlSpec Annotation for TSM DM
vishnukavach Nov 14, 2022
24a6e50
Add GraphQlSpec Annotation Parser function
vishnukavach Nov 14, 2022
905bf6b
Makefile changes
vishnukavach Nov 15, 2022
477d617
Add support of directive @timeseriesAPI and listobj Args
vishnukavach Nov 16, 2022
8652fe0
Added nullable check for listObjects
vishnukavach Nov 18, 2022
7d4389f
Remove global_ prefix from CRDs and graphql
Nov 22, 2022
1264987
Fix plural namer and graphql schema name method
Nov 24, 2022
a980101
Render non nexus types to single file
Nov 25, 2022
3d54bcf
Add graphql schema gen for Array
vishnukavach Nov 28, 2022
6d4f642
Move common file to separate directory
Nov 29, 2022
8308d5e
NPT-670 idType support and NPT-691 Enum support
vishnukavach Nov 29, 2022
01be4f2
Parse graphql files in datamodel and add them to generated graphql
Nov 29, 2022
372b3de
Add nexus type string support
vishnukavach Nov 30, 2022
173d6fb
Add new line to customQuery schema and modified maketarget
vishnukavach Dec 2, 2022
89a55f1
Remove global dir if clause from preparser target
Dec 2, 2022
9e1e01c
Fix schema field name for nexus-alias-type. Add different types to no…
Dec 7, 2022
124b959
NPT-727: Added new annoation for fieldName alias
vishnukavach Dec 8, 2022
7e67527
Update TSM gen template
Dec 8, 2022
434d014
Export non nexus types to a single file
Dec 9, 2022
d6230b4
alias type for customQuery arg
vishnukavach Dec 13, 2022
b8e9712
resolve conflict
vishnukavach Dec 14, 2022
698ce5a
preparser in DM build
vishnukavach Dec 14, 2022
8000c99
Modify tsm grahql generation make target and removed timeseriesdata n…
vishnukavach Dec 14, 2022
718a3a6
Skip outer datamodel node
vishnukavach Dec 16, 2022
bc14534
Ignore nexus vars when generating common file
Dec 22, 2022
86c91d7
Change template name
Dec 22, 2022
874ee8c
Update go.mod
Dec 22, 2022
7b5540a
NPT-752: Fix Nexus graphql generation issue
vishnukavach Dec 23, 2022
21f221f
Update Makefile
Dec 29, 2022
10c66fe
Add support for implicit jsonencoded annotations
Dec 30, 2022
613d5fa
NPT-752: Collect enums from datamodel dir and generate schema
vishnukavach Jan 3, 2023
ee149f5
Fix implicit jsonencoded annotation
Jan 3, 2023
8f709e5
Makefile changes
vishnukavach Jan 4, 2023
d602109
Merge branch 'npt-632' of github.com:vmware-tanzu/graph-framework-for…
vishnukavach Jan 4, 2023
c54793a
Handle external types in preparser
Jan 4, 2023
b1c53ef
Fix preparser
Jan 4, 2023
2921ecb
Merge branch 'main' into npt-632
Jan 4, 2023
cab58d3
Render templates
Jan 4, 2023
3f9c3dc
Fix implicit jsonencoded annotation
Jan 5, 2023
e7399e5
add support for implicit @relation for link fields and add new annota…
Jan 5, 2023
52d6196
Add relation-uuidkey annotation and add implicit annotation for child…
Jan 9, 2023
8ff162d
Add imported pkg name to jsonencoded annotation when it's external
Jan 11, 2023
1690ad6
Add missing commas
Jan 11, 2023
896202d
Disable pkg import in jsonencoded annotation
Jan 12, 2023
ce03c78
Generate external type aliases to model.go
Jan 13, 2023
77919b4
Add protobuf-name and protobuf-file annotation
Jan 16, 2023
9510575
Check for duplicates when adding new alias type
Jan 16, 2023
061ee26
Check for duplicates in preparser (nodes with Spec and List suffix)
Jan 19, 2023
d9ce1de
Add goname to jsonencoded annotation
Jan 23, 2023
d5ae237
copy common pkg into global in preparser to fix deep copy issue
vishnukavach Jan 24, 2023
e3ed1ec
Merge branch 'main' into npt-632
Jan 24, 2023
8620529
Update go.mod
Jan 24, 2023
6bffecc
Copy parents slice before append
Jan 25, 2023
9a12c5d
Fix parents slice
Jan 25, 2023
5575f21
Fix root nodes detection panic
Jan 25, 2023
a736f84
Copy tsm-nexus-gql during dm build
vishnukavach Jan 25, 2023
cddfae3
Copy packages to build/pkgs dir
Jan 26, 2023
67ba9ac
Use normal name for global pkg when generating CRDs
Jan 27, 2023
c420b43
Generate jsonencoded annotation when type-name annotation is not present
Jan 30, 2023
3939cda
Org and Project --> Root and makefile changes
vishnukavach Jan 30, 2023
352e9b1
Merge branch 'npt-632' of github.com:vmware-tanzu/graph-framework-for…
vishnukavach Jan 30, 2023
92d5799
revert skip root and project node from graphql template
vishnukavach Jan 31, 2023
fc82786
Fix imports in model.go
Jan 31, 2023
d4bf065
Fix imports in model.go
Jan 31, 2023
248d916
Add correct annotations for alias type
Feb 2, 2023
ae02a57
Fix alias type
Feb 2, 2023
b899a7a
Render imports and copy packages to model dir
Feb 3, 2023
3387db6
Fix model directory
Feb 3, 2023
515349f
Add PREPARSER_MODPATH env to supply modpath argument in preparser com…
Feb 6, 2023
751b73d
Remove empty directories from build/model dir
Feb 7, 2023
83cf9ce
Add new line at the end of imports file
Feb 8, 2023
f225182
Fix imports template and trim prefix for schemaType instead of replacing
Feb 8, 2023
a787df0
Fix jsonencoded annotation for internal imports and copy all director…
Feb 9, 2023
ed60dcb
Render non nexus types only from global package
Feb 10, 2023
205f5d8
Update Dockerfile
Feb 10, 2023
4e88f7a
Fix problem with schemaType
Feb 10, 2023
f8c288d
Fix GetGroupResourceName method
Feb 16, 2023
cbdf639
remove-camel-case forcing (#120)
vishnukavach Feb 16, 2023
1b8268b
Add node directives
vishnukavach Feb 17, 2023
8fa256c
Add node directives support
vishnukavach Feb 17, 2023
d83b287
Merge branch 'npt-632' of github.com:vmware-tanzu/graph-framework-for…
vishnukavach Feb 17, 2023
3f39f90
remove setup docker - docker available debug
janakiramanmesh7 Feb 17, 2023
cfbc56a
NPT-827: Add syncer status fields in status section of all CRD's impl…
LokeshvarKr Feb 24, 2023
0c0dc6c
debug logs
janakiramanmesh7 Mar 9, 2023
6d60e96
pin utils
janakiramanmesh7 Mar 10, 2023
d4eebb9
pin client-go and x/time
janakiramanmesh7 Mar 10, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 0 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: setup-docker
uses: docker-practice/actions-setup-docker@1.0.11
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
- name: Build Compiler image
Expand Down Expand Up @@ -51,8 +49,6 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: '>=1.17.0'
- name: setup-docker
uses: docker-practice/actions-setup-docker@1.0.11
- name: Test Generate Code and Render templates
run: |
git config --global url."https://github.com/".insteadOf "git@github.com:"
Expand Down
1 change: 1 addition & 0 deletions compiler/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cmd/nexus-openapi-gen
cmd/gqlgen
compiler.tar
_generated
_tsm_temp

### GoLand ###
.idea
Expand Down
2 changes: 1 addition & 1 deletion compiler/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ RUN go mod download
WORKDIR /go/src/github.com/vmware-tanzu/graph-framework-for-microservices/compiler
RUN go mod download

CMD make docker.gitlab_credentials && make generate_code
CMD make docker.gitlab_credentials && make preparser
46 changes: 39 additions & 7 deletions compiler/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ CONFIG_FILE ?= ""
GENERATED_OUTPUT_DIRECTORY ?= generated
COMPILER_SRC_DIRECTORY ?= ""
FORCE ?= false
PREPARSER_MODPATH ?= model

NEXUS_KUBEOPENAPI_VERSION ?= 7416bd4754d3c0dd8b3fa37fff53d36594f11607
NEXUS_GRAPHQLGEN_VERSION ?= 32f028bce22efeb70b47a640195bd969dbb337f0
Expand Down Expand Up @@ -134,11 +135,41 @@ generate_example_in_container:
test_in_container: ${BUILDER_NAME}\:${BUILDER_TAG}.image.exists
$(call run_in_container, make test)

.PHONY: preparser
preparser:
@echo "Nexus Compiler: Start Preparser"
@echo "Cleaning up workdir"
rm -rf _generated
@echo "Copying generated_base_structure to create directory structure"
@echo "COMPILER_SRC_DIRECTORY: ${COMPILER_SRC_DIRECTORY}"
cp -R _generated_base_structure _generated
@echo "Cleaning up temp dir"
rm -rf _tsm_temp
@echo "Copying Datamodel to temp directory"
cp -R ${DATAMODEL_PATH} _tsm_temp
cp -R _generated_base_structure/* ${DATAMODEL_PATH}/build
@echo "Nexus Compiler: Running Preparser"
go run cmd/preparser/main.go -dsl _tsm_temp -output _generated -modpath ${PREPARSER_MODPATH}
@echo "Nexus Compiler: Remove empty directories from model directory"
@find _generated/model -depth -type d -empty -delete

@if [ -d "_tsm_temp/global" ]; then \
cp _tsm_temp/go.mod _tsm_temp/global/go.mod; \
for d in _tsm_temp/*/; do \
if [[ ! "$$d" == "_tsm_temp/global/" && ! "$$d" == "_tsm_temp/build/" ]]; then \
cp -r "$$d" "_tsm_temp/global/"; \
fi; \
done; \
$(MAKE) generate_code DATAMODEL_PATH=_tsm_temp/global; \
else \
$(MAKE) generate_code; \
fi

.PHONY: generate_code
generate_code:
@echo "Nexus Compiler: Running compiler code generation"
@echo "Cleaning up workdir"
rm -rf _generated ${GOPATH}/src/nexustempmodule
rm -rf ${GOPATH}/src/nexustempmodule
@echo "Copying generated_base_structure to create directory structure"
@echo "COMPILER_SRC_DIRECTORY: ${COMPILER_SRC_DIRECTORY}"
cp -R _generated_base_structure _generated
Expand All @@ -158,11 +189,12 @@ generate_code:
@echo "Nexus Compiler: Generating CRD yamls"
go run cmd/generate-openapischema/generate-openapischema.go -yamls-path _generated/crds -existing-CRDs-Path ${GENERATED_OUTPUT_DIRECTORY}/crds -force ${FORCE}
git checkout -- pkg/openapi_generator/openapi/openapi_generated.go
rm -rf ${GENERATED_OUTPUT_DIRECTORY}/{client,apis,crds,common,nexus-client,helper,nexus-gql}
cp -r _generated/{client,apis,crds,common,nexus-client,helper,nexus-gql} ${GENERATED_OUTPUT_DIRECTORY}
rm -rf ${GENERATED_OUTPUT_DIRECTORY}/{client,apis,crds,common,nexus-client,helper,nexus-gql,tsm-nexus-gql,model}
cp -r _generated/{client,apis,crds,common,nexus-client,helper,nexus-gql,tsm-nexus-gql,model} ${GENERATED_OUTPUT_DIRECTORY}
@echo "Nexus Compiler: Generating GRAPHQL PKG"
cd _generated && goimports -w .
cd _generated && mv model/model.go model/model.tmp && goimports -w . && mv model/model.tmp model/model.go
cd _generated/nexus-gql && gqlgen generate
@echo "Nexus Compiler: GRAPHQL Generating completed"
cp -rf _generated/* ${GOPATH}/src/nexustempmodule/
cd ${GOPATH}/src/nexustempmodule && cd nexus-gql && go mod init && \
go mod edit -replace nexustempmodule=${GOPATH}/src/nexustempmodule && \
Expand All @@ -174,10 +206,10 @@ generate_code:
./scripts/replace_mod_path.sh
find . -name "*.bak" -type f -delete
@echo "Sorting imports"
cd _generated && goimports -w .
cd _generated && mv model/model.go model/model.tmp && goimports -w . && mv model/model.tmp model/model.go
@echo "Nexus Compiler: Moving files to output directory"
cp -r _generated/{client,apis,crds,common,nexus-client,helper,nexus-gql} ${GENERATED_OUTPUT_DIRECTORY}
cp -r ${GOPATH}/src/nexustempmodule/nexus-gql/graphql.so ${GENERATED_OUTPUT_DIRECTORY}/nexus-gql
cp -r _generated/{client,apis,crds,common,nexus-client,helper,nexus-gql,tsm-nexus-gql,model} ${GENERATED_OUTPUT_DIRECTORY}
cp -r ${GOPATH}/src/nexustempmodule/nexus-gql/* ${GENERATED_OUTPUT_DIRECTORY}/nexus-gql/
@echo "Nexus Compiler: Compiler code generation completed"

.PHONY: test_generate_code_in_container
Expand Down
Empty file.
Empty file.
2 changes: 1 addition & 1 deletion compiler/builder/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ RUN tdnf -y --refresh install \
make=4.3-2.ph4 \
coreutils=8.32-3.ph4 \
build-essential=0.1-3.ph4 \
openssh-clients=8.8p1-3.ph4 \
openssh-clients \
jq=1.6-2.ph4 \
&& go install github.com/onsi/ginkgo/ginkgo@v1.16.0 \
&& go install github.com/onsi/gomega/...@v1.18.0 \
Expand Down
5 changes: 3 additions & 2 deletions compiler/cmd/nexus-sdk/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,10 +49,11 @@ func main() {
config.ConfigInstance = conf
pkgs := parser.ParseDSLPkg(*dslDir)
graphlqQueries := parser.ParseGraphqlQuerySpecs(pkgs)
graph := parser.ParseDSLNodes(*dslDir, conf.GroupName, pkgs, graphlqQueries)
graph, nonNexusTypes, fileset := parser.ParseDSLNodes(*dslDir, conf.GroupName, pkgs, graphlqQueries)
methods, codes := rest.ParseResponses(pkgs)
graphqlFiles := parser.ParseGraphQLFiles(*dslDir)
if err = generator.RenderCRDTemplate(conf.GroupName, conf.CrdModulePath, pkgs, graph,
*crdDir, methods, codes); err != nil {
*crdDir, methods, codes, nonNexusTypes, fileset, graphqlFiles); err != nil {
log.Fatalf("Error rendering crd template: %v", err)
}
}
39 changes: 39 additions & 0 deletions compiler/cmd/preparser/main.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package main

import (
"flag"

log "github.com/sirupsen/logrus"
"github.com/vmware-tanzu/graph-framework-for-microservices/compiler/pkg/preparser"
)

func main() {
dslDir := flag.String("dsl", "datamodel", "DSL file location.")
outputDir := flag.String("output", "_generated", "output dir location.")
modPath := flag.String("modpath", "datamodel", "ModPath for rendered imports")
logLevel := flag.String("log-level", "ERROR", "Log level")
flag.Parse()

lvl, err := log.ParseLevel(*logLevel)
if err != nil {
log.Fatalf("Failed to configure logging: %v\n", err)
}
log.SetLevel(lvl)

packages := preparser.Parse(*dslDir)
err = preparser.Render(*dslDir, packages)
if err != nil {
log.Fatal(err)
}

err = preparser.CopyPkgsToBuild(*dslDir, *outputDir)
if err != nil {
log.Fatal(err)
}

packages = preparser.Parse(*dslDir)
err = preparser.RenderImports(packages, *outputDir, *modPath)
if err != nil {
log.Fatal(err)
}
}
Loading