@@ -111,7 +111,6 @@ func (b *Builder) compileFiles(
111
111
return objectFiles , nil
112
112
}
113
113
114
- // CompileFilesRecursive fixdoc
115
114
func (b * Builder ) compileFileWithRecipe (
116
115
sourcePath * paths.Path ,
117
116
source * paths.Path ,
@@ -129,11 +128,6 @@ func (b *Builder) compileFileWithRecipe(
129
128
return nil , err
130
129
}
131
130
132
- objIsUpToDate , err := utils .ObjFileIsUpToDate (source , objectFile , depsFile )
133
- if err != nil {
134
- return nil , err
135
- }
136
-
137
131
properties := b .buildProperties .Clone ()
138
132
properties .Set ("compiler.warning_flags" , properties .Get ("compiler.warning_flags." + b .logger .WarningsLevel ()))
139
133
properties .Set ("includes" , strings .Join (includes , " " ))
@@ -146,41 +140,50 @@ func (b *Builder) compileFileWithRecipe(
146
140
if b .compilationDatabase != nil {
147
141
b .compilationDatabase .Add (source , command )
148
142
}
149
- if ! objIsUpToDate && ! b .onlyUpdateCompilationDatabase {
150
- commandStdout , commandStderr := & bytes.Buffer {}, & bytes.Buffer {}
151
- command .RedirectStdoutTo (commandStdout )
152
- command .RedirectStderrTo (commandStderr )
153
143
144
+ objIsUpToDate , err := utils .ObjFileIsUpToDate (source , objectFile , depsFile )
145
+ if err != nil {
146
+ return nil , err
147
+ }
148
+ if objIsUpToDate {
154
149
if b .logger .VerbosityLevel () == logger .VerbosityVerbose {
155
- b .logger .Info (utils .PrintableCommand (command .GetArgs ()))
156
- }
157
- // Since this compile could be multithreaded, we first capture the command output
158
- if err := command .Start (); err != nil {
159
- return nil , err
150
+ b .logger .Info (i18n .Tr ("Using previously compiled file: %[1]s" , objectFile ))
160
151
}
161
- err := command .Wait ()
162
- // and transfer all at once at the end...
152
+ return objectFile , nil
153
+ }
154
+ if b .onlyUpdateCompilationDatabase {
163
155
if b .logger .VerbosityLevel () == logger .VerbosityVerbose {
164
- b .logger .WriteStdout ( commandStdout . Bytes ( ))
156
+ b .logger .Info ( i18n . Tr ( "Skipping compile of: %[1]s" , objectFile ))
165
157
}
166
- b .logger .WriteStderr (commandStderr .Bytes ())
158
+ return objectFile , nil
159
+ }
167
160
168
- // Parse the output of the compiler to gather errors and warnings...
169
- if b .diagnosticStore != nil {
170
- b .diagnosticStore .Parse (command .GetArgs (), commandStdout .Bytes ())
171
- b .diagnosticStore .Parse (command .GetArgs (), commandStderr .Bytes ())
172
- }
161
+ commandStdout , commandStderr := & bytes.Buffer {}, & bytes.Buffer {}
162
+ command .RedirectStdoutTo (commandStdout )
163
+ command .RedirectStderrTo (commandStderr )
164
+ if b .logger .VerbosityLevel () == logger .VerbosityVerbose {
165
+ b .logger .Info (utils .PrintableCommand (command .GetArgs ()))
166
+ }
167
+ // Since this compile could be multithreaded, we first capture the command output
168
+ if err := command .Start (); err != nil {
169
+ return nil , err
170
+ }
171
+ err = command .Wait ()
172
+ // and transfer all at once at the end...
173
+ if b .logger .VerbosityLevel () == logger .VerbosityVerbose {
174
+ b .logger .WriteStdout (commandStdout .Bytes ())
175
+ }
176
+ b .logger .WriteStderr (commandStderr .Bytes ())
173
177
174
- // ...and then return the error
175
- if err != nil {
176
- return nil , err
177
- }
178
- } else if b .logger .VerbosityLevel () == logger .VerbosityVerbose {
179
- if objIsUpToDate {
180
- b .logger .Info (i18n .Tr ("Using previously compiled file: %[1]s" , objectFile ))
181
- } else {
182
- b .logger .Info (i18n .Tr ("Skipping compile of: %[1]s" , objectFile ))
183
- }
178
+ // Parse the output of the compiler to gather errors and warnings...
179
+ if b .diagnosticStore != nil {
180
+ b .diagnosticStore .Parse (command .GetArgs (), commandStdout .Bytes ())
181
+ b .diagnosticStore .Parse (command .GetArgs (), commandStderr .Bytes ())
182
+ }
183
+
184
+ // ...and then return the error
185
+ if err != nil {
186
+ return nil , err
184
187
}
185
188
186
189
return objectFile , nil
0 commit comments