package jetbrains.mps.build.mps.runner.generator.template.main; /*Generated by MPS */ import jetbrains.mps.generator.runtime.Generated; import jetbrains.mps.generator.impl.query.QueryProviderBase; import jetbrains.mps.generator.template.PropertyMacroContext; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SPropertyOperations; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SLinkOperations; import jetbrains.mps.smodel.adapter.structure.MetaAdapterFactory; import org.jetbrains.mps.openapi.model.SNode; import jetbrains.mps.internal.collections.runtime.Sequence; import jetbrains.mps.lang.smodel.generator.smodelAdapter.SNodeOperations; import jetbrains.mps.build.mps.behavior.BuildMps_AbstractModule__BehaviorDescriptor; import jetbrains.mps.build.mps.runner.behavior.BuildSolutionRunnerAspect__BehaviorDescriptor; import jetbrains.mps.generator.template.IfMacroContext; import jetbrains.mps.generator.template.SourceSubstituteMacroNodesContext; import jetbrains.mps.build.mps.util.ModuleFinder; import jetbrains.mps.internal.collections.runtime.ISelector; import jetbrains.mps.generator.template.TemplateVarContext; import jetbrains.mps.build.mps.util.MPSModulesClosure; import jetbrains.mps.build.mps.util.ModulePlugins; import java.util.Map; import jetbrains.mps.generator.impl.query.SourceNodesQuery; import java.util.HashMap; import org.jetbrains.annotations.NotNull; import jetbrains.mps.generator.impl.query.QueryKey; import jetbrains.mps.generator.impl.query.QueryKeyImpl; import java.util.Collection; import jetbrains.mps.generator.impl.GenerationFailureException; import jetbrains.mps.util.IterableUtil; import jetbrains.mps.generator.impl.query.PropertyValueQuery; import org.jetbrains.mps.openapi.language.SProperty; import org.jetbrains.annotations.Nullable; import jetbrains.mps.generator.impl.query.IfMacroCondition; import jetbrains.mps.generator.impl.query.VariableValueQuery; import org.jetbrains.mps.openapi.persistence.PersistenceFacade; import jetbrains.mps.smodel.SModelUtil_new; @Generated public class QueriesGenerated extends QueryProviderBase { public QueriesGenerated() { super(1); } public static Object propertyMacro_GetPropertyValue_3919210978214235101(final PropertyMacroContext _context) { return "Running code from " + SPropertyOperations.getString(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x427a473d5177432cL, 0x9905bcbceb71b996L, 0x39ea87a41cc0827eL, 0x54b085b5945c6691L, "solution")), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) + " solution in MPS"; } public static Object propertyMacro_GetPropertyValue_3919210978214491515(final PropertyMacroContext _context) { return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0xd94b027412f0824L, 0xd94b027412f0827L, "path")); } public static Object propertyMacro_GetPropertyValue_3919210978214632533(final PropertyMacroContext _context) { return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")); } public static Object propertyMacro_GetPropertyValue_3919210978214676897(final PropertyMacroContext _context) { return "${" + SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")) + "}"; } public static Object propertyMacro_GetPropertyValue_3919210978214528740(final PropertyMacroContext _context) { return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0xd94b027412f0824L, 0xd94b027412f0827L, "path")); } public static Object propertyMacro_GetPropertyValue_6102524510012109764(final PropertyMacroContext _context) { return SPropertyOperations.getString(_context.getNode(), MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0xd94b027412f0824L, 0xd94b027412f0827L, "path")); } public static Object propertyMacro_GetPropertyValue_9076354678688345524(final PropertyMacroContext _context) { SNode mpsAspect = Sequence.fromIterable(SNodeOperations.ofConcept(SLinkOperations.getChildren(((SNode) _context.getVariable("var:buildProject")), MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, 0x31292e1a60db57afL, "aspects")), MetaAdapterFactory.getConcept(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, "jetbrains.mps.build.mps.structure.BuildMpsAspect"))).first(); int heapSize; // 0 as default value and 0 as heap size should be distinguished if ((mpsAspect != null) && (isNotEmptyString(mpsAspect.getProperty(MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, 0x6ec3e043947b1eedL, "generationMaxHeapSizeInMb"))))) { heapSize = SPropertyOperations.getInteger(mpsAspect, MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, 0x6ec3e043947b1eedL, "generationMaxHeapSizeInMb")); } else { // default size heapSize = 512; } return "-Xmx" + heapSize + "m"; } public static Object propertyMacro_GetPropertyValue_353547257300549687(final PropertyMacroContext _context) { // 0 is the default value (not generated) int size = SPropertyOperations.getInteger(Sequence.fromIterable(SNodeOperations.ofConcept(SLinkOperations.getChildren(((SNode) _context.getVariable("var:buildProject")), MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, 0x31292e1a60db57afL, "aspects")), MetaAdapterFactory.getConcept(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, "jetbrains.mps.build.mps.structure.BuildMpsAspect"))).first(), MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, 0x4e80d5b7ab57aaaL, "generationMaxPermSizeInMb")); return "-XX:MaxPermSize=" + size + "m"; } public static Object propertyMacro_GetPropertyValue_6102524510012313449(final PropertyMacroContext _context) { return (String) BuildMps_AbstractModule__BehaviorDescriptor.getModuleReference_id41K1b4v5ZCB.invoke(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x427a473d5177432cL, 0x9905bcbceb71b996L, 0x39ea87a41cc0827eL, 0x54b085b5945c6691L, "solution"))); } public static Object propertyMacro_GetPropertyValue_6102524510012566133(final PropertyMacroContext _context) { return (String) BuildSolutionRunnerAspect__BehaviorDescriptor.getFQClassName_id1aYLt$9eyUg.invoke(_context.getNode()); } public static Object propertyMacro_GetPropertyValue_7415565752189735701(final PropertyMacroContext _context) { return (String) BuildSolutionRunnerAspect__BehaviorDescriptor.getMethodName_id1aYLt$9dX0a.invoke(_context.getNode()); } public static Object propertyMacro_GetPropertyValue_4173297143639165102(final PropertyMacroContext _context) { return "run." + SPropertyOperations.getString(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x427a473d5177432cL, 0x9905bcbceb71b996L, 0x39ea87a41cc0827eL, 0x54b085b5945c6691L, "solution")), MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name")); } public static boolean ifMacro_Condition_353547257300591823(final IfMacroContext _context) { return SPropertyOperations.getInteger(Sequence.fromIterable(SNodeOperations.ofConcept(SLinkOperations.getChildren(((SNode) _context.getVariable("var:buildProject")), MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, 0x31292e1a60db57afL, "aspects")), MetaAdapterFactory.getConcept(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, "jetbrains.mps.build.mps.structure.BuildMpsAspect"))).first(), MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0x5a408fb8c80220a9L, 0x4e80d5b7ab57aaaL, "generationMaxPermSizeInMb")) != 0; } public static Iterable<SNode> sourceNodesQuery_3919210978214504484(final SourceSubstituteMacroNodesContext _context) { return ModuleFinder.findModules(((Iterable<SNode>) _context.getVariable("var:libs")), _context, _context.getNode()); } public static Iterable<SNode> sourceNodesQuery_3919210978214507267(final SourceSubstituteMacroNodesContext _context) { return SNodeOperations.ofConcept(SLinkOperations.getChildren(((SNode) _context.getVariable("var:buildProject")), MetaAdapterFactory.getContainmentLink(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, 0x4df58c6f18f84a22L, "macros")), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x668c6cfbafadd002L, "jetbrains.mps.build.structure.BuildFolderMacro")); } public static Iterable<SNode> sourceNodesQuery_3919210978214521412(final SourceSubstituteMacroNodesContext _context) { return Sequence.fromIterable(Sequence.fromArray(((String[]) _context.getVariable("var:requiredPlugins")))).select(new ISelector<String, SNode>() { public SNode select(String it) { return createGeneratorInternal_String_x583g4_a0a0a0a0q(it); } }); } public static Iterable<SNode> sourceNodesQuery_6102524510012299620(final SourceSubstituteMacroNodesContext _context) { return ModuleFinder.findModules(Sequence.<SNode>singleton(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x427a473d5177432cL, 0x9905bcbceb71b996L, 0x39ea87a41cc0827eL, 0x54b085b5945c6691L, "solution"))), _context, _context.getNode()); } public static Object insertMacro_varValue_3919210978214839183(final TemplateVarContext _context) { return ((MPSModulesClosure) _context.getVariable("var:closure")).getAllModules(); } public static Object insertMacro_varValue_3919210978213957549(final TemplateVarContext _context) { return new MPSModulesClosure(Sequence.<SNode>singleton(SLinkOperations.getTarget(_context.getNode(), MetaAdapterFactory.getReferenceLink(0x427a473d5177432cL, 0x9905bcbceb71b996L, 0x39ea87a41cc0827eL, 0x54b085b5945c6691L, "solution"))), new MPSModulesClosure.ModuleDependenciesOptions().trackDevkits()).designtimeClosure(); } public static Object insertMacro_varValue_3919210978213965147(final TemplateVarContext _context) { return new ModulePlugins(SNodeOperations.cast(SNodeOperations.getContainingRoot(_context.getNode()), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, "jetbrains.mps.build.structure.BuildProject")), _context).getPluginPaths(); } public static Object insertMacro_varValue_3919210978214780329(final TemplateVarContext _context) { return SNodeOperations.as(SNodeOperations.getContainingRoot(_context.getNode()), MetaAdapterFactory.getConcept(0x798100da4f0a421aL, 0xb99171f8c50ce5d2L, 0x4df58c6f18f84a13L, "jetbrains.mps.build.structure.BuildProject")); } private final Map<String, SourceNodesQuery> snsqMethods = new HashMap<String, SourceNodesQuery>(); { int i = 0; snsqMethods.put("3919210978214504484", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("3919210978214507267", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("3919210978214521412", new QueriesGenerated.SNsQ(i++)); snsqMethods.put("6102524510012299620", new QueriesGenerated.SNsQ(i++)); } @NotNull @Override public SourceNodesQuery getSourceNodesQuery(@NotNull QueryKey identity) { final String id = ((QueryKeyImpl) identity).getQueryNodeId().toString(); if (!(snsqMethods.containsKey(id))) { return super.getSourceNodesQuery(identity); } return snsqMethods.get(id); } private static class SNsQ implements SourceNodesQuery { private final int methodKey; public SNsQ(int methodKey) { this.methodKey = methodKey; } @NotNull public Collection<SNode> evaluate(@NotNull SourceSubstituteMacroNodesContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_3919210978214504484(ctx)); case 1: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_3919210978214507267(ctx)); case 2: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_3919210978214521412(ctx)); case 3: return IterableUtil.asCollection(QueriesGenerated.sourceNodesQuery_6102524510012299620(ctx)); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private final Map<String, PropertyValueQuery> pvqMethods = new HashMap<String, PropertyValueQuery>(); { int i = 0; pvqMethods.put("3919210978214235100", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "starting code in MPS")); pvqMethods.put("3919210978214491514", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "lib.module.location.jar")); pvqMethods.put("3919210978214632530", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "name")); pvqMethods.put("3919210978214676894", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "value")); pvqMethods.put("3919210978214528739", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "plugin.jar")); pvqMethods.put("6102524510012109763", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "solution.location.jar")); pvqMethods.put("9076354678688345521", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "-Xmx512m")); pvqMethods.put("353547257300549686", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "-XX:MaxPermSize=64m")); pvqMethods.put("6102524510012313448", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "moduleRef")); pvqMethods.put("6102524510012566132", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "solution.MainClass")); pvqMethods.put("7415565752189735700", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0x479c7a8c02f943b5L, 0x9139d910cb22f298L, 0x5c842a42c54cfd1fL, 0x5c842a42c54cfd20L, "text"), "mpsmain")); pvqMethods.put("4173297143639165099", new QueriesGenerated.PVQ(i++, MetaAdapterFactory.getProperty(0xceab519525ea4f22L, 0x9b92103b95ca8c0cL, 0x110396eaaa4L, 0x110396ec041L, "name"), "run")); } @NotNull @Override public PropertyValueQuery getPropertyValueQuery(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(pvqMethods.containsKey(id))) { return super.getPropertyValueQuery(identity); } return pvqMethods.get(id); } private static class PVQ extends PropertyValueQuery.Base { private final int methodKey; /*package*/ PVQ(int methodKey, SProperty property, String templateValue) { super(property, templateValue); this.methodKey = methodKey; } @Nullable public Object evaluate(@NotNull PropertyMacroContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.propertyMacro_GetPropertyValue_3919210978214235101(ctx); case 1: return QueriesGenerated.propertyMacro_GetPropertyValue_3919210978214491515(ctx); case 2: return QueriesGenerated.propertyMacro_GetPropertyValue_3919210978214632533(ctx); case 3: return QueriesGenerated.propertyMacro_GetPropertyValue_3919210978214676897(ctx); case 4: return QueriesGenerated.propertyMacro_GetPropertyValue_3919210978214528740(ctx); case 5: return QueriesGenerated.propertyMacro_GetPropertyValue_6102524510012109764(ctx); case 6: return QueriesGenerated.propertyMacro_GetPropertyValue_9076354678688345524(ctx); case 7: return QueriesGenerated.propertyMacro_GetPropertyValue_353547257300549687(ctx); case 8: return QueriesGenerated.propertyMacro_GetPropertyValue_6102524510012313449(ctx); case 9: return QueriesGenerated.propertyMacro_GetPropertyValue_6102524510012566133(ctx); case 10: return QueriesGenerated.propertyMacro_GetPropertyValue_7415565752189735701(ctx); case 11: return QueriesGenerated.propertyMacro_GetPropertyValue_4173297143639165102(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private final Map<String, IfMacroCondition> imcMethods = new HashMap<String, IfMacroCondition>(); { int i = 0; imcMethods.put("353547257300591821", new QueriesGenerated.IfMC(i++)); } @NotNull @Override public IfMacroCondition getIfMacroCondition(@NotNull QueryKey identity) { final String id = identity.getTemplateNode().getNodeId().toString(); if (!(imcMethods.containsKey(id))) { return super.getIfMacroCondition(identity); } return imcMethods.get(id); } private static class IfMC implements IfMacroCondition { private final int methodKey; public IfMC(int methodKey) { this.methodKey = methodKey; } @Override public boolean check(@NotNull IfMacroContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.ifMacro_Condition_353547257300591823(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no condition method for if macro %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private final Map<String, VariableValueQuery> vvqMethods = new HashMap<String, VariableValueQuery>(); { vvqMethods.put("3919210978214839181", new QueriesGenerated.VVQ(0)); vvqMethods.put("3919210978213957547", new QueriesGenerated.VVQ(1)); vvqMethods.put("3919210978213965145", new QueriesGenerated.VVQ(2)); vvqMethods.put("3919210978214780327", new QueriesGenerated.VVQ(3)); } @NotNull @Override public VariableValueQuery getVariableValueQuery(@NotNull QueryKey queryKey) { final String id = queryKey.getTemplateNode().getNodeId().toString(); if (!(vvqMethods.containsKey(id))) { return super.getVariableValueQuery(queryKey); } return vvqMethods.get(id); } private static class VVQ implements VariableValueQuery { private final int methodKey; /*package*/ VVQ(int methodKey) { this.methodKey = methodKey; } @Nullable public Object evaluate(@NotNull TemplateVarContext ctx) throws GenerationFailureException { switch (methodKey) { case 0: return QueriesGenerated.insertMacro_varValue_3919210978214839183(ctx); case 1: return QueriesGenerated.insertMacro_varValue_3919210978213957549(ctx); case 2: return QueriesGenerated.insertMacro_varValue_3919210978213965147(ctx); case 3: return QueriesGenerated.insertMacro_varValue_3919210978214780329(ctx); default: throw new GenerationFailureException(String.format("Inconsistent QueriesGenerated: there's no method for query %s (key: #%d)", ctx.getTemplateReference(), methodKey)); } } } private static boolean isNotEmptyString(String str) { return str != null && str.length() > 0; } private static SNode createGeneratorInternal_String_x583g4_a0a0a0a0q(Object p0) { PersistenceFacade facade = PersistenceFacade.getInstance(); SNode n1 = SModelUtil_new.instantiateConceptDeclaration(MetaAdapterFactory.getConcept(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0xd94b027412f0824L, "jetbrains.mps.build.mps.structure.GeneratorInternal_String"), null, null, false); n1.setProperty(MetaAdapterFactory.getProperty(0xcf935df46994e9cL, 0xa132fa109541cba3L, 0xd94b027412f0824L, 0xd94b027412f0827L, "path"), p0 + ""); return n1; } }