Skip to content

Commit

Permalink
Initial commit.
Browse files Browse the repository at this point in the history
  • Loading branch information
yunikkk committed Sep 29, 2022
0 parents commit 11a4687
Show file tree
Hide file tree
Showing 404 changed files with 159,338 additions and 0 deletions.
98 changes: 98 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# Use the latest 2.1 version of CircleCI pipeline process engine.
# See: https://circleci.com/docs/2.0/configuration-reference
version: 2.1

orbs:
# https://circleci.com/developer/orbs/orb/circleci/flutter?version=1.1.0
flutter: circleci/[email protected]
android: circleci/[email protected]
macos: circleci/[email protected]

commands:
inject-netrc-credentials:
steps:
- run:
name: Configure .netrc
command: |
echo "machine api.mapbox.com login mapbox password ${SDK_REGISTRY_TOKEN}" >> ~/.netrc
chmod 0600 ~/.netrc
jobs:
build-android:
executor:
name: android/android-machine
resource-class: xlarge
tag: 2022.03.1
steps:
- checkout
- android/create-avd:
avd-name: flutter
install: true
system-image: system-images;android-29;default;x86
- flutter/install_sdk_and_pub:
flutter_version: 3.3.2
- run:
name: ktlint
working_directory: example/android
command: ./gradlew ktlint
- run:
name: flutter format
command: ./scripts/check-format.sh
- run:
name: unit test
command: flutter test test
- android/start-emulator:
avd-name: flutter
post-emulator-launch-assemble-command: ''
restore-gradle-cache-post-emulator-launch: false
- run:
name: "Build flutter wrapper for android"
working_directory: example
command: flutter build apk
- run:
name: "Run integration tests for android"
working_directory: example
command: flutter test integration_test/all_test.dart -r expanded --dart-define=ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}
build-ios:
executor: macos-xcode-latest
steps:
- checkout
# - macos/preboot-simulator:
# device: iPhone 13
# version: "15.4"
- inject-netrc-credentials
- flutter/install_sdk_and_pub:
flutter_version: 3.3.2
- flutter/install_ios_pod:
app-dir: example
- run:
name: swiftlint
working_directory: ios
command: brew install swiftlint; swiftlint lint --strict
- run:
name: "Flutter doctor"
working_directory: example
command: flutter doctor -v
- run:
name: "Build flutter wrapper for iOS"
working_directory: example
command: flutter build ios --simulator --no-codesign
- run:
name: unit test
command: flutter test test
# - run:
# name: "Run integration tests on the iOS simulator"
# working_directory: example
# command: flutter test integration_test/all_test.dart -r expanded --dart-define=ACCESS_TOKEN=${MAPBOX_ACCESS_TOKEN}

workflows:
build:
jobs:
- build-android
- build-ios

executors:
macos-xcode-latest:
resource_class: large
macos:
xcode: 13.3.0
19 changes: 19 additions & 0 deletions .github/workflows/issues.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
on:
issues:
types: [opened, reopened]

permissions: write-all

env:
GITHUB_API_TOKEN: ${{ secrets.ACTION_TOKEN }}

jobs:
add_to_project:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Assign new issues to the project
uses: ./
with:
project_url: "https://github.com/orgs/mapbox/projects/707"
114 changes: 114 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
# Miscellaneous
*.class
*.lock
*.log
*.pyc
*.swp
.DS_Store
.atom/
.buildlog/
.history
.svn/

# IntelliJ related
*.iml
*.ipr
*.iws
.idea/

# Visual Studio Code related
.classpath
.project
.settings/
.vscode/

# Flutter repo-specific
/bin/cache/
/bin/mingit/
/dev/benchmarks/mega_gallery/
/dev/bots/.recipe_deps
/dev/bots/android_tools/
/dev/docs/doc/
/dev/docs/flutter.docs.zip
/dev/docs/lib/
/dev/docs/pubspec.yaml
/dev/integration_tests/**/xcuserdata
/dev/integration_tests/**/Pods
/packages/flutter/coverage/
version

# packages file containing multi-root paths
.packages.generated

# Flutter/Dart/Pub related
**/doc/api/
.dart_tool/
.flutter-plugins
.flutter-plugins-dependencies
.packages
.pub-cache/
.pub/
build/
flutter_*.png
linked_*.ds
unlinked.ds
unlinked_spec.ds

# Android related
**/android/**/gradle-wrapper.jar
**/android/.gradle
**/android/captures/
**/android/gradlew
**/android/gradlew.bat
**/android/local.properties
**/android/**/GeneratedPluginRegistrant.java
**/android/key.properties
*.jks

