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
24e1cac9
Commit
24e1cac9
authored
2 years ago
by
Clayton, Brandon Scott
Browse files
Options
Downloads
Patches
Plain Diff
use try catch
parent
e1c1046e
No related branches found
Branches containing commit
No related tags found
Tags containing commit
2 merge requests
!619
Production Release | nshmp-haz
,
!614
Try Catch Version
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
gradle/app-version.gradle
+22
-18
22 additions, 18 deletions
gradle/app-version.gradle
with
22 additions
and
18 deletions
gradle/app-version.gradle
+
22
−
18
View file @
24e1cac9
...
...
@@ -2,23 +2,27 @@ apply plugin: "com.palantir.git-version"
tasks
.
withType
(
JavaCompile
)
{
doFirst
{
def
versionFile
=
new
File
(
"${projectDir}/src/main/resources/version/nshmp-haz-version.json"
)
new
File
(
versionFile
.
getParent
()).
mkdirs
()
def
details
=
versionDetails
()
def
ciProjectUrl
=
System
.
getenv
(
"CI_PROJECT_URL"
)
def
branch
=
System
.
getenv
(
"CI_COMMIT_BRANCH"
)
def
versionInfo
=
[
branchName:
branch
?
branch
:
details
.
branchName
,
commitDistance:
details
.
commitDistance
,
gitHash:
details
.
gitHash
,
gitHashFull:
details
.
gitHashFull
,
isCleanTag:
details
.
isCleanTag
,
lastTag:
details
.
lastTag
,
projectName:
project
.
name
,
url:
ciProjectUrl
?
ciProjectUrl
:
'git config --get remote.origin.url'
.
execute
().
text
.
replace
(
'\n'
,
''
),
version:
details
.
version
,
]
def
json
=
groovy
.
json
.
JsonOutput
.
toJson
(
versionInfo
)
versionFile
.
write
(
groovy
.
json
.
JsonOutput
.
prettyPrint
(
json
))
try
{
def
versionFile
=
new
File
(
"${projectDir}/src/main/resources/version/nshmp-haz-version.json"
)
new
File
(
versionFile
.
getParent
()).
mkdirs
()
def
details
=
versionDetails
()
def
ciProjectUrl
=
System
.
getenv
(
"CI_PROJECT_URL"
)
def
branch
=
System
.
getenv
(
"CI_COMMIT_BRANCH"
)
def
versionInfo
=
[
branchName:
branch
?
branch
:
details
.
branchName
,
commitDistance:
details
.
commitDistance
,
gitHash:
details
.
gitHash
,
gitHashFull:
details
.
gitHashFull
,
isCleanTag:
details
.
isCleanTag
,
lastTag:
details
.
lastTag
,
projectName:
project
.
name
,
url:
ciProjectUrl
?
ciProjectUrl
:
"git config --get remote.origin.url"
.
execute
().
text
.
replace
(
"\n"
,
""
),
version:
details
.
version
,
]
def
json
=
groovy
.
json
.
JsonOutput
.
toJson
(
versionInfo
)
versionFile
.
write
(
groovy
.
json
.
JsonOutput
.
prettyPrint
(
json
))
}
catch
(
Exception
e
)
{
println
(
"Failed to create version file."
)
}
}
}
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