mirror of
https://github.com/datahub-project/datahub.git
synced 2025-07-15 05:04:45 +00:00

* fix(docs): fix sidebar titles for clarity * re-arrange docs to make Intro to Metadata ingestion easier for beginners * minor changes for readability * add heading * docs: add note for common question
124 lines
3.2 KiB
Groovy
124 lines
3.2 KiB
Groovy
apply plugin: 'distribution'
|
|
apply plugin: 'com.github.node-gradle.node'
|
|
|
|
node {
|
|
|
|
// If true, it will download node using above parameters.
|
|
// If false, it will try to use globally installed node.
|
|
if (project.hasProperty('useSystemNode') && project.getProperty('useSystemNode').toBoolean()) {
|
|
download = false
|
|
} else {
|
|
download = true
|
|
}
|
|
|
|
// Version of node to use.
|
|
version = '16.8.0'
|
|
|
|
// Version of Yarn to use.
|
|
yarnVersion = '1.22.0'
|
|
|
|
// Base URL for fetching node distributions (change if you have a mirror).
|
|
distBaseUrl = 'https://nodejs.org/dist'
|
|
|
|
// Set the work directory for unpacking node
|
|
workDir = file("${project.projectDir}/.gradle/nodejs")
|
|
|
|
// Set the work directory for NPM
|
|
yarnWorkDir = file("${project.projectDir}/.gradle/yarn")
|
|
|
|
// Set the work directory where node_modules should be located
|
|
nodeModulesDir = file("${project.projectDir}")
|
|
|
|
}
|
|
/*
|
|
Re-trigger build if any markdown files change anywhere in the project
|
|
*/
|
|
def projectMdFiles = project.fileTree("${project.projectDir}") {
|
|
include '**/*.md'
|
|
include '**/*.js'
|
|
include '**/*.ts'
|
|
exclude 'node_modules'
|
|
exclude '**/dist/**'
|
|
}
|
|
|
|
// Combine GraphQL schemas for documentation.
|
|
task generateGraphQLSchema(type: Exec) {
|
|
workingDir "$projectDir/graphql"
|
|
commandLine './generateGraphQLSchema.sh'
|
|
}
|
|
|
|
/*
|
|
Wrappers around Yarn Tasks.
|
|
*/
|
|
task yarnInstall(type: YarnTask) {
|
|
logger.info('CI = "{}"', System.env.CI)
|
|
if (System.env.CI != null && System.env.CI == "true") {
|
|
args = ['install','--frozen-lockfile']
|
|
} else {
|
|
args = ['install']
|
|
}
|
|
}
|
|
|
|
task generateGraphQLDocumentation(type: YarnTask, dependsOn: [yarnInstall, generateGraphQLSchema] ) {
|
|
args = ['docusaurus', 'docs:generate:graphql']
|
|
}
|
|
|
|
task yarnGenerate(type: YarnTask, dependsOn: [yarnInstall, generateGraphQLDocumentation] ) {
|
|
inputs.files(projectMdFiles)
|
|
outputs.cacheIf { true }
|
|
args = ['run', 'generate']
|
|
}
|
|
|
|
task yarnServe(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate]) {
|
|
args = ['run', 'start']
|
|
}
|
|
|
|
task yarnLint(type: YarnTask, dependsOn: [yarnInstall]) {
|
|
inputs.files(projectMdFiles)
|
|
args = ['run', 'lint-check']
|
|
outputs.dir("dist")
|
|
// tell gradle to apply the build cache
|
|
outputs.cacheIf { true }
|
|
}
|
|
|
|
task yarnLintFix(type: YarnTask, dependsOn: [yarnInstall]) {
|
|
inputs.files(projectMdFiles)
|
|
args = ['run', 'lint-fix']
|
|
outputs.dir("dist")
|
|
// tell gradle to apply the build cache
|
|
outputs.cacheIf { true }
|
|
}
|
|
|
|
task serve(type: YarnTask, dependsOn: [yarnInstall] ) {
|
|
args = ['run', 'serve']
|
|
}
|
|
|
|
|
|
task yarnBuild(type: YarnTask, dependsOn: [yarnLint, yarnGenerate]) {
|
|
inputs.files(projectMdFiles)
|
|
inputs.file("package.json").withPathSensitivity(PathSensitivity.RELATIVE)
|
|
inputs.dir("src").withPathSensitivity(PathSensitivity.RELATIVE)
|
|
inputs.dir("static").withPathSensitivity(PathSensitivity.RELATIVE)
|
|
inputs.file("yarn.lock").withPathSensitivity(PathSensitivity.RELATIVE)
|
|
outputs.dir("dist")
|
|
// tell gradle to apply the build cache
|
|
outputs.cacheIf { true }
|
|
args = ['run', 'build']
|
|
|
|
}
|
|
task yarnClear(type: YarnTask) {
|
|
args = ['run','clear']
|
|
}
|
|
clean {
|
|
delete 'node_modules'
|
|
delete 'dist'
|
|
delete 'tmp'
|
|
delete 'build'
|
|
delete 'just'
|
|
yarnClear
|
|
}
|
|
|
|
build {
|
|
dependsOn yarnBuild
|
|
}
|