Skip to content

A Dart library and CLI tool for managing APK dependencies using YAML specifications, with support for ADB integration, recursive dependency resolution, and optional URL-based APK sources.

License

Notifications You must be signed in to change notification settings

MintyStore/dependipk

Repository files navigation

dependipk

A Dart library and CLI tool for managing APK dependencies using YAML specifications, with support for ADB integration, recursive dependency resolution, and optional URL-based APK sources.

Features

  • Define APK dependencies and metadata in YAML files
  • Install APKs and their dependencies via ADB
  • Support for optional dependencies and version constraints
  • Block or allow APK installation from remote URLs
  • Customizable install and detection logic for integration with Flutter or other platforms
  • CLI for install, list, validate, and spec creation tasks

YAML Specification

Each APK and its dependencies are described in a YAML file. Example:

package: com.example.myapp
version: 1.0.0
dependencies:
  - package: com.example.dep1
    min_version: 1.2.0
    max_version: 2.0.0
    is_optional: false
    url: https://example.com/dep1.apk
  - package: com.example.dep2
    is_optional: true
  • package: The package name of the APK.
  • version: The version of the APK.
  • dependencies: List of dependencies, each with:
    • package: Dependency package name (required)
    • min_version: Minimum version (optional)
    • max_version: Maximum version (optional)
    • is_optional: Whether the dependency is optional (default: false)
    • url: Remote URL to fetch the APK (optional)

CLI Usage

Install the CLI and run:

dependipk <command> [options]

Commands

  • install <spec.yaml> [--block-urls] [--main-url <url>]
    Installs all dependencies and the main APK using ADB.
    Use --block-urls to prevent installing APKs from remote URLs.
    Use --main-url to specify a base URL for APKs.

  • list <spec.yaml> [--main-url <url>]
    Lists all dependencies in install order.

  • validate <spec.yaml> [--main-url <url>]
    Validates that all dependencies are resolvable.

  • create <spec.yaml> <package> <version>
    Generates a new YAML spec template.

Library Usage

Add dependipk to your Dart or Flutter project. Example:

import 'package:dependipk/dependipk.dart';

final dependipk = Dependipk(blockUrls: true);
await dependipk.installDependencies('myapp.yaml');

Customization

You can provide custom logic for checking if an app is installed or for installing APKs, which is useful for Flutter or platform-specific integration:

final dependipk = Dependipk(
  isInstalled: (package) async {
    // Custom logic to check if the app is installed
    return false;
  },
  installApk: (apkPath, package) async {
    // Custom logic to install the APK
  },
);

If not provided, the library defaults to using ADB for installation and does not check if the app is already installed.

Dependency Resolution

  • Dependencies are resolved recursively. If a dependency's YAML file is present in the same directory, it will be used.
  • Version constraints (min_version, max_version) and optional dependencies are supported.
  • If a dependency specifies a url, the APK will be downloaded unless --block-urls is set.
  • The --main-url option can be used to provide a base URL for APKs that do not specify their own.

Example

Given the following spec.yaml:

package: pack
version: 1.0.0
dependencies:
  - package: com.example.dep1
    min_version: 1.0.0
    max_version: 2.0.0
    is_optional: false
    url: https://google.com/

Run:

dependipk install spec.yaml

Notes

  • APKs are installed using ADB by default.
  • Downloading APKs from URLs is supported unless blocked.
  • Recursive dependencies require YAML specs for each dependency in the same directory or accessible via URL.
  • The tool prevents cyclic dependencies.

License

This project is licensed under the MIT License.

A project by The Better Internet.

About

A Dart library and CLI tool for managing APK dependencies using YAML specifications, with support for ADB integration, recursive dependency resolution, and optional URL-based APK sources.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages