diff --git a/.gitignore b/.gitignore index 3c88c1b..54cf105 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,6 @@ # orb.yml is "packed" from source, and not published directly from the repository. orb.yml -.DS_Store \ No newline at end of file +.DS_Store + +# cloned cache +rhino-setup/ \ No newline at end of file diff --git a/src/commands/setup_rhino.yml b/src/commands/setup_rhino.yml index a0e74c6..da6c7fa 100644 --- a/src/commands/setup_rhino.yml +++ b/src/commands/setup_rhino.yml @@ -22,6 +22,13 @@ steps: name: Setup wget command: pip install wget + # https://support.circleci.com/hc/en-us/articles/115015426888-Clear-project-dependency-cache + - restore_cache: + name: Restore Rhino Install Cache + key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} + paths: + - "./rhino-setup/" + - run: name: Download Rhino environment: @@ -30,6 +37,12 @@ steps: PARAM_CULTURE: <> command: <> + - save_cache: + name: Cache Nuget Packages + key: rhino-<>-<>-{{ .Environment.CACHE_VERSION }} + paths: + - "./rhino-setup/" + - run: name: Setup Rhino command: <> diff --git a/src/scripts/cache_check.ps1 b/src/scripts/cache_check.ps1 new file mode 100644 index 0000000..785aa08 --- /dev/null +++ b/src/scripts/cache_check.ps1 @@ -0,0 +1,4 @@ +$no_rhino = (Get-ChildItem *.exe).Length -eq 0 +$exit_code = if ($no_rhino) { 1 } else { 0 } +Write-Host $exit_code +exit $exit_code \ No newline at end of file diff --git a/src/scripts/download.ps1 b/src/scripts/download.ps1 index 1bdb8a0..c2f93c8 100644 --- a/src/scripts/download.ps1 +++ b/src/scripts/download.ps1 @@ -1,10 +1,23 @@ #!powershell.exe -ExecutionPolicy Bypass -Write-Host "This is powershell!" +Write-Host "VERS: $ENV:PARAM_VERSION" +Write-Host "FULL: $ENV:PARAM_FULLVERSION" +Write-Host "CULT: $ENV:PARAM_CULTURE" -Write-Host $ENV:PARAM_VERSION -Write-Host $ENV:PARAM_FULLVERSION -Write-Host $ENV:PARAM_CULTURE +$base_dir = (Get-Item(Get-Item $PSScriptRoot).Parent).Parent.FullName +$version_file = "rhino_$ENV:PARAM_VERSION`_$ENV:PARAM_FULLVERSION.exe" +$version_filepath = "$base_dir\rhino-setup\py\$version_file" + +try +{ + if (Test-Path $version_filepath) + { + Write-Host "Cache for $version_file was found, skipping download." + exit 0 + } +} catch {} + +Write-Host "No Cache found, Downloading!" ## https://github.com/mcneel/compute.rhino3d/blob/7.x/script/update-rhino.ps1 python rhino-setup/py/download-rhino.py -v $ENV:PARAM_VERSION -fv $ENV:PARAM_FULLVERSION -c $ENV:PARAM_CULTURE \ No newline at end of file diff --git a/src/scripts/install.ps1 b/src/scripts/install.ps1 index dd57376..eaa1f36 100644 --- a/src/scripts/install.ps1 +++ b/src/scripts/install.ps1 @@ -12,7 +12,12 @@ Write-Host = $token.Length python rhino-setup/py/install-rhino.py -l CORE -tk $token # show the install(s) -Get-ChildItem 'C:\Program Files\Rhino *\System\*.exe' +$installs = Get-ChildItem 'C:\Program Files\Rhino *\System\*.exe' +if ($installs -eq 0) +{ + Write-Host "No Rhino install found!" + exit 1 +} # Remove any download cache Remove-Item *.exe \ No newline at end of file