Downloads:

160

Downloads of v 2021.2.1:

24

Last Update:

26 Jan 2021

Package Maintainer(s):

Software Author(s):

  • WPI
  • PeterJohnson
  • Et Al.

Tags:

wpilib frc first robotics admin

WPILib

2021.2.1 | Updated: 26 Jan 2021

Downloads:

160

Downloads of v 2021.2.1:

24

Maintainer(s):

Software Author(s):

  • WPI
  • PeterJohnson
  • Et Al.

WPILib 2021.2.1

All Checks are Passing

2 Passing Test


Validation Testing Passed


Verification Testing Passed

Details

To install WPILib, run the following command from the command line or from PowerShell:

>

To upgrade WPILib, run the following command from the command line or from PowerShell:

>

To uninstall WPILib, run the following command from the command line or from PowerShell:

>

NOTE: This applies to both open source and commercial editions of Chocolatey.

1. Ensure you are set for organizational deployment

Please see the organizational deployment guide

  • Open Source or Commercial:
    • Proxy Repository - Create a proxy nuget repository on Nexus, Artifactory Pro, or a proxy Chocolatey repository on ProGet. Point your upstream to https://community.chocolatey.org/api/v2. Packages cache on first access automatically. Make sure your choco clients are using your proxy repository as a source and NOT the default community repository. See source command for more information.
    • You can also just download the package and push it to a repository Download

3. Enter your internal repository url

(this should look similar to https://community.chocolatey.org/api/v2)

4. Choose your deployment method:


choco upgrade wpilib -y --source="'STEP 3 URL'" [other options]

See options you can pass to upgrade.

See best practices for scripting.

Add this to a PowerShell script or use a Batch script with tools and in places where you are calling directly to Chocolatey. If you are integrating, keep in mind enhanced exit codes.

If you do use a PowerShell script, use the following to ensure bad exit codes are shown as failures:


choco upgrade wpilib -y --source="'STEP 3 URL'"
$exitCode = $LASTEXITCODE

Write-Verbose "Exit code was $exitCode"
$validExitCodes = @(0, 1605, 1614, 1641, 3010)
if ($validExitCodes -contains $exitCode) {
  Exit 0
}

Exit $exitCode

- name: Ensure wpilib installed
  win_chocolatey:
    name: wpilib
    state: present
    version: 2021.2.1
    source: STEP 3 URL

See docs at https://docs.ansible.com/ansible/latest/modules/win_chocolatey_module.html.


chocolatey_package 'wpilib' do
  action    :install
  version  '2021.2.1'
  source   'STEP 3 URL'
end

See docs at https://docs.chef.io/resource_chocolatey_package.html.


Chocolatey::Ensure-Package
(
    Name: wpilib,
    Version: 2021.2.1,
    Source: STEP 3 URL
);

Requires Otter Chocolatey Extension. See docs at https://inedo.com/den/otter/chocolatey.


cChocoPackageInstaller wpilib
{
   Name     = 'wpilib'
   Ensure   = 'Present'
   Version  = '2021.2.1'
   Source   = 'STEP 3 URL'
}

Requires cChoco DSC Resource. See docs at https://github.com/chocolatey/cChoco.


package { 'wpilib':
  provider => 'chocolatey',
  ensure   => '2021.2.1',
  source   => 'STEP 3 URL',
}

Requires Puppet Chocolatey Provider module. See docs at https://forge.puppet.com/puppetlabs/chocolatey.


salt '*' chocolatey.install wpilib version="2021.2.1" source="STEP 3 URL"

See docs at https://docs.saltstack.com/en/latest/ref/modules/all/salt.modules.chocolatey.html.

5. If applicable - Chocolatey configuration/installation

See infrastructure management matrix for Chocolatey configuration elements and examples.

This package was approved by moderator TheCakeIsNaOH on 20 Feb 2021.

Description

The WPILib software required by FIRST Robotics for the FRC competition.

Package Parameters

  • /ProgrammingLanguage:Language - Selects the language specific software to install. Default is 'both'. ('java'/'cpp'/'both')
  • /CachedZip:Zip - Selects whether to use a cached zip with the installer or to download it. Default is 'false'. ('true'/'false'/path_to_zip)
    >NOTE: If 'true', it will be assumed the zip is next to the installer with the default name.
  • /AllowUserInteraction:boolean - Let the user intereact with the installer before execution. Default is 'false'. ('true'/'false')
    >NOTE: This is really only for debugging or for custom control over install options.

To pass parameters, use --params "''" (e.g. choco install packageID [other options] --params="'/ITEM:value /ITEM2:value2 /FLAG_BOOLEAN'").
To have choco remember parameters on upgrade, be sure to set choco feature enable -n=useRememberedArgumentsForUpgrades.


LICENSE.md
Copyright (c) 2009-2019 FIRST
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
   * Redistributions of source code must retain the above copyright
     notice, this list of conditions and the following disclaimer.
   * Redistributions in binary form must reproduce the above copyright
     notice, this list of conditions and the following disclaimer in the
     documentation and/or other materials provided with the distribution.
   * Neither the name of the FIRST nor the
     names of its contributors may be used to endorse or promote products
      derived from this software without specific prior written permission.

THIS SOFTWARE IS PROVIDED BY FIRST AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY NONINFRINGEMENT AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL FIRST OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
tools\chocolateyinstall.ps1
$ErrorActionPreference = 'Stop'; # stop on all errors

$toolsDir = "$(Split-Path -parent $MyInvocation.MyCommand.Definition)"

$url32         = 'https://github.com/wpilibsuite/allwpilib/releases/download/v2021.2.1/WPILib_Windows32-2021.2.1.iso'
$url64         = 'https://github.com/wpilibsuite/allwpilib/releases/download/v2021.2.1/WPILib_Windows64-2021.2.1.iso'
$fileName32    = 'WPILibInstaller.exe'
$fileName64    = 'WPILibInstaller.exe'
$isoChecksum32 = '8a0fcfae9f3eed70b33ab9a56f60a1c7c03e5cf78763256a4c7675a5d20fbc89'
$isoChecksum64 = '388d25a0b0cc312546df1c00f51b87c1552ed87eb7367cd2ed058faf6170c0af'

$pp = Get-PackageParameters
$ahkParameters = ""
$ahkParameters += if ($pp.ProgrammingLanguage) { "`"$($pp.ProgrammingLanguage)`"" }
$ahkParameters += if ($pp.CachedZip) { " $($pp.CachedZip)" }
$ahkParameters += if ($pp.AllowUserInteraction) { " $($pp.AllowUserInteraction)" }

$packageArgs = @{
  packageName    = $env:ChocolateyPackageName
  softwareName   = 'WPILib*'
  fileType       = 'EXE'
  checksumType   = 'sha256'
  checksumType64 = 'sha256'
  silentArgs     = '' #none
}
if (Get-ProcessorBits -compare '32') {
  $packageArgs += @{
    Url      = $url32
    file     = $fileName32
    checksum = $isoChecksum32
  }
} elseif (Get-ProcessorBits -compare '64') {
  $packageArgs += @{
    Url      = $url64
    file     = $fileName64
    checksum = $isoChecksum64
  }
}

$ahkExe = "AutoHotKey" # This is a reference to the global AHK exe
$ahkFile = Join-Path $toolsDir "WPILibInstall.ahk"
Write-Debug "Running: $ahkExe `"$ahkFile`"$ahkParameters"
$ahkProc = Start-Process -FilePath $ahkExe -ArgumentList "`"$ahkFile`" $ahkParameters" -Verb RunAs -PassThru

$ahkId = $ahkProc.Id
Write-Debug "$ahkExe start time:`t$($ahkProc.StartTime.ToShortTimeString())"
Write-Debug "Process ID:`t$ahkId"

Install-ChocolateyIsoPackage @packageArgs #https://docs.chocolatey.org/en-us/guides/create/mount-an-iso-in-chocolatey-package
tools\chocolateyuninstall.ps1
#Debug lines can be printed by passing the flag -Debug
$ErrorActionPreference = 'Stop'; # stop on all errors
Write-Host "Beginning uninstall process of WPILib..."

# Variables that will need changed
$year = '2021'

# Generated/Constant Variables
$systemDriveLetter = (Get-WmiObject Win32_OperatingSystem).getPropertyValue("SystemDrive")
$publicUserHome = $systemDriveLetter + "\Users\Public"
$wpiFolder = "$publicUserHome\wpilib"
$userStartMenuFolder = "$HOME\AppData\Roaming\Microsoft\Windows\Start Menu\Programs"
$systemStartMenuFolder = "$systemDriveLetter\ProgramData\Microsoft\Windows\Start Menu\Programs"
$startMenuLinks = @(
  "$year WPILib Tools",
  "$year WPILib Documentation.lnk",
  "$year WPILib VS Code.lnk"
)
$possibleLinkDirectories = @(
  "$HOME\Desktop",
  "$publicUserHome\Desktop",
  "$HOME\OneDrive\Desktop"
)
$linkNames = @(
  "$year WPILib VS Code.lnk",
  "$year WPILib Documentation.lnk",
  "$year WPILib Tools"
)

##### Delete WPILib folder #####
# Check if the inside wpilib folder exists, attempt to delete it, check if was successful
Write-Host "`nRemoving the WPILib folder..."
if (Test-Path -Path "$wpiFolder\$year") {
  Remove-Item "$wpiFolder\$year" -ErrorAction SilentlyContinue -Force -Recurse
  
  if (!(Test-Path -Path "$wpiFolder\$year")) {
    Write-Host "`tRemoved wpilib folder at `"$wpiFolder\$year`"" -ForegroundColor Green
  } else {
    Write-Host "`tAn error occured while trying to delete the wpilib folder at `"$wpiFolder\$year`"" -ForegroundColor Red
  }
} else {
  Write-Host "`tIt appears that the wpilib folder expected at `"$wpiFolder\$year`" does not exists. This could be a good indicator that wpilib (for this year) is not/no longer installed, however the uninstall process will continue to ensure that all elements of wpilib are gone`n" -ForegroundColor Yellow
}

# Delete the outside wpilib folder if it exists and is now empty
if(Test-Path $wpiFolder){
  if ((Get-ChildItem $wpiFolder -force | Select-Object -First 1 | Measure-Object).Count -eq 0) {
    Remove-Item $wpiFolder -ErrorAction SilentlyContinue -Force -Recurse

    if (!(Test-Path -Path $wpiFolder)) {
      Write-Host "`tRemoved the main wpilib folder at `"$wpiFolder`" because it was empty" -ForegroundColor Green
    } else {
      Write-Host "`tAn error occured while trying to delete the main wpilib folder at `"$wpiFolder`"" -ForegroundColor Red
    }
  }
} else {
  Write-Host "`tIt appears that the main wpilib folder at `"$wpiFolder`" does not exists. This could be a good indicator that wpilib is not/no longer installed, however the uninstall process will continue to ensure that all elements of wpilib are gone" -ForegroundColor Yellow
}

##### Delete Desktop Shortcuts ##### 
# Both public and current user desktop. It differes upon whether you select current user or all users when installing. 
# It might be infered that if one link is found the others will be next to it, but that's a dangerous game. Plus what if the links are in multiple places?
Write-Host "`nDeleteing Desktop Shortcuts..."
$LinksFound = ""
foreach ($directory in $possibleLinkDirectories) {
  Write-Host "`tSearching `"$directory`" for links to delete:"
  foreach ($link in $linkNames) {
    # Check for link file, if its there attempt to delete it, recheck if its there.
    if (Test-Path ("{0}\{1}" -f $directory, $link)) {
      $LinksFound = $TRUE
      Remove-Item ("{0}\{1}" -f $directory, $link) -ErrorAction SilentlyContinue -Force -Recurse

      if (!(Test-Path ("{0}\{1}" -f $directory, $link))) {
        Write-Host "`t`tFound and deleted `"$link`" in `"$directory`"" -ForegroundColor Green
      } else {
        Write-Host "`t`tAttempted Deleting `"$link`" in `"$directory`" but could not delete" -ForegroundColor Red
      }
    } else {
      Write-Host "`t`tLooked for `"$link`" in `"$directory`" but found nothing" -ForegroundColor Yellow
    }
  }
}
if (!$LinksFound) {
  Write-Host "`tUnable to find links to be deleted automatically. You will have to manually delete them if you have them in a place other than your desktop." -ForegroundColor Yellow
}