# iOS/XCode related
**/ios/**/*.mode1v3
**/ios/**/*.mode2v3
**/ios/**/*.moved-aside
**/ios/**/*.pbxuser
**/ios/**/*.perspectivev3
**/ios/**/*sync/
**/ios/**/.sconsign.dblite
**/ios/**/.tags*
**/ios/**/.vagrant/
**/ios/**/DerivedData/
**/ios/**/Icon?
**/ios/**/Pods/
**/ios/**/.symlinks/
**/ios/**/profile
**/ios/**/xcuserdata
**/ios/.generated/
**/ios/Flutter/App.framework
**/ios/Flutter/Flutter.framework
**/ios/Flutter/Flutter.podspec
**/ios/Flutter/Generated.xcconfig
**/ios/Flutter/app.flx
**/ios/Flutter/app.zip
**/ios/Flutter/flutter_assets/
**/ios/Flutter/flutter_export_environment.sh
**/ios/ServiceDefinitions.json
**/ios/Runner/GeneratedPluginRegistrant.*

# macOS
**/macos/Flutter/GeneratedPluginRegistrant.swift
**/macos/Flutter/Flutter-Debug.xcconfig
**/macos/Flutter/Flutter-Release.xcconfig
**/macos/Flutter/Flutter-Profile.xcconfig

# Coverage
coverage/

# Symbols
app.*.symbols

# Exceptions to above rules.
!**/ios/**/default.mode1v3
!**/ios/**/default.mode2v3
!**/ios/**/default.pbxuser
!**/ios/**/default.perspectivev3
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule "codegen/vendor/mapbox-maps-stylegen"]
path = codegen/vendor/mapbox-maps-stylegen
url = [email protected]:mapbox/mapbox-maps-stylegen.git
10 changes: 10 additions & 0 deletions .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: f4abaa0735eba4dfd8f33f73363911d63931fe03
channel: stable

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

* TODO: Describe initial release.
57 changes: 57 additions & 0 deletions DEVELOPING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
### Configuring private Mapbox access token
A mapbox secret token is required to download the corresponding Android/iOS native libraries from Mapbox hosting infrastructure. Please follow the instructions from below to configure your secret token:

For Android:
https://docs.mapbox.com/android/maps/guides/install/#configure-credentials

For iOS:
https://docs.mapbox.com/ios/maps/guides/install/#configure-credentials

### Configuring public Mapbox access token

A public access token must be provided to a MapboxMap widget for retrieving styles and resources.
While you can hardcode it directly into source files,
it's good practise to retrieve access tokens from some external source
(e.g. a config file or an environment variable).

You can pass access token via the command line arguments when either building :

```
flutter build <platform> --dart-define ACCESS_TOKEN=YOUR_TOKEN_HERE
```

or running the application :

```
flutter run --dart-define ACCESS_TOKEN=YOUR_TOKEN_HERE
```

You can also persist token in launch.json :
```
"configurations": [
{
...
"args": [
"--dart-define", "ACCESS_TOKEN=..."
],
}
]
```

Then it's retrieved in Dart:
```
MapboxMap(
...
accessToken: const String.fromEnvironment("ACCESS_TOKEN"),
...
)
```

### Develop with pigeon
We apply pigeon to generate bridge codes between dart and Android/iOS, the develop process is:

1. Update the template file `pigeons/mapbox_map.dart`.

2. Run command `make run-pigeon` to generate the bridge codes.

3. Implement the APIs in Android and iOS the forward the api call to sdk side.
10 changes: 10 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
FROM python:3.8.5-slim

# Install python requirements
COPY ./requirements.txt .
RUN pip3 install --upgrade pip && pip3 install -r requirements.txt

# Copy source files
COPY ./github-actions-app /github-actions-app
RUN chmod +x /github-actions-app/main.py
ENTRYPOINT [ "/github-actions-app/main.py" ]
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
TODO: Add your license here.
34 changes: 34 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
.PHONY: run-pigeon
run-pigeon:
sh scripts/run-pigeon.sh

.PHONY: format
format:
flutter format lib example/lib example/integration_test;
swiftlint --fix ios;
cd example/android; ./gradlew ktlintFormat

###
### Codegen targets
###
.PHONY: generate-config-templates
generate-config-templates:
cd codegen && \
npm install && \
node map-serialization-generator/generate-configurations-code.js

.PHONY: generate-annotation-templates
generate-annotation-templates:
cd codegen && \
npm install && \
node annotation-generator/generate-annotation-code.js

.PHONY: generate-style-code
generate-style-code:
cd codegen && \
npm install && \
node style-generator/generate-style-code.js

.PHONY: generate-api-docs
generate-api-docs:
dart doc .
Loading

0 comments on commit 11a4687

Please sign in to comment.