Skip to content

Commit

Permalink
[#542] feat(trino-connector): package gravitino trino-connector (#578)
Browse files Browse the repository at this point in the history
### What changes were proposed in this pull request?

- Package `trino-connetor` as
`gravition-trinno-connector-{version}.tar.gz` and put it under
`distribution` directory
- Add docs about `trino-connector` accordingly.

### Why are the changes needed?

We need to package `trino-connector` when releasing `Gravitino` 

Fix: #542 

### Does this PR introduce _any_ user-facing change?

No

### How was this patch tested?

No
  • Loading branch information
yuqi1129 authored Oct 24, 2023
1 parent 38731aa commit d6c6d92
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 6 deletions.
34 changes: 31 additions & 3 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -195,18 +195,30 @@ tasks {
}

val assembleDistribution by registering(Tar::class) {
dependsOn("assembleTrinoConnector")
group = "gravitino distribution"
finalizedBy("checksumDistribution")
into("${rootProject.name}-${version}")
into("${rootProject.name}-${version}-bin")
from(compileDistribution.map { it.outputs.files.single() })
compression = Compression.GZIP
archiveFileName.set("${rootProject.name}-${version}.tar.gz")
archiveFileName.set("${rootProject.name}-${version}-bin.tar.gz")
destinationDirectory.set(projectDir.dir("distribution"))
}

val assembleTrinoConnector by registering(Tar::class) {
dependsOn("trino-connector:copyLibs")
group = "gravitino distribution"
finalizedBy("checksumTrinoConnector")
into("${rootProject.name}-trino-connector-${version}")
from("trino-connector/build/libs")
compression = Compression.GZIP
archiveFileName.set("${rootProject.name}-trino-connector-${version}.tar.gz")
destinationDirectory.set(projectDir.dir("distribution"))
}

register("checksumDistribution") {
group = "gravitino distribution"
dependsOn(assembleDistribution)
dependsOn(assembleDistribution, "checksumTrinoConnector")
val archiveFile = assembleDistribution.flatMap { it.archiveFile }
val checksumFile = archiveFile.map { archive ->
archive.asFile.let { it.resolveSibling("${it.name}.sha256") }
Expand All @@ -220,6 +232,22 @@ tasks {
}
}

register("checksumTrinoConnector") {
group = "gravitino distribution"
dependsOn(assembleTrinoConnector)
val archiveFile = assembleTrinoConnector.flatMap { it.archiveFile }
val checksumFile = archiveFile.map { archive ->
archive.asFile.let { it.resolveSibling("${it.name}.sha256") }
}
inputs.file(archiveFile)
outputs.file(checksumFile)
doLast {
checksumFile.get().writeText(
serviceOf<ChecksumService>().sha256(archiveFile.get().asFile).toString()
)
}
}

val cleanDistribution by registering(Delete::class) {
group = "gravitino distribution"
delete(outputDir)
Expand Down
20 changes: 17 additions & 3 deletions docs/how-to-build.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,20 @@ This software is licensed under the Apache License version 2."
```shell
./gradlew assembleDistribution
```
The `assembleDistribution` command will create `gravitino-{version}-bin.tar` and `gravitino-{version}-bin.tar.sha256` files in the `distribution/package` directory.
You can deploy the `gravitino-{version}-bin.tar` file to your production environment.
> Note: The `gravitino-{version}-bin.tar` file is the Gravitino Server distribution package, and the `gravitino-{version}-bin.tar.sha256` file is the sha256 checksum file for the Gravitino Server distribution package.
The `assembleDistribution` command will create `gravitino-{version}-bin.tar.gz` and `gravitino-{version}-bin.tar.gz.sha256` under the `distribution` directory.

You can deploy them to your production environment.

> Note: The `gravitino-{version}-bin.tar.gz` file is the Gravitino Server distribution package, and the `gravitino-{version}-bin.tar.gz.sha256` file is the sha256 checksum file for the Gravitino Server distribution package.

7. Assemble Gravitino trino connector package

```shell
./gradlew assembleTrinoConnector
```
or
```shell
./gradlew assembleDistribution
```

It will create `gravitino-trino-connector-{version}.tar.gz` and `gravitino-trino-connector-{version}.tar.gz.sha256` under the `distribution` directory.
6 changes: 6 additions & 0 deletions trino-connector/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -50,4 +50,10 @@ tasks {
jar {
finalizedBy(copyDepends)
}

val copyLibs by registering(Copy::class) {
dependsOn(copyDepends, "build")
from("build/libs")
into("${rootDir}/distribution/${rootProject.name}-trino-connector")
}
}

0 comments on commit d6c6d92

Please sign in to comment.