Skip to content

Latest commit

 

History

History
153 lines (125 loc) · 9.92 KB

CONTRIBUTING.md

File metadata and controls

153 lines (125 loc) · 9.92 KB

Contributing

Please submit contributions as PRs against the main branch. PRs must pass all checks to merge.

Format your commit messages as conventional commits. If the changes of a PR are limited to a single package use it as the commit message's scope, e.g. feat(cbl): ....

Dart packages

All Dart code is organized into several packages.

Package Description Pub Internal
cbl Dart API Couchbase Lite
cbl_dart Package to use Couchbase Lite in pure Dart apps
cbl_e2e_tests E2E tests
cbl_e2e_tests_flutter E2E tests runner for Flutter
cbl_e2e_tests_standalone_dart E2E tests runner for standalone Dart
cbl_libcblite_api Marker package for API versions of libcblite 🔴
cbl_libcblitedart_api Marker package for API versions of libcblitedart 🔴
cbl_flutter Flutter plugin for Couchbase Lite (frontend)
cbl_flutter_platform_interface Platform interface for cbl_flutter 🔴
cbl_flutter_local Platform implementation of cbl_flutter for development
cbl_flutter_prebuilt Platform implementations of cbl_flutter based on prebuilt official binaries. Generates the cbl_flutter_ce and cbl_flutter_ee package.
cbl_flutter_prebuilt_e2e_tests E2E test for packages generated by cbl_flutter_prebuilt
cbl_flutter_ce Platform implementation of cbl_flutter for the Community Edition
cbl_flutter_ee Platform implementation of cbl_flutter for the Enterprise Edition
cbl_sentry Sentry integration for Couchbase Lite
cbl_generator Code generation for Couchbase Lite

Native libraries

Two native libraries are required to enable Couchbase Lite for Dart.

Library Description
libcblite Couchbase Lite C
libcblitedart Support library required by Dart to make use of Couchbase Lite C

Development environment

Requirements

  • Flutter (stable)
  • melos
    flutter pub global activate melos

Linux

Dependencies:

  • CMake 3.12+
  • ninja-build
  • GCC/Clang

Android

Dependencies:

  • Android SDK with NDK 23.1.7779620 and CMake 3.18.1

iOS + macOS

Dependencies:

  • XCode 12+
  • xcpretty (gem install xcpretty)
  • CMake 3.12+

Get started

  1. Fork and clone the repo:
    git clone https://github.com/$YOUR_USERNAME$/cbl-dart.git
  2. Build the generated Flutter packages:
    melos run build:cbl_flutter_prebuilt
  3. Build the native libraries for the host target:
    melos run build:nativeLibraries
  4. Bootstrap the Dart packages so they depend on the local versions of their siblings:
    melos bootstrap

Running tests

The cbl package is pure Dart and has unit tests, which can be run through the normal methods, e.g dart test/flutter test or the IDE. These unit tests only test components which are independent of the native libraries.

To ensure good test coverage a suite of E2E tests is maintained in cbl_e2e_tests. This package is not used to run the tests, through.

To execute them against a standalone Dart VM you need to go though the cbl_e2e_tests_standalone_dart package. The test files have been symbolically linked from cbl_e2e_test/lib/src to cbl_e2e_tests_standalone_dart/test/cbl_e2e_tests to support launching them from an IDE and easy editing. All the normal methods to run unit tests in Dart packages work.

The story for executing tests in the context of Flutter is similar. Here the tests have been linked into cbl_e2e_tests_flutter/integration_test/cbl_e2e_tests. The difference is that the tests are not configured as Flutter unit tests, but instead as Flutter integration tests. Integration tests can can be launched through the IDE or through flutter test with a specific test file in integration_test. By using integration_test/e2e_test.dart as the test file all tests are executed.