| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  | plugins { | 
					
						
							|  |  |  |   id 'distribution' | 
					
						
							|  |  |  |   id 'com.github.node-gradle.node' | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | node { | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   // If true, it will download node using above parameters.
 | 
					
						
							|  |  |  |   // If false, it will try to use globally installed node.
 | 
					
						
							| 
									
										
										
										
											2021-11-09 20:50:06 +01:00
										 |  |  |   if (project.hasProperty('useSystemNode') && project.getProperty('useSystemNode').toBoolean()) { | 
					
						
							|  |  |  |     download = false | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     download = true | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Version of node to use.
 | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  |   version = '21.2.0' | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // Version of Yarn to use.
 | 
					
						
							| 
									
										
										
										
											2024-09-23 19:29:50 -05:00
										 |  |  |   yarnVersion = '1.22.22' | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-03-31 16:15:25 +01:00
										 |  |  |   // Base URL for fetching node distributions (set nodeDistBaseUrl if you have a mirror).
 | 
					
						
							|  |  |  |   if (project.hasProperty('nodeDistBaseUrl')) { | 
					
						
							|  |  |  |     distBaseUrl = project.getProperty('nodeDistBaseUrl') | 
					
						
							|  |  |  |   } else { | 
					
						
							|  |  |  |     distBaseUrl = 'https://nodejs.org/dist' | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // 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
 | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  |   nodeProjectDir = file("${project.projectDir}") | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  |   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/**' | 
					
						
							| 
									
										
										
										
											2024-02-29 12:39:32 -08:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-09-22 17:30:15 -07:00
										 |  |  | // Combine GraphQL schemas for documentation.
 | 
					
						
							|  |  |  | task generateGraphQLSchema(type: Exec) { | 
					
						
							|  |  |  |   workingDir "$projectDir/graphql" | 
					
						
							|  |  |  |   commandLine './generateGraphQLSchema.sh' | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-06-06 09:31:44 +02:00
										 |  |  | task generateJsonSchema(type: Exec, dependsOn: [':metadata-ingestion:docGen']) { | 
					
						
							|  |  |  |   workingDir "$projectDir/genJsonSchema" | 
					
						
							|  |  |  |   commandLine './generateJsonSchema.sh' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | /* | 
					
						
							|  |  |  |   Wrappers around Yarn Tasks. | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | task yarnInstall(type: YarnTask) { | 
					
						
							|  |  |  |   logger.info('CI = "{}"', System.env.CI) | 
					
						
							|  |  |  |   if (System.env.CI != null && System.env.CI == "true") { | 
					
						
							| 
									
										
										
										
											2024-09-23 19:29:50 -05:00
										 |  |  |     args = ['install', '--frozen-lockfile', '--network-timeout', '300000'] | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2024-09-23 19:29:50 -05:00
										 |  |  |     args = ['install', '--network-timeout', '300000'] | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2024-02-29 12:39:32 -08:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // The node_modules directory can contain built artifacts, so
 | 
					
						
							|  |  |  |   // it's not really safe to cache it.
 | 
					
						
							|  |  |  |   outputs.cacheIf { false } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   inputs.files( | 
					
						
							|  |  |  |     file('yarn.lock'), | 
					
						
							|  |  |  |     file('package.json'), | 
					
						
							|  |  |  |   ) | 
					
						
							|  |  |  |   outputs.dir('node_modules') | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-03-22 21:31:32 +05:30
										 |  |  | task yarnGenerate(type: YarnTask, dependsOn: [yarnInstall, | 
					
						
							|  |  |  |     generateGraphQLSchema, generateJsonSchema, | 
					
						
							|  |  |  |     ':metadata-ingestion:modelDocGen', ':metadata-ingestion:docGen', | 
					
						
							| 
									
										
										
										
											2024-03-25 13:28:35 +01:00
										 |  |  |     ':metadata-ingestion:buildWheel', | 
					
						
							| 
									
										
										
										
											2024-03-25 18:46:57 -07:00
										 |  |  |     ':metadata-ingestion-modules:airflow-plugin:buildWheel', | 
					
						
							|  |  |  |     ':metadata-ingestion-modules:dagster-plugin:buildWheel', | 
					
						
							| 
									
										
										
										
											2024-08-29 15:40:10 +02:00
										 |  |  |     ':metadata-ingestion-modules:prefect-plugin:buildWheel', | 
					
						
							| 
									
										
										
										
											2024-08-21 21:43:36 +05:30
										 |  |  |     ':metadata-ingestion-modules:gx-plugin:buildWheel', | 
					
						
							| 
									
										
										
										
											2024-03-25 18:46:57 -07:00
										 |  |  |     ]) { | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   inputs.files(projectMdFiles) | 
					
						
							|  |  |  |   outputs.cacheIf { true } | 
					
						
							|  |  |  |   args = ['run', 'generate'] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-26 06:10:13 +09:00
										 |  |  | task downloadHistoricalVersions(type: Exec) { | 
					
						
							|  |  |  |     workingDir '.' | 
					
						
							|  |  |  |     commandLine 'python3', 'download_historical_versions.py' | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task yarnStart(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate, downloadHistoricalVersions]) { | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   args = ['run', 'start'] | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2022-11-29 00:52:16 -05:00
										 |  |  | task fastReload(type: YarnTask) { | 
					
						
							|  |  |  |   args = ['run', 'generate-rsync'] | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-09-14 11:34:21 +09:00
										 |  |  | task yarnLint(type: YarnTask, dependsOn: [yarnInstall, yarnGenerate]) { | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   inputs.files(projectMdFiles) | 
					
						
							|  |  |  |   args = ['run', 'lint-check'] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-02-11 22:33:01 +05:30
										 |  |  | task yarnLintFix(type: YarnTask, dependsOn: [yarnInstall]) { | 
					
						
							|  |  |  |   inputs.files(projectMdFiles) | 
					
						
							|  |  |  |   args = ['run', 'lint-fix'] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task serve(type: YarnTask, dependsOn: [yarnInstall] ) { | 
					
						
							|  |  |  |   args = ['run', 'serve'] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2023-08-26 06:10:13 +09:00
										 |  |  | task yarnBuild(type: YarnTask, dependsOn: [yarnLint, yarnGenerate, downloadHistoricalVersions]) { | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   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 } | 
					
						
							| 
									
										
										
										
											2023-09-11 13:29:31 -07:00
										 |  |  |   // See https://stackoverflow.com/questions/53230823/fatal-error-ineffective-mark-compacts-near-heap-limit-allocation-failed-java
 | 
					
						
							|  |  |  |   // and https://github.com/facebook/docusaurus/issues/8329.
 | 
					
						
							| 
									
										
										
										
											2024-02-29 12:39:32 -08:00
										 |  |  |   // TODO: As suggested in https://github.com/facebook/docusaurus/issues/4765, try switching to swc-loader or esbuild minification.
 | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  |   if (project.hasProperty('useSystemNode') && project.getProperty('useSystemNode').toBoolean()) { | 
					
						
							| 
									
										
										
										
											2024-03-11 15:06:39 -07:00
										 |  |  |     environment = ['NODE_OPTIONS': '--max-old-space-size=10240'] | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  |   } else { | 
					
						
							| 
									
										
										
										
											2024-03-11 15:06:39 -07:00
										 |  |  |     environment = ['NODE_OPTIONS': '--max-old-space-size=10240 --openssl-legacy-provider'] | 
					
						
							| 
									
										
										
										
											2023-12-15 13:28:33 -06:00
										 |  |  |   } | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   args = ['run', 'build'] | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | task yarnClear(type: YarnTask) { | 
					
						
							|  |  |  |   args = ['run','clear'] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | clean { | 
					
						
							|  |  |  |   delete 'node_modules' | 
					
						
							|  |  |  |   delete 'dist' | 
					
						
							|  |  |  |   delete 'tmp' | 
					
						
							|  |  |  |   delete 'build' | 
					
						
							|  |  |  |   delete 'just' | 
					
						
							| 
									
										
										
										
											2024-06-11 11:44:13 -07:00
										 |  |  |   delete 'sphinx/venv' | 
					
						
							|  |  |  |   delete 'sphinx/_build' | 
					
						
							|  |  |  |   delete 'versioned_docs' | 
					
						
							| 
									
										
										
										
											2022-07-15 06:08:32 -04:00
										 |  |  |   delete fileTree(dir: 'genDocs', exclude: '.gitignore') | 
					
						
							|  |  |  |   delete fileTree(dir: 'docs', exclude: '.gitignore') | 
					
						
							| 
									
										
										
										
											2024-06-11 11:44:13 -07:00
										 |  |  |   delete fileTree(dir: 'genStatic', exclude: '.gitignore') | 
					
						
							| 
									
										
										
										
											2022-07-15 06:08:32 -04:00
										 |  |  |   delete 'graphql/combined.graphql' | 
					
						
							| 
									
										
										
										
											2021-03-15 16:13:07 -07:00
										 |  |  |   yarnClear | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | build { | 
					
						
							|  |  |  |     dependsOn yarnBuild | 
					
						
							|  |  |  | } |