• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

UiPath / uipathcli / 13284663834

12 Feb 2025 11:48AM UTC coverage: 90.185% (-0.3%) from 90.522%
13284663834

push

github

thschmitt
Download .net runtime for cross-platform Studio Projects

- Added support to extract tar.gz archives which is needed to extract
  dotnet runtime archives on Linux and MacOS
- Downloading the suitable .net runtime when the user uses
  cross-platform Studio projects which allows the uipathcli to work
  without any additional dependencies

81 of 110 new or added lines in 4 files covered. (73.64%)

2 existing lines in 1 file now uncovered.

5072 of 5624 relevant lines covered (90.18%)

1.01 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

71.19
/plugin/studio/uipcli.go
1
package studio
2

3
import (
4
        "path/filepath"
5
        "runtime"
6

7
        "github.com/UiPath/uipathcli/log"
8
        "github.com/UiPath/uipathcli/plugin"
9
        "github.com/UiPath/uipathcli/utils/process"
10
)
11

12
const uipcliCrossPlatformVersion = "24.12.9111.31003"
13
const uipcliCrossPlatformUrl = "https://uipath.pkgs.visualstudio.com/Public.Feeds/_apis/packaging/feeds/1c781268-d43d-45ab-9dfc-0151a1c740b7/nuget/packages/UiPath.CLI/versions/" + uipcliCrossPlatformVersion + "/content"
14

15
const uipcliWindowsVersion = "24.12.9111.31003"
16
const uipcliWindowsUrl = "https://uipath.pkgs.visualstudio.com/Public.Feeds/_apis/packaging/feeds/1c781268-d43d-45ab-9dfc-0151a1c740b7/nuget/packages/UiPath.CLI.Windows/versions/" + uipcliWindowsVersion + "/content"
17

18
const dotnetLinuxUrl = "https://aka.ms/dotnet/8.0/dotnet-runtime-linux-x64.tar.gz"
19
const dotnetMacOsUrl = "https://aka.ms/dotnet/8.0/dotnet-runtime-osx-x64.tar.gz"
20
const dotnetWindowsUrl = "https://aka.ms/dotnet/8.0/dotnet-runtime-win-x64.zip"
21

22
type uipcli struct {
23
        Exec   process.ExecProcess
24
        Logger log.Logger
25
        path   string
26
        args   []string
27
}
28

29
func (c *uipcli) Initialize(targetFramework TargetFramework) error {
1✔
30
        uipcliPath, err := c.getUipcliPath(targetFramework)
1✔
31
        if err != nil {
1✔
32
                return err
×
33
        }
×
34
        c.path = uipcliPath
1✔
35

1✔
36
        if filepath.Ext(c.path) == ".dll" {
2✔
37
                dotnetPath, err := c.getDotnetPath()
1✔
38
                if err != nil {
1✔
NEW
39
                        return err
×
40
                }
×
41
                c.path = dotnetPath
1✔
42
                c.args = []string{uipcliPath}
1✔
43
        }
44
        return nil
1✔
45
}
46

47
func (c uipcli) Execute(args ...string) (process.ExecCmd, error) {
1✔
48
        args = append(c.args, args...)
1✔
49
        cmd := c.Exec.Command(c.path, args...)
1✔
50
        return cmd, nil
1✔
51
}
1✔
52

53
func (c uipcli) getUipcliPath(targetFramework TargetFramework) (string, error) {
1✔
54
        externalPlugin := plugin.NewExternalPlugin(c.Logger)
1✔
55
        name := "uipcli"
1✔
56
        url := uipcliCrossPlatformUrl
1✔
57
        executable := "tools/uipcli.dll"
1✔
58
        if targetFramework.IsWindowsOnly() {
1✔
NEW
59
                name = "uipcli-win"
×
NEW
60
                url = uipcliWindowsUrl
×
61
                executable = "tools/uipcli.exe"
×
62
        }
×
63
        return externalPlugin.GetTool(name, url, executable, "Zip")
1✔
64
}
65

66
func (c uipcli) getDotnetPath() (string, error) {
1✔
67
        externalPlugin := plugin.NewExternalPlugin(c.Logger)
1✔
68
        name := "dotnet8"
1✔
69
        url := dotnetLinuxUrl
1✔
70
        executable := "dotnet"
1✔
71
        archiveType := "TarGz"
1✔
72

1✔
73
        if c.isWindows() {
1✔
NEW
74
                name = "dotnet8-win"
×
NEW
75
                url = dotnetWindowsUrl
×
NEW
76
                executable = "dotnet.exe"
×
NEW
77
                archiveType = "Zip"
×
78
        } else if c.isMacOS() {
1✔
NEW
79
                name = "dotnet8-macos"
×
NEW
80
                url = dotnetMacOsUrl
×
NEW
81
                executable = "dotnet"
×
NEW
82
                archiveType = "TarGz"
×
NEW
83
        }
×
84
        return externalPlugin.GetTool(name, url, executable, archiveType)
1✔
85
}
86

87
func (c uipcli) isWindows() bool {
1✔
88
        return runtime.GOOS == "windows"
1✔
89
}
1✔
90

91
func (c uipcli) isMacOS() bool {
1✔
92
        return runtime.GOOS == "darwin"
1✔
93
}
1✔
94

95
func newUipcli(exec process.ExecProcess, logger log.Logger) *uipcli {
1✔
96
        return &uipcli{exec, logger, "", []string{}}
1✔
97
}
1✔
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc