forked from datahub-project/datahub
-
Notifications
You must be signed in to change notification settings - Fork 1
/
build.gradle
137 lines (119 loc) · 4.22 KB
/
build.gradle
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
plugins {
id 'scala'
id 'com.palantir.docker'
id 'org.gradle.playframework'
}
apply from: '../gradle/versioning/versioning.gradle'
apply from: './play.gradle'
apply from: '../gradle/coverage/java-coverage.gradle'
ext {
docker_repo = 'datahub-frontend-react'
docker_dir = 'datahub-frontend'
}
java {
toolchain {
languageVersion = JavaLanguageVersion.of(jdkVersion(project))
}
}
test {
jacoco {
// jacoco instrumentation is failing when dealing with code of this dependency, excluding it.
excludes = ["com/gargoylesoftware/**"]
}
}
model {
// Must specify the dependency here as "stage" is added by rule based model.
tasks.myTar {
dependsOn stage
}
}
task myTar(type: Tar) {
compression = Compression.GZIP
from("${buildDir}/stage")
into("bin") {
from("bin")
}
into("conf") {
from("conf")
fileMode = 0600
}
}
artifacts {
archives myTar
}
/*
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
}
}
docker {
name "${docker_registry}/${docker_repo}:v${version}"
version "v${version}"
dockerfile file("${rootProject.projectDir}/docker/${docker_dir}/Dockerfile")
files fileTree(rootProject.projectDir) {
include '.dockerignore'
include 'docker/monitoring/*'
include "docker/${docker_dir}/*"
}.exclude {
i -> (!i.file.name.endsWith(".dockerignore") && i.file.isHidden())
}
tag("Debug", "${docker_registry}/${docker_repo}:debug")
// platform('linux/arm64', 'linux/amd64')
buildx(true)
load(true)
push(false)
// Add build args if they are defined (needed for some CI or enterprise environments)
def dockerBuildArgs = [:]
if (project.hasProperty('alpineApkRepositoryUrl')) {
dockerBuildArgs.ALPINE_REPO_URL = project.getProperty('alpineApkRepositoryUrl')
}
if (project.hasProperty('githubMirrorUrl')) {
dockerBuildArgs.GITHUB_REPO_URL = project.getProperty('githubMirrorUrl')
}
if (project.hasProperty('mavenCentralRepositoryUrl')) {
dockerBuildArgs.MAVEN_CENTRAL_REPO_URL = project.getProperty('mavenCentralRepositoryUrl')
}
if (dockerBuildArgs.size() > 0) {
buildArgs(dockerBuildArgs)
}
}
task unversionZip(type: Copy, dependsOn: [':datahub-web-react:distZip', dist]) {
from ("${buildDir}/distributions")
include "datahub-frontend-${version}.zip"
into "${buildDir}/docker/"
rename "datahub-frontend-${version}.zip", "datahub-frontend.zip"
}
tasks.getByPath(":datahub-frontend:docker").dependsOn(unversionZip)
task cleanLocalDockerImages {
doLast {
rootProject.ext.cleanLocalDockerImages(docker_registry, docker_repo, "${version}")
}
}
dockerClean.finalizedBy(cleanLocalDockerImages)
// gradle 8 fixes
tasks.getByName('createDatahub-frontendTarDist').dependsOn 'stageMainDist'
tasks.getByName('createDatahub-frontendZipDist').dependsOn 'stageMainDist'
stagePlayBinaryDist.dependsOn tasks.getByName('createDatahub-frontendStartScripts')
playBinaryDistTar.dependsOn tasks.getByName('createDatahub-frontendStartScripts')
playBinaryDistZip.dependsOn tasks.getByName('createDatahub-frontendStartScripts')
tasks.getByName('stageDatahub-frontendDist').dependsOn stagePlayBinaryDist
tasks.getByName('stageDatahub-frontendDist').dependsOn createPlayBinaryStartScripts
tasks.getByName('datahub-frontendDistTar').dependsOn createPlayBinaryStartScripts
tasks.getByName('datahub-frontendDistTar').dependsOn createMainStartScripts
tasks.getByName('datahub-frontendDistZip').dependsOn createPlayBinaryStartScripts
tasks.getByName('datahub-frontendDistZip').dependsOn createMainStartScripts
playBinaryDistTar.dependsOn createMainStartScripts
playBinaryDistZip.dependsOn createMainStartScripts
createMainStartScripts.dependsOn 'stageDatahub-frontendDist'
createPlayBinaryTarDist.dependsOn 'stageDatahub-frontendDist'
createPlayBinaryZipDist.dependsOn 'stageDatahub-frontendDist'
createPlayBinaryTarDist.dependsOn 'stageMainDist'
createPlayBinaryZipDist.dependsOn 'stageMainDist'