##### Remove Start Menu Shortcuts #####
Write-Host "`nRemoving Start Menu Shortcuts..."
$foundStartMenu = ""
# Check for and delete start menu shortcuts in the user's start menu folder
Write-Host "`tSearching `"$userStartMenuFolder`" for links to delete:"
foreach ($item in $startMenuLinks) {
  if (Test-Path -Path "$userStartMenuFolder\$item") {
    Remove-Item "$userStartMenuFolder\$item" -ErrorAction SilentlyContinue -Force -Recurse
    $foundStartMenu = $TRUE
    
    if (!(Test-Path -Path "$userStartMenuFolder\$item")) {
      Write-Host "`t`tRemoved start menu item at `"$userStartMenuFolder\$item`"" -ForegroundColor Green
    } else {
      Write-Host "`t`tAn error occured while trying to delete the start menu item at `"$userStartMenuFolder\$item`"" -ForegroundColor Red
    }
  } else {
    Write-Host "`t`tLooked for `"$item`" in `"$userStartMenuFolder`" but found nothing" -ForegroundColor Yellow
  }
}
# Check for and delete start menu shortcuts in the system's start menu folder
Write-Host "`tSearching `"$systemStartMenuFolder`" for links to delete:"
foreach ($item in $startMenuLinks) {
  if (Test-Path -Path "$systemStartMenuFolder\$item") {
    Remove-Item "$systemStartMenuFolder\$item" -ErrorAction SilentlyContinue -Force -Recurse
    $foundStartMenu = $TRUE
    
    if (!(Test-Path -Path "$systemStartMenuFolder\$item")) {
      Write-Host "`t`tRemoved start menu item at `"$systemStartMenuFolder\$item`"" -ForegroundColor Green
    } else {
      Write-Host "`t`tAn error occured while trying to delete the start menu item at `"$systemStartMenuFolder\$item`"" -ForegroundColor Red
    } 
  } else {
    Write-Host "`t`tLooked for `"$item`" in `"$userStartMenuFolder`" but found nothing" -ForegroundColor Yellow
  }
}
if (!$foundStartMenu) {
  Write-Host "`tThere is no Start Menu folder to delete. It was either already removed or the wpilib installer was run without admin privlages" -ForegroundColor Yellow
}

