Skip to content

Repo structure multi plugins #940

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 20 commits into
base: main
Choose a base branch
from
Draft
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
101 changes: 47 additions & 54 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,15 @@ commands:
fingerprints:
- "9d:db:07:0b:62:81:11:c3:46:21:8e:fa:51:99:80:2d"

setup-flutter:
parameters:
app-dir:
type: string
steps:
- flutter/install_sdk_and_pub:
version: 3.27.0
app-dir: << parameters.app-dir >>

slack-notify-failure-if-any:
steps:
- slack/notify:
Expand All @@ -60,23 +69,9 @@ commands:
"type": "section",
"text": {
"type": "mrkdwn",
"text": "`$CIRCLE_JOB` <$CIRCLE_BUILD_URL|failed> for <https://github.com/mapbox/mapbox-maps-flutter/commit/$CIRCLE_SHA1|${CIRCLE_SHA1:0:6}> by `$(git log --format='%an' -n 1 $CIRCLE_SHA1)` on $(if [ \"$CIRCLE_BRANCH\" == \"main\" ]; then echo 'the'; fi) `${CIRCLE_TAG:-$CIRCLE_BRANCH}` ${CIRCLE_TAG:+tag}${CIRCLE_BRANCH:+branch}."
"text": "`$CIRCLE_JOB` <$CIRCLE_BUILD_URL|failed> for commit ${CIRCLE_SHA1:0:6} on `${CIRCLE_TAG:-$CIRCLE_BRANCH}` ${CIRCLE_TAG:+tag}${CIRCLE_BRANCH:+branch}."
}
},
{
"type": "rich_text",
"elements": [
{
"type": "rich_text_quote",
"elements": [
{
"type": "text",
"text": "$(git log --format=%s -n 1 $CIRCLE_SHA1)"
}
]
}
]
},
{
"type": "section",
"fields": [
Expand All @@ -90,53 +85,50 @@ commands:
}

jobs:

build-android:
parameters:
workspace-path:
type: string
default: example/build/app/outputs/apk
default: mapbox_maps_flutter_mobile/example/build/app/outputs/apk
docker:
- image: cimg/android:2024.01.1
resource_class: 2xlarge
steps:
- checkout
- flutter/install_sdk_and_pub:
version: 3.24.3
app-dir: example
- setup-flutter:
app-dir: mapbox_maps_flutter_mobile/example
- run:
name: ktlint
working_directory: example/android
working_directory: mapbox_maps_flutter_mobile/example/android
command: ./gradlew ktlint
- run:
name: unit test
command: flutter test test
command: flutter test mapbox_maps_flutter_mobile/test
- run:
name: "Build Android integration tests"
working_directory: example/android
name: Build Android integration tests
working_directory: mapbox_maps_flutter_mobile/example/android
command: |
./gradlew app:assembleAndroidTest --stacktrace
./gradlew app:assembleDebug -Ptarget=integration_test/all_test.dart -Pdart-defines="$(echo -n "ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN" | base64 -w 0)" --stacktrace
./gradlew app:assembleDebug -Ptarget=integration_test/all_test.dart -Pdart-defines="$(echo -n \"ACCESS_TOKEN=$MAPBOX_ACCESS_TOKEN\" | base64 -w 0)" --stacktrace
- persist_to_workspace:
root: << parameters.workspace-path >>
paths:
- debug/app-debug.apk
- androidTest/debug/app-debug-androidTest.apk
- slack-notify-failure-if-any


run-android-tests-firebase:
parameters:
workspace-path:
type: string
default: example/build/app/outputs/apk
default: mapbox_maps_flutter_mobile/example/build/app/outputs/apk
executor: firebase-test-runner
steps:
- attach_workspace:
at: << parameters.workspace-path >>
- setup-gcloud
- run:
name: "Run Android integration tests on Firebase"
name: Run Android integration tests on Firebase
no_output_timeout: 20m
command: |
gcloud firebase test android run --type instrumentation \
Expand All @@ -156,34 +148,28 @@ jobs:
parameters:
workspace-path:
type: string
default: example/build/output
default: mapbox_maps_flutter_mobile/example/build/output
executor: macos-xcode-latest
steps:
- checkout
- inject-netrc-credentials
- add-mapbox-submodules-key
- macos/install-rosetta
- flutter/install_sdk_and_pub:
version: 3.24.3
app-dir: example
- setup-flutter:
app-dir: mapbox_maps_flutter_mobile/example
- run:
name: swiftlint
working_directory: ios/mapbox_maps_flutter
working_directory: mapbox_maps_flutter_mobile/ios/mapbox_maps_flutter
command: HOMEBREW_NO_AUTO_UPDATE=1 brew install swiftlint; swiftlint lint --strict
- run:
name: unit test
command: flutter test test
command: flutter test mapbox_maps_flutter_mobile/test
- run:
name: "Build iOS integration tests"
name: Build iOS integration tests
command: |
pushd example

# required to init configs that pass environment variables to fastlane later
flutter build ios --config-only integration_test/all_test.dart \
--release --dart-define=ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}

