@@ -15,31 +15,33 @@ import (
15
15
16
16
const (
17
17
// SCALA_GAZELLE_UNMANAGED_DEPS_FILE is an environment variable that, if
18
- // defined, activates the saving of uncorrelated deps for a given set of
18
+ // defined, activates the saving of unmanaged deps for a given set of
19
19
// rules that have recorded it.
20
20
SCALA_GAZELLE_UNMANAGED_DEPS_FILE = procutil .EnvVar ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE" )
21
21
)
22
22
23
23
// cleanup is the top-level function for various cleanup related features.
24
24
func (sl * scalaLang ) cleanup () {
25
25
if err := sl .cleanupUnmanagedDeps (); err != nil {
26
- log .Println ("warning: cleanup uncorrelated deps failed: %v" , err )
26
+ log .Println ("warning: cleanup unmanaged deps failed: %v" , err )
27
27
}
28
28
}
29
29
30
30
func (sl * scalaLang ) cleanupUnmanagedDeps () error {
31
31
if filename , ok := procutil .LookupEnv (SCALA_GAZELLE_UNMANAGED_DEPS_FILE ); ok {
32
- return sl .saveUncorrelatedDepsFile (filename )
32
+ return sl .saveUnmanagedDepsFile (filename )
33
33
} else {
34
+ log .Println ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE not set" )
34
35
sl .logger .Debug ().Msg ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE not set" )
35
36
}
36
37
return nil
37
38
}
38
39
39
- func (sl * scalaLang ) saveUncorrelatedDepsFile (filename string ) error {
40
- deps := sl .makeUncorrelatedDeps ()
40
+ func (sl * scalaLang ) saveUnmanagedDepsFile (filename string ) error {
41
+ deps := sl .makeUnmanagedDeps ()
41
42
if len (deps ) == 0 {
42
- sl .logger .Debug ().Msg ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE not written (no uncorrelated deps to write)" )
43
+ log .Println ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE not written (no unmanaged deps to write)" )
44
+ sl .logger .Debug ().Msg ("SCALA_GAZELLE_UNMANAGED_DEPS_FILE not written (no unmanaged deps to write)" )
43
45
return nil
44
46
}
45
47
@@ -53,22 +55,23 @@ func (sl *scalaLang) saveUncorrelatedDepsFile(filename string) error {
53
55
return err
54
56
}
55
57
56
- sl .logger .Debug ().Msg ("Wrote uncorrelated deps to " + filename )
58
+ log .Println ("Wrote unmanaged deps to " + filename )
59
+ sl .logger .Debug ().Msgf ("Wrote unmanaged deps to %s" , filename )
57
60
58
61
return nil
59
62
}
60
63
61
- func (sl * scalaLang ) makeUncorrelatedDeps () []UncorrelatedDeps {
62
- nonDirect := make (map [label.Label ]UncorrelatedDeps )
64
+ func (sl * scalaLang ) makeUnmanagedDeps () []UnmanagedDeps {
65
+ nonDirect := make (map [label.Label ]UnmanagedDeps )
63
66
64
67
for from , rule := range sl .knownRules {
65
68
if deps , ok := rule .PrivateAttr (scalaconfig .UnmanagedDepsPrivateAttrName ).([]string ); ok {
66
- nonDirect [from ] = UncorrelatedDeps {from : from , deps : deps }
67
- sl .logger .Debug ().Str ("from" , from .String ()).Msgf ("uncorrelated deps: %v" , deps )
69
+ nonDirect [from ] = UnmanagedDeps {from : from , deps : deps }
70
+ sl .logger .Debug ().Str ("from" , from .String ()).Msgf ("unmanaged deps: %v" , deps )
68
71
}
69
72
}
70
73
71
- deps := make ([]UncorrelatedDeps , 0 , len (nonDirect ))
74
+ deps := make ([]UnmanagedDeps , 0 , len (nonDirect ))
72
75
for _ , d := range nonDirect {
73
76
deps = append (deps , d )
74
77
}
@@ -82,11 +85,11 @@ func (sl *scalaLang) makeUncorrelatedDeps() []UncorrelatedDeps {
82
85
return deps
83
86
}
84
87
85
- type UncorrelatedDeps struct {
88
+ type UnmanagedDeps struct {
86
89
from label.Label
87
90
deps []string
88
91
}
89
92
90
- func (td * UncorrelatedDeps ) String () string {
93
+ func (td * UnmanagedDeps ) String () string {
91
94
return fmt .Sprintf ("%v %v" , td .from .String (), strings .Join (td .deps , " " ))
92
95
}
0 commit comments