mirror of
https://github.com/datahub-project/datahub.git
synced 2025-06-27 05:03:31 +00:00

Co-authored-by: Hendrik Richert <hendrik.richert@swisscom.com> Co-authored-by: david-leifker <114954101+david-leifker@users.noreply.github.com>
79 lines
2.0 KiB
Groovy
79 lines
2.0 KiB
Groovy
import org.yaml.snakeyaml.Yaml
|
|
|
|
buildscript {
|
|
repositories{
|
|
if (project.hasProperty('apacheMavenRepositoryUrl')) {
|
|
maven { url project.getProperty('apacheMavenRepositoryUrl') }
|
|
} else {
|
|
mavenCentral()
|
|
}
|
|
}
|
|
dependencies {
|
|
classpath("org.yaml:snakeyaml:1.33")
|
|
}
|
|
}
|
|
|
|
plugins {
|
|
id 'base'
|
|
id 'maven-publish'
|
|
}
|
|
apply plugin: 'pegasus'
|
|
|
|
if (project.hasProperty('projVersion')) {
|
|
project.version = project.projVersion
|
|
} else {
|
|
project.version = '0.0.0-dev'
|
|
}
|
|
|
|
|
|
dependencies {
|
|
implementation spec.product.pegasus.data
|
|
// Uncomment these if you want to depend on models defined in core datahub
|
|
//implementation project(':li-utils')
|
|
//dataModel project(':li-utils')
|
|
//implementation project(':metadata-models')
|
|
//dataModel project(':metadata-models')
|
|
|
|
}
|
|
def deployBaseDir = findProperty('pluginModelsDir') ?: file(project.gradle.gradleUserHomeDir.parent + "/.datahub/plugins/models")
|
|
|
|
mainAvroSchemaJar.dependsOn generateAvroSchema
|
|
|
|
pegasus.main.generationModes = [PegasusGenerationMode.PEGASUS, PegasusGenerationMode.AVRO]
|
|
|
|
|
|
task modelArtifact(type: Zip) {
|
|
|
|
from(layout.buildDirectory.dir("libs")) {
|
|
include "*-data-template-*.jar"
|
|
exclude "*-test-data-template-*.jar"
|
|
into "libs"
|
|
}
|
|
from(layout.projectDirectory.dir("registry")) {
|
|
include "*.yml", "*.yaml"
|
|
}
|
|
|
|
destinationDirectory = layout.buildDirectory.dir("dist")
|
|
}
|
|
|
|
modelArtifact.dependsOn compileJava
|
|
|
|
build.dependsOn modelArtifact
|
|
|
|
task modelDeploy(type: Copy) {
|
|
def registryDir = layout.projectDirectory.dir("registry")
|
|
def cfg = new Yaml().load(new File("$registryDir/entity-registry.yaml").newInputStream())
|
|
def outputBaseName = cfg.id ? cfg.id : project.name
|
|
def zipFile = file("build/dist/${project.name}-${version}.zip")
|
|
logger.info("Zip file is $zipFile")
|
|
def outputDir = "$deployBaseDir/${outputBaseName}/$version"
|
|
from zipTree(zipFile)
|
|
into outputDir
|
|
}
|
|
|
|
modelDeploy.dependsOn modelArtifact
|
|
|
|
publish.dependsOn modelDeploy
|
|
|
|
|