Skip to content

Commit fffa451

Browse files
committed
Slightly simplify utils.compileFileWithRecipe
This commit should be equivalent, no semantic changes just simplified the notation.
1 parent c750434 commit fffa451

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

Diff for: legacy/builder/builder_utils/utils.go

+7-6
Original file line numberDiff line numberDiff line change
@@ -237,28 +237,29 @@ func compileFileWithRecipe(ctx *types.Context, sourcePath *paths.Path, source *p
237237
if err != nil {
238238
return nil, i18n.WrapError(err)
239239
}
240-
properties.Set(constants.BUILD_PROPERTIES_OBJECT_FILE, buildPath.JoinPath(relativeSource).String()+".o")
240+
depsFile := buildPath.Join(relativeSource.String() + ".d")
241+
objectFile := buildPath.Join(relativeSource.String() + ".o")
241242

242-
err = properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE).Parent().MkdirAll()
243+
properties.SetPath(constants.BUILD_PROPERTIES_OBJECT_FILE, objectFile)
244+
err = objectFile.Parent().MkdirAll()
243245
if err != nil {
244246
return nil, i18n.WrapError(err)
245247
}
246248

247-
objIsUpToDate, err := ObjFileIsUpToDate(ctx, properties.GetPath(constants.BUILD_PROPERTIES_SOURCE_FILE), properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE), buildPath.Join(relativeSource.String()+".d"))
249+
objIsUpToDate, err := ObjFileIsUpToDate(ctx, source, objectFile, depsFile)
248250
if err != nil {
249251
return nil, i18n.WrapError(err)
250252
}
251-
252253
if !objIsUpToDate {
253254
_, _, err = ExecRecipe(ctx, properties, recipe, false /* stdout */, utils.ShowIfVerbose /* stderr */, utils.Show)
254255
if err != nil {
255256
return nil, i18n.WrapError(err)
256257
}
257258
} else if ctx.Verbose {
258-
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, properties.Get(constants.BUILD_PROPERTIES_OBJECT_FILE))
259+
logger.Println(constants.LOG_LEVEL_INFO, constants.MSG_USING_PREVIOUS_COMPILED_FILE, objectFile)
259260
}
260261

261-
return properties.GetPath(constants.BUILD_PROPERTIES_OBJECT_FILE), nil
262+
return objectFile, nil
262263
}
263264

264265
func ObjFileIsUpToDate(ctx *types.Context, sourceFile, objectFile, dependencyFile *paths.Path) (bool, error) {

0 commit comments

Comments
 (0)