Skip to content

Commit

Permalink
Prepare project for publishing (maplibre#411)
Browse files Browse the repository at this point in the history
The main idea here is to get a the publishing working with the current
state of the project.
The `maplibre_gl_web` has never been published.
With the new publishing workflow all packages will hopefully be
published with a single tag ( `v0.19.0` in this case).

* raise version to 0.19.0
* raise min Dart SDK to 3.0.0 as required by the `js: ^0.6.7` dependency
* add `pubspec_overrides.yaml` files and move overridden local deps
there
* add `.pubignore` to prevent publishing unnecessary files
* prepare new publish workflow
* add supported platforms to `pubspec.yaml`
* cancel in progress jobs if new commits are pushed
* necessary lint fixes and formatting to satisfy Flutter version

---------

Co-authored-by: Joscha <34318751+josxha@users.noreply.github.com>
  • Loading branch information
2 people authored and remax21 committed Sep 10, 2024
1 parent 3dddd49 commit 793bf81
Show file tree
Hide file tree
Showing 47 changed files with 177 additions and 231 deletions.
5 changes: 5 additions & 0 deletions .github/workflows/flutter_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Flutter CI

on: [push, pull_request, workflow_dispatch]

# Ensure that new pushes/updates cancel running jobs
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true

jobs:
format:
name: "Check formatting"
Expand Down
23 changes: 0 additions & 23 deletions .github/workflows/pub-platform-interface-publish.yml

This file was deleted.

12 changes: 0 additions & 12 deletions .github/workflows/pub-toplevel-publish.yml

This file was deleted.

29 changes: 29 additions & 0 deletions .github/workflows/publish-single.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
name: Publish a package to pub.dev

on:
workflow_call:
inputs:
working-directory:
description: Directory of the package to publish
required: true
type: string

permissions:
id-token: write

jobs:
publish:
name: 'Publish to pub.dev'
permissions:
id-token: write # This is required for requesting the OIDC
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Dart SDK with JWT token
- uses: dart-lang/setup-dart@v1
- name: Install dependencies
run: dart pub get
# Publishing...
# skip validation due to https://github.com/dart-lang/setup-dart/issues/68
- name: Publish to pub.dev
run: dart pub publish --force --skip-validation
25 changes: 25 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish maplibre_gl packages to pub.dev

on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'

permissions:
id-token: write

jobs:
publish_maplibre_gl_platform_interface:
uses: ./.github/workflows/publish_single.yml
with:
working-directory: maplibre_gl_platform_interface
publish_maplibre_gl_web:
needs: [publish_maplibre_gl_platform_interface]
uses: ./.github/workflows/publish_single.yml
with:
working-directory: maplibre_gl_web
publish_maplibre_gl:
needs: [publish_maplibre_gl_platform_interface, publish_maplibre_gl_web]
uses: ./.github/workflows/publish_single.yml
with:
working-directory: .
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,11 @@ app.*.symbols
!/packages/flutter_tools/test/data/dart_dependencies_test/**/.packages
!/dev/ci/**/Gemfile.lock
google-java-format-1.13.0-all-deps.jar

# Ruby/CocoaPods
Gemfile*
.ruby-version

# FVM Version Cache
.fvm/
.fvmrc
4 changes: 4 additions & 0 deletions .pubignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
scripts
screenshot.png
maplibre_gl_web
maplibre_gl_platform_interface
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
## UNRELEASED
## 0.19.0

* Bump min Dart SDK to 3.0.0 (this was already implicitly required by transitive dependencies)
* Publish all packages to pub.dev
* Add support for Gradle/AGP namespace configuration
* Bump Android `compileSdkVersion` to 34
* Loosen the dependency constraint of [js](https://pub.dev/packages/js) to allow `0.6.x` and `0.7.x`.
Expand Down
2 changes: 1 addition & 1 deletion example/android/app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ android {
}

kotlinOptions {
jvmTarget = '1.8'
jvmTarget = JavaVersion.VERSION_1_8
}

sourceSets {
Expand Down
13 changes: 6 additions & 7 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,6 @@ DEPENDENCIES:
- device_info_plus (from `.symlinks/plugins/device_info_plus/ios`)
- Flutter (from `Flutter`)
- location (from `.symlinks/plugins/location/ios`)
- MapLibre
- maplibre_gl (from `.symlinks/plugins/maplibre_gl/ios`)
- path_provider_foundation (from `.symlinks/plugins/path_provider_foundation/darwin`)

Expand All @@ -37,13 +36,13 @@ EXTERNAL SOURCES:
:path: ".symlinks/plugins/path_provider_foundation/darwin"

SPEC CHECKSUMS:
device_info_plus: 7545d84d8d1b896cb16a4ff98c19f07ec4b298ea
device_info_plus: c6fb39579d0f423935b0c9ce7ee2f44b71b9fce6
Flutter: f04841e97a9d0b0a8025694d0796dd46242b2854
location: 3a2eed4dd2fab25e7b7baf2a9efefe82b512d740
location: d5cf8598915965547c3f36761ae9cc4f4e87d22e
MapLibre: 620fc933c1d6029b33738c905c1490d024e5d4ef
maplibre_gl: 249958f57ed5cca73baf413ad6cbdbc64be69658
path_provider_foundation: c68054786f1b4f3343858c1e1d0caaded73f0be9
maplibre_gl: a2efec727dd340e4c65e26d2b03b584f14881fd9
path_provider_foundation: 3784922295ac71e43754bd15e0653ccfd36a147c

PODFILE CHECKSUM: 00bbce151cce7e3542226c3dbb2422a2cb667d7a
PODFILE CHECKSUM: 76b02dc813a095e7650def38e0c540365f37c732

COCOAPODS: 1.12.1
COCOAPODS: 1.15.2
25 changes: 2 additions & 23 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,17 +13,8 @@ dependencies:
flutter:
sdk: flutter

maplibre_gl_platform_interface:
git:
url: https://github.com/maplibre/flutter-maplibre-gl.git
path: maplibre_gl_platform_interface
ref: git-release-0.17.0

maplibre_gl:
git:
url: https://github.com/maplibre/flutter-maplibre-gl.git
ref: git-release-0.17.0

maplibre_gl: ^0.19.0
maplibre_gl_platform_interface: ^0.19.0
location: ^5.0.3
path_provider: ^2.0.15
http: ^1.1.0
Expand All @@ -32,18 +23,6 @@ dependencies:
platform: ^3.1.0
device_info_plus: ^9.0.2

# The following lines can be useful if you make changes to this plugin (specifically to the two sub-plugins),
# e.g. because you contribute to the project.
# If the following lines are not commented out, your local versions of the sub-plugins will be used,
# instead of the hosted ones.
dependency_overrides:
maplibre_gl_platform_interface:
path: ../maplibre_gl_platform_interface
maplibre_gl_web:
path: ../maplibre_gl_web
maplibre_gl:
path: ..

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'
flutter_test:
Expand Down
7 changes: 7 additions & 0 deletions example/pubspec_overrides.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
dependency_overrides:
maplibre_gl:
path: ..
maplibre_gl_platform_interface:
path: ../maplibre_gl_platform_interface
maplibre_gl_web:
path: ../maplibre_gl_web
19 changes: 0 additions & 19 deletions flutter_mapbox_gl.iml

This file was deleted.

40 changes: 12 additions & 28 deletions lib/src/annotation_manager.dart
Original file line number Diff line number Diff line change
Expand Up @@ -168,12 +168,8 @@ abstract class AnnotationManager<T extends Annotation> {
}

class LineManager extends AnnotationManager<Line> {
LineManager(MaplibreMapController controller,
{void Function(Line)? onTap, bool enableInteraction = true})
LineManager(super.controller, {super.onTap, super.enableInteraction = true})
: super(
controller,
onTap: onTap,
enableInteraction: enableInteraction,
selectLayer: (Line line) => line.options.linePattern == null ? 0 : 1,
);

Expand All @@ -197,13 +193,10 @@ class LineManager extends AnnotationManager<Line> {

class FillManager extends AnnotationManager<Fill> {
FillManager(
MaplibreMapController controller, {
void Function(Fill)? onTap,
bool enableInteraction = true,
super.controller, {
super.onTap,
super.enableInteraction = true,
}) : super(
controller,
onTap: onTap,
enableInteraction: enableInteraction,
selectLayer: (Fill fill) => fill.options.fillPattern == null ? 0 : 1,
);

Expand All @@ -225,14 +218,10 @@ class FillManager extends AnnotationManager<Fill> {

class CircleManager extends AnnotationManager<Circle> {
CircleManager(
MaplibreMapController controller, {
void Function(Circle)? onTap,
bool enableInteraction = true,
}) : super(
controller,
enableInteraction: enableInteraction,
onTap: onTap,
);
super.controller, {
super.onTap,
super.enableInteraction = true,
});

@override
List<LayerProperties> get allLayerProperties => const [
Expand All @@ -250,22 +239,17 @@ class CircleManager extends AnnotationManager<Circle> {

class SymbolManager extends AnnotationManager<Symbol> {
SymbolManager(
MaplibreMapController controller, {
void Function(Symbol)? onTap,
super.controller, {
super.onTap,
bool iconAllowOverlap = false,
bool textAllowOverlap = false,
bool iconIgnorePlacement = false,
bool textIgnorePlacement = false,
bool enableInteraction = true,
super.enableInteraction = true,
}) : _iconAllowOverlap = iconAllowOverlap,
_textAllowOverlap = textAllowOverlap,
_iconIgnorePlacement = iconIgnorePlacement,
_textIgnorePlacement = textIgnorePlacement,
super(
controller,
enableInteraction: enableInteraction,
onTap: onTap,
);
_textIgnorePlacement = textIgnorePlacement;

bool _iconAllowOverlap;
bool _textAllowOverlap;
Expand Down
5 changes: 2 additions & 3 deletions lib/src/maplibre_map.dart
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ typedef MapCreatedCallback = void Function(MaplibreMapController controller);
/// Also refer to the documentation of [maplibre_gl] and [MaplibreMapController].
class MaplibreMap extends StatefulWidget {
const MaplibreMap({
Key? key,
super.key,
required this.initialCameraPosition,
this.styleString = "https://demotiles.maplibre.org/style.json",
this.onMapCreated,
Expand Down Expand Up @@ -63,8 +63,7 @@ class MaplibreMap extends StatefulWidget {
"$myLocationRenderMode requires [myLocationEnabled] set to true.",
),
assert(annotationOrder.length <= 4),
assert(annotationConsumeTapEvents.length > 0),
super(key: key);
assert(annotationConsumeTapEvents.length > 0);

/// Defines the layer order of annotations displayed on map
///
Expand Down
10 changes: 5 additions & 5 deletions maplibre_gl_platform_interface/pubspec.yaml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
name: maplibre_gl_platform_interface
description: A common platform interface for the maplibre_gl plugin.
version: 0.18.0
version: 0.19.0
repository: https://github.com/maplibre/flutter-maplibre-gl
issue_tracker: https://github.com/maplibre/flutter-maplibre-gl/issues

environment:
sdk: ">=3.0.0 <4.0.0"
flutter: ">=3.10.0"

dependencies:
flutter:
sdk: flutter
meta: ^1.0.5

dev_dependencies:
flutter_lints: '>=3.0.0 <5.0.0'

environment:
sdk: '>=2.14.0 <3.0.0'
flutter: '>=2.10.0'
7 changes: 3 additions & 4 deletions maplibre_gl_web/lib/src/geo/geojson.dart
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ class FeatureCollection extends JsObjectWrapper<FeatureCollectionJsImpl> {
}

/// Creates a new FeatureCollection from a [jsObject].
FeatureCollection.fromJsObject(FeatureCollectionJsImpl jsObject)
: super.fromJsObject(jsObject);
FeatureCollection.fromJsObject(super.jsObject) : super.fromJsObject();
}

class Feature extends JsObjectWrapper<FeatureJsImpl> {
Expand Down Expand Up @@ -69,7 +68,7 @@ class Feature extends JsObjectWrapper<FeatureJsImpl> {
));

/// Creates a new Feature from a [jsObject].
Feature.fromJsObject(FeatureJsImpl jsObject) : super.fromJsObject(jsObject);
Feature.fromJsObject(super.jsObject) : super.fromJsObject();
}

class Geometry extends JsObjectWrapper<GeometryJsImpl> {
Expand All @@ -87,5 +86,5 @@ class Geometry extends JsObjectWrapper<GeometryJsImpl> {
));

/// Creates a new Geometry from a [jsObject].
Geometry.fromJsObject(GeometryJsImpl jsObject) : super.fromJsObject(jsObject);
Geometry.fromJsObject(super.jsObject) : super.fromJsObject();
}
2 changes: 1 addition & 1 deletion maplibre_gl_web/lib/src/geo/lng_lat.dart
Original file line number Diff line number Diff line change
Expand Up @@ -84,5 +84,5 @@ class LngLat extends JsObjectWrapper<LngLatJsImpl> {
LngLat.fromJsObject(LngLatJsImpl.convert(input));

/// Creates a new LngLat from a [jsObject].
LngLat.fromJsObject(LngLatJsImpl jsObject) : super.fromJsObject(jsObject);
LngLat.fromJsObject(super.jsObject) : super.fromJsObject();
}
3 changes: 1 addition & 2 deletions maplibre_gl_web/lib/src/geo/lng_lat_bounds.dart
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,5 @@ class LngLatBounds extends JsObjectWrapper<LngLatBoundsJsImpl> {
LngLatBounds.fromJsObject(LngLatBoundsJsImpl.convert(input));

/// Creates a new LngLatBounds from a [jsObject].
LngLatBounds.fromJsObject(LngLatBoundsJsImpl jsObject)
: super.fromJsObject(jsObject);
LngLatBounds.fromJsObject(super.jsObject) : super.fromJsObject();
}
Loading

0 comments on commit 793bf81

Please sign in to comment.