diff --git a/AGENTS.md b/AGENTS.md new file mode 100644 index 00000000..c99c5d46 --- /dev/null +++ b/AGENTS.md @@ -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. diff --git a/build_tools/SDK_VERSION b/build_tools/SDK_VERSION index f94ed442..bef80db4 100644 --- a/build_tools/SDK_VERSION +++ b/build_tools/SDK_VERSION @@ -1 +1 @@ -3.38.5 +3.38.4 diff --git a/rollbar_flutter/example/android/app/build.gradle b/rollbar_flutter/example/android/app/build.gradle index a1baf606..3b02d5dd 100644 --- a/rollbar_flutter/example/android/app/build.gradle +++ b/rollbar_flutter/example/android/app/build.gradle @@ -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()) { @@ -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' @@ -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 diff --git a/rollbar_flutter/example/android/build.gradle b/rollbar_flutter/example/android/build.gradle index 2eb4306a..bc157bd1 100644 --- a/rollbar_flutter/example/android/build.gradle +++ b/rollbar_flutter/example/android/build.gradle @@ -1,14 +1,3 @@ -buildscript { - repositories { - google() - mavenCentral() - } - - dependencies { - classpath 'com.android.tools.build:gradle:7.1.2' - } -} - allprojects { repositories { google() diff --git a/rollbar_flutter/example/android/settings.gradle b/rollbar_flutter/example/android/settings.gradle index 44e62bcf..cd3231ed 100644 --- a/rollbar_flutter/example/android/settings.gradle +++ b/rollbar_flutter/example/android/settings.gradle @@ -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"