Skip to content
This repository has been archived by the owner on Apr 13, 2023. It is now read-only.

Commit

Permalink
Add appropriate language module as a dependency of a binary module
Browse files Browse the repository at this point in the history
It is not the current version if the module was compiled with an old compiler

Part of #5734
  • Loading branch information
tombentley committed Nov 13, 2015
1 parent 32d4b52 commit ba711e5
Showing 1 changed file with 23 additions and 3 deletions.
26 changes: 23 additions & 3 deletions model/src/com/redhat/ceylon/model/loader/AbstractModelLoader.java
Original file line number Diff line number Diff line change
Expand Up @@ -2013,9 +2013,29 @@ private boolean loadCompiledModule(Module module, ClassMirror moduleClass, Strin
Module languageModule = modules.getLanguageModule();
module.setLanguageModule(languageModule);
if(!ModelUtil.equalModules(module, languageModule)){
ModuleImport moduleImport = moduleManager.findImport(module, languageModule);
if (moduleImport == null) {
moduleImport = new ModuleImport(languageModule, false, false);
boolean found = false;
for (ModuleImport mi : module.getImports()) {
if ("ceylon.language".equals(mi.getModule().getNameAsString())) {
found = true;
break;
}
}
if (!found) {
// It's not really a LazyModule because we're not loading
// it lazily. It's only here for module version analysis.
// But other stuff expects non-source modules to be lazy.
LazyModule oldLangMod = new LazyModule() {
@Override
protected AbstractModelLoader getModelLoader() {
return AbstractModelLoader.this;
}};
oldLangMod.setLanguageModule(oldLangMod);
oldLangMod.setName(Arrays.asList("ceylon", "language"));
oldLangMod.setVersion("1.1.1");
oldLangMod.setNativeBackends(Backends.JAVA);
oldLangMod.setMajor(Versions.V1_1_BINARY_MAJOR_VERSION);
oldLangMod.setMinor(Versions.V1_1_BINARY_MINOR_VERSION);
ModuleImport moduleImport = new ModuleImport(oldLangMod, false, false);
module.addImport(moduleImport);
}
}
Expand Down

0 comments on commit ba711e5

Please sign in to comment.