popd # to repo root

pushd mapbox_maps_flutter_mobile/example
flutter build ios --config-only integration_test/all_test.dart --release --dart-define=ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}
popd
bundle install
bundle exec fastlane build_examples_tests
- persist_to_workspace:
Expand All @@ -196,14 +182,14 @@ jobs:
parameters:
workspace-path:
type: string
default: example/build/output
default: mapbox_maps_flutter_mobile/example/build/output
executor: firebase-test-runner
steps:
- attach_workspace:
at: << parameters.workspace-path >>
- setup-gcloud
- run:
name: "Run iOS integration tests on Firebase"
name: Run iOS integration tests on Firebase
no_output_timeout: 20m
command: |
gcloud firebase test ios run \
Expand All @@ -214,17 +200,17 @@ jobs:
--client-details matrixLabel="${CIRCLE_JOB}-${CIRCLE_SHA1:0:6}" 2>&1 | tee firebase_test_lab_run.log
- run:
name: Download XCResults
when: always
command: |
TEST_LAB_PATH=$(cat firebase_test_lab_run.log | grep -o "test-lab.*/")

TEST_LAB_PATH=$(grep -o "test-lab.*/" firebase_test_lab_run.log)
mkdir testlab_results
gsutil -m cp -r "gs://${TEST_LAB_PATH}i*" testlab_results
zip -r testlab_results.zip testlab_results
when: always
- store_artifacts:
path: firebase_test_lab_run.log
- store_artifacts:
path: testlab_results.zip
destination: ios/testlab_results.zip
- store_test_results:
path: testlab_results
- slack-notify-failure-if-any
Expand All @@ -235,18 +221,24 @@ jobs:
resource_class: small
steps:
- checkout
- flutter/install_sdk_and_pub:
version: 3.27.0
- setup-flutter:
app-dir: .
- run:
name: Check license
command: bash scripts/license.sh --mode validate
name: Install dependencies for examples
command: |
dart pub get -C mapbox_maps_flutter_mobile/example
dart pub get -C mapbox_maps_flutter_web/example
dart pub get -C mapbox_maps_flutter_v3/example
- run:
name: Check license for mapbox_maps_flutter_mobile
command: bash scripts/license.sh mapbox_maps_flutter --mode=validate
- run:
name: Run dart analyze
command: dart analyze
- run:
name: Check all tests are in the test suite
command: dart ../scripts/check_test_suite.dart
working_directory: example
working_directory: mapbox_maps_flutter_mobile/example
command: dart ../../scripts/check_test_suite.dart
- check-api-breakage

workflows:
Expand All @@ -267,6 +259,7 @@ executors:
resource_class: macos.m1.medium.gen1
macos:
xcode: 16.0.0

firebase-test-runner:
resource_class: small
docker:
Expand Down
12 changes: 6 additions & 6 deletions .fastlane/Fastfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,34 +10,34 @@ platform :ios do
sync_code_signing(type: "development")
update_code_signing_settings(
use_automatic_signing: false,
path: "example/ios/Runner.xcodeproj",
path: "mapbox_maps_flutter_mobile/example/ios/Runner.xcodeproj",
team_id: "GJZR2MEM28", # Developer Portal Team ID,
profile_name: lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]["com.mapbox.maps.FlutterMapsExample"],
targets: ["Runner"],
code_sign_identity: "Apple Development: Created via API",
)
update_code_signing_settings(
use_automatic_signing: false,
path: "example/ios/Runner.xcodeproj",
path: "mapbox_maps_flutter_mobile/example/ios/Runner.xcodeproj",
team_id: "GJZR2MEM28", # Developer Portal Team ID,
profile_name: lane_context[SharedValues::MATCH_PROVISIONING_PROFILE_MAPPING]["com.mapbox.maps.FlutterRunnerTests"],
targets: ["RunnerTests"],
code_sign_identity: "Apple Development: Created via API",
)
# build tests archive in the `output_directory` to launch on firebase
run_tests(
workspace: 'example/ios/Runner.xcworkspace',
workspace: 'mapbox_maps_flutter_mobile/example/ios/Runner.xcworkspace',
scheme: 'Runner', # XCTest scheme
xcconfig: "example/ios/Flutter/Release.xcconfig",
derived_data_path: "example/build/output",
xcconfig: "mapbox_maps_flutter_mobile/example/ios/Flutter/Release.xcconfig",
derived_data_path: "mapbox_maps_flutter_mobile/example/build/output",
configuration: "Release",
xcargs: "SWIFT_TREAT_WARNINGS_AS_ERRORS=NO COMPILER_INDEX_STORE_ENABLE=NO",
skip_detect_devices: true, # Required
build_for_testing: true, # Required
sdk: 'iphoneos', # Required
should_zip_build_products: true, # Must be true to set the correct format for Firebase Test Lab,
result_bundle: true,
output_directory: "example/build/output/",
output_directory: "mapbox_maps_flutter_mobile/example/build/output/",
code_coverage: true
)
end
Expand Down
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@
.buildlog/
.history
.svn/
**/.cxx


