Skip to content

Commit

Permalink
Integrate with auto-release toolchain (#118)
Browse files Browse the repository at this point in the history
- Added `.codegen/changelog.md.tmpl`
- Added `version` and `toolchain` configurations to `.codegen.json`
  • Loading branch information
nfx authored Jul 17, 2023
1 parent 6ef5698 commit cde0a0e
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 0 deletions.
9 changes: 9 additions & 0 deletions .codegen.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,14 @@
"batch": {
".codegen/workspace.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/WorkspaceClient.java",
".codegen/account.java.tmpl": "databricks-sdk-java/src/main/java/com/databricks/sdk/AccountClient.java"
},
"version": {
"pom.xml": "<artifactId>databricks-sdk-parent</artifactId>\n <version>$VERSION</version>",
"databricks-sdk-java/pom.xml": "<artifactId>databricks-sdk-parent</artifactId>\n <version>$VERSION</version>",
"databricks-sdk-java/src/main/java/com/databricks/sdk/core/UserAgent.java": "private static final String version = \"$VERSION\";"
},
"toolchain": {
"require": ["mvn", "java"],
"post_generate": ["mvn --errors clean test"]
}
}
56 changes: 56 additions & 0 deletions .codegen/changelog.md.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
# Version changelog

## {{.Version}}

{{range .Changes -}}
* {{.}}.
{{end}}{{- if .ApiChanges}}
API Changes:
{{range .ApiChanges}}
* {{.Action}} {{template "what" .}}{{if .Extra}} {{.Extra}}{{with .Other}} {{template "what" .}}{{end}}{{end}}.
{{- end}}

OpenAPI SHA: {{.Sha}}, Date: {{.Changed}}
{{- end}}
{{if .DependencyUpdates}}
Dependency updates:
{{range .DependencyUpdates}}
* {{.}}.
{{- end -}}
{{end}}

## {{.PrevVersion}}

{{- define "what" -}}
{{if eq .X "package" -}}
`com.databricks.sdk.service.{{.Package.Name}}` package
{{- else if eq .X "service" -}}
{{template "service" .Service}}
{{- else if eq .X "method" -}}
`{{.Method.CamelName}}()` method for {{template "service" .Method.Service}}
{{- else if eq .X "entity" -}}
{{template "entity" .Entity}} class
{{- else if eq .X "field" -}}
`{{.Field.CamelName}}` field for {{template "entity" .Field.Of}}
{{- end}}
{{- end -}}

{{- define "service" -}}
`{{if .IsAccounts}}accountClient{{else}}workspaceClient{{end}}.{{(.TrimPrefix "account").CamelName}}()` service
{{- end -}}

{{- define "entity" -}}
{{- if not . }}any /* ERROR */
{{- else if .IsEmpty}}`Object`
{{- else if .PascalName}}`com.databricks.sdk.service.{{.Package.Name}}.{{.PascalName}}`
{{- else if .IsAny}}`Object`
{{- else if .IsString}}`String`
{{- else if .IsBool}}`Boolean`
{{- else if .IsInt64}}`Integer`
{{- else if .IsFloat64}}`Float`
{{- else if .IsInt}}`Integer`
{{- else if .ArrayValue }}List<{{template "entity" .ArrayValue}}>
{{- else if .MapValue }}Map<String,{{template "entity" .MapValue}}>
{{- else}}`com.databricks.sdk.service.{{.Package.Name}}.{{.PascalName}}`
{{- end -}}
{{- end -}}
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Version changelog

## 0.1.1

* Usable version

0 comments on commit cde0a0e

Please sign in to comment.