From 017effe6067a42afaae011ad6410076fe1dbb33c Mon Sep 17 00:00:00 2001 From: Robert burner Schadek Date: Thu, 25 Jun 2020 15:31:16 +0100 Subject: [PATCH] fix for get --- clisource/app.d | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) diff --git a/clisource/app.d b/clisource/app.d index 311b8ac..b75a090 100644 --- a/clisource/app.d +++ b/clisource/app.d @@ -1,6 +1,8 @@ import std.array : empty; +import std.algorithm.searching : startsWith; import std.stdio; import std.getopt; +import std.string : indexOf; import std.experimental.logger; import std.file : exists; import std.path : buildPath; @@ -122,6 +124,44 @@ int main(string[] args) { } } + if(!opts.options.proxyFile.empty && !opts.options.packages.empty) { + tracef("get %s", opts.options.packages); + DubProxyFile dpf = fromFile(opts.options.proxyFile); + foreach(pkg; opts.options.packages) { + GetSplit sp = pkg.indexOf(":") != -1 + ? splitGet(pkg) + : splitLocal(pkg); + sp.ver = !sp.ver.empty && !startsWith(sp.ver, "v") + ? "v" ~ sp.ver + : sp.ver; + + string gitDestDir = getPackage(dpf, sp.pkg); + tracef("path to cloned git '%s'", gitDestDir); + const GetSplit s = splitLocal(gitDestDir); + TagReturn[] allTags = getTags(gitDestDir, TagKind.all, + opts.options.libOptions); + tracef("_\t_\tallTags %s", allTags); + foreach(tag; allTags) { + tracef("_\t_\t_\tbuild tag %s", tag); + const ver = tag.getVersion(); + tracef("_\t_\t_\tsp.ver %s == ver %s", sp.ver, ver); + if(sp.ver == ver) { + tracef("_\t_\t_\tactually build tag split %s destdir %s" + ~ " packageFolder %s", ver, gitDestDir, + opts.options.packageFolder); + try { + createWorkingTree(gitDestDir, tag, s.pkg, + opts.options.packageFolder, + opts.options.libOptions); + } catch(Exception e) { + errorf("Failed to create working tree %s", + e.toString()); + } + } + } + } + } + return 0; }