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