X2CommunityCore / X2ModBuildCommon

An improved XCOM 2 mod build system
MIT License
5 stars 5 forks source link

Account for dependencies when deciding what maps to cook #47

Open Xymanek opened 3 years ago

Xymanek commented 3 years ago

Since switch to the DLC cook (#46) we need to figure out which maps are dirty and are in need of recook ourselves. Currently this logic only considers the map file only, ignoring the dependencies since we don't know what they are (except for collection maps, where we do know the, at least the direct ones).

One approach would be to have the mod devs manually specify the dependencies. This is simple for X2MBC, but error-prone for mod devs. A better approach would be to automatically infer the list of dependencies. If only there was a way to do it...

.\XComGame.com pkginfo TEST_map_CI.umap -import

[… Other output …]
--------------------------------------------
        Packages referenced by test_map_ci:
                0) Engine
                1) Core
                2) XComGame
                3) EngineMaterials
                4) EngineMeshes
                5) TEST_mat_CI_2
                6) UILibrary_StrategyImages

What's even better, is that it also lists transitive dependencies, not only the direct ones - in this case the map itself only referenced TEST_mat_CI_2, while an object there referenced something in UILibrary_StrategyImages. This command also accepts multiple packages/maps to check in one invocation.

I suggest the following workflow:

When a map is dirty/(re)cooked:

1) Before undoing the junctions/ini changes, run the above command to gather the dependencies 2) Save the list of maps with their dependencies to a json file in BuildCache (outside of PublishedCookedPCConsole)

When deciding whether a map is dirty:

1) If the tracking file is missing, all maps are dirty 2) If the cooked map is missing, it is dirty 3) If the specific map is missing a record for its dependencies, it is dirty 4) If the timestamp of the map or any of its dependencies is later than the cooked map, it is dirty

Of course, the output of the command will need to be parsed and cleaned - we don't want to check the timestamps for:

Xymanek commented 3 years ago

No longer relevant as DLC cook was reverted (#53)

Xymanek commented 2 years ago

Reopening since DLC cooking was re-implemented (#70)