Skip to content

Commit

Permalink
fix artifact generation (#2732)
Browse files Browse the repository at this point in the history
  • Loading branch information
Yasirmod17 authored Mar 27, 2024
1 parent b8f53cb commit e3b226d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public class FunctionActivatorArtifact

public String getVersionInfo(AlloySDLC sdlc)
{
if (this.version != null)
if (sdlc.version != null)
{
return sdlc.groupId + ":" + sdlc.artifactId + ":" + sdlc.version;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,12 @@
import org.eclipse.collections.api.block.function.Function;
import org.eclipse.collections.api.factory.Lists;
import org.eclipse.collections.api.factory.Maps;
import org.eclipse.collections.api.list.ListIterable;
import org.eclipse.collections.api.list.MutableList;
import org.finos.legend.engine.language.hostedService.generation.control.HostedServiceOwnerValidationService;
import org.finos.legend.engine.language.hostedService.generation.control.HostedServiceOwnerValidator;
import org.finos.legend.engine.plan.generation.extension.PlanGeneratorExtension;
import org.finos.legend.engine.plan.generation.transformers.PlanTransformer;
import org.finos.legend.engine.protocol.hostedService.deployment.model.GenerationInfoData;
import org.finos.legend.engine.language.pure.compiler.toPureGraph.PureModel;
import org.finos.legend.engine.plan.generation.PlanGenerator;
Expand All @@ -41,11 +45,14 @@
import org.finos.legend.pure.m3.coreinstance.meta.pure.metamodel.function.ConcreteFunctionDefinition;

import java.util.Map;
import java.util.ServiceLoader;

import static org.finos.legend.pure.generated.platform_pure_basics_meta_elementToPath.Root_meta_pure_functions_meta_elementToPath_PackageableElement_1__String_1_;

public class HostedServiceArtifactGenerator
{
static final MutableList<PlanGeneratorExtension> generatorExtensions = Lists.mutable.withAll(ServiceLoader.load(PlanGeneratorExtension.class));

public static GenerationInfoData renderArtifact(PureModel pureModel, Root_meta_external_function_activator_hostedService_HostedService activator, PureModelContext inputModel, String clientVersion, Function<PureModel, RichIterable<? extends Root_meta_pure_extension_Extension>> routerExtensions)
{
ExecutionPlan plan = generatePlan(pureModel, activator, inputModel, clientVersion, routerExtensions);
Expand All @@ -55,14 +62,15 @@ public static GenerationInfoData renderArtifact(PureModel pureModel, Root_meta_e

public static ExecutionPlan generatePlan(PureModel pureModel, Root_meta_external_function_activator_hostedService_HostedService activator, PureModelContext inputModel, String clientVersion,Function<PureModel, RichIterable<? extends Root_meta_pure_extension_Extension>> routerExtensions)
{
ListIterable<PlanTransformer> transformers = generatorExtensions.flatCollect(PlanGeneratorExtension::getExtraPlanTransformers);
if (core_hostedservice_generation_generation.Root_meta_external_function_activator_hostedService_generation_isMultiEenvironmentService_HostedService_1__Boolean_1_(activator, pureModel.getExecutionSupport()))
{
Map<String, SingleExecutionPlan> plans = Maps.mutable.empty();
String execKey = core_hostedservice_generation_generation.Root_meta_external_function_activator_hostedService_generation_getEnvironmentkey_HostedService_1__String_1_(activator, pureModel.getExecutionSupport());
core_hostedservice_generation_generation.Root_meta_external_function_activator_hostedService_generation_rebuildServiceUsingSingleExecutionParams_HostedService_1__Pair_MANY_(activator, pureModel.getExecutionSupport()).forEach(p ->
{
ExecutionPlan plan = PlanGenerator.generateExecutionPlan((ConcreteFunctionDefinition) p._second()._function(), null, null, null, pureModel,
clientVersion, PlanPlatform.JAVA, null, routerExtensions.apply(pureModel), LegendPlanTransformers.transformers);
clientVersion, PlanPlatform.JAVA, null, routerExtensions.apply(pureModel), transformers);
plans.put(p._first(), (SingleExecutionPlan) plan);

}
Expand All @@ -72,7 +80,7 @@ public static ExecutionPlan generatePlan(PureModel pureModel, Root_meta_external
else
{
return PlanGenerator.generateExecutionPlan((ConcreteFunctionDefinition)activator._function(), null, null, null, pureModel,
clientVersion, PlanPlatform.JAVA, null, routerExtensions.apply(pureModel), LegendPlanTransformers.transformers);
clientVersion, PlanPlatform.JAVA, null, routerExtensions.apply(pureModel), transformers);
}
}

Expand Down

0 comments on commit e3b226d

Please sign in to comment.