-
Notifications
You must be signed in to change notification settings - Fork 1.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feature: migrate to gestaltv7 #4593
Changes from 1 commit
e55b7f0
f9ce52f
46c29ee
5504449
9afe704
850ee40
911110a
d9af0ba
0a175af
8e26159
7b1bd17
cba8ef5
3986c4d
b874418
bfb1a8e
6412aab
a7e2fb3
f3711c3
442d2fd
31715d2
1c48c86
42ffb8e
2f9d4af
20546f1
c69a87f
d8de0d3
3c5ff6e
873dec8
ccec83d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -73,17 +73,32 @@ public ModuleManager(String masterServerAddress, List<Class<?>> classesOnClasspa | |
|
||
registry = new TableModuleRegistry(); | ||
|
||
engineModule = loadEngineModule(classesOnClasspathsToAddToEngine); | ||
engineModule = moduleFactory.createPackageModule("org.terasology.engine"); | ||
Module nui = createSyntheticPackageModule("nui", "3.0.0", "org.terasology.nui"); | ||
Module discordSubsystem = moduleFactory.createPackageModule("org.terasology.subsystem.discordrpc"); | ||
|
||
loadModulesFromApplicationPath(pathManager); | ||
createDependency(engineModule, nui); | ||
|
||
registry.add(nui); | ||
registry.add(engineModule); | ||
registry.add(discordSubsystem); | ||
|
||
loadModulesFromApplicationPath(pathManager); | ||
ensureModulesDependOnEngine(); | ||
|
||
setupSandbox(); | ||
loadEnvironment(Sets.newHashSet(engineModule), true); | ||
loadEnvironment(Sets.newHashSet(engineModule, nui, discordSubsystem), true); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. TODO: We should switch this to the new |
||
installManager = new ModuleInstallManager(this, masterServerAddress); | ||
} | ||
|
||
private void createDependency(Module parent, Module child) { | ||
DependencyInfo dependencyInfo = new DependencyInfo(); | ||
dependencyInfo.setId(child.getId()); | ||
dependencyInfo.setMinVersion(child.getVersion()); | ||
dependencyInfo.setMaxVersion(child.getVersion().getNextPatchVersion()); | ||
parent.getMetadata().getDependencies().add(dependencyInfo); | ||
Comment on lines
+92
to
+97
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 👍 makes sense to have a function for this. TODO: refactor FIXME: note 20546f1 — getNextPatchVersion may break for this purpose when base version is a SNAPSHOT. |
||
} | ||
|
||
/** | ||
* I wondered why this is important, and found MovingBlocks/Terasology#1450. | ||
* It's not a worry that the engine module wouldn't be loaded without it. | ||
|
@@ -110,27 +125,6 @@ private void loadModulesFromApplicationPath(PathManager pathManager) { | |
scanner.scan(registry, paths); | ||
} | ||
|
||
private Module loadEngineModule(List<Class<?>> classesOnClasspathsToAddToEngine) { | ||
// FIXME: is `classes…toAddToEngine` gone? Did we ever use it in the first place? | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Did you check for |
||
Module engine = moduleFactory.createPackageModule("org.terasology.engine"); | ||
// TODO: document why nui is a module when other libraries are not | ||
Module nui = createSyntheticPackageModule("nui", "3.0.0" /* FIXME */, "org.terasology.nui"); | ||
|
||
DependencyInfo nuiDependency = new DependencyInfo(); | ||
nuiDependency.setId(nui.getId()); | ||
nuiDependency.setMinVersion(nui.getVersion()); | ||
nuiDependency.setMaxVersion(nui.getVersion().getNextPatchVersion()); | ||
engine.getMetadata().getDependencies().add(nuiDependency); | ||
|
||
registry.add(nui); | ||
registry.add(engine); | ||
|
||
// FIXME: why doesn't gestalt-v7 need this? | ||
// enrichReflectionsWithSubsystems(engineModule); | ||
|
||
return engine; | ||
} | ||
|
||
public ModuleManager(Config config) { | ||
this(config, Collections.emptyList()); | ||
} | ||
|
@@ -242,19 +236,4 @@ public ModuleFactory getModuleFactory() { | |
return moduleFactory; | ||
} | ||
|
||
// private void enrichReflectionsWithSubsystems(Module engineModule) { | ||
// Serializer serializer = new XmlSerializer(); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. why doesn't the gestalt-v7 branch need an |
||
// try { | ||
// Enumeration<URL> urls = ModuleManager.class.getClassLoader().getResources("reflections.cache"); | ||
// while (urls.hasMoreElements()) { | ||
// URL url = urls.nextElement(); | ||
// if (url.getPath().contains("subsystem")) { | ||
// Reflections subsystemReflections = serializer.read(url.openStream()); | ||
// engineModule.getReflectionsFragment().merge(subsystemReflections); | ||
// } | ||
// } | ||
// } catch (IOException e) { | ||
// logger.error("Cannot enrich engine's reflections with subsystems"); | ||
// } | ||
// } | ||
} |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
{ | ||
"id" : "discord", | ||
"version" : "4.4.1-SNAPSHOT", | ||
"displayName" : "Discord Subsystem", | ||
"description" : "Discord Subsystem" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hrmmm. Not sure about adding hardcoded references to subsystems in engine's ModuleManager.
The point of extracting subsystems—as I understand it—is to make it so the engine doesn't always need to depend on them. i.e. a facade should be able to start an engine that doesn't have a DiscordRPC subsystem at all.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yea, at the moment its a hack to get the game to run. System is registered but it can't resolve autoconfig when it tries to scan with environment.