# GitDependencyResolverForUnity
**Repository Path**: gaozhou/GitDependencyResolverForUnity
## Basic Information
- **Project Name**: GitDependencyResolverForUnity
- **Description**: No description available
- **Primary Language**: Unknown
- **License**: MIT
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2020-09-09
- **Last Updated**: 2020-12-19
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
Git Dependency Resolver For Unity
===
This plugin resolves git url dependencies in the package for Unity Package Manager.
You can use a git url as a package dependency!

[](https://github.com/mob-sakai/GitDependencyResolverForUnity/releases)
[](https://github.com/mob-sakai/GitDependencyResolverForUnity/releases)

[](https://github.com/mob-sakai/GitDependencyResolverForUnity/blob/upm/LICENSE.txt)
[](http://makeapullrequest.com)
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
<< [Description](#Description) | [Install](#install) | [Usage](#usage) | [Demo](#demo) | [Development Note](#development-note) >>
### What's new? [See changelog ](https://github.com/mob-sakai/GitDependencyResolverForUnity/blob/upm/CHANGELOG.md)
### Do you want to receive notifications for new releases? [Watch this repo ](https://github.com/mob-sakai/GitDependencyResolverForUnity/subscription)
### Support me on Patreon! [](https://www.patreon.com/join/2343451?)
## Description
In Unity 2018.3, the Unity Package Manager (UPM) supported Git. :)
https://forum.unity.com/threads/git-support-on-package-manager.573673/
This update allows us to quickly install packages on code hosting services such as GitHub.
However, UPM does not support git urls as 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"
}
}
```

This plugin resolves git url dependencies in the package for Unity Package Manager.
You can use a git url as a package dependency!
#### Features
* Easy to use: just install
* Resolve git url dependencies in packages
* Uninstall unused packages that is installed by this plugin
* Support GitHub, Bitbucket, GitLab, etc.
* Support private repository
* Support Unity 2019.1+
* Support .Net 3.5 & 4.x
* Update package with a specific tag/branch
* Deterministic package installation
* Refer to no files from the Library folder
#### 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**
## Install
Find `Packages/manifest.json` in your project and edit it to look like this:
```js
{
"dependencies": {
"com.coffee.git-dependency-resolver": "https://github.com/mob-sakai/GitDependencyResolverForUnity.git#1.1.2",
...
}
}
```
To update the package, change `#{version}` to the target version.
Or, use [UpmGitExtension](https://github.com/mob-sakai/UpmGitExtension.git) to install or update the package.
##### Requirement
* Unity 2018.3 or later
## Usage
* If dependencies are not resolved successfully, try the following:
* Reopen the project.
* Delete `Library` directory in the project.

* When `Unity Package Manager Error` window is opens, click `Continue`.

* Use [SemVer](https://semver.org/) as a tag or branch name.
eg. `1.0.0`, `0.5.0-preview10`, `0.1.0-alpha+daily5`
## Demo
https://github.com/mob-sakai/UnityGitDependencyTest
## Development Note
#### Develop a package for UPM
The branching strategy when I develop a package for UPM is as follows.
|Branch|Description|'Assets' directory|
|-|-|-|
|develop|Development, Testing|Included|
|upm(default)|Subtree to publish for UPM|Excluded|
|{tags}|Tags to install using UPM|Excluded|
**Steps to release a package:**
1. Develop your package project on `develop` branch and update version in `package.json`.
2. Split subtree into `ump` branch.
`git subtree split --prefix=Assets/YOUR/PACKAGE/DIRECTRY --branch upm`
3. Tag on `ump` branch as new version.
4. That's all. :)
For details, see https://www.patreon.com/posts/25070968.
## License
* MIT
* [MiniJson](https://gist.github.com/darktable/1411710) by Calvin Rien
* [SemVer](https://github.com/maxhauser/semver) by Max Hauser
## Author
[mob-sakai](https://github.com/mob-sakai)
[](https://twitter.com/intent/follow?screen_name=mob_sakai)
[](https://www.patreon.com/join/2343451?)
## See Also
* GitHub page : https://github.com/mob-sakai/GitDependencyResolverForUnity
* Releases : https://github.com/mob-sakai/GitDependencyResolverForUnity/releases
* Issue tracker : https://github.com/mob-sakai/GitDependencyResolverForUnity/issues
* Current project : https://github.com/mob-sakai/GitDependencyResolverForUnity/projects/1
* Change log : https://github.com/mob-sakai/GitDependencyResolverForUnity/blob/upm/CHANGELOG.md