Skip to content

move local data download logic to settings.gradle #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Aug 9, 2019
19 changes: 2 additions & 17 deletions analysis/line-of-sight-geoelement/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

import de.undercouch.gradle.tasks.download.Download

group = 'com.esri.samples'

ext {
Expand Down Expand Up @@ -39,18 +36,6 @@ dependencies {
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task downloadData(type: Download) {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/3af5cfec0fd24dac8d88aea679027cb9/data"
dest 'build/data.zip'
overwrite false
}

task unpackData(type: Copy) {
dependsOn downloadData
from zipTree(downloadData.dest)
into './samples-data/dolmus_3ds'
}

task copyNatives(type: Copy) {
description = "Copies the arcgis native libraries into the project build directory for development."
group = "build"
Expand All @@ -62,7 +47,7 @@ task copyNatives(type: Copy) {
}

run {
dependsOn copyNatives, unpackData
dependsOn copyNatives
mainClassName = 'com.esri.samples.line_of_sight_geoelement.LineOfSightGeoElementLauncher'
}

Expand All @@ -78,7 +63,7 @@ jar {

task productionZip(type: Zip) {
group = 'distribution'
from (unpackData) {
from ("samples-data") {
into "samples-data"
}
from copyNatives
Expand Down
17 changes: 16 additions & 1 deletion analysis/line-of-sight-geoelement/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = 'line-of-sight-geoelement'
rootProject.name = 'line-of-sight-geoelement'

// download sample data
def ant = new groovy.util.AntBuilder()

if (!file("./samples-data").exists()) {
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/3af5cfec0fd24dac8d88aea679027cb9/data",
dest: file("./data.zip")
)
ant.unzip(
src: file("./data.zip"),
dest: file("./samples-data/dolmus_3ds")
)
delete file("./data.zip")
}
19 changes: 2 additions & 17 deletions analysis/viewshed-geoelement/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

import de.undercouch.gradle.tasks.download.Download

group = 'com.esri.samples'

ext {
Expand Down Expand Up @@ -39,18 +36,6 @@ dependencies {
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task downloadData(type: Download) {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/78847654fbe042e6af617ebbfbf985c7/data"
dest './data.zip'
overwrite false
}

task unpackData(type: Copy) {
dependsOn downloadData
from zipTree(downloadData.dest)
into './samples-data/bradley_low_3ds'
}

task copyNatives(type: Copy) {
description = "Copies the arcgis native libraries into the project build directory for development."
group = "build"
Expand All @@ -62,7 +47,7 @@ task copyNatives(type: Copy) {
}

run {
dependsOn copyNatives, unpackData
dependsOn copyNatives
mainClassName = 'com.esri.samples.viewshed_geoelement.ViewshedGeoElementLauncher'
}

Expand All @@ -78,7 +63,7 @@ jar {

task productionZip(type: Zip) {
group = 'distribution'
from (unpackData) {
from ("samples-data") {
into "samples-data"
}
from copyNatives
Expand Down
17 changes: 16 additions & 1 deletion analysis/viewshed-geoelement/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = 'viewshed-geoelement'
rootProject.name = 'viewshed-geoelement'

// download sample data
def ant = new groovy.util.AntBuilder()

if (!file("./samples-data").exists()) {
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/78847654fbe042e6af617ebbfbf985c7/data",
dest: file("./data.zip")
)
ant.unzip(
src: file("./data.zip"),
dest: file("./samples-data/bradley_low_3ds")
)
delete file("./data.zip")
}
3 changes: 0 additions & 3 deletions display_information/display-grid/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

import de.undercouch.gradle.tasks.download.Download

group = 'com.esri.samples'

ext {
Expand Down
19 changes: 2 additions & 17 deletions editing/edit-and-sync-features/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

import de.undercouch.gradle.tasks.download.Download

group = 'com.esri.samples'

ext {
Expand Down Expand Up @@ -39,18 +36,6 @@ dependencies {
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task downloadData(type: Download) {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/793a4620fbba443a931ac1fa52ad7f45/data"
dest 'build/data.zip'
overwrite false
}

task unpackData(type: Copy) {
dependsOn downloadData
from zipTree(downloadData.dest)
into './samples-data/sanfrancisco'
}

task copyNatives(type: Copy) {
description = "Copies the arcgis native libraries into the project build directory for development."
group = "build"
Expand All @@ -62,7 +47,7 @@ task copyNatives(type: Copy) {
}

run {
dependsOn copyNatives, unpackData
dependsOn copyNatives
mainClassName = 'com.esri.samples.edit_and_sync_features.EditAndSyncFeaturesLauncher'
}

Expand All @@ -78,7 +63,7 @@ jar {

task productionZip(type: Zip) {
group = 'distribution'
from (unpackData) {
from ("samples-data") {
into "samples-data"
}
from copyNatives
Expand Down
17 changes: 16 additions & 1 deletion editing/edit-and-sync-features/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = 'edit-and-sync-features'
rootProject.name = 'edit-and-sync-features'

// download sample data
def ant = new groovy.util.AntBuilder()

if (!file("./samples-data").exists()) {
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/793a4620fbba443a931ac1fa52ad7f45/data",
dest: file("./data.zip")
)
ant.unzip(
src: file("./data.zip"),
dest: file("./samples-data/sanfrancisco")
)
delete file("./data.zip")
}
26 changes: 2 additions & 24 deletions feature_layers/feature-layer-dictionary-renderer/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

group = 'com.esri.samples'
Expand Down Expand Up @@ -37,27 +36,6 @@ dependencies {
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task downloadData() {
download {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/5491f01d92554751902ecad85cc5d6ca/data"
dest 'build/data/dictionary.zip'
overwrite false
}
download {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/c78b149a1d52414682c86a5feeb13d30/data"
dest './samples-data/stylx/mil2525d.stylx'
overwrite false
}
}

task unpackData(type: Copy) {
dependsOn downloadData
from (file("build/data/").listFiles().findAll { f -> f.name.endsWith(".zip") }.collect { f -> zipTree(f) }) {
into 'dictionary'
}
into 'samples-data'
}

task copyNatives(type: Copy) {
description = "Copies the arcgis native libraries into the project build directory for development."
group = "build"
Expand All @@ -69,7 +47,7 @@ task copyNatives(type: Copy) {
}

run {
dependsOn copyNatives, unpackData
dependsOn copyNatives
mainClassName = 'com.esri.samples.feature_layer_dictionary_renderer.FeatureLayerDictionaryRendererLauncher'
}

Expand All @@ -85,7 +63,7 @@ jar {

task productionZip(type: Zip) {
group = 'distribution'
from (unpackData) {
from ("samples-data") {
into "samples-data"
}
from copyNatives
Expand Down
21 changes: 21 additions & 0 deletions feature_layers/feature-layer-dictionary-renderer/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
rootProject.name = 'feature-layer-dictionary-renderer'

// download sample data
def ant = new groovy.util.AntBuilder()

if (!file("./samples-data").exists()) {
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/5491f01d92554751902ecad85cc5d6ca/data",
dest: file("./data.zip")
)
ant.unzip(
src: file("./data.zip"),
dest: file("./samples-data/dictionary")
)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing the stylx download here:

    ant.get(
            src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/c78b149a1d52414682c86a5feeb13d30/data",
            dest: file("./samples-data/stylx/mil2525d.stylx")
    )        

delete file("./data.zip")

file("./samples-data/stylx").mkdirs()
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/c78b149a1d52414682c86a5feeb13d30/data",
dest: file("./samples-data/stylx/mil2525d.stylx")
)
}
19 changes: 2 additions & 17 deletions feature_layers/feature-layer-geodatabase/build.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
plugins {
id 'application'
id 'org.openjfx.javafxplugin' version '0.0.5'
id "de.undercouch.download" version "3.4.3"
}

import de.undercouch.gradle.tasks.download.Download

group = 'com.esri.samples'

ext {
Expand Down Expand Up @@ -39,18 +36,6 @@ dependencies {
natives "com.esri.arcgisruntime:arcgis-java-resources:$arcgisVersion"
}

task downloadData(type: Download) {
src "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/cb1b20748a9f4d128dad8a87244e3e37/data"
dest 'build/data.zip'
overwrite false
}

task unpackData(type: Copy) {
dependsOn downloadData
from zipTree(downloadData.dest)
into './samples-data/los_angeles'
}

task copyNatives(type: Copy) {
description = "Copies the arcgis native libraries into the project build directory for development."
group = "build"
Expand All @@ -62,7 +47,7 @@ task copyNatives(type: Copy) {
}

run {
dependsOn copyNatives, unpackData
dependsOn copyNatives
mainClassName = 'com.esri.samples.feature_layer_geodatabase.FeatureLayerGeodatabaseLauncher'
}

Expand All @@ -78,7 +63,7 @@ jar {

task productionZip(type: Zip) {
group = 'distribution'
from (unpackData) {
from ("samples-data") {
into "samples-data"
}
from copyNatives
Expand Down
15 changes: 15 additions & 0 deletions feature_layers/feature-layer-geodatabase/settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1,16 @@
rootProject.name = 'feature-layer-geodatabase'

// download sample data
def ant = new groovy.util.AntBuilder()

if (!file("./samples-data").exists()) {
ant.get(
src: "https://arcgisruntime.maps.arcgis.com/sharing/rest/content/items/cb1b20748a9f4d128dad8a87244e3e37/data",
dest: file("./data.zip")
)
ant.unzip(
src: file("./data.zip"),
dest: file("./samples-data/los_angeles")
)
delete file("./data.zip")
}
Loading