Skip to content

Commit 266deaf

Browse files
committed
Allow a module to exempt itself from requiring init via PROVIDE: init.
1 parent bf8e40d commit 266deaf

1 file changed

Lines changed: 5 additions & 5 deletions

File tree

PSql.Deploy.Engine/Seeds/SeedLoader.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -154,11 +154,6 @@ private void NewModule(CaptureCollection arguments)
154154

155155
_moduleName = arguments[0].Value;
156156

157-
// Ensure every module (except the initial module) implicitly requires
158-
// the initial module
159-
if (_moduleName != InitialModuleName)
160-
_requires.Add(InitialModuleName);
161-
162157
foreach (Capture argument in arguments.Skip(1))
163158
_provides.Add(argument.Value);
164159
}
@@ -208,6 +203,11 @@ private void AddBatch(string text, int start, int index)
208203

209204
private void EndModule()
210205
{
206+
// Ensure every module except the initial module (or its own
207+
// dependencies) implicitly requires the initial module
208+
if (_moduleName != InitialModuleName && !_provides.Contains(InitialModuleName))
209+
_requires.Add(InitialModuleName);
210+
211211
_modules.Add(new(
212212
_moduleName,
213213
_allWorkers ? -1 : 0, // workerId // TODO: constants or a custom struct

0 commit comments

Comments
 (0)