diff --git a/gradle/nshm.gradle b/gradle/nshm.gradle index ea8f4b1076a19a9dbc091c17a86727d7ebdaef08..a8ca1f442528a484ea4a6d33aec483a4889d775b 100644 --- a/gradle/nshm.gradle +++ b/gradle/nshm.gradle @@ -1,4 +1,4 @@ -apply plugin: "de.undercouch.download" +apply plugin: "org.ajoberstar.grgit" buildscript { repositories { @@ -16,32 +16,22 @@ ext { envMemory = System.getenv("CI_RUNNER_MEMORY") xmx = envMemory ? envMemory : "16g" - // Download and unzip NSHM + // Clone repo downloadNshm = {nshm -> def repo = nshm.repo def tag = nshm.tag def year = nshm.year - - def zipName = "${repo}-${tag}.zip"; - def zipFile = new File(nshmDir, zipName) - def nshmFile = file("${nshmDir}/${repo}-${year}") + def uri = "https://code.usgs.gov/ghsc/nshmp/nshms/${repo}.git" + def nshmFile = new File("${projectDir}/${nshmDir}/${repo}-${year}") if (nshmFile.exists()) { delete nshmFile } - download.run { - src "https://code.usgs.gov/ghsc/nshmp/nshms/${repo}/-/archive/${tag}/${zipName}" - dest zipFile - } - copy { - from zipTree(zipFile) - into nshmDir - } - file("${nshmDir}/${repo}-${tag}").renameTo(nshmFile) - delete { - delete zipFile - } + grgit.clone( + dir: nshmFile, + uri: uri, + refToCheckout: tag) } // Returns a NSHM from nshms.yml array