Skip to content

Commit

Permalink
#159 date and version to show
Browse files Browse the repository at this point in the history
  • Loading branch information
yegor256 committed Nov 15, 2020
1 parent 39b20e1 commit 59102f8
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 6 deletions.
4 changes: 4 additions & 0 deletions eo-compiler/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,10 @@ SOFTWARE.
<groupId>com.jcabi</groupId>
<artifactId>jcabi-xml</artifactId>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-manifests</artifactId>
</dependency>
<dependency>
<groupId>com.jcabi</groupId>
<artifactId>jcabi-log</artifactId>
Expand Down
15 changes: 14 additions & 1 deletion eo-compiler/src/main/java/org/eolang/compiler/XeListener.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,12 @@
*/
package org.eolang.compiler;

import com.jcabi.manifests.Manifests;
import com.jcabi.xml.XML;
import com.jcabi.xml.XMLDocument;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.time.format.DateTimeFormatter;
import org.antlr.v4.runtime.ParserRuleContext;
import org.antlr.v4.runtime.tree.ErrorNode;
import org.antlr.v4.runtime.tree.TerminalNode;
Expand Down Expand Up @@ -70,7 +74,16 @@ public XML xml() {

@Override
public void enterProgram(final ProgramParser.ProgramContext ctx) {
this.dirs.add("program").attr("name", this.name).add("errors").up();
this.dirs.add("program")
.attr("name", this.name)
.attr("version", Manifests.read("EO-Version"))
.attr(
"time",
ZonedDateTime.now(ZoneOffset.UTC).format(
DateTimeFormatter.ISO_INSTANT
)
)
.add("errors").up();
}

@Override
Expand Down
1 change: 1 addition & 0 deletions eo-compiler/src/main/resources/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
EO-Version: ${project.version}
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
xsls: []
tests:
- /program[@name='simple.yaml']
- /program[@version != '']
- /program[@time != '']
- /program/objects
- //o[not(@name) and @base='a']
- //o[@base='a' and @line='1']
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,11 +43,12 @@ SOFTWARE.
<xsl:text>/*</xsl:text>
<xsl:value-of select="$EOL"/>
<xsl:text> * This file was auto-generated by eolang-maven-plugin</xsl:text>
<xsl:value-of select="$EOL"/>
<xsl:text> * on </xsl:text>
<xsl:value-of select="current-dateTime()"/>
<xsl:text>. Don't edit it, your changes will be discarded</xsl:text>
<xsl:text>. Don't edit it,</xsl:text>
<xsl:value-of select="$EOL"/>
<xsl:text> * on the next build.</xsl:text>
<xsl:text> * your changes will be discarded on the next build.</xsl:text>
<xsl:value-of select="$EOL"/>
<xsl:text> */</xsl:text>
<xsl:value-of select="$EOL"/>
Expand Down
4 changes: 1 addition & 3 deletions eo-runtime/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,13 +39,12 @@ SOFTWARE.
<artifactId>cactoos</artifactId>
</dependency>
</dependencies>
<!--
<build>
<plugins>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.1</version>
<version>0.1.1</version>
<executions>
<execution>
<goals>
Expand All @@ -56,5 +55,4 @@ SOFTWARE.
</plugin>
</plugins>
</build>
-->
</project>

0 comments on commit 59102f8

Please sign in to comment.