Skip to content

Setting up your local development environment

Fernando Trigoso edited this page May 16, 2023 · 5 revisions

The Monarch team has worked hard to make the contribution workflow easy. The Monarch repo has many build scripts which ease the contribution experience.

The build scripts can be run from macOS, Windows, or Linux.

Prerequisites

  1. On macOS, make sure you have Xcode installed.
  2. On Windows, make sure you have Visual Studio 2022 with the “Desktop development with C++” workload installed, including all of its default components.
  3. On Linux, make sure you have the Additional Linux requirements and also install sudo apt install lib32stdc++-12-dev (Flutter documentation issue).

Local setup

The steps below will help you set up Monarch in your local environment.

Set up your local repo

  1. Clone this repo to your local environment.

  2. Create a cli/lib/settings.dart file with these contents:

const kDeployment = 'local';
const kElasticsearchEndpoint = '';
const kElasticsearchUsername = '';
const kElasticsearchPassword = '';
const kVersionApiUrl = '';
  1. Create a file tools/local_settings.yaml, and declare the paths to the local Flutter SDKs you want to use for Monarch:
local_flutter_sdks:
  - /Users/bob/development/flutter-sdks/beta
  - /Users/bob/development/flutter-sdks/stable

Monarch Linux works on Flutter 3.9 or above.

Build Monarch locally

  1. Run dart pub get inside the tools directory:
cd tools
dart pub get
  1. From the monarch root directory, use the tools/build.dart script to build Monarch:
dart tools/build.dart all

The tools/build.dart script has many subcommands. To get more details run:

dart tools/build -h

The build script will output the built artifacts to the out directory.

Run tests

  1. Run all the Monarch tests:
dart tools/test.dart

The tools/test.dart script accepts many arguments. To get more details run:

dart tools/test.dart -h

Run Monarch

  1. Run the version of Monarch you just built against a new Flutter project:
flutter create my_project
cd my_project
/path/to/out/monarch/bin/monarch init
/path/to/out/monarch/bin/monarch run --verbose

To make things easier, you could add the out/monarch/bin directory to your PATH.