Support to Branch without SemVer
See original GitHub issueHello again @mob-sakai , i thinking if its okey to you to add support to Non-SemVer dependence resolver. I already implemented inside my project to manage this.
The logic behind is:
if (Has any previous InstalledPackage with this name && dependence.version == null) { //Keep any previous downloaded version } else if(InstalledPackage with this name not present) { //Download using dependence URL (probably is a head or a branch, like UPM branch) }
IMPLEMENTATION
PackageMeta.cs
public static PackageMeta FromNameAndUrl (string name, string url)
{
. . .
if (first.Contains ("://"))
{
meta.path = first;
meta.branch = 0 < second.Length ? second : "HEAD";
SemVersion version;
if (!SemVersion.TryParse(meta.branch, out version))
version = null;//empty version
meta.version = version;
}
. . .
}
GitDependencyResolver.cs
static void UninstallUnusedPackages ()
{
. . .
// Collect unused pakages.
var unusedPackages = autoInstalledPackages
.Where (x => Path.GetFileName(x.path).StartsWith (".", Ordinal)) // Directory name starts with '.'. This is 'auto-installed package'
.Where (x => !allDependencies.Any (y => y.name == x.name && (y.version == null || y.version == x.version))) // No depended from other packages
;
. . .
}
static void StartResolve ()
{
. . .
// Check all dependencies.
foreach (var dependency in dependencies)
{
// Is the depended package installed already?
bool isInstalled = installedPackages
.Concat(requestedPackages)
.Any(x => dependency.name == x.name && ((dependency.version != null && dependency.version <= x.version) || (dependency.version == null)));
// Install the depended package later.
if (!isInstalled)
{
requestedPackages.RemoveAll (x => dependency.name == x.name);
requestedPackages.Add (dependency);
}
}
. . .
}
Best Regards Rafael
Issue Analytics
- State:
- Created 4 years ago
- Comments:8 (5 by maintainers)
Top Results From Across the Web
Semantic versioning and git branches [closed]
When you branch your code, leave the branch version at v1.0. This will be the release branch, the codebase that goes into this...
Read more >How to deal with major/minor changes on a branched ...
We'd like to understand what the best practices are for dealing with numbering of releases on branches of components.
Read more >Why I don't like SemVer anymore
Once again PEP 440 supports it, so why not! It still communicates your branch strategy of there being only a single branch at...
Read more >How to do semver for develop branches? : r/devops
An alternative is to only use sha versions without any semver but you loose context knowing what that artifact was based off.
Read more >How to use GitVersion to get sensible versioning
So in essence, a support branch is nothing like an alternative reality of main that starts off when your main receives breaking changes....
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
done @mob-sakai
#20
To my shame, I misunderstood that this is UpmGitExtension. 😉