Write-Host "`nFinished uninstalling WPILib!" -ForegroundColor Green
tools\WPILibInstall.ahk
#SingleInstance, Force
#NoEnv  ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn  ; Enable warnings to assist with detecting common errors.
SendMode Input  ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir%  ; Ensures a consistent starting directory.
CoordMode, Mouse, Client
CoordMode, Pixel, Client

;;;;; Options ;;;;;
VSCodeZipName := "WPILib-VSCode-1.51.1.zip" ; Default Zip Name
usePreDownloadedZip := "download" ; Default value that controls whether the main zip file will be downloaded(0) or looked for(1).
installModeOption := "both" ; Default value that sets whether or not to install Java(0) mode or C++(1) mode or both(2)
allowUserInteraction := "false" ; Default is to not allow user interaction

;;;;; Contstants ;;;;;
InstallerTitle := "WPILib Installer"
ZipSelecterTitle := "Select VS Code Installer ZIP"
ButtonPixelColor := "0xFFFFFF"
ActualButtonColor := "0xF5F5F5"

;;;;; Parameters ;;;;;
; MsgBox % "Starting with " . A_Args[0] . " parameters: " . A_Args[1] . " " A_Args[2] . " " A_Args[3] . "."

; Parameter for Install Mode Option
if(A_Args[1] != "" and A_Args[1] = "cpp" or A_Args[1] = "java" or A_Args[1] = "both") {
    installModeOption := A_Args[1]
    StringLower, installModeOption, installModeOption
}

