Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
N
nshmp-haz
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ghsc
National Seismic Hazard Model Project
nshmp-haz
Commits
ce0a9ab6
Commit
ce0a9ab6
authored
2 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
add function and task
parent
9a0fc467
No related branches found
No related tags found
2 merge requests
!690
Production Release | nshmp-haz
,
!689
Resolves: NSHM Gradle Download
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gradle/nshm.gradle
+36
-13
36 additions, 13 deletions
gradle/nshm.gradle
with
36 additions
and
13 deletions
gradle/nshm.gradle
+
36
−
13
View file @
ce0a9ab6
...
@@ -15,16 +15,11 @@ ext {
...
@@ -15,16 +15,11 @@ ext {
nshmDir
=
"nshms"
;
nshmDir
=
"nshms"
;
// Download and unzip NSHM
// Download and unzip NSHM
downloadNshm
=
{
repo
,
year
->
downloadNshm
=
{
nshm
->
def
yaml
=
new
Yaml
()
def
repo
=
nshm
.
repo
def
nshmConfig
=
new
Yaml
().
load
(
new
File
(
"${projectDir}/nshms.yml"
).
newInputStream
())
def
nshm
=
nshmConfig
.
nshms
.
find
{
nshm
->
nshm
.
repo
==
repo
&&
nshm
.
year
==
year
}
if
(
nshm
==
null
)
{
throw
new
Exception
(
"NSHM ${repo} ${year} not found."
)
}
def
tag
=
nshm
.
tag
def
tag
=
nshm
.
tag
def
year
=
nshm
.
year
def
zipName
=
"${repo}-${tag}.zip"
;
def
zipName
=
"${repo}-${tag}.zip"
;
def
zipFile
=
new
File
(
nshmDir
,
zipName
)
def
zipFile
=
new
File
(
nshmDir
,
zipName
)
def
nshmFile
=
file
(
"${nshmDir}/${repo}-${year}"
)
def
nshmFile
=
file
(
"${nshmDir}/${repo}-${year}"
)
...
@@ -46,6 +41,20 @@ ext {
...
@@ -46,6 +41,20 @@ ext {
delete
zipFile
delete
zipFile
}
}
}
}
// Returns a NSHM from nshms.yml array
findNshm
=
{
repo
,
year
->
def
yaml
=
new
Yaml
()
def
nshmConfig
=
new
Yaml
().
load
(
new
File
(
"${projectDir}/nshms.yml"
).
newInputStream
())
def
nshm
=
nshmConfig
.
nshms
.
find
{
nshm
->
nshm
.
repo
==
repo
&&
nshm
.
year
==
year
}
if
(
nshm
==
null
)
{
throw
new
Exception
(
"NSHM ${repo} ${year} not found."
)
}
return
nshm
}
}
}
task
cleanNshm
(
type:
Delete
)
{
task
cleanNshm
(
type:
Delete
)
{
...
@@ -53,13 +62,27 @@ task cleanNshm(type: Delete) {
...
@@ -53,13 +62,27 @@ task cleanNshm(type: Delete) {
}
}
clean
.
dependsOn
cleanNshm
clean
.
dependsOn
cleanNshm
// Download all NSHMs
task
nshms
()
{
dependsOn
cleanNshm
def
yaml
=
new
Yaml
()
def
nshmConfig
=
new
Yaml
().
load
(
new
File
(
"${projectDir}/nshms.yml"
).
newInputStream
())
doLast
{
for
(
nshm
in
nshmConfig
.
nshms
)
{
// Download NSHM
downloadNshm
(
nshm
)
}
}
}
// Test Alaska 2023 NSHM
// Test Alaska 2023 NSHM
task
testAlaska2023
(
type:
Test
)
{
task
testAlaska2023
(
type:
Test
)
{
description
=
"Test Alaska 2023 NSHM"
description
=
"Test Alaska 2023 NSHM"
group
=
"verification"
group
=
"verification"
doFirst
{
doFirst
{
downloadNshm
(
"nshm-alaska"
,
2023
)
downloadNshm
(
findNshm
(
"nshm-alaska"
,
2023
)
)
}
}
testLogging
{
testLogging
{
...
@@ -83,7 +106,7 @@ task testConus2018(type: Test) {
...
@@ -83,7 +106,7 @@ task testConus2018(type: Test) {
group
=
"verification"
group
=
"verification"
doFirst
{
doFirst
{
downloadNshm
(
"nshm-conus"
,
2018
)
downloadNshm
(
findNshm
(
"nshm-conus"
,
2018
)
)
}
}
testLogging
{
testLogging
{
...
@@ -107,7 +130,7 @@ task testConus2023(type: Test) {
...
@@ -107,7 +130,7 @@ task testConus2023(type: Test) {
group
=
"verification"
group
=
"verification"
doFirst
{
doFirst
{
downloadNshm
(
"nshm-conus"
,
2023
)
downloadNshm
(
findNshm
(
"nshm-conus"
,
2023
)
)
}
}
testLogging
{
testLogging
{
...
@@ -131,7 +154,7 @@ task testHawaii2021(type: Test) {
...
@@ -131,7 +154,7 @@ task testHawaii2021(type: Test) {
group
=
"verification"
group
=
"verification"
doFirst
{
doFirst
{
downloadNshm
(
"nshm-hawaii"
,
2021
)
downloadNshm
(
findNshm
(
"nshm-hawaii"
,
2021
)
)
}
}
testLogging
{
testLogging
{
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment