-
-
Notifications
You must be signed in to change notification settings - Fork 80
Optimize git library installation #607
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 17 commits
7e7f215
8bf372a
3228e74
f6bfa64
756e98b
73fe837
c9103b7
d225486
7526402
b2f91fb
a41e7ec
243e49c
7ca8411
1083373
8b01fb4
824c06d
91d8f60
f96c34f
16a910f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,13 @@ package haxelib; | |
else | ||
throw 'Invalid VscID $s'; | ||
} | ||
|
||
public function getName() { | ||
return switch cast(this, VcsID) { | ||
case Git: "Git"; | ||
case Hg: "Mercurial"; | ||
}; | ||
} | ||
} | ||
|
||
/** Class containing repoducible git or hg library data. **/ | ||
|
@@ -28,7 +35,7 @@ class VcsData { | |
var url:String; | ||
/** Commit hash **/ | ||
@:optional | ||
var ref:Null<String>; | ||
var commit:Null<String>; | ||
/** The git tag or mercurial revision **/ | ||
@:optional | ||
var tag:Null<String>; | ||
|
@@ -45,7 +52,7 @@ class VcsData { | |
|
||
public function toString(): String { | ||
var qualifier = | ||
if (ref != null) ref | ||
if (commit != null) commit | ||
else if (tag != null) tag | ||
else if (branch != null) branch | ||
else null; | ||
|
@@ -54,6 +61,35 @@ class VcsData { | |
else | ||
url; | ||
} | ||
|
||
public function isReproducible() { | ||
return commit != null; | ||
} | ||
|
||
/** | ||
Returns an object containing the filled-in VcsData fields, | ||
without the empty ones. | ||
|
||
**/ | ||
public function getCleaned() { | ||
var data:{ | ||
url:String, | ||
?commit:String, | ||
?tag:String, | ||
?branch:String, | ||
?subDir:String | ||
} = { url : url }; | ||
|
||
if (commit != null) | ||
data.commit = commit; | ||
if (tag != null) | ||
data.tag = tag; | ||
if (!(branch == null || branch == "")) | ||
data.branch = branch; | ||
if (!(subDir == null || haxe.io.Path.normalize(subDir) == "")) | ||
data.subDir = subDir; | ||
|
||
return data; | ||
} | ||
} | ||
|
||
/** Data required to reproduce a library version **/ | ||
|
@@ -89,7 +125,7 @@ class VersionDataHelper { | |
type: type, | ||
data: { | ||
url: vcsRegex.matched(2), | ||
ref: vcsRegex.matched(3), | ||
commit: vcsRegex.matched(3), | ||
branch: vcsRegex.matched(4), | ||
subDir: null, | ||
tag: null | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -59,9 +59,11 @@ class GlobalScope extends Scope { | |
} | ||
|
||
public function setVcsVersion(library:ProjectName, vcsVersion:VcsID, ?data:VcsData):Void { | ||
if (data == null) data = {url: "unknown"}; | ||
if (data != null) { | ||
repository.setVcsData(library, vcsVersion, data); | ||
} | ||
|
||
if (data.subDir != null) { | ||
if (!(data == null || data.subDir == "" || data.subDir == null)) { | ||
|
||
final devDir = repository.getValidVersionPath(library, vcsVersion) + data.subDir; | ||
repository.setDevPath(library, devDir); | ||
} else { | ||
|
@@ -273,4 +275,15 @@ class GlobalScope extends Scope { | |
return {path: path, version: current}; | ||
} | ||
|
||
public function resolve(library:ProjectName):VersionData { | ||
final version = repository.getCurrentVersion(library); | ||
|
||
return switch version { | ||
case vcs if (VcsID.isValid(vcs)): | ||
final vcsId = VcsID.ofString(vcs); | ||
VcsInstall(vcsId, repository.getVcsData(library, vcsId)); | ||
case semVer: | ||
Haxelib(SemVer.ofString(semVer)); | ||
}; | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.