Skip to content

Publish a plugin #7815

Closed
Closed

Description

@mit-mit

Support publishing a plugin so that others can consume it (#7816).

A plugin consists of three pieces:

  1. A plugin interface written in dart, which sends and receives HostMessages
  2. Android specific code (java) which responds to HostMessages and interfaces with the native Android platform
  3. iOS specific code (ojb-c or swift) which responds to HostMessages and interfaces with the native iOS platform

We assume that parts 2. and 3. is published on their existing distribution mechanisms, specifically mavencentral for java code and cocoapods for obj-c/swift code, and that some manifest is provided for declaring a dependency on those artifacts.

The functionality needed to actually build a plugin that depends on binaries in mavencentral/cocoapods is tracked in #7813.

Activity

  1. a14n commented on Feb 3, 2017

    @a14n
    Contributor

    We assume that parts 2. and 3. is published on their existing distribution mechanisms, specifically mavencentral for java code and cocoapods for obj-c/swift code, and that some manifest is provided for declaring a dependency on those artifacts.

    disclaimer: dunno how iOS works

    Regarding Android I'd also really like to be able to use java code without publishing to maven-central because some company may not want to publish their sources that are used to build flutter apps and because it's not as easy as pub to publish to maven-central.

    It could perhaps be possible to have a plugin structure with the java code where a maven local install will be perform before running the app (with mvn clean install in /plugin/flutter/android regarding the following structure).

    /plugin
    /plugin/pubspec.yaml
    /plugin/lib                                # dart code
    /plugin/flutter/android                    # java code
    /plugin/flutter/android/pom.xml
    /plugin/flutter/android/src/main/java
    

    Thus the plugin could also be self contained.

    wdyt?

  2. mit-mit commented on Feb 3, 2017

    @mit-mit
    MemberAuthor

    Hi @a14n, yes totally get the use case where you have a plugin with code that you prefer not / are not able to publish. It's still early, and we don't have all the details figured out, but we hope to still support that use case! It's covered in these two separate issues: #7812, #7811.

    Note though, the such plugins will be considered private, cannot be published to others, and you would need to handle the distribution of the source code yourself (e.g., in a source control system).

  3. jakobr-google commented on Mar 23, 2017

    @jakobr-google
    Contributor

    Here's what's being implemented:

    Android: The native part of the plugin is a Gradle project. In the plugin template, there will be source code here, but you don't have to have it. You could also just depend on binary artifacts, either from Maven Central, or shipped with the plugin.

    iOS: The native part of the plugin is a Pod. In the plugin template, there will be source code, but again, you don't have to have it. You could set up the Podspec to depend on other Pods, or include a vendored binary framework.

    This should cover all the use cases, but hasn't been fully tested yet. Plus, the new plugin template hasn't landed.

  4. jakobr-google commented on Mar 30, 2017

    @jakobr-google
    Contributor

    Plugin template landed in #9076. Now we just need to build a plugin and prove that we can publish (and consume) it.

  5. jakobr-google commented on Apr 18, 2017

    @jakobr-google
    Contributor

    @szakarias is working on building and publishing a plugin, which will validate this workflow.

  6. szakarias commented on Apr 21, 2017

    @szakarias
    Contributor

    The url_launcher plugin has been published on pub: https://pub.dartlang.org/packages/url_launcher

  7. github-actions commented on Sep 5, 2021

    @github-actions

    This thread has been automatically locked since there has not been any recent activity after it was closed. If you are still experiencing a similar issue, please open a new bug, including the output of flutter doctor -v and a minimal reproduction of the issue.

  8. locked as resolved and limited conversation to collaborators on Sep 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

p: toolingAffects the flutter_plugin_tools package

Type

No type

Projects

No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions