|
| 1 | + Pr←ListNuGetDependencies |
| 2 | +⍝ List dependencies |
| 3 | +⍝Morten |
| 4 | + ∘∘∘ |
| 5 | + load←9=⎕NC'ns' ⍝ Project Space provided |
| 6 | + none←'No nuget dependencies registered.' |
| 7 | + type←⎕C type |
| 8 | + :If (~list∨load)∧0∊≢¨type package |
| 9 | + 'syntax is ]Cider.Dependency nuget|tatin package [folder] -list'⎕SIGNAL 11 |
| 10 | + :EndIf |
| 11 | + |
| 12 | + :If ~∧/m←(gotnuget gottatin)←9=⌊⎕SE.⎕NC'NuGet' 'Tatin' |
| 13 | + ⎕←'Warning: ',(⍕(~m)/'⎕SE.NuGet' '⎕SE.Tatin'),' not found - unable to report on or manage those dependencies.' |
| 14 | + :EndIf |
| 15 | + |
| 16 | + :If gotnuget |
| 17 | + NuGet←⎕SE.NuGet |
| 18 | + :EndIf |
| 19 | + |
| 20 | + :If ~load |
| 21 | + ns←path{3::0 ⋄ ⊃⍵[⍵[;2]⍳⊂⍺;1]}ListOpenProjects 0 |
| 22 | + :EndIf |
| 23 | + config←Get_JSON5 configfile←path,'/cider.config' |
| 24 | + :If load∧~hasdeps←0≠⎕NC'config.CIDER.dependencies.nuget' |
| 25 | + →0⊣r←'' ⍝ Asked to load, and there are no nuget dependencies |
| 26 | + :EndIf |
| 27 | + |
| 28 | + :If ~list∨load∨hasdeps∨~gotnuget |
| 29 | + config.CIDER.dependencies.nuget←'nuget-packages' |
| 30 | + config Put_JSON5 configfile |
| 31 | + :EndIf |
| 32 | + |
| 33 | + nuget_dir←path,'/',{0::⍵ ⋄ config.CIDER.dependencies.nuget}'nuget-packages' |
| 34 | + tatin_dir←path,'/',config.CIDER.dependencies.tatin |
| 35 | + gotnuget←gotnuget∧~list∧~⎕NEXISTS nuget_dir ⍝ Pretend we have no nuget if listing and no folder |
| 36 | + |
| 37 | + :If gotnuget∧type≡'nuget' |
| 38 | + r←NuGet.Setup nuget_dir |
| 39 | + →(∨/'error:'⍷⎕C r)⍴0 |
| 40 | + :EndIf |
| 41 | + |
| 42 | + :If list |
| 43 | + r←0 2⍴⊂nuget←tatin←'' |
| 44 | + :If gotnuget |
| 45 | + :AndIf ⎕NEXISTS nuget_dir |
| 46 | + nuget←{⍵,(0=≢⍵)/none}NuGet.Packages nuget_dir |
| 47 | + nuget←{1↓∊'/',¨⍵}¨nuget |
| 48 | + :EndIf |
| 49 | + :If gottatin |
| 50 | + :If {0::0 ⋄ ⎕NEXISTS ⍵}tatin_dir |
| 51 | + :Trap 11 ⍝ ListTatinPackages fails if there are none |
| 52 | + tatin←{2=⍴⍴⍵:(3↓⍵[;2])/3↓⍵[;1] ⋄ ⍬}ListTatinPackages path |
| 53 | + tatin←(' '=⊃¨tatin)↓¨tatin ⍝ leading space? |
| 54 | + :EndTrap |
| 55 | + :EndIf |
| 56 | + :EndIf |
| 57 | + r←(×≢¨nuget tatin)⌿2 2⍴'nuget: 'nuget'tatin:'tatin |
| 58 | + :If 0=≢r |
| 59 | + r←'No dependencies found' |
| 60 | + :EndIf |
| 61 | + →0 |
| 62 | + :EndIf |
| 63 | + |
| 64 | + :Select type |
| 65 | + :Case 'nuget' |
| 66 | + :If gotnuget∧(0≠≢package)∧type≡'nuget' |
| 67 | + r←NuGet.Add nuget_dir package |
| 68 | + →(∨/'error:'⍷⎕C r)⍴0 |
| 69 | + :EndIf |
| 70 | + |
| 71 | + :If ns≢0 |
| 72 | + :If 2=⎕NC'ns' |
| 73 | + ns←⍎ns |
| 74 | + :EndIf |
| 75 | + 'dotnet'ns.⎕NS'' |
| 76 | + ns.dotnet.⎕USING←NuGet.Using nuget_dir |
| 77 | + r←((~load)/r,'. '),'NuGet dependencies established in ',(⍕ns),'.dotnet' |
| 78 | + :EndIf |
| 79 | + :Case 'tatin' |
| 80 | + r←⎕SE.Tatin.InstallPackages package tatin_dir |
| 81 | + :EndSelect |
0 commit comments