Thursday, October 14, 2021

Managing Multiple Sotware Development Kits Using Scoop On Windows



I think we can see this is part two of the article I wrote, Managing Multiple Software Development Kits Using SDK Man!. Even though one can set up SDK Man on Windows OS, it's a bit more involved compared to setting it up on a Unix based OS out of the box. I mentioned that one would need to work with Cygwin, with the link specified in that article. So please note I am not saying it's impossible, I would just like to share something that I think can be easier on Windows OS. 

So as you know there are various package managers to managing OS packages and SDKs, i.e. Homebrew & Macports for Mac OS, Apt-Get on some Linux Distros. With Winnows OS it is a bit tricky but, I love the idea that there's something that was inspired by Homebrew for Mac OS which is called Scoop

Scoop allows one to manage Tools, Software Development Kits and Packages. Please read up on my previous article I wrote and mentioned above, it will give you an idea on what I am trying to highlight in this article. I this article it's more about Windows OS.

Let's Get Started!

To setup Scoop you will need Powershell 5 and later, I am using Powershell 7. Open up your Powershell terminal to install Scoop, with the following command : 

# Installing Scoop
Invoke-Expression (New-Object System.Net.WebClient).DownloadString('')

Scoop Installation

As shown in the image above, an indication that Scoop has been installed successfully. At times you may get an error especially if it's the first time you are using Powershell on that machine. I think some permissions need to be enabled since they are disabled out the box. If you try running the installation command as shown above and you get an error then run the following command to enable Powershell

# Permissions to enable Powershell
Set-ExecutionPolicy RemoteSigned -scope CurrentUser
So that's it, you have setup Scoop on your machine! 



Down To Work

To setup Scoop you will need Powershell 5 and later. Open up your Powershell terminal to install Scoop, with the following command : 

  • You have installed Scoop and there are no SDKs or packages installed. So you can check that out by  running :

    # List installed SDKs / Tools / Packages
    scoop list

Scoop List

  • Now you want to install something like Gradle. Double check first that you don't have Gradle on your machine :

    # Check Gradle version
    gradle -version

Gradle Version

  • You are happy that Gradle is not installed and want to now install it, so because you want the latest version of Gradle you don't specify the version in your command, also noted that depending on your internet speed this may be either quick or slow. Scoop will try to download your Gradle and also work on extracting it. 

    # Check Gradle version
    scoop install gradle

Scoop Gradle Installation

Yay! Gradle installed successfully, notice we are now dealing with version 7.2, which is the latest at the time of this article. 
  • Now you can run two commands to validate that Gradle is really installed. You can run the same gradle -version command we ran above or run a scoop command to list installed Gradles on your machine.

    # List Installed Gradles On Machine
    scoop list gradle

Scoop List Gradle

  • Say you don't want the latest Gradle because you inherited a project that uses an earlier version 6.9. Then you would do it this way by specifying the version after the "@" symbol.

    # Install Specific Version Of Gradle
    scoop install gradle@6.9

Scoop Install Specific Gradle Version

  • The installation is done and your current version is set to Gradle 7.2 if you run the gradle -version or gradle -v command. At this point you are ready to use Gradle 6.9 so let's change the machine gradle version.

    # Set Specific Gradle Version
    scoop reset gradle@6.9

Scoop Setting Specific Gradle Version

Gradle Version Validation

You can see that your version has now changed. Meaning the "reset" command worked. So it's an easy way of switching across multiple versions of the same tool or SDK.

  • You want to run a check on versions intalled on your machine just to be clear.

    # Get Info On Gradle On The Machine
    scoop info gradle

Scoop Info Gradle

  • Now you feel that the latest version is of Gradle ( 7.2 ) is not necessary at this point and you would like to remove it. So at the moment there's a ticket GitHub #3733 logged to add this feature. Something that's much like the "reset" with specified version. At the moment you will have to remove the version manually in your scoop directory. These directories are similar to SDK Man folders, there are minor differences with regards to the structure and folder names and yes, you spotted the folder names in the info command screenshot above. To verify that Gradle 7.2 is gone you can just try to switch to it via Scoop

    # Get Info On Gradle On The Machine
    scoop reset gradle@7.2

    Scoop Reset To Removed Version

There you have it. Checking the Gradle version should give you 6.9 now since you recently reset to it and then you removed 7.2. Let's keep a close eye to see if this "uninstall" will be added soon.


Above & Beyond

Scoop is a powerful tool that brings that Homebrew feel to Windows OS. There's more you can do with it than manging SDK. You can download add Curl you can add Git plugings like with have with ZShell's Oh My ZSH! for Unix platforms. You can add SSH to you machine for quick SSH Commands on your Powershell window and many more. 
Also note that just like in the previous article, you now know where the folders are and can point your IDE to them. I hope that if you are using Windows OS then you will find this tool really helpful. 

Thanks for reading and pleaes leave comments in the section below. Until next time!

No comments:

Post a Comment