Skip to content

Commit 2e06146

Browse files
committed
Removed unused parameter
1 parent 4044e39 commit 2e06146

File tree

3 files changed

+10
-25
lines changed

3 files changed

+10
-25
lines changed

legacy/builder/builder_utils/utils.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p
210210
return nil, errors.WithStack(err)
211211
}
212212

213-
objIsUpToDate, err := ObjFileIsUpToDate(ctx, source, objectFile, depsFile)
213+
objIsUpToDate, err := ObjFileIsUpToDate(source, objectFile, depsFile)
214214
if err != nil {
215215
return nil, errors.WithStack(err)
216216
}
@@ -237,7 +237,7 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p
237237
return objectFile, nil
238238
}
239239

240-
func ObjFileIsUpToDate(ctx *types.Context, sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {
240+
func ObjFileIsUpToDate(sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {
241241
logrus.Debugf("Checking previous results for %v (result = %v, dep = %v)", sourceFile, objectFile, dependencyFile)
242242
if objectFile == nil || dependencyFile == nil {
243243
logrus.Debugf("Not found: nil")

legacy/builder/container_find_includes.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,7 @@ func findIncludesUntilDone(ctx *types.Context, cache *includeCache, sourceFile t
312312
// TODO: This reads the dependency file, but the actual building
313313
// does it again. Should the result be somehow cached? Perhaps
314314
// remove the object file if it is found to be stale?
315-
unchanged, err := builder_utils.ObjFileIsUpToDate(ctx, sourcePath, objPath, depPath)
315+
unchanged, err := builder_utils.ObjFileIsUpToDate(sourcePath, objPath, depPath)
316316
if err != nil {
317317
return errors.WithStack(err)
318318
}

legacy/builder/test/builder_utils_test.go

Lines changed: 7 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import (
2121
"time"
2222

2323
"github.com/arduino/arduino-cli/legacy/builder/builder_utils"
24-
"github.com/arduino/arduino-cli/legacy/builder/types"
2524
paths "github.com/arduino/go-paths-helper"
2625
"github.com/stretchr/testify/require"
2726
)
@@ -40,33 +39,27 @@ func tempFile(t *testing.T, prefix string) *paths.Path {
4039
}
4140

4241
func TestObjFileIsUpToDateObjMissing(t *testing.T) {
43-
ctx := &types.Context{}
44-
4542
sourceFile := tempFile(t, "source")
4643
defer sourceFile.RemoveAll()
4744

48-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, nil, nil)
45+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, nil, nil)
4946
NoError(t, err)
5047
require.False(t, upToDate)
5148
}
5249

5350
func TestObjFileIsUpToDateDepMissing(t *testing.T) {
54-
ctx := &types.Context{}
55-
5651
sourceFile := tempFile(t, "source")
5752
defer sourceFile.RemoveAll()
5853

5954
objFile := tempFile(t, "obj")
6055
defer objFile.RemoveAll()
6156

62-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, nil)
57+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, nil)
6358
NoError(t, err)
6459
require.False(t, upToDate)
6560
}
6661

6762
func TestObjFileIsUpToDateObjOlder(t *testing.T) {
68-
ctx := &types.Context{}
69-
7063
objFile := tempFile(t, "obj")
7164
defer objFile.RemoveAll()
7265
depFile := tempFile(t, "dep")
@@ -77,14 +70,12 @@ func TestObjFileIsUpToDateObjOlder(t *testing.T) {
7770
sourceFile := tempFile(t, "source")
7871
defer sourceFile.RemoveAll()
7972

80-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, depFile)
73+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, depFile)
8174
NoError(t, err)
8275
require.False(t, upToDate)
8376
}
8477

8578
func TestObjFileIsUpToDateObjNewer(t *testing.T) {
86-
ctx := &types.Context{}
87-
8879
sourceFile := tempFile(t, "source")
8980
defer sourceFile.RemoveAll()
9081

@@ -95,14 +86,12 @@ func TestObjFileIsUpToDateObjNewer(t *testing.T) {
9586
depFile := tempFile(t, "dep")
9687
defer depFile.RemoveAll()
9788

98-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, depFile)
89+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, depFile)
9990
NoError(t, err)
10091
require.True(t, upToDate)
10192
}
10293

10394
func TestObjFileIsUpToDateDepIsNewer(t *testing.T) {
104-
ctx := &types.Context{}
105-
10695
sourceFile := tempFile(t, "source")
10796
defer sourceFile.RemoveAll()
10897

@@ -121,14 +110,12 @@ func TestObjFileIsUpToDateDepIsNewer(t *testing.T) {
121110
data := objFile.String() + ": \\\n\t" + sourceFile.String() + " \\\n\t" + headerFile.String()
122111
depFile.WriteFile([]byte(data))
123112

124-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, depFile)
113+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, depFile)
125114
NoError(t, err)
126115
require.False(t, upToDate)
127116
}
128117

129118
func TestObjFileIsUpToDateDepIsOlder(t *testing.T) {
130-
ctx := &types.Context{}
131-
132119
sourceFile := tempFile(t, "source")
133120
defer sourceFile.RemoveAll()
134121

@@ -145,14 +132,12 @@ func TestObjFileIsUpToDateDepIsOlder(t *testing.T) {
145132
res := objFile.String() + ": \\\n\t" + sourceFile.String() + " \\\n\t" + headerFile.String()
146133
depFile.WriteFile([]byte(res))
147134

148-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, depFile)
135+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, depFile)
149136
NoError(t, err)
150137
require.True(t, upToDate)
151138
}
152139

153140
func TestObjFileIsUpToDateDepIsWrong(t *testing.T) {
154-
ctx := &types.Context{}
155-
156141
sourceFile := tempFile(t, "source")
157142
defer sourceFile.RemoveAll()
158143

@@ -171,7 +156,7 @@ func TestObjFileIsUpToDateDepIsWrong(t *testing.T) {
171156
res := sourceFile.String() + ": \\\n\t" + sourceFile.String() + " \\\n\t" + headerFile.String()
172157
depFile.WriteFile([]byte(res))
173158

174-
upToDate, err := builder_utils.ObjFileIsUpToDate(ctx, sourceFile, objFile, depFile)
159+
upToDate, err := builder_utils.ObjFileIsUpToDate(sourceFile, objFile, depFile)
175160
NoError(t, err)
176161
require.False(t, upToDate)
177162
}

0 commit comments

Comments
 (0)