Home

Awesome

Git Dependency Resolver For Unity

This plugin resolves git-based dependencies in the package for Unity Package Manager.
You can use git repositories url as a package dependencies! :+1:

logo

PRs Welcome

<< Description | Install | Usage | Development Note | Contributing | Change log >>

<br><br><br><br>

Description

In Unity 2018.3, the Unity Package Manager (UPM) supported Git. :)

This update allows us to quickly install packages on code hosting services such as GitHub.

However, UPM does not support git-based dependencies in the package. :(

[ package-a/package.json ]
{
  "name": "com.coffee.package-a",
  "version": "0.1.0",
  "dependencies": {
    "com.coffee.core-a" : "https://github.com/mob-sakai/GitPackageTest#core-a-0.1.0"
  }
}

When the above package is installed, the following error occur. console

Git-based dependencies in packages feature is on the roadmap for 2020, but no specific ETA.

<br>

This plugin resolves git-based dependencies in the package.
You can use git repositories url as a package dependencies! :+1:

Features

Notes

From: https://forum.unity.com/threads/git-support-on-package-manager.573673/page-3#post-4552084

There is no conflict detection and/or resolution algorithm. The lastest package found with the same name is used. This is not how the package manager resolve dependency (See https://docs.unity3d.com/Manual/upm-conflicts-auto.html).

In Unity's algorithm, package conflicts are resolved by "dependency-level from root".
The all packages resolved by this plugin are "dependency-level=1".
Therefore, in some cases, the package of the intended version may not be installed.

For example, in the case of a project with a dependency graph like this:

project (root)
 ├ package A: 1.0.0
 │  └ package X: 2.0.0
 └ package B: 1.0.0
    └ package C: 2.0.0
       └ package X: 2.0.1

This plugin's algorithm

Install -> A: 1.0.0, B: 1.0.0, C: 2.0.0, X: 2.0.1

Unity's algorithm

Install -> A: 1.0.0, B: 1.0.0, C: 2.0.0, X: 2.0.0

<br><br><br><br>

Installation

Requirement

Using OpenUPM

This package is available on OpenUPM. You can install it via openupm-cli.

openupm add com.coffee.git-dependency-resolver

Using Git

Find the manifest.json file in the Packages directory in your project and edit it as follows:

{
  "dependencies": {
    "com.coffee.git-dependency-resolver": "https://github.com/mob-sakai/GitDependencyResolverForUnity.git",
    ...
  },
}

To update the package, change suffix #{version} to the target version.

Or, use UpmGitExtension to install and update the package.

<br><br><br><br>

Usage

For package user

For package developer

{
  ...
  "gitDependencies": {
    "your.package": "https://github.com/yourname/yourpackage.git#v1.2.3",
    ...
  }
}

<br><br><br><br>

Contributing

Issues

Issues are very valuable to this project.

Pull Requests

Pull requests are, a great way to get your ideas into this repository.
See CONTRIBUTING.md.

Support

This is an open source project that I am developing in my spare time.
If you like it, please support me.
With your support, I can spend more time on development. :)


<br><br><br><br>

License

Author

mob-sakai

See Also