# IntelliJ related
*.iml
Expand Down
4 changes: 0 additions & 4 deletions example/android/gradle.properties

This file was deleted.

10 changes: 10 additions & 0 deletions mapbox_maps_flutter_interface/.metadata
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# This file tracks properties of this Flutter project.
# Used by Flutter tool to assess capabilities and perform upgrades etc.
#
# This file should be version controlled and should not be manually edited.

version:
revision: "c23637390482d4cf9598c3ce3f2be31aa7332daf"
channel: "stable"

project_type: package
3 changes: 3 additions & 0 deletions mapbox_maps_flutter_interface/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## 0.0.1

* TODO: Describe initial release.
1 change: 1 addition & 0 deletions mapbox_maps_flutter_interface/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
39 changes: 39 additions & 0 deletions mapbox_maps_flutter_interface/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<!--
This README describes the package. If you publish this package to pub.dev,
this README's contents appear on the landing page for your package.
For information about how to write a good package README, see the guide for
[writing package pages](https://dart.dev/tools/pub/writing-package-pages).
For general information about developing packages, see the Dart guide for
[creating packages](https://dart.dev/guides/libraries/create-packages)
and the Flutter guide for
[developing packages and plugins](https://flutter.dev/to/develop-packages).
-->

TODO: Put a short description of the package here that helps potential users
know whether this package might be useful for them.

## Features

TODO: List what your package can do. Maybe include images, gifs, or videos.

## Getting started

TODO: List prerequisites and provide or point to information on how to
start using the package.

## Usage

TODO: Include short and useful examples for package users. Add longer examples
to `/example` folder.

```dart
const like = 'sample';
```

## Additional information

TODO: Tell users more about the package: where to find more information, how to
contribute to the package, how to file issues, what response they can expect
from the package authors, and more.
8 changes: 8 additions & 0 deletions mapbox_maps_flutter_interface/analysis_options.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
include: package:flutter_lints/flutter.yaml

analyzer:
errors:
library_private_types_in_public_api: error

# Additional information about this file can be found at
# https://dart.dev/guides/language/analysis-options
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
library mapbox_maps_flutter_interface;

export 'src/mapbox_maps_flutter_platform_interface.dart';
export 'src/map_interface.dart';
export 'src/callbacks.dart';
export 'package:turf/helpers.dart';

import 'dart:convert';

import 'package:turf/turf.dart' as turf;

part 'src/pigeons/platform_interface_data_types.dart';
part 'src/turf_adapter.dart';
3 changes: 3 additions & 0 deletions mapbox_maps_flutter_interface/lib/src/callbacks.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import 'package:mapbox_maps_flutter_interface/mapbox_maps_flutter_interface.dart';

typedef OnMapCreated = void Function(MapboxMapInterface mapboxMap);
18 changes: 18 additions & 0 deletions mapbox_maps_flutter_interface/lib/src/map_interface.dart
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import 'package:mapbox_maps_flutter_interface/mapbox_maps_flutter_interface.dart';

/// An abstract base class that defines the interface for interacting with a Mapbox map.
///
/// This interface provides methods for setting the camera options and retrieving the current camera state.
abstract base class MapboxMapInterface {
/// Sets the camera options for the map.
///
/// [cameraOptions] - The desired camera options to apply to the map.
///
/// Returns a [Future] that completes when the camera options have been applied.
Future<void> setCamera(CameraOptions cameraOptions);

/// Retrieves the current state of the camera.
///
/// Returns a [Future] that completes with the current [CameraState] of the map.
Future<CameraState> getCameraState();
}
Loading