Skip to content
Snippets Groups Projects
Commit 64e84be2 authored by Bensong Liu's avatar Bensong Liu
Browse files

bug fix

parent 61104008
No related branches found
No related tags found
No related merge requests found
...@@ -85,3 +85,5 @@ dotnet build ...@@ -85,3 +85,5 @@ dotnet build
2. deps de-duplicate 2. deps de-duplicate
3. Parallelize `openxt sync` with multiple fake environment.
...@@ -3,13 +3,17 @@ package main ...@@ -3,13 +3,17 @@ package main
import ( import (
"flag" "flag"
"fmt" "fmt"
"log"
"os" "os"
) )
// Some options here // Some options here. Would be improved in beta release.
const DeductPkgNameFromVarName = true const DeductPkgNameFromVarName = true
const OPENXT_VERSION = "0.1.2a"
func main() { func main() {
log.Println("OpenXT version " + OPENXT_VERSION)
nugetConfigPath := "/home/recolic/tmp/test.nuget.config" // warning: not supported yet nugetConfigPath := "/home/recolic/tmp/test.nuget.config" // warning: not supported yet
projectDir := flag.String("project-dir", "", "Path to the CoreXT/OpenXT project. ") projectDir := flag.String("project-dir", "", "Path to the CoreXT/OpenXT project. ")
localRepoDir := flag.String("local-repo-dir", "", "Path to local nuget repo. (known as CxCache in CoreXT)") localRepoDir := flag.String("local-repo-dir", "", "Path to local nuget repo. (known as CxCache in CoreXT)")
......
...@@ -45,7 +45,10 @@ func SyncPackages(nugetConfigPath, localRepoPath string, allDeps []dependencyIte ...@@ -45,7 +45,10 @@ func SyncPackages(nugetConfigPath, localRepoPath string, allDeps []dependencyIte
targetNetVer = "net472" // Default dotnet version targetNetVer = "net472" // Default dotnet version
} }
if DeductPkgNameFromVarName { if DeductPkgNameFromVarName {
pkgName = varNameToPkgName(dep.envName) // PkgCis_SdkV2 requires this to work. guessedName := guessPkgNameFromVarName(dep.envName) // PkgCis_SdkV2 requires this to work.
if guessedName != "" {
pkgName = guessedName
}
} }
log.Println("DEBUG: Downloading pkg: " + pkgName + ":" + targetNetVer + " as var " + dep.envName) log.Println("DEBUG: Downloading pkg: " + pkgName + ":" + targetNetVer + " as var " + dep.envName)
......
...@@ -55,9 +55,11 @@ func assertStringNotEmpty(s, msg string) { ...@@ -55,9 +55,11 @@ func assertStringNotEmpty(s, msg string) {
} }
} }
func varNameToPkgName(varName string) string { // PkgCis_SdkV2 => Cis.SdkV2
if varName[:3] != "Pkg" { // On error, returns empty string.
return "InvalidVarName_" + varName func guessPkgNameFromVarName(varName string) string {
if len(varName) <= 3 || varName[:3] != "Pkg" {
return ""
} }
return strings.ReplaceAll(varName[3:], "_", ".") return strings.ReplaceAll(varName[3:], "_", ".")
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment