question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Support to Branch without SemVer

See original GitHub issue

Hello 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:closed
  • Created 4 years ago
  • Comments:8 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
rafcsoarescommented, Dec 23, 2019
1reaction
mob-sakaicommented, Dec 20, 2019

To my shame, I misunderstood that this is UpmGitExtension. 😉

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found