|
53 | 53 | # committed). Run `./task generate` explicitly when codegen inputs change. |
54 | 54 | - task: generate-refschema |
55 | 55 | - task: generate-schema |
| 56 | + - task: generate-schema-map |
56 | 57 | - task: generate-schema-docs |
57 | 58 | - task: generate-validation |
58 | 59 | - task: generate-docs |
@@ -706,13 +707,17 @@ tasks: |
706 | 707 | # can be invoked standalone. |
707 | 708 |
|
708 | 709 | generate: |
709 | | - desc: Run all generators (genkit, refschema, schema, docs, validation, direct, pydabs) |
| 710 | + desc: Run all generators (genkit, tf-schema, refschema, schema, docs, validation, direct, pydabs) |
710 | 711 | cmds: |
711 | 712 | # Runs first: regenerates CLI command stubs from the OpenAPI spec at |
712 | 713 | # .codegen/_openapi_sha. SDK version bumps (go.mod/go.sum) are a manual |
713 | 714 | # step outside this task; TestConsistentDatabricksSdkVersion (run inside |
714 | 715 | # generate-genkit) asserts the two stay in sync. |
715 | 716 | - task: generate-genkit |
| 717 | + # Requires Terraform provider access (set TF_CLI_CONFIG_FILE to a |
| 718 | + # filesystem mirror, or rely on the public registry). Only re-runs when |
| 719 | + # bundle/internal/tf/codegen/schema/version.go changes. |
| 720 | + - task: generate-tf-schema |
716 | 721 | # Refreshes acceptance/bundle/refschema/out.fields.txt, which feeds |
717 | 722 | # generate-direct-apitypes and generate-direct-resources below. |
718 | 723 | - task: generate-refschema |
@@ -745,12 +750,20 @@ tasks: |
745 | 750 | sh: echo "${UNIVERSE_DIR:-$HOME/universe}" |
746 | 751 | cmds: |
747 | 752 | - | |
748 | | - echo "Checking out universe at SHA: $(cat .codegen/_openapi_sha)" |
749 | | - cd {{.UNIVERSE_DIR}} |
750 | | - if ! git cat-file -e $(cat {{.ROOT_DIR}}/.codegen/_openapi_sha) 2>/dev/null; then |
751 | | - git fetch --filter=blob:none origin master |
| 753 | + if [ -z "$UNIVERSE_SKIP_CHECKOUT" ]; then |
| 754 | + if ! git -C {{.UNIVERSE_DIR}} diff --quiet || ! git -C {{.UNIVERSE_DIR}} diff --cached --quiet; then |
| 755 | + echo "Error: universe repo at {{.UNIVERSE_DIR}} has uncommitted changes; commit or stash them, or set UNIVERSE_SKIP_CHECKOUT=1 to skip checkout" |
| 756 | + exit 1 |
| 757 | + fi |
| 758 | + echo "Checking out universe at SHA: $(cat .codegen/_openapi_sha)" |
| 759 | + cd {{.UNIVERSE_DIR}} |
| 760 | + if ! git cat-file -e $(cat {{.ROOT_DIR}}/.codegen/_openapi_sha) 2>/dev/null; then |
| 761 | + git fetch --filter=blob:none origin master |
| 762 | + fi |
| 763 | + git checkout $(cat {{.ROOT_DIR}}/.codegen/_openapi_sha) |
| 764 | + else |
| 765 | + echo "UNIVERSE_SKIP_CHECKOUT set; using current {{.UNIVERSE_DIR}} HEAD" |
752 | 766 | fi |
753 | | - git checkout $(cat {{.ROOT_DIR}}/.codegen/_openapi_sha) |
754 | 767 | - echo "Building genkit..." |
755 | 768 | - cd {{.UNIVERSE_DIR}} && bazel build //openapi/genkit |
756 | 769 | - echo "Generating CLI code..." |
@@ -846,6 +859,32 @@ tasks: |
846 | 859 | cmds: |
847 | 860 | - "sh -c 'go run ./bundle/internal/validation/. && gofmt -w -s ./bundle/internal/validation/generated'" |
848 | 861 |
|
| 862 | + generate-schema-map: |
| 863 | + desc: Regenerate bundle/terraform_dabs_map/generated.go |
| 864 | + sources: |
| 865 | + - "**/*.go" |
| 866 | + - exclude: bundle/terraform_dabs_map/generated.go |
| 867 | + - go.mod |
| 868 | + - go.sum |
| 869 | + - "{{.EMBED_SOURCES}}" |
| 870 | + generates: |
| 871 | + - bundle/terraform_dabs_map/generated.go |
| 872 | + cmds: |
| 873 | + - go test ./bundle/terraform_dabs_map -run TestGenerateSchemaMap -update -v |
| 874 | + |
| 875 | + generate-tf-schema: |
| 876 | + desc: Regenerate bundle/internal/tf/schema from the Databricks Terraform provider |
| 877 | + dir: bundle/internal/tf/codegen |
| 878 | + sources: |
| 879 | + - schema/version.go |
| 880 | + - templates/** |
| 881 | + - "**/*.go" |
| 882 | + - exclude: "**/*_test.go" |
| 883 | + generates: |
| 884 | + - ../schema/*.go |
| 885 | + cmds: |
| 886 | + - go run . |
| 887 | + |
849 | 888 | generate-direct: |
850 | 889 | desc: Generate direct engine config (apitypes + resources) |
851 | 890 | deps: ['generate-direct-apitypes', 'generate-direct-resources'] |
|
0 commit comments