Skip to content

Commit eafaa82

Browse files
Merge pull request #85 from OP-TED/release/1.3.0
Release/1.3.0
2 parents 361c402 + 19c4166 commit eafaa82

38 files changed

+1417
-341
lines changed

.github/workflows/build.yml

+21
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Build the project
2+
on:
3+
push:
4+
5+
# Allows to run this workflow manually from the Actions tab
6+
workflow_dispatch:
7+
8+
jobs:
9+
build:
10+
runs-on: ubuntu-latest
11+
permissions:
12+
contents: read
13+
packages: write
14+
steps:
15+
- uses: actions/checkout@v3
16+
- uses: actions/setup-java@v3
17+
with:
18+
java-version: '11'
19+
distribution: 'adopt'
20+
- name: Build package
21+
run: mvn --batch-mode clean install -s .github/workflows/settings.xml

.github/workflows/publish.yml

+10-8
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
name: Publish package to the Maven Central Repository
22

33
on:
4+
push:
5+
branches:
6+
- 'develop'
7+
- 'main'
8+
49
release:
510
types: [created]
611

@@ -16,20 +21,17 @@ jobs:
1621
steps:
1722
- uses: actions/checkout@v3
1823
- name: Import GPG Key
19-
uses: crazy-max/ghaction-import-gpg@v1
20-
env:
21-
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }}
22-
PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}
24+
uses: crazy-max/ghaction-import-gpg@v5
25+
with:
26+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
27+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
2328
- name: Set up Java for publishing to Maven Central Repository
2429
uses: actions/setup-java@v3
2530
with:
2631
java-version: '11'
2732
distribution: 'adopt'
28-
server-id: ossrh
29-
server-username: MAVEN_USERNAME
30-
server-password: MAVEN_PASSWORD
3133
- name: Publish to the Maven Central Repository
32-
run: mvn --batch-mode deploy -Dgpg.passphrase='${{ secrets.GPG_PASSPHRASE }}' -Prelease
34+
run: mvn --batch-mode deploy -Dgpg.passphrase='${{ secrets.GPG_PASSPHRASE }}' -Prelease -s .github/workflows/settings.xml
3335
env:
3436
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
3537
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}

.github/workflows/settings.xml

+34
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<settings xmlns="http://maven.apache.org/SETTINGS/1.0.0"
3+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4+
xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd">
5+
<servers>
6+
<server>
7+
<id>ossrh</id>
8+
<username>${env.MAVEN_USERNAME}</username>
9+
<password>${env.MAVEN_PASSWORD}</password>
10+
</server>
11+
</servers>
12+
13+
<profiles>
14+
<profile>
15+
<id>repositories</id>
16+
<activation>
17+
<activeByDefault>true</activeByDefault>
18+
</activation>
19+
<repositories>
20+
<repository>
21+
<id>ossrh</id>
22+
<name>OSSRH Snapshots</name>
23+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
24+
<releases>
25+
<enabled>false</enabled>
26+
</releases>
27+
<snapshots>
28+
<enabled>true</enabled>
29+
</snapshots>
30+
</repository>
31+
</repositories>
32+
</profile>
33+
</profiles>
34+
</settings>

CHANGELOG.md

+7-7
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,18 @@
1-
# EFX Toolkit 1.2.0 Release Notes
1+
# EFX Toolkit 1.3.0 Release Notes
22

