Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
openxt
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
msc
openxt
Commits
8db5f09c
There was an error fetching the commit references. Please try again later.
Commit
8db5f09c
authored
4 years ago
by
Bensong Liu
Browse files
Options
Downloads
Patches
Plain Diff
many bug fix, now openxt is able to work on the complete ControlPlane repo
parent
00433d25
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
csproj.go
+4
-0
4 additions, 0 deletions
csproj.go
main.go
+1
-1
1 addition, 1 deletion
main.go
packageManager.go
+8
-2
8 additions, 2 deletions
packageManager.go
tools/nuget-download-package/main.go
+8
-0
8 additions, 0 deletions
tools/nuget-download-package/main.go
util.go
+36
-0
36 additions, 0 deletions
util.go
with
57 additions
and
3 deletions
csproj.go
+
4
−
0
View file @
8db5f09c
...
...
@@ -80,6 +80,10 @@ func ParseDependencies(csprojPath string) (dependencies []dependencyItem, err er
}
else
{
endPos
:=
strings
.
IndexAny
(
hintPath
,
"/
\\
"
)
// Maybe `/lib/` or `\lib\`
targetNetVer
=
hintPath
[
:
endPos
]
if
dashPos
:=
strings
.
Index
(
targetNetVer
,
"-"
);
dashPos
!=
-
1
{
// Someone use "lib/net40-full/..." in HintPath. Cut the tail.
targetNetVer
=
targetNetVer
[
:
dashPos
]
}
}
}
}
...
...
This diff is collapsed.
Click to expand it.
main.go
+
1
−
1
View file @
8db5f09c
...
...
@@ -10,7 +10,7 @@ import (
// Some options here. Would be improved in beta release.
const
DEDUCT_PKGNAME_FROM_VARNAME
=
true
const
USE_PROJECT_NETVER_INSTEAD_OF_HINTPATH_NETVER
=
false
const
OPENXT_VERSION
=
"1.
1-
2"
const
OPENXT_VERSION
=
"1.2"
func
print_help_and_exit
()
{
println
(
"Usage: openxt <subcommand> [options...]"
)
...
...
This diff is collapsed.
Click to expand it.
packageManager.go
+
8
−
2
View file @
8db5f09c
...
...
@@ -39,9 +39,15 @@ func SyncPackages(nugetConfigPath, localRepoPath string, allDeps []dependencyIte
go
func
(
index
int
,
dep
dependencyItem
)
{
defer
func
()
{
<-
concurrencyLimitChan
;
wg
.
Done
()}()
log
.
Printf
(
"[%v/%v] Begin downloading: %v:%v as var %v"
,
index
,
len
(
depsToSync
),
dep
.
pkgName
,
dep
.
targetNetVer
,
dep
.
envName
)
log
.
Println
(
"nuget-download-package"
,
dep
.
pkgName
,
dep
.
targetNetVer
,
localRepoPath
,
nugetConfigPath
)
cmd
:=
exec
.
Command
(
"nuget-download-package"
,
dep
.
pkgName
,
dep
.
targetNetVer
,
localRepoPath
,
nugetConfigPath
)
realPkgName
,
realPkgVer
:=
extractPostfixPkgVerFromPkgName
(
dep
.
pkgName
)
if
realPkgVer
==
""
{
// This is not a pkgname.pkgver format. Use targetNetVer to deduce.
realPkgVer
=
dep
.
targetNetVer
}
log
.
Println
(
"EXEC: nuget-download-package"
,
realPkgName
,
realPkgVer
,
localRepoPath
,
nugetConfigPath
)
cmd
:=
exec
.
Command
(
"nuget-download-package"
,
realPkgName
,
realPkgVer
,
localRepoPath
,
nugetConfigPath
)
stdout
,
err
:=
cmd
.
CombinedOutput
()
log
.
Println
(
string
(
stdout
))
// We can do nothing on failure. usually, if envName is NULL, we need not install it at all.
...
...
This diff is collapsed.
Click to expand it.
tools/nuget-download-package/main.go
+
8
−
0
View file @
8db5f09c
...
...
@@ -231,7 +231,15 @@ func decidePackageVersion(frameworkVersion, packageVersion string, indexJsons, i
}
if
packageVersion
!=
""
{
// It should be a percise match here. However, someone in ControlPlane using PkgNewtonsoft_json_12.
// They only provide parts of the version number. It sucks.
thisPkgVersionIsOk
=
packageVersion
==
myVersionText
// That's why we use a prefix match here.
thisPkgVersionIsPossibleOk
=
strings
.
HasPrefix
(
myVersionText
,
packageVersion
)
// Some noob is writing `windowsazure.servicebus:6.0.0.0` (should be 6.0.0).
// Let's also tolerate this. Fuck!
thisPkgVersionIsPossibleOk
=
strings
.
HasPrefix
(
packageVersion
,
myVersionText
)
}
if
thisPkgVersionIsOk
{
...
...
This diff is collapsed.
Click to expand it.
util.go
+
36
−
0
View file @
8db5f09c
...
...
@@ -92,3 +92,39 @@ func depsDeduplicate(deps []dependencyItem) (resultDeps []dependencyItem) {
}
return
}
// Sometimes, they use `PkgMicrosoft_VisualStudio_Services_Release_Client_15_131_1` as var name,
// which would yeild Microsoft.VisualStudio.Services.Release.Client.15.131.1 as package name.
// This function could extract the real pkgName and pkgVer from bad pkgName.
func
extractPostfixPkgVerFromPkgName
(
badPkgName
string
)
(
realPkgName
,
pkgVer
string
)
{
// Reverse returns its argument string reversed rune-wise left to right.
strings_reverse
:=
func
(
s
string
)
string
{
r
:=
[]
rune
(
s
)
for
i
,
j
:=
0
,
len
(
r
)
-
1
;
i
<
len
(
r
)
/
2
;
i
,
j
=
i
+
1
,
j
-
1
{
r
[
i
],
r
[
j
]
=
r
[
j
],
r
[
i
]
}
return
string
(
r
)
}
splitedReversedStr
:=
strings
.
Split
(
strings_reverse
(
badPkgName
),
"."
)
for
eleIndex
,
ele
:=
range
splitedReversedStr
{
if
strings
.
IndexFunc
(
ele
,
func
(
r
rune
)
bool
{
return
strings
.
IndexRune
(
"0123456789"
,
r
)
==
-
1
})
==
-
1
{
// There's no non-number characters
// This element is version number.
}
else
{
pkgVer
=
strings_reverse
(
strings
.
Join
(
splitedReversedStr
[
:
eleIndex
],
"."
))
realPkgName
=
strings_reverse
(
strings
.
Join
(
splitedReversedStr
[
eleIndex
:
],
"."
))
break
}
}
if
realPkgName
==
""
{
// This is not a valid PkgName.PkgVer format. Give up the guess.
// If there's no `.` in pkgVer, someone is using partial version number. Luckily, nuget-download-package can do this now.
// Example: microsoft.azure.webjobs:2 (PkgMicrosoft_Azure_Webjobs_2)
// Example: newtonsoft.json.12:net45
realPkgName
=
badPkgName
pkgVer
=
""
}
return
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment