Skip to content

Commit

Permalink
minor fixes
Browse files Browse the repository at this point in the history
fix build with java 21

use google inject instead of javax inject

in esa-cdk do not replace "_" by "." in package name

in xsmp-sdk do not generate unused parameter if possible
  • Loading branch information
ydaveluy committed Nov 29, 2023
1 parent 6ba11fe commit e32dd8b
Show file tree
Hide file tree
Showing 20 changed files with 226 additions and 247 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.cli
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.feature
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.inject.Inject;
import com.google.inject.Inject;

import org.eclipse.core.databinding.Binding;
import org.eclipse.emf.ecore.EObject;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import java.util.UUID;

import javax.inject.Inject;
import com.google.inject.Inject;

import org.eclipse.emf.ecp.view.spi.context.ViewModelContext;
import org.eclipse.emf.ecp.view.spi.core.swt.renderer.TextControlSWTRenderer;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.ide
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.profile.esa_cdk.cli
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ final class EsaCdkProject {

override protected updateVariables() {
if (name.value == cName)
name.value = projectInfo.projectName.split("\\.").last
name.value = projectInfo.projectName.replaceAll("\\.","_")
super.updateVariables()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,10 @@
import org.eclipse.xsmp.generator.cpp.type.ExceptionGenerator;
import org.eclipse.xsmp.generator.cpp.type.StringGenerator;
import org.eclipse.xsmp.profile.esa_cdk.generator.EsaCdkGenerator;
import org.eclipse.xsmp.profile.esa_cdk.generator.EsaCdkGeneratorExtension;
import org.eclipse.xsmp.profile.esa_cdk.generator.EsaCdkOutputConfigurationProvider;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.EsaCdkCatalogueGenerator;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.EsaCdkCopyrightProvider;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.EsaCdkGeneratorExtension;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.member.EsaCdkConstantGenerator;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.member.EsaCdkContainerGenerator;
import org.eclipse.xsmp.profile.esa_cdk.generator.cpp.member.EsaCdkEntryPointGenerator;
Expand All @@ -45,93 +45,76 @@
import org.eclipse.xtext.service.SingletonBinding;

/**
* Use this class to register components to be used at runtime / without the Equinox extension
* registry.
* Use this class to register components to be used at runtime / without the
* Equinox extension registry.
*/
public class EsaCdkRuntimeModule extends XsmpcatRuntimeModule
{

@Override
public Class< ? extends IGenerator2> bindIGenerator2()
{
return EsaCdkGenerator.class;
}

@SingletonBinding(eager = true)
public Class< ? extends EsaCdkValidator> bindEsaCdkValidator()
{
return EsaCdkValidator.class;
}

@Override
public Class< ? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider()
{
return EsaCdkOutputConfigurationProvider.class;
}

public Class< ? extends EntryPointGenerator> bindEntryPointGenerator()
{
return EsaCdkEntryPointGenerator.class;
}

public Class< ? extends EventSinkGenerator> bindEventSinkGenerator()
{
return EsaCdkEventSinkGenerator.class;
}

public Class< ? extends EventSourceGenerator> bindEventSourceGenerator()
{
return EsaCdkEventSourceGenerator.class;
}

public Class< ? extends ReferenceGenerator> bindReferenceGenerator()
{
return EsaCdkReferenceGenerator.class;
}

public Class< ? extends ContainerGenerator> bindConatinerGenerator()
{
return EsaCdkContainerGenerator.class;
}

public Class< ? extends ComponentGenerator> bindComponentGenerator()
{
return EsaCdkComponentGenerator.class;
}

public Class< ? extends CatalogueGenerator> bindCatalogueGenerator()
{
return EsaCdkCatalogueGenerator.class;
}

public Class< ? extends ArrayGenerator> bindArrayGenerator()
{
return EsaCdkArrayGenerator.class;
}

public Class< ? extends StringGenerator> bindStringGenerator()
{
return EsaCdkStringGenerator.class;
}

public Class< ? extends ExceptionGenerator> bindExceptionGenerator()
{
return EsaCdkExceptionGenerator.class;
}

public Class< ? extends ConstantGenerator> bindConstantGenerator()
{
return EsaCdkConstantGenerator.class;
}

public Class< ? extends GeneratorUtil> bindGeneratorExtension()
{
return EsaCdkGeneratorExtension.class;
}

public Class< ? extends CppCopyrightNoticeProvider> bindCopyrightProvider()
{
return EsaCdkCopyrightProvider.class;
}
public class EsaCdkRuntimeModule extends XsmpcatRuntimeModule {

@Override
public Class<? extends IGenerator2> bindIGenerator2() {
return EsaCdkGenerator.class;
}

@SingletonBinding(eager = true)
public Class<? extends EsaCdkValidator> bindEsaCdkValidator() {
return EsaCdkValidator.class;
}

@Override
public Class<? extends IOutputConfigurationProvider> bindIOutputConfigurationProvider() {
return EsaCdkOutputConfigurationProvider.class;
}

public Class<? extends EntryPointGenerator> bindEntryPointGenerator() {
return EsaCdkEntryPointGenerator.class;
}

public Class<? extends EventSinkGenerator> bindEventSinkGenerator() {
return EsaCdkEventSinkGenerator.class;
}

public Class<? extends EventSourceGenerator> bindEventSourceGenerator() {
return EsaCdkEventSourceGenerator.class;
}

public Class<? extends ReferenceGenerator> bindReferenceGenerator() {
return EsaCdkReferenceGenerator.class;
}

public Class<? extends ContainerGenerator> bindConatinerGenerator() {
return EsaCdkContainerGenerator.class;
}

public Class<? extends ComponentGenerator> bindComponentGenerator() {
return EsaCdkComponentGenerator.class;
}

public Class<? extends CatalogueGenerator> bindCatalogueGenerator() {
return EsaCdkCatalogueGenerator.class;
}

public Class<? extends ArrayGenerator> bindArrayGenerator() {
return EsaCdkArrayGenerator.class;
}

public Class<? extends StringGenerator> bindStringGenerator() {
return EsaCdkStringGenerator.class;
}

public Class<? extends ExceptionGenerator> bindExceptionGenerator() {
return EsaCdkExceptionGenerator.class;
}

public Class<? extends ConstantGenerator> bindConstantGenerator() {
return EsaCdkConstantGenerator.class;
}

public Class<? extends GeneratorUtil> bindGeneratorExtension() {
return EsaCdkGeneratorExtension.class;
}

public Class<? extends CppCopyrightNoticeProvider> bindCopyrightProvider() {
return EsaCdkCopyrightProvider.class;
}

}

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
/*******************************************************************************
* Copyright (C) 2020-2022 THALES ALENIA SPACE FRANCE.
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
* which accompanies this distribution, and is available at
* https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
******************************************************************************/
package org.eclipse.xsmp.profile.esa_cdk.generator.cpp

import com.google.inject.Singleton
import org.eclipse.xsmp.generator.cpp.GeneratorUtil
import org.eclipse.xsmp.util.QualifiedNames
import org.eclipse.xsmp.xcatalogue.NamedElement
import org.eclipse.xsmp.xcatalogue.Type
import org.eclipse.xsmp.xcatalogue.Operation
import org.eclipse.xsmp.xcatalogue.SimpleType
import org.eclipse.xsmp.xcatalogue.String

@Singleton
class EsaCdkGeneratorExtension extends GeneratorUtil {

override CharSequence uuidDeclaration(Type it) {
'''
/// Universally unique identifier of type «name».
class UuidProvider_«name»
{
public:
static constexpr ::Smp::Uuid UUID «generateUUID()»;
};
'''
}

override CharSequence uuidDefinition(Type it) {
'''
/// Definition of the UuidProvider constexpr for «name»
constexpr Smp::Uuid UuidProvider_«name»::UUID;
'''
}

override CharSequence uuid(Type it) {
val fqn = fqn

// In Smp, Uuids are in a separate namespace ::Smp::Uuids::
if (fqn.startsWith(QualifiedNames.Smp))
'''::Smp::Uuids::Uuid_«name»'''
else
'''«(eContainer as NamedElement).id»::UuidProvider_«name»::UUID'''
}

override protected computeIsInvokable(Operation op) {
super.computeIsInvokable(op) && op.attributeValue(QualifiedNames.Attributes_View) !== null &&
!op.parameter.exists[!(it.type instanceof SimpleType) || (it.type instanceof String)]
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ class EsaCdkComponentGenerator extends ComponentGenerator {
typedef ::esa::ecss::smp::cdk::RequestContainer<_Type> Help;
// ---- Operations ----
«FOR op : t.member.filter(Operation).filter[it.isInvokable && it.attributeValue(QualifiedNames.Attributes_View) !== null && !it.parameter.exists[!(it.type instanceof SimpleType) || (it.type instanceof String)]
«FOR op : t.member.filter(Operation).filter[it.isInvokable]»
«t.generatePopulateRqHandler(op, useGenPattern)»
«ENDFOR»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.profile.xsmp_sdk.cli
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.profile.xsmp_sdk.tests
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ final class XsmpProject {

override protected updateVariables() {
if (name.value == cName)
name.value = projectInfo.projectName.split("\\.").last
name.value = projectInfo.projectName.replaceAll("\\.","_")
super.updateVariables()
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -315,7 +315,7 @@ class XsmpSdkComponentGenerator extends ComponentGenerator {

'''
if (handlers.find("«o.name»") == handlers.end()) {
handlers["«o.name»"] = [](«container.name(useGenPattern)»* cmp, ::Smp::IRequest* req) {
handlers["«o.name»"] = [](«container.name(useGenPattern)»* cmp, ::Smp::IRequest *«IF !o.parameter.empty || o.returnParameter !== null»req«ENDIF») {
«FOR p : o.parameter»
«p.initParameter(container)»
«ENDFOR»
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.tool.python.feature
sqPrefixKey=org.eclipse.xsmp.report
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ eclipse.preferences.version=1
idePrefixKey=
projectKey=ThalesGroup_xsmp-modeler-core
serverId=SonarCloud/thalesgroup
sqPrefixKey=org.eclipse.xsmp.tool.smp.cli
sqPrefixKey=org.eclipse.xsmp.report
Loading

0 comments on commit e32dd8b

Please sign in to comment.