build: Store depends in GeneratedList instead of Generator

Since they are actually dependencies out the output not the Generator
itself.

This fixes dependency issues in the ninja backend, allowing Meson to
rebuild more accurately. It also does sometimes in the vs backend, but
there are problems in the vs backend I'm not sure how to solve. The
vsbackend is, itself, so fragile looking I don't want to get too
involved with it.
pull/10473/head
Dylan Baker 3 years ago committed by Jussi Pakkanen
parent 3efb51a958
commit d0a0e04c98
  1. 8
      mesonbuild/backend/vs2010backend.py
  2. 4
      mesonbuild/build.py

@ -12,7 +12,9 @@
# See the License for the specific language governing permissions and # See the License for the specific language governing permissions and
# limitations under the License. # limitations under the License.
from __future__ import annotations
import copy import copy
import itertools
import os import os
import xml.dom.minidom import xml.dom.minidom
import xml.etree.ElementTree as ET import xml.etree.ElementTree as ET
@ -318,11 +320,13 @@ class Vs2010Backend(backends.Backend):
gen_exe = generator.get_exe() gen_exe = generator.get_exe()
if isinstance(gen_exe, build.Executable): if isinstance(gen_exe, build.Executable):
all_deps[gen_exe.get_id()] = gen_exe all_deps[gen_exe.get_id()] = gen_exe
for d in generator.depends: for d in itertools.chain(generator.depends, gendep.depends):
if isinstance(d, build.CustomTargetIndex): if isinstance(d, build.CustomTargetIndex):
all_deps[d.get_id()] = d.target all_deps[d.get_id()] = d.target
else: elif isinstance(d, build.Target):
all_deps[d.get_id()] = d all_deps[d.get_id()] = d
# FIXME: we don't handle other kinds of deps correctly here, such
# as GeneratedLists, StructuredSources, and generated File.
if not t or not recursive: if not t or not recursive:
return all_deps return all_deps

@ -1720,7 +1720,7 @@ class Generator(HoldableObject):
output.depends.add(e.target) output.depends.add(e.target)
if isinstance(e, (CustomTarget, CustomTargetIndex, GeneratedList)): if isinstance(e, (CustomTarget, CustomTargetIndex, GeneratedList)):
self.depends.append(e) # BUG: this should go in the GeneratedList object, not this object. output.depends.add(e)
fs = [File.from_built_file(state.subdir, f) for f in e.get_outputs()] fs = [File.from_built_file(state.subdir, f) for f in e.get_outputs()]
elif isinstance(e, str): elif isinstance(e, str):
fs = [File.from_source_file(state.environment.source_dir, state.subdir, e)] fs = [File.from_source_file(state.environment.source_dir, state.subdir, e)]
@ -1748,7 +1748,7 @@ class GeneratedList(HoldableObject):
def __post_init__(self) -> None: def __post_init__(self) -> None:
self.name = self.generator.exe self.name = self.generator.exe
self.depends: T.Set['CustomTarget'] = set() # Things this target depends on (because e.g. a custom target was used as input) self.depends: T.Set[GeneratedTypes] = set()
self.infilelist: T.List['File'] = [] self.infilelist: T.List['File'] = []
self.outfilelist: T.List[str] = [] self.outfilelist: T.List[str] = []
self.outmap: T.Dict[File, T.List[str]] = {} self.outmap: T.Dict[File, T.List[str]] = {}

Loading…
Cancel
Save