private Iterable<SNode> getUsedLanguages(SNode module) { Iterable<SNode> usedLangs = Sequence.fromIterable( SNodeOperations.ofConcept( dependencies(module), MetaAdapterFactory.getConcept( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c4467914643d2d2L, "jetbrains.mps.build.mps.structure.BuildMps_ModuleDependencyUseLanguage"))) .select( new ISelector<SNode, SNode>() { public SNode select(SNode it) { return SLinkOperations.getTarget( it, MetaAdapterFactory.getReferenceLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x2c4467914643d2d2L, 0x2c4467914643d2d3L, "language")); } }); Iterable<SNode> usedDevkits = Sequence.fromIterable(includingExtended(usedDevkits(module))).toListSequence(); if (trackDevkits) { SetSequence.fromSet(devkits).addSequence(Sequence.fromIterable(usedDevkits)); } Iterable<SNode> languagesFromDevkits = Sequence.fromIterable(usedDevkits) .translate( new ITranslator2<SNode, SNode>() { public Iterable<SNode> translate(SNode it) { return Sequence.fromIterable( SNodeOperations.ofConcept( SLinkOperations.getChildren( it, MetaAdapterFactory.getContainmentLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d2060eL, 0x4780308f5d29d82L, "exports")), MetaAdapterFactory.getConcept( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d29d6aL, "jetbrains.mps.build.mps.structure.BuildMps_DevKitExportLanguage"))) .select( new ISelector<SNode, SNode>() { public SNode select(SNode iit) { return SLinkOperations.getTarget( iit, MetaAdapterFactory.getReferenceLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d29d6aL, 0x4780308f5d29d73L, "language")); } }); } }); // use "core" language is added in loadModules pre-script return toOriginalLangs( includingExtendedLanguages(IterableUtil.merge(usedLangs, languagesFromDevkits))); }
private Iterable<SNode> getDependencies(SNode module, final boolean reexportOnly) { Iterable<SNode> dependencies = Sequence.fromIterable( SNodeOperations.ofConcept( dependencies(module), MetaAdapterFactory.getConcept( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x48e82d508334b11aL, "jetbrains.mps.build.mps.structure.BuildMps_ModuleDependencyOnModule"))) .where( new IWhereFilter<SNode>() { public boolean accept(SNode it) { return (!(reexportOnly) || SPropertyOperations.getBoolean( it, MetaAdapterFactory.getProperty( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x48e82d508334b11aL, 0x48e82d5083341cc1L, "reexport"))); } }) .select( new ISelector<SNode, SNode>() { public SNode select(SNode it) { return SLinkOperations.getTarget( it, MetaAdapterFactory.getReferenceLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x48e82d508334b11aL, 0x48e82d5083341cb9L, "module")); } }); // add extended langs dependencies = Sequence.fromIterable(dependencies) .concat( Sequence.fromIterable( SNodeOperations.ofConcept( dependencies(module), MetaAdapterFactory.getConcept( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x3b60c4a45c19032eL, "jetbrains.mps.build.mps.structure.BuildMps_ModuleDependencyExtendLanguage"))) .select( new ISelector<SNode, SNode>() { public SNode select(SNode it) { return SLinkOperations.getTarget( it, MetaAdapterFactory.getReferenceLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x3b60c4a45c19032eL, 0x3b60c4a45c190330L, "language")); } })); if (reexportOnly) { return toOriginal(dependencies); } Iterable<SNode> usedDevkits = Sequence.fromIterable(includingExtended(usedDevkits(module))).toListSequence(); if (trackDevkits) { SetSequence.fromSet(devkits).addSequence(Sequence.fromIterable(usedDevkits)); } Iterable<SNode> solutionsFromDevkits = Sequence.fromIterable(usedDevkits) .translate( new ITranslator2<SNode, SNode>() { public Iterable<SNode> translate(SNode it) { return Sequence.fromIterable( SNodeOperations.ofConcept( SLinkOperations.getChildren( it, MetaAdapterFactory.getContainmentLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d2060eL, 0x4780308f5d29d82L, "exports")), MetaAdapterFactory.getConcept( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d29d7aL, "jetbrains.mps.build.mps.structure.BuildMps_DevKitExportSolution"))) .select( new ISelector<SNode, SNode>() { public SNode select(SNode iit) { return SLinkOperations.getTarget( iit, MetaAdapterFactory.getReferenceLink( 0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x4780308f5d29d7aL, 0x4780308f5d29d7bL, "solution")); } }); } }); // "core" language is added in loadModules pre-script return toOriginal( IterableUtil.distinct(IterableUtil.merge(dependencies, solutionsFromDevkits))); }