Skip to content

Commit 53df515

Browse files
authored
Merge branch 'master' into peter/column-level-lineage
2 parents 98ac163 + 679d4cb commit 53df515

File tree

13 files changed

+205
-146
lines changed

13 files changed

+205
-146
lines changed

build.gradle

+42-8
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
1+
import org.apache.tools.ant.filters.ReplaceTokens
2+
3+
14
buildscript {
25
ext.jdkVersionDefault = 17
36
ext.javaClassVersionDefault = 11
@@ -396,25 +399,56 @@ configure(subprojects.findAll {! it.name.startsWith('spark-lineage')}) {
396399
}
397400
}
398401

402+
apply plugin: 'com.gorylenko.gradle-git-properties'
403+
gitProperties {
404+
keys = ['git.commit.id','git.commit.id.describe','git.commit.time']
405+
// using any tags (not limited to annotated tags) for "git.commit.id.describe" property
406+
// see http://ajoberstar.org/grgit/grgit-describe.html for more info about the describe method and available parameters
407+
// 'it' is an instance of org.ajoberstar.grgit.Grgit
408+
customProperty 'git.commit.id.describe', { it.describe(tags: true) }
409+
gitPropertiesResourceDir = rootProject.buildDir
410+
failOnNoGitDirectory = false
411+
}
412+
413+
def gitPropertiesGenerated = false
414+
415+
apply from: 'gradle/versioning/versioning-global.gradle'
416+
417+
tasks.register("generateGitPropertiesGlobal", com.gorylenko.GenerateGitPropertiesTask) {
418+
doFirst {
419+
if (!gitPropertiesGenerated) {
420+
println "Generating git.properties"
421+
gitPropertiesGenerated = true
422+
} else {
423+
// Skip actual execution if already run
424+
onlyIf { false }
425+
}
426+
}
427+
}
428+
399429
subprojects {
400430

401431
apply plugin: 'maven-publish'
402-
apply plugin: 'com.gorylenko.gradle-git-properties'
403432
apply plugin: 'com.diffplug.spotless'
404433

405-
gitProperties {
406-
keys = ['git.commit.id','git.commit.id.describe','git.commit.time']
407-
// using any tags (not limited to annotated tags) for "git.commit.id.describe" property
408-
// see http://ajoberstar.org/grgit/grgit-describe.html for more info about the describe method and available parameters
409-
// 'it' is an instance of org.ajoberstar.grgit.Grgit
410-
customProperty 'git.commit.id.describe', { it.describe(tags: true) }
411-
failOnNoGitDirectory = false
434+
def gitPropertiesTask = tasks.register("copyGitProperties", Copy) {
435+
dependsOn rootProject.tasks.named("generateGitPropertiesGlobal")
436+
def sourceFile = file("${rootProject.buildDir}/git.properties")
437+
from sourceFile
438+
into "$project.buildDir/resources/main"
412439
}
413440

414441
plugins.withType(JavaPlugin).configureEach {
442+
project.tasks.named(JavaPlugin.CLASSES_TASK_NAME).configure{
443+
dependsOn gitPropertiesTask
444+
}
415445
if (project.name == 'datahub-web-react') {
416446
return
417447
}
448+
/* TODO: evaluate ignoring jar timestamps for increased caching (compares checksum instead)
449+
jar {
450+
preserveFileTimestamps = false
451+
}*/
418452

419453
dependencies {
420454
implementation externalDependency.annotationApi

datahub-web-react/build.gradle

+1-2
Original file line numberDiff line numberDiff line change
@@ -111,14 +111,13 @@ task yarnBuild(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate]) {
111111
outputs.dir('dist')
112112
}
113113

114-
task cleanExtraDirs {
114+
clean {
115115
delete 'node_modules/.yarn-integrity'
116116
delete 'dist'
117117
delete 'tmp'
118118
delete 'just'
119119
delete fileTree(dir: 'src', include: '*.generated.ts')
120120
}
121-
clean.finalizedBy(cleanExtraDirs)
122121

123122
configurations {
124123
assets

docs/automations/ai-docs.md

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@ With AI-powered documentation, you can automatically generate documentation for
1818

1919
## Configuring
2020

21-
No configuration is required - just hit "Generate" on any table or column in the UI.
21+
Ensure you have edit dataset description privileges.
22+
23+
Once permissions are obtained, no configuration is required - just hit "Generate" on any table or column in the UI.
2224

2325
## How it works
2426

+101
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,101 @@
1+
/**
2+
Applies a consistent versioning scheme to all projects using this script
3+
4+
Uses git tags to mint versions by default.
5+
git tags can be of a few forms:
6+
- short sha (typical for a PR or a commit) (e.g. 38960ae)
7+
- versioned tags (typical for a release) (e.g. v0.8.45, v0.8.45.1, v0.8.45rc1, v0.8.45.1rc4)
8+
9+
Produces the following variables and supports token replacement
10+
- version: server version amenable for creating jars
11+
- fullVersion: full version string
12+
- cliMajorVersion: cli version amenable for binding to server as a default
13+
0.8.44 or 0.8.44-1 (for clean tags) or 0.8.45-SNAPSHOT (for unclean repositories)
14+
15+
All inference can be overridden by passing in the releaseVersion property
16+
e.g. -PreleaseVersion=0.2.3.4 will set the jar version to 0.2.3-4
17+
18+
**/
19+
20+
import groovy.json.JsonBuilder
21+
22+
def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
23+
def cliMajorVersion = "0.15.0" // base default cli major version
24+
def snapshotVersion = false
25+
def javaVersion = ""
26+
27+
if (project.hasProperty("releaseVersion")) {
28+
version = releaseVersion
29+
detailedVersionString = releaseVersion
30+
} else {
31+
try {
32+
// apply this plugin in a try-catch block so that we can handle cases without .git directory
33+
apply plugin: "com.palantir.git-version"
34+
def details = versionDetails()
35+
detailedVersionString = gitVersion()
36+
version = details.lastTag
37+
version = version.startsWith("v")? version.substring(1): version
38+
def suffix = details.isCleanTag? "": "-SNAPSHOT"
39+
snapshotVersion = ! details.isCleanTag
40+
}
41+
catch (Exception e) {
42+
e.printStackTrace()
43+
// last fall back
44+
version = detailedVersionString
45+
}
46+
}
47+
48+
// trim version if it is of size 4 to size 3
49+
def versionParts = version.tokenize(".")
50+
cliMajorVersion = version
51+
if (versionParts.size() > 3) {
52+
// at-least 4 part version
53+
// we check if the 4th part is a .0 in which case we want to create a release
54+
if ((versionParts.size() == 4) && (versionParts[3] == '0')) {
55+
versionParts = versionParts[0..2]
56+
}
57+
version = versionParts[0..2].join('.')
58+
if (versionParts.size() > 3) {
59+
version = version + "-" + versionParts[3..versionParts.size()-1].join('-')
60+
}
61+
}
62+
63+
if (snapshotVersion) {
64+
if (versionParts[versionParts.size()-1].isInteger()) {
65+
def base_version = versionParts[0..versionParts.size()-2].join('.')
66+
version = base_version + '.' + (versionParts[versionParts.size()-1].toInteger()+1).toString() + "-SNAPSHOT"
67+
cliMajorVersion = base_version + "." + versionParts[versionParts.size()-1]
68+
} else {
69+
// we are unable to part the last token as an integer, so we just append SNAPSHOT to this version
70+
version = versionParts[0..versionParts.size()-1].join('.') + '-SNAPSHOT'
71+
cliMajorVersion = versionParts[0..versionParts.size()-1].join('.')
72+
}
73+
74+
// differences from metadata-integration/java/versioning.gradle
75+
if (versionParts[versionParts.size()-1].isInteger()) {
76+
javaVersion = versionParts[0..versionParts.size()-2].join('.') + '.' + (versionParts[versionParts.size()-1].toInteger()+1).toString() + "-SNAPSHOT"
77+
} else {
78+
// we are unable to part the last token as an integer, so we just append SNAPSHOT to this version
79+
javaVersion = versionParts[0..versionParts.size()-1].join('.') + '-SNAPSHOT'
80+
}
81+
}
82+
83+
// Note: No task, we want this executed during config phase, once for rootProject.
84+
def data = [
85+
fullVersion: detailedVersionString,
86+
cliMajorVersion: cliMajorVersion,
87+
version: version,
88+
javaVersion: javaVersion
89+
]
90+
91+
// Convert to JSON
92+
def jsonBuilder = new JsonBuilder(data)
93+
def outputFile = file("${rootProject.buildDir}/version.json")
94+
95+
// Ensure buildDir exists
96+
rootProject.buildDir.mkdirs()
97+
98+
// Write to file
99+
outputFile.text = jsonBuilder.toPrettyString()
100+
101+
println "git.properties JSON data written to ${outputFile}"

gradle/versioning/versioning.gradle

+18-68
Original file line numberDiff line numberDiff line change
@@ -1,83 +1,33 @@
1-
/**
2-
Applies a consistent versioning scheme to all projects using this script
3-
4-
Uses git tags to mint versions by default.
5-
git tags can be of a few forms:
6-
- short sha (typical for a PR or a commit) (e.g. 38960ae)
7-
- versioned tags (typical for a release) (e.g. v0.8.45, v0.8.45.1, v0.8.45rc1, v0.8.45.1rc4)
8-
9-
Produces the following variables and supports token replacement
10-
- version: server version amenable for creating jars
11-
- fullVersion: full version string
12-
- cliMajorVersion: cli version amenable for binding to server as a default
13-
0.8.44 or 0.8.44-1 (for clean tags) or 0.8.45-SNAPSHOT (for unclean repositories)
14-
15-
All inference can be overridden by passing in the releaseVersion property
16-
e.g. -PreleaseVersion=0.2.3.4 will set the jar version to 0.2.3-4
17-
18-
**/
19-
20-
1+
import groovy.json.JsonSlurper
212
import org.apache.tools.ant.filters.ReplaceTokens
223

4+
235
def detailedVersionString = "0.0.0-unknown-SNAPSHOT"
246
def cliMajorVersion = "0.15.0" // base default cli major version
25-
def snapshotVersion = false
26-
if (project.hasProperty("releaseVersion")) {
27-
version = releaseVersion
28-
detailedVersionString = releaseVersion
29-
} else {
30-
try {
31-
// apply this plugin in a try-catch block so that we can handle cases without .git directory
32-
apply plugin: "com.palantir.git-version"
33-
def details = versionDetails()
34-
detailedVersionString = gitVersion()
35-
version = details.lastTag
36-
version = version.startsWith("v")? version.substring(1): version
37-
def suffix = details.isCleanTag? "": "-SNAPSHOT"
38-
snapshotVersion = ! details.isCleanTag
39-
}
40-
catch (Exception e) {
41-
e.printStackTrace()
42-
// last fall back
43-
version = detailedVersionString
44-
}
45-
}
467

47-
// trim version if it is of size 4 to size 3
48-
def versionParts = version.tokenize(".")
49-
cliMajorVersion = version
50-
if (versionParts.size() > 3) {
51-
// at-least 4 part version
52-
// we check if the 4th part is a .0 in which case we want to create a release
53-
if ((versionParts.size() == 4) && (versionParts[3] == '0')) {
54-
versionParts = versionParts[0..2]
55-
}
56-
version = versionParts[0..2].join('.')
57-
if (versionParts.size() > 3) {
58-
version = version + "-" + versionParts[3..versionParts.size()-1].join('-')
8+
def inputFile = file("${rootProject.buildDir}/version.json")
9+
10+
task readJsonData {
11+
if (inputFile.exists()) {
12+
def jsonSlurper = new JsonSlurper()
13+
def data = jsonSlurper.parse(inputFile)
14+
15+
detailedVersionString = data.fullVersion
16+
cliMajorVersion = data.cliMajorVersion
17+
version = data.version
18+
} else {
19+
println "git.properties JSON file not found: ${inputFile.path}"
5920
}
6021
}
6122

62-
if (snapshotVersion) {
63-
if (versionParts[versionParts.size()-1].isInteger()) {
64-
def base_version = versionParts[0..versionParts.size()-2].join('.')
65-
version = base_version + '.' + (versionParts[versionParts.size()-1].toInteger()+1).toString() + "-SNAPSHOT"
66-
cliMajorVersion = base_version + "." + versionParts[versionParts.size()-1]
67-
} else {
68-
// we are unable to part the last token as an integer, so we just append SNAPSHOT to this version
69-
version = versionParts[0..versionParts.size()-1].join('.') + '-SNAPSHOT'
70-
cliMajorVersion = versionParts[0..versionParts.size()-1].join('.')
71-
}
23+
task printVersionDetails() {
24+
println("fullVersion=" + detailedVersionString)
25+
println("cliMajorVersion=" + cliMajorVersion)
26+
println("version=" + version)
7227
}
7328

7429
processResources {
7530
filter(ReplaceTokens, tokens:[fullVersion: detailedVersionString])
7631
filter(ReplaceTokens, tokens:[cliMajorVersion: cliMajorVersion])
7732
}
7833

79-
task printVersionDetails() {
80-
println("fullVersion=" + detailedVersionString)
81-
println("cliMajorVersion=" + cliMajorVersion)
82-
println("version=" + version)
83-
}

metadata-events/mxe-schemas/build.gradle

+9-7
Original file line numberDiff line numberDiff line change
@@ -19,19 +19,21 @@ generateDataTemplate.dependsOn copyMetadataModels
1919
mainCopySchemas.dependsOn copyMetadataModels
2020
pegasus.main.generationModes = [PegasusGenerationMode.PEGASUS, PegasusGenerationMode.AVRO]
2121

22-
task copyOriginalAvsc(type: Copy, dependsOn: generateAvroSchema) {
22+
task renameNamespace(type: Copy, dependsOn: generateAvroSchema) {
2323
from("src/mainGeneratedAvroSchema/avro")
2424
into file("src/renamed/avro")
25-
}
2625

27-
task renameNamespace(type: Exec, dependsOn: copyOriginalAvsc) {
28-
commandLine 'bash', './rename-namespace.sh'
26+
doLast {
27+
project.exec {
28+
commandLine 'bash', './rename-namespace.sh'
29+
}
30+
}
2931
}
3032

3133
build.dependsOn renameNamespace
3234

3335
clean {
34-
project.delete('src/main/pegasus')
35-
project.delete('src/mainGeneratedAvroSchema/avro')
36-
project.delete('src/renamed/avro')
36+
delete 'src/main/pegasus'
37+
delete 'src/mainGeneratedAvroSchema/avro'
38+
delete 'src/renamed/avro'
3739
}

metadata-events/mxe-utils-avro/build.gradle

+1-1
Original file line numberDiff line numberDiff line change
@@ -36,5 +36,5 @@ compileJava.dependsOn copyOriginalMXESchemas
3636
processResources.dependsOn copyOriginalMXESchemas
3737

3838
clean {
39-
project.delete("src/main/resources/avro")
39+
delete "src/main/resources/avro"
4040
}

0 commit comments

Comments
 (0)