-
Notifications
You must be signed in to change notification settings - Fork 15
/
product.go
52 lines (43 loc) · 1.07 KB
/
product.go
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
package main
//
// Defines the CLI products we can build
//
import (
"fmt"
"path/filepath"
"strings"
"github.com/ooni/probe-engine/pkg/runtimex"
)
// product is a product we can build.
type product struct {
// Pkg is the package to build
Pkg string
// Kind is the product kind.
Kind string
}
// DestinationPath is the path where to build the product.
func (p *product) DestinationPath(goos, goarch string) string {
suffix := ""
if goos == "windows" {
suffix = ".exe"
}
pv := strings.Split(p.Pkg, "/")
runtimex.Assert(len(pv) >= 1, "expected at least one entry")
pname := pv[len(pv)-1]
return filepath.Join(p.Kind, fmt.Sprintf("%s-%s-%s%s", pname, goos, goarch, suffix))
}
// productMiniooni is the miniooni product.
var productMiniooni = &product{
Pkg: "./internal/cmd/miniooni",
Kind: "CLI",
}
// productOoniprobe is the ooniprobe product.
var productOoniprobe = &product{
Pkg: "./cmd/ooniprobe",
Kind: "CLI",
}
// productLibooniengine is the ooni engine shared library
var productLibooniengine = &product{
Pkg: "./internal/libooniengine",
Kind: "lib",
}