Skip to content

Commit

Permalink
feat: support gitDependencies in package.json
Browse files Browse the repository at this point in the history
BREAKING CHANGE: Must use `gitDependencies` instead of `dependencies` to define git-based dependencies for the package.
This plugin also supports `dependencies` to resolve git-based dependencies, but if `dependencies` include packages that UPM can't resolve, it will fail to start Unity in CI environment.
  • Loading branch information
mob-sakai committed Aug 28, 2020
1 parent fa365cc commit 8961111
Showing 1 changed file with 14 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ internal class PackageMeta
public string url { get; private set; }
public string path { get; private set; }
public PackageMeta[] dependencies { get; private set; }
public PackageMeta[] gitDependencies { get; private set; }

private PackageMeta()
{
Expand All @@ -41,6 +42,7 @@ private PackageMeta()
path = "";
version = new SemVersion(0);
dependencies = new PackageMeta [0];
gitDependencies = new PackageMeta [0];
}

public static PackageMeta FromPackageJson(string filePath)
Expand Down Expand Up @@ -80,6 +82,17 @@ public static PackageMeta FromPackageJson(string filePath)
package.dependencies = new PackageMeta[0];
}

if (dict.TryGetValue("gitDependencies", out obj))
{
package.gitDependencies = (obj as Dictionary<string, object>)
.Select(x => FromNameAndUrl(x.Key, (string) x.Value))
.ToArray();
}
else
{
package.gitDependencies = new PackageMeta[0];
}

return package;
}
catch
Expand Down Expand Up @@ -159,7 +172,7 @@ private void ProcessUrlQuery(string urlQuery)

public IEnumerable<PackageMeta> GetAllDependencies()
{
return dependencies;
return gitDependencies.Concat(dependencies);
}

public string GetDirectoryName()
Expand Down

0 comments on commit 8961111

Please sign in to comment.