Skip to content

Commit

Permalink
chore(plc4go): fix build
Browse files Browse the repository at this point in the history
  • Loading branch information
sruehl committed Feb 6, 2024
1 parent 80d6de9 commit 90f43c9
Show file tree
Hide file tree
Showing 9 changed files with 976 additions and 13 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,45 @@ func ${type.name}ParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffe
<#assign simpleField = field.asSimpleField().orElseThrow()>

// Simple Field (${simpleField.name})
<#if (case.name == "Struct") || ((case.name == "TIME") && (simpleField.name == "milliseconds")) || ((case.name == "LTIME") && (simpleField.name == "nanoseconds")) || ((case.name == "DATE") && ((simpleField.name == "secondsSinceEpoch") || (simpleField.name == "daysSinceSiemensEpoch"))) || ((case.name == "LDATE") && (simpleField.name == "nanosecondsSinceEpoch")) || ((case.name == "TIME_OF_DAY") && (simpleField.name == "millisecondsSinceMidnight")) || ((case.name == "LTIME_OF_DAY") && (simpleField.name == "nanosecondsSinceMidnight")) || ((case.name == "DATE_AND_TIME") && (simpleField.name == "secondsSinceEpoch")) || ((case.name == "LDATE_AND_TIME") && (simpleField.name == "nanosecondsSinceEpoch")) || ((case.name == "DATE_AND_TIME") && ((simpleField.name == "year") || (simpleField.name == "month") || (simpleField.name == "day") || (simpleField.name == "hour") || (simpleField.name == "minutes") || (simpleField.name == "seconds") || (simpleField.name == "nanoseconds"))) || (simpleField.name == "value")>${simpleField.name}<#else>_</#if>, _${simpleField.name}Err := <#if simpleField.type.isSimpleTypeReference()>${helper.getReadBufferReadMethodCall(simpleField.name, simpleField.type.asSimpleTypeReference().orElseThrow(), simpleField)}<#else>${simpleField.type.asComplexTypeReference().orElseThrow().name}Parse(io<#if simpleField.type.asComplexTypeReference().orElseThrow().params.isPresent()>, <#list simpleField.type.asComplexTypeReference().orElseThrow().params.orElseThrow() as parserArgument>(${helper.getLanguageTypeNameForTypeReference(helper.getArgumentType(simpleField.type, parserArgument?index))}) (${helper.toParseExpression(simpleField, helper.getArgumentType(simpleField.type, parserArgument?index), parserArgument, parserArguments)})<#sep>, </#sep></#list></#if>)</#if>
<#if
(case.name == "Struct")
|| ((case.name == "TIME") && (simpleField.name == "milliseconds"))
|| ((case.name == "LTIME") && (simpleField.name == "nanoseconds"))
|| (
(case.name == "DATE") && ((simpleField.name == "secondsSinceEpoch")
|| (simpleField.name == "daysSinceSiemensEpoch"))
)
|| ((case.name == "LDATE") && (simpleField.name == "nanosecondsSinceEpoch"))
|| ((case.name == "TIME_OF_DAY") && (simpleField.name == "millisecondsSinceMidnight"))
|| ((case.name == "LTIME_OF_DAY") && (simpleField.name == "nanosecondsSinceMidnight"))
|| ((case.name == "DATE_AND_TIME") && (simpleField.name == "secondsSinceEpoch"))
|| ((case.name == "DATE_AND_LTIME") && (
(simpleField.name == "year")
|| (simpleField.name == "month")
|| (simpleField.name == "day")
|| (simpleField.name == "hour")
|| (simpleField.name == "minutes")
|| (simpleField.name == "seconds")
|| (simpleField.name == "nanoseconds")
|| (simpleField.name == "nannosecondsOfSecond")
|| (simpleField.name == "dayOfWeek")
)
)
|| ((case.name == "LDATE_AND_TIME") && (simpleField.name == "nanosecondsSinceEpoch"))
|| (
(case.name == "DATE_AND_TIME") && (
(simpleField.name == "year")
|| (simpleField.name == "month")
|| (simpleField.name == "day")
|| (simpleField.name == "hour")
|| (simpleField.name == "minutes")
|| (simpleField.name == "seconds")
|| (simpleField.name == "nanoseconds")
|| (simpleField.name == "millisecondsOfSecond")
|| (simpleField.name == "dayOfWeek")
)
)
|| (simpleField.name == "value")>${simpleField.name}<#else>_</#if>, _${simpleField.name}Err := <#if simpleField.type.isSimpleTypeReference()>${helper.getReadBufferReadMethodCall(simpleField.name, simpleField.type.asSimpleTypeReference().orElseThrow(), simpleField)}<#else>${simpleField.type.asComplexTypeReference().orElseThrow().name}Parse(io<#if simpleField.type.asComplexTypeReference().orElseThrow().params.isPresent()>, <#list simpleField.type.asComplexTypeReference().orElseThrow().params.orElseThrow() as parserArgument>(${helper.getLanguageTypeNameForTypeReference(helper.getArgumentType(simpleField.type, parserArgument?index))}) (${helper.toParseExpression(simpleField, helper.getArgumentType(simpleField.type, parserArgument?index), parserArgument, parserArguments)})<#sep>, </#sep></#list></#if>)</#if>
if _${simpleField.name}Err != nil {
return nil, errors.Wrap(_${simpleField.name}Err, "Error parsing '${simpleField.name}' field")<@emitImport import="github.com/pkg/errors" />
}
Expand All @@ -166,6 +204,10 @@ func ${type.name}ParseWithBuffer(ctx context.Context, readBuffer utils.ReadBuffe
<#assign valueDefined=true>
<#break>
</#switch>
<#if field.isNamedField()>
<#assign namedField=field.asNamedField().orElseThrow()/>
_ = ${namedField.name} // TODO: temporary till we fix TIME stuff in golang (see above in the template)
</#if>
</#list>
<#switch case.name>
<#case "TIME">
Expand Down
1 change: 1 addition & 0 deletions plc4go/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -357,6 +357,7 @@
<goal>custom</goal>
</goals>
<configuration>
<skip>${skipTests}</skip>
<exec>gotestsum</exec>
<customCommand>--junitfile</customCommand>
<buildFlags>
Expand Down
27 changes: 27 additions & 0 deletions plc4go/protocols/ads/readwrite/model/DataItem.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit 90f43c9

Please sign in to comment.