33
_The EFX Toolkit for Java developers is a library that enables the transpilation of [EFX](https://docs.ted.europa.eu/eforms/latest/efx) expressions and templates to different target languages. It also includes an implementation of an EFX-to-XPath transpiler._
44

55
---
66
## In this release:
77

8-
- We fixed a bug in the `XPathScriptGenerator` that was causing references to fields of type `measure` (duration) to throw an exception when multiple values where matched by the reference.
9-
- We fixed an issue in the `SdkSymbolResolver` that was causing some code labels to be resolved incorrectly. The `SdkSymbolResolver` now correctly looks for the root codelist associated with a field in the codelist metadata provided in the `codelists` folder, instead of relying on the codelist constraint metadata provided in `fields.json`.
10-
:warning: _**CAUTION:** If you have implemented your own `SymbolResolver` make sure that your implementation of `getRootCodelistOfField` retrieves the parent codelist information from `codelists/codelists.json` or directly from the `.gc` files in the `codelists` folder of the eForms SDK._
11-
- We refactored the code to move to the [eForms Core Java](https://github.com/OP-TED/eforms-core-java) library some common entity classes that were not specific to EFX (`SdkEntityFactory`, `SdkField`, `SdkNode`, `SdkCodelist`). We also moved into the EFX Toolkit some reusable classes (`SdkSymbolResolver`, `ComponentFactory`) from the [eForms Notice Viewer](https://github.com/OP-TED/eforms-notice-viewer) sample application. The result of this refactoring is `efx-toolkit-java`-`1.2.0`, `eforms-core-java`-`1.0.0` and `eforms-notice-viewer`-`0.6.0`.
8+
- Updated the XPath 2.0 parser, XPathContextualizer and XPathScriptGenerator to correctly translate sequences.
9+
- Improved numeric formatting. The EfxTranslator API now includes overloaded methods that permit control of numeric formatting. The existing API has been preserved.
10+
- Improved handling of multilingual text fields by adding automatic selection of the visualisation language.
11+
1212
---
1313

1414
You can download the latest EFX Toolkit from Maven Central.
15-
[![Maven Central](https://img.shields.io/maven-central/v/eu.europa.ted.eforms/efx-toolkit-java?label=Download%20&style=flat-square)](https://search.maven.org/search?q=g:%22eu.europa.ted.eforms%22%20AND%20a:%22efx-toolkit-java%22)
15+
[![Maven Central](https://img.shields.io/maven-central/v/eu.europa.ted.eforms/efx-toolkit-java?label=Download%20&style=flat-square)](https://central.sonatype.com/artifact/eu.europa.ted.eforms/efx-toolkit-java)
1616

1717
Documentation for the EFX Toolkit is available at: https://docs.ted.europa.eu/eforms/latest/efx-toolkit
1818

@@ -23,4 +23,4 @@ This version of the EFX Toolkit has a compile-time dependency on the following v
2323
- eForms SDK 0.7.x
2424
- eForms SDK 1.x.x
2525

26-
It also depends on the [eForms Core Java library](https://github.com/OP-TED/eforms-core-java) version 1.0.0.
26+
It also depends on the [eForms Core Java library](https://github.com/OP-TED/eforms-core-java) version 1.0.5.

README.md

+37-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
**[:memo: Latest Release Notes](CHANGELOG.md)** | **[:package: Latest Release Artifacts](https://search.maven.org/search?q=g:%22eu.europa.ted.eforms%22%20AND%20a:%22efx-toolkit-java%22)**
1+
**[:memo: Latest Release Notes](CHANGELOG.md)** | **[:package: Latest Release Artifacts](https://central.sonatype.com/artifact/eu.europa.ted.eforms/efx-toolkit-java)**
22

33
---
44
# Java toolkit for the eForms Expression Language (EFX)
@@ -36,6 +36,40 @@ You can build this project as usual using Maven.
3636

3737
The build process uses the grammar files provided in the [eForms SDK](https://github.com/OP-TED/eForms-SDK/tree/develop/efx-grammar) to generate a parser, using [ANTLR4](https://www.antlr.org).
3838

39+
In order to be able to use snapshot versions of dependencies, the following should be added to the "profiles" section of the Maven configuration file "settings.xml" (normally under ${HOME}/.m2):
40+
41+
```
42+
<servers>
43+
<server>
44+
<id>ossrh</id>
45+
<username>${env.MAVEN_USERNAME}</username>
46+
<password>${env.MAVEN_PASSWORD}</password>
47+
</server>
48+
</servers>
49+
50+
<profile>
51+
<id>repositories</id>
52+
<activation>
53+
<activeByDefault>true</activeByDefault>
54+
</activation>
55+
<repositories>
56+
<repository>
57+
<id>ossrh</id>
58+
<name>OSSRH Snapshots</name>
59+
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
60+
<releases>
61+
<enabled>false</enabled>
62+
</releases>
63+
<snapshots>
64+
<enabled>true</enabled>
65+
</snapshots>
66+
</repository>
67+
</repositories>
68+
</profile>
69+
```
70+
71+
See ".github/workflows/settings.xml".
72+
3973
## Testing
4074

4175
Unit tests are available under `src/test/java/`. They show in particular a variety of EFX expressions and the corresponding XPath expression.
@@ -47,10 +81,10 @@ The report is available under `target/site/jacoco/`, in HTML, CSV, and XML forma
4781

4882
You can download the latest EFX Toolkit from Maven Central.
4983

50-
[![Maven Central](https://img.shields.io/maven-central/v/eu.europa.ted.eforms/efx-toolkit-java?label=Download%20&style=flat-square)](https://search.maven.org/search?q=g:%22eu.europa.ted.eforms%22%20AND%20a:%22efx-toolkit-java%22)
84+
[![Maven Central](https://img.shields.io/maven-central/v/eu.europa.ted.eforms/efx-toolkit-java?label=Download%20&style=flat-square)](https://central.sonatype.com/artifact/eu.europa.ted.eforms/efx-toolkit-java)
5185

5286
[^1]: _Copyright 2022 European Union_
5387
_Licensed under the EUPL, Version 1.2 or – as soon they will be approved by the European Commission –
5488
subsequent versions of the EUPL (the "Licence");_
5589
_You may not use this work except in compliance with the Licence. You may obtain [a copy of the Licence here](LICENSE)._
56-
_Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence for the specific language governing permissions and limitations under the Licence._
90+
_Unless required by applicable law or agreed to in writing, software distributed under the Licence is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the Licence for the specific language governing permissions and limitations under the Licence._

pom.xml

+33-5
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
<groupId>eu.europa.ted.eforms</groupId>
55
<artifactId>efx-toolkit-java</artifactId>
6-
<version>1.2.0</version>
6+
<version>1.3.0</version>
77
<packaging>jar</packaging>
88

99
<name>EFX Toolkit for Java</name>
@@ -39,24 +39,27 @@
3939
<distributionManagement>
4040
<snapshotRepository>
4141
<id>ossrh</id>
42-
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
42+
<url>https://${sonatype.server.url}/content/repositories/snapshots</url>
4343
</snapshotRepository>
4444
<repository>
4545
<id>ossrh</id>
46-
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
46+
<url>https://${sonatype.server.url}/service/local/staging/deploy/maven2/</url>
4747
</repository>
4848
</distributionManagement>
4949

5050
<properties>
5151
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
52+
<project.build.outputTimestamp>2023-05-30T06:25:09Z</project.build.outputTimestamp>
53+
54+
<sonatype.server.url>s01.oss.sonatype.org</sonatype.server.url>
5255

5356
<maven.compiler.source>11</maven.compiler.source>
5457
<maven.compiler.target>11</maven.compiler.target>
5558

5659
<sdk.antlr4.dir>${project.build.directory}/eforms-sdk/antlr4</sdk.antlr4.dir>
5760

5861
<!-- Versions - eForms -->
59-
<version.eforms-core>1.0.0</version.eforms-core>
62+
<version.eforms-core>1.0.5</version.eforms-core>
6063

6164
<!-- Versions - Third-party libraries -->
6265
<version.antlr4>4.9.3</version.antlr4>
@@ -72,8 +75,10 @@
7275
<version.dependency.plugin>3.3.0</version.dependency.plugin>
7376
<version.install.plugin>2.5.2</version.install.plugin>
7477
<version.jacoco.plugin>0.8.8</version.jacoco.plugin>
78+
<version.jar.plugin>3.2.0</version.jar.plugin>
7579
<version.javadoc.plugin>3.4.0</version.javadoc.plugin>
7680
<version.pgp.plugin>1.5</version.pgp.plugin>
81+
<version.nexus-staging.plugin>1.6.7</version.nexus-staging.plugin>
7782
<version.source.plugin>3.2.1</version.source.plugin>
7883
<version.surefire.plugin>3.0.0-M7</version.surefire.plugin> <!-- Versions prior to 3.0.x do not pick up Junit 5 tests correctly. -->
7984
</properties>
@@ -194,6 +199,11 @@
194199
<artifactId>jacoco-maven-plugin</artifactId>
195200
<version>${version.jacoco.plugin}</version>
196201
</plugin>
202+
<plugin>
203+
<groupId>org.apache.maven.plugins</groupId>
204+
<artifactId>maven-jar-plugin</artifactId>
205+
<version>${version.jar.plugin}</version>
206+
</plugin>
197207
<plugin>
198208
<groupId>org.apache.maven.plugins</groupId>
199209
<artifactId>maven-javadoc-plugin</artifactId>
@@ -209,6 +219,11 @@
209219
<artifactId>maven-source-plugin</artifactId>
210220
<version>${version.source.plugin}</version>
211221
</plugin>
222+
<plugin>
223+
<groupId>org.sonatype.plugins</groupId>
224+
<artifactId>nexus-staging-maven-plugin</artifactId>
225+
<version>${version.nexus-staging.plugin}</version>
226+
</plugin>
212227
</plugins>
213228
</pluginManagement>
214229

@@ -231,7 +246,7 @@
231246
<artifactItem>
232247
<groupId>eu.europa.ted.eforms</groupId>
233248
<artifactId>eforms-sdk</artifactId>
234-
<version>1.2.1</version>
249+
<version>1.7.0</version>
235250
<type>jar</type>
236251
<includes>eforms-sdk/efx-grammar/**/*.g4</includes>
237252
<outputDirectory>${sdk.antlr4.dir}/eu/europa/ted/efx/sdk1</outputDirectory>
@@ -342,6 +357,9 @@
342357
<profile>
343358
<!-- Profile "release" caters to the requirements for releasing to Maven Central -->
344359
<id>release</id>
360+
<properties>
361+
<maven.compiler.debug>false</maven.compiler.debug>
362+
</properties>
345363
<build>
346364
<plugins>
347365
<plugin>
@@ -388,6 +406,16 @@
388406
</gpgArguments>
389407
</configuration>
390408
</plugin>
409+
<plugin>
410+
<groupId>org.sonatype.plugins</groupId>
411+
<artifactId>nexus-staging-maven-plugin</artifactId>
412+
<extensions>true</extensions>
413+
<configuration>
414+
<serverId>ossrh</serverId>
415+
<nexusUrl>https://${sonatype.server.url}/</nexusUrl>
416+
<autoReleaseAfterClose>true</autoReleaseAfterClose>
417+
</configuration>
418+
</plugin>
391419
</plugins>
392420
</build>
393421
</profile>

src/main/antlr4/eu/europa/ted/efx/xpath/XPath20.g4

+4-7
Original file line numberDiff line numberDiff line change
@@ -4,13 +4,9 @@
44
//
55
// This is a faithful implementation of the XPath version 2.0 grammar
66
// from the spec at https://www.w3.org/TR/xpath20/
7-
//
8-
// Note: Some minor adoptations were done
9-
// to simplify the translator using this grammar.
107

118
grammar XPath20;
129

13-
1410
// [1]
1511
xpath : expr EOF ;
1612
expr : exprsingle ( COMMA exprsingle)* ;
@@ -43,8 +39,8 @@ nodecomp : KW_IS | LL | GG ;
4339
// [25]
4440
pathexpr : ( SLASH relativepathexpr?) | ( SS relativepathexpr) | relativepathexpr ;
4541
relativepathexpr : stepexpr (( SLASH | SS) stepexpr)* ;
46-
stepexpr : step predicatelist;
47-
step: primaryexpr | reversestep | forwardstep;
42+
stepexpr : filterexpr | axisstep ;
43+
axisstep : (reversestep | forwardstep) predicatelist ;
4844
forwardstep : (forwardaxis nodetest) | abbrevforwardstep ;
4945
// [30]
5046
forwardaxis : ( KW_CHILD COLONCOLON) | ( KW_DESCENDANT COLONCOLON) | ( KW_ATTRIBUTE COLONCOLON) | ( KW_SELF COLONCOLON) | ( KW_DESCENDANT_OR_SELF COLONCOLON) | ( KW_FOLLOWING_SIBLING COLONCOLON) | ( KW_FOLLOWING COLONCOLON) | ( KW_NAMESPACE COLONCOLON) ;
@@ -56,6 +52,7 @@ abbrevreversestep : DD ;
5652
nodetest : kindtest | nametest ;
5753
nametest : qname | wildcard ;
5854
wildcard : STAR | (NCName CS) | ( SC NCName) ;
55+
filterexpr : primaryexpr predicatelist ;
5956
predicatelist : predicate* ;
6057
// [40]
6158
predicate : OB expr CB ;
@@ -343,4 +340,4 @@ fragment FragChar : '\u0009' | '\u000a' | '\u000d'
343340
Whitespace : ('\u000d' | '\u000a' | '\u0020' | '\u0009')+ -> skip ;
344341

345342
// Not per spec. Specified for testing.
346-
SEMI : ';' ;
343+
SEMI : ';' ;

src/main/java/eu/europa/ted/eforms/sdk/ComponentFactory.java

+6-4
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,13 @@
44
import java.text.MessageFormat;
55
import java.util.HashMap;
66
import java.util.Map;
7+
78
import eu.europa.ted.eforms.sdk.component.SdkComponentFactory;
89
import eu.europa.ted.eforms.sdk.component.SdkComponentType;
910
import eu.europa.ted.efx.interfaces.MarkupGenerator;
1011
import eu.europa.ted.efx.interfaces.ScriptGenerator;
1112
import eu.europa.ted.efx.interfaces.SymbolResolver;
13+
import eu.europa.ted.efx.interfaces.TranslatorOptions;
1214

1315
public class ComponentFactory extends SdkComponentFactory {
1416
public static final ComponentFactory INSTANCE = new ComponentFactory();
@@ -43,15 +45,15 @@ public static SymbolResolver getSymbolResolver(final String sdkVersion, final Pa
4345
});
4446
}
4547

46-
public static MarkupGenerator getMarkupGenerator(final String sdkVersion)
48+
public static MarkupGenerator getMarkupGenerator(final String sdkVersion, TranslatorOptions options)
4749
throws InstantiationException {
4850
return ComponentFactory.INSTANCE.getComponentImpl(sdkVersion,
49-
SdkComponentType.MARKUP_GENERATOR, MarkupGenerator.class);
51+
SdkComponentType.MARKUP_GENERATOR, MarkupGenerator.class, options);
5052
}
5153

52-
public static ScriptGenerator getScriptGenerator(final String sdkVersion)
54+
public static ScriptGenerator getScriptGenerator(final String sdkVersion, TranslatorOptions options)
5355
throws InstantiationException {
5456
return ComponentFactory.INSTANCE.getComponentImpl(sdkVersion,
55-
SdkComponentType.SCRIPT_GENERATOR, ScriptGenerator.class);
57+
SdkComponentType.SCRIPT_GENERATOR, ScriptGenerator.class, options);
5658
}
5759
}

src/main/java/eu/europa/ted/eforms/sdk/SdkSymbolResolver.java

+2-1
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,9 @@
33
import java.nio.file.Path;
44
import java.util.List;
55
import java.util.Map;
6+
67
import org.antlr.v4.runtime.misc.ParseCancellationException;
7-
import eu.europa.ted.eforms.sdk.SdkConstants;
8+
89
import eu.europa.ted.eforms.sdk.component.SdkComponent;
910
import eu.europa.ted.eforms.sdk.component.SdkComponentType;
1011
import eu.europa.ted.eforms.sdk.entity.SdkCodelist;

0 commit comments

Comments
 (0)