Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 39 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Repository Guidelines

This monorepo hosts Rollbar SDKs for Dart and Flutter. Use the package-level READMEs for usage examples, and follow the guidelines below when contributing.

## Project Structure & Module Organization

- `rollbar_common/`: shared Dart core (models, serialization, extensions) used by both SDKs; tests live in `rollbar_common/test`.
- `rollbar_dart/`: pure Dart notifier package with examples in `rollbar_dart/example` and tests in `rollbar_dart/test`.
- `rollbar_flutter/`: Flutter plugin and platform integration; Dart sources in `rollbar_flutter/lib`, native code in `rollbar_flutter/android` and `rollbar_flutter/ios`, tests in `rollbar_flutter/test`, and a sample app in `rollbar_flutter/example`.
- `build_tools/`: scripts for linting, tests, builds, and publishing.

## Build, Test, and Development Commands

- `./build_tools/check.sh`: runs the standard CI-style pipeline across packages (pub get, `flutter test`, `flutter analyze`, `pana`, Gradle checks, and example builds).
- `./build_tools/build.sh -d rollbar_dart test`: run a single task in one package (tasks include `pub-get`, `test`, `analyze`, `pana`, `gradle-check`, `example-android`, `example-ios`).
- `./build_tools/clean.sh`: `flutter clean` for all packages.
- `cd rollbar_flutter/example && flutter run`: run the Flutter example app locally.

## Coding Style & Naming Conventions

- Dart code follows standard formatting (2-space indent) and analyzer rules from `analysis_options.yaml` in each package.
- Lints include `prefer_single_quotes`, `always_declare_return_types`, and `unawaited_futures` (plus `sort_child_properties_last` in `rollbar_dart`).
- Use Dart naming conventions: `UpperCamelCase` for types, `lowerCamelCase` for members, `snake_case` for files.

## Testing Guidelines

- Tests are organized under each package’s `test/` directory and run via `flutter test` from that package root.
- Android unit tests live under `rollbar_flutter/android/src/test`.
- Add or update tests for new behavior; there is no explicit coverage gate, but regression tests are expected.

## Commit & Pull Request Guidelines

- Commit messages are short and imperative; optional type/scope prefixes are common (e.g., `feat: ...`, `fix(android): ...`, `doc: ...`).
- Before opening a PR, run `./build_tools/check.sh` and note results in the PR description.
- Link relevant issues and describe platform-specific changes (Dart vs. Flutter, Android vs. iOS) clearly.

## Security & Configuration Tips

- Never commit real Rollbar access tokens; use placeholders like `YOUR-ROLLBAR-ACCESSTOKEN` in examples and tests.
2 changes: 1 addition & 1 deletion build_tools/SDK_VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
3.38.5
3.38.4
13 changes: 5 additions & 8 deletions rollbar_flutter/example/android/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
plugins {
id "com.android.application"
id "dev.flutter.flutter-gradle-plugin"
}

def localProperties = new Properties()
def localPropertiesFile = rootProject.file('local.properties')
if (localPropertiesFile.exists()) {
Expand All @@ -6,11 +11,6 @@ if (localPropertiesFile.exists()) {
}
}

def flutterRoot = localProperties.getProperty('flutter.sdk')
if (flutterRoot == null) {
throw new GradleException("Flutter SDK not found. Define location with flutter.sdk in the local.properties file.")
}

def flutterVersionCode = localProperties.getProperty('flutter.versionCode')
if (flutterVersionCode == null) {
flutterVersionCode = '1'
Expand All @@ -21,9 +21,6 @@ if (flutterVersionName == null) {
flutterVersionName = '1.0'
}

apply plugin: 'com.android.application'
apply from: "$flutterRoot/packages/flutter_tools/gradle/flutter.gradle"

android {
compileSdkVersion flutter.compileSdkVersion

Expand Down
11 changes: 0 additions & 11 deletions rollbar_flutter/example/android/build.gradle
Original file line number Diff line number Diff line change
@@ -1,14 +1,3 @@
buildscript {
repositories {
google()
mavenCentral()
}

dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
}
}

allprojects {
repositories {
google()
Expand Down
29 changes: 21 additions & 8 deletions rollbar_flutter/example/android/settings.gradle
Original file line number Diff line number Diff line change
@@ -1,11 +1,24 @@
include ':app'
pluginManagement {
def flutterSdkPath = {
def properties = new Properties()
file("local.properties").withInputStream { properties.load(it) }
def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
return flutterSdkPath
}()

def localPropertiesFile = new File(rootProject.projectDir, "local.properties")
def properties = new Properties()
includeBuild("$flutterSdkPath/packages/flutter_tools/gradle")

assert localPropertiesFile.exists()
localPropertiesFile.withReader("UTF-8") { reader -> properties.load(reader) }
repositories {
google()
mavenCentral()
gradlePluginPortal()
}
}

def flutterSdkPath = properties.getProperty("flutter.sdk")
assert flutterSdkPath != null, "flutter.sdk not set in local.properties"
apply from: "$flutterSdkPath/packages/flutter_tools/gradle/app_plugin_loader.gradle"
plugins {
id "dev.flutter.flutter-plugin-loader" version "1.0.0"
id "com.android.application" version "7.1.2" apply false
}

include ":app"
Loading