| 
									
										
										
										
											2021-05-11 15:41:42 -07:00
										 |  |  | plugins { | 
					
						
							|  |  |  |   id "io.github.kobylynskyi.graphql.codegen" version "4.1.1" | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  |   id 'com.palantir.docker' | 
					
						
							|  |  |  |   id 'scala' | 
					
						
							| 
									
										
										
										
											2021-05-11 15:41:42 -07:00
										 |  |  | } | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  | apply from: "../gradle/versioning/versioning.gradle" | 
					
						
							| 
									
										
										
										
											2019-08-31 20:51:14 -07:00
										 |  |  | apply from: './play.gradle' | 
					
						
							|  |  |  | 
 | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  | ext { | 
					
						
							|  |  |  |   docker_repo = 'datahub-frontend-react' | 
					
						
							|  |  |  |   docker_dir = 'datahub-frontend' | 
					
						
							|  |  |  | } | 
					
						
							| 
									
										
										
										
											2021-05-11 15:41:42 -07:00
										 |  |  | 
 | 
					
						
							| 
									
										
										
										
											2019-08-31 20:51:14 -07:00
										 |  |  | model { | 
					
						
							|  |  |  |   // Must specify the dependency here as "stage" is added by rule based model.
 | 
					
						
							|  |  |  |   tasks.myTar { | 
					
						
							|  |  |  |     dependsOn stage | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task myTar(type: Tar) { | 
					
						
							|  |  |  |   extension = "tgz" | 
					
						
							|  |  |  |   compression = Compression.GZIP | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   from("${buildDir}/stage") | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   into("bin") { | 
					
						
							|  |  |  |     from("bin") | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  |   into("conf") { | 
					
						
							|  |  |  |     from("conf") | 
					
						
							|  |  |  |     fileMode = 0600 | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | artifacts { | 
					
						
							|  |  |  |   archives myTar | 
					
						
							| 
									
										
										
										
											2021-05-11 15:41:42 -07:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | graphqlCodegen { | 
					
						
							|  |  |  |   // For options: https://github.com/kobylynskyi/graphql-java-codegen/blob/master/docs/codegen-options.md
 | 
					
						
							|  |  |  |   graphqlSchemaPaths = ["$projectDir/conf/datahub-frontend.graphql".toString()] | 
					
						
							|  |  |  |   outputDir = new File("$projectDir/app/graphql") | 
					
						
							|  |  |  |   packageName = "generated" | 
					
						
							|  |  |  |   generateApis = true | 
					
						
							|  |  |  |   modelValidationAnnotation = "" | 
					
						
							|  |  |  |   customTypesMapping = [ | 
					
						
							|  |  |  |           Long: "Long", | 
					
						
							|  |  |  |   ] | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | tasks.withType(Checkstyle) { | 
					
						
							|  |  |  |   exclude "**/generated/**" | 
					
						
							| 
									
										
										
										
											2022-05-10 18:15:53 -05:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | checkstyleMain.source = "app/" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | /* | 
					
						
							|  |  |  | PLAY UPGRADE NOTE | 
					
						
							|  |  |  | Generates the distribution jars under the expected names. The playFramework plugin only accepts certain name values | 
					
						
							|  |  |  | for the resulting folders and files, so some changes were made to accommodate. Default distribution is main if these are excluded | 
					
						
							|  |  |  |  */ | 
					
						
							|  |  |  | distributions { | 
					
						
							|  |  |  |   create("datahub-frontend") { | 
					
						
							|  |  |  |     distributionBaseName = project.ext.playBinaryBaseName | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  |   playBinary { | 
					
						
							|  |  |  |     distributionBaseName = project.ext.playBinaryBaseName | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | docker { | 
					
						
							| 
									
										
										
										
											2023-01-31 18:44:37 -06:00
										 |  |  |   name "${docker_registry}/${docker_repo}:v${version}" | 
					
						
							|  |  |  |   version "v${version}" | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  |   dockerfile file("${rootProject.projectDir}/docker/${docker_dir}/Dockerfile") | 
					
						
							|  |  |  |   files fileTree(rootProject.projectDir) { | 
					
						
							|  |  |  |     include 'docker/monitoring/*' | 
					
						
							|  |  |  |     include "docker/${docker_dir}/*" | 
					
						
							|  |  |  |   } | 
					
						
							| 
									
										
										
										
											2023-02-16 10:41:42 -06:00
										 |  |  |   tag("Debug", "${docker_registry}/${docker_repo}:debug") | 
					
						
							| 
									
										
										
										
											2022-12-26 10:09:08 -06:00
										 |  |  | 
 | 
					
						
							|  |  |  |   // platform('linux/arm64', 'linux/amd64')
 | 
					
						
							|  |  |  |   buildx(true) | 
					
						
							|  |  |  |   load(true) | 
					
						
							|  |  |  |   push(false) | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task unversionZip(type: Copy, dependsOn: [':datahub-web-react:build', dist]) { | 
					
						
							|  |  |  |   from ("${buildDir}/distributions") | 
					
						
							|  |  |  |   include "datahub-frontend-${version}.zip" | 
					
						
							|  |  |  |   into "${buildDir}/docker/" | 
					
						
							|  |  |  |   rename "datahub-frontend-${version}.zip", "datahub-frontend.zip" | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | tasks.getByName("docker").dependsOn(unversionZip) | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | task cleanLocalDockerImages { | 
					
						
							|  |  |  |   doLast { | 
					
						
							|  |  |  |     rootProject.ext.cleanLocalDockerImages(docker_registry, docker_repo, "v${version}".toString()) | 
					
						
							|  |  |  |   } | 
					
						
							|  |  |  | } | 
					
						
							|  |  |  | dockerClean.finalizedBy(cleanLocalDockerImages) |