; Parameter for whether to download zip or use given or default local zip
if(A_Args[2] = "true") {
    usePreDownloadedZip := "cached"
}
if(A_Args[2] != "" and A_Args[2] != "true" and A_Args[2] != "false") {
    usePreDownloadedZip := "cached"
    VSCodeZipName := A_Args[2]
}

; Parameter for user interaction
if(A_Args[3] = "true") {
    allowUserInteraction := "true"
}

;;;;; Operations ;;;;;
WinWait, %InstallerTitle%
WinActivate, %InstallerTitle%
Sleep, 3000

MouseClick, Left, 594, 360, 1, 0 ; Click Start
Sleep, 5000 

; Selecting the options to either download or choose existing
if (usePreDownloadedZip = "cached") {
    MouseClick, Left, 129, 295, 1, 0 ; Click Use Downloaded Offline Installer

    ; Type in the file name and hit enter
    WinWait, %ZipSelecterTitle%
    Sleep, 300
    SendInput {Raw}%VSCodeZipName%
    Send {Enter}
    Sleep, 300

    MouseClick, Left, 594, 360, 1, 0 ; Click Next
} else {
    MouseClick, Left, 127, 254, 1, 0 ; Click Download
    Sleep, 2000
    While(ButtonPixelColor != ActualButtonColor) { ; Wait for Download to finish and for 'next' button to push 'back' button to the left
        PixelGetColor, ButtonPixelColor, 538, 350
        Sleep, 500
    }
    MouseClick, Left, 594, 360, 1, 0 ; Click Next
}
Sleep, 2000

; Select desired C++ or Java options
; MsgBox % "Selecting Language Options: " . installModeOption
if (installModeOption == "java") {
    MouseClick, Left, 136, 113, 1, 0
} else if (installModeOption == "cpp") {
    MouseClick, Left, 136, 154, 1, 0
} else if (installModeOption == "both") {
    ; Do nothing
}

if !(ErrorLevel) {
    ; MsgBox % "No AHK errors! - GO!"
    if (allowUserInteraction == "false") {
        MouseClick, Left, 438, 265, 1, 0 ; Click Install for all Users
        Sleep, 5000

        ButtonPixelColor := "0xFFFFFF"
        While(ButtonPixelColor != ActualButtonColor) { ; Wait for installation to finish and for 'finish' button to appear
            PixelGetColor, ButtonPixelColor, 599, 381
            Sleep, 1000
        }
        MouseClick, Left, 591, 362, 1, 0 ; Click Finish
    } else {
        MsgBox % "Ending to allow user interaction."
    }
} else {
   MsgBox % "AHK ERROR!!" 
}

Log in or click on link to see number of positives.

In cases where actual malware is found, the packages are subject to removal. Software sometimes has false positives. Moderators do not necessarily validate the safety of the underlying software, only that a package retrieves software from the official distribution point and/or validate embedded software against official distribution point (where distribution rights allow redistribution).

Chocolatey Pro provides runtime protection from possible malware.

Version Downloads Last Updated Status
WPILib 2021.1.2.20210123 25 Tuesday, January 26, 2021 Approved
WPILib 2021.1.2 37 Friday, January 8, 2021 Approved
WPILib 2021.1.1-beta4 14 Wednesday, January 6, 2021 Exempted
WPILib 2020.3.2 60 Sunday, January 3, 2021 Approved
Discussion for the WPILib Package

Ground Rules:

  • This discussion is only about WPILib and the WPILib package. If you have feedback for Chocolatey, please contact the Google Group.
  • This discussion will carry over multiple versions. If you have a comment about a particular version, please note that in your comments.
  • The maintainers of this Chocolatey Package will be notified about new comments that are posted to this Disqus thread, however, it is NOT a guarantee that you will get a response. If you do not hear back from the maintainers after posting a message below, please follow up by using the link on the left side of this page or follow this link to contact maintainers. If you still hear nothing back, please follow the package triage process.
  • Tell us what you love about the package or WPILib, or tell us what needs improvement.
  • Share your experiences with the package, or extra configuration or gotchas that you've found.
  • If you use a url, the comment will be flagged for moderation until you've been whitelisted. Disqus moderated comments are approved on a weekly schedule if not sooner. It could take between 1-5 days for your comment to show up.
comments powered by Disqus