Skip to content

Developer Getting Started Guide

Charles Gagnon edited this page Apr 29, 2021 · 46 revisions

In order to download necessary tools, clone the repository, and install dependencies via yarn you need network access.

You'll need the following tools:

  • Git
  • Node.JS, x64, version >= 10.x, <= 14.x
  • Yarn, follow the installation guide
  • Python (required for node-gyp; check the node-gyp readme for the currently supported Python versions)
    • Note: Python will be automatically installed for Windows users through installing windows-build-tools npm module (see below)
  • A C/C++ compiler tool chain for your platform:
    • Windows

      • Set a PYTHON environment variable pointing to your python.exe. E.g.: C:\Python\python.exe
      • Install a compiler for the native modules VS Code is depending on
        • Option 1 (recommended): Use Windows Build Tools npm module

          • Start Powershell as Administrator and install Windows Build Tools npm module (documentation).

            Note: If you get The build tools for v141 (Platform Toolset = 'v141') cannot be found when you run yarn later, you might need to delete VCTargetsPath from your environment variables before installing.

             npm install --global windows-build-tools --vs2017
            

            Note: The --debug flag is helpful if you encounter any problems during installation.

            Note: if you have installed a previous version of the build tools using the --vs2015 flag you need to uninstall the build tools first using npm uninstall global windows-build-tools and the Windows Control Panel to uninstall the binaries.

        • Option 2: Use Visual Studio 2019

      • Restart your computer
      • Warning: Make sure your profile path only contains ASCII letters, e.g. John, otherwise it can lead to node-gyp usage problems (nodejs/node-gyp/issues#297)
      • Note: Building and debugging via the Windows subsystem for Linux (WSL) is currently not supported.
    • macOS

      • Xcode and the Command Line Tools, which will install gcc and the related toolchain containing make
        • Run xcode-select --install to install the Command Line Tools
    • Linux

      • On Debian-based Linux: sudo apt-get install build-essential g++ libx11-dev libxkbfile-dev libsecret-1-dev python-is-python3
      • On Red Hat-based Linux: sudo yum groupinstall "Development Tools" && sudo yum install libX11-devel.x86_64 libxkbfile-devel.x86_64 libsecret-devel # or .i686.
      • Others:
      • Building deb and rpm packages requires fakeroot and rpm, run: sudo apt-get install fakeroot rpm

Troubleshooting

In case of issues, try deleting the contents of ~/.node-gyp (alternatively ~/.cache/node-gyp for Linux, ~/Library/Caches/node-gyp/ for macOS or %USERPROFILE%\AppData\Local\node-gyp for Windows) first and then run yarn cache clean and then try again.

If you are on Windows or Linux 64 bit systems and would like to compile to 32 bit, you'll need to set the npm_config_arch environment variable to ia32 before running yarn. This will compile all native node modules for a 32 bit architecture.

Note: For more information on how to install NPM modules globally on UNIX systems without resorting to sudo, refer to this guide.

If you have Visual Studio 2019 installed, you may face issues when using the default version of node-gyp. If you have Visual Studio 2019 installed, you may need to follow the solutions here

Recommended Tools

  • VSCode We have multiple integrations with VSCode's task system so it's highly recommended to use that as your Editor/IDE.

Source Code

Getting Authenticated

If you're a new Microsoft employee, you will need to connect your Github account to the Microsoft org. Follow the instructions at https://docs.opensource.microsoft.com/tools/github/accounts/linking.html and join the Microsoft org.

If you're an outside contributor, simply fork the codebase and make a PR against ours with your changes.

Compiling

git clone https://github.com/microsoft/azuredatastudio
cd azuredatastudio
yarn
yarn run watch

Note: When you run 'yarn' if you hit the error gyp ERR! stack Error: spawn C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\15.0\Bin\MSBuild.exe ENOENT, change the config to use version 2015:

npm config set msvs_version 2015

Running

VSCode

Go to debugging -> Launch azuredatastudio

OS X and Linux

./scripts/sql.sh

Windows

.\scripts\sql.bat

Creating optimized builds

This step isn't necessary for development, but if you want to create a build with optimized code for production. Essentially a "release" quality build:

REM for windows
yarn run gulp vscode-win32-x64
cd ../azureadatastudio-windows-x64
# for macOS
yarn run gulp vscode-darwin
cd ../azureadatastudio-darwin

# for linux
yarn run gulp vscode-linux-x64
cd ../azureadatastudio-linux-x64

Cleaning the repo

Sometimes we have breaking changes that require the entire code to be rebuilt. For example, if we upgrade the electron version of the code, everyone's local development environment will break. To handle this scenario, we do a git clean. This restores the locally cloned repository to its original form:

git clean -fxd

Additionally sometimes we need to clean the cache manually which is located at C:\Users{userName}\AppData\Roaming\AzureDataStudio. By doing this all saved servers and their logins will be cleared.

Clone this wiki locally