Skip to content

Commit

Permalink
Merge branch '__rultor'
Browse files Browse the repository at this point in the history
  • Loading branch information
rultor committed Oct 31, 2024
2 parents 20720e2 + 05154e1 commit 60c35d2
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 2 deletions.
10 changes: 10 additions & 0 deletions src/it/jna/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# JNA Usage Test

This integration test was added in order to mitigate the problem
with JNA usage: https://github.com/objectionary/hone-maven-plugin/issues/58

To run this test exclusively, execute the command below:

```shell
mvn clean integration-test -Dinvoker.test=jna -DskipTests
```
33 changes: 33 additions & 0 deletions src/it/jna/invoker.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#
# The MIT License (MIT)
#
# Copyright (c) 2016-2024 Objectionary.com
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included
# in all copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
#
# @todo #824:30min Use 'full' profile for integration tests in JNA invoker
# This test is currently using the 'short' profile, which excludes 'phi/unphi' and
# 'unroll' transformations since they take too long to run.
# Here is the detailed explanation of the problem:
# - https://github.com/objectionary/eo/issues/3257
# When the issue is fixed, use the 'full' profile instead of 'short'.
# Just to compare, the 'short' path takes 13 seconds to run, while the 'full' path
# takes 31 minutes.
invoker.goals=clean verify -e -B
invoker.profiles=short
297 changes: 297 additions & 0 deletions src/it/jna/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,297 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
The MIT License (MIT)
Copyright (c) 2016-2024 Objectionary.com
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included
in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
-->
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.eolang</groupId>
<artifactId>jna-it</artifactId>
<version>@project.version@</version>
<packaging>jar</packaging>
<description>
This integration test was added in order to mitigate the problem
with JNA usage: https://github.com/objectionary/hone-maven-plugin/issues/58
</description>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
<stack-size>256M</stack-size>
<jeo.disassemble>${project.build.directory}/generated-sources/jeo-disassemble</jeo.disassemble>
<eo.phi>${project.build.directory}/generated-sources/eo-phi</eo.phi>
<eo.unphi>${project.build.directory}/generated-sources/eo-unphi</eo.unphi>
<jeo.unroll>${project.build.directory}/generated-sources/jeo-unroll</jeo.unroll>
<jeo.assemble>target/classes</jeo.assemble>
</properties>
<profiles>
<profile>
<id>short</id>
<activation>
<activeByDefault>true</activeByDefault>
</activation>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.15.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>jeo-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<id>bytecode-to-xmir</id>
<phase>process-classes</phase>
<configuration>
<outputDir>${jeo.disassemble}</outputDir>
</configuration>
<goals>
<goal>disassemble</goal>
</goals>
</execution>
<execution>
<id>xmir-to-bytecode</id>
<phase>package</phase>
<configuration>
<sourcesDir>${jeo.disassemble}</sourcesDir>
<outputDir>${jeo.assemble}</outputDir>
</configuration>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.eolang.hone.App</mainClass>
</configuration>
</plugin>
<!--
We clean target/classes directory to be sure
that bytecode verification works without old
class files.
-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>clean-target-classes</id>
<phase>process-classes</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target/classes</directory>
<includes>
<include>**/*.class</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
<profile>
<id>full</id>
<build>
<plugins>
<plugin>
<artifactId>maven-dependency-plugin</artifactId>
<version>3.8.1</version>
<executions>
<execution>
<phase>generate-resources</phase>
<goals>
<goal>unpack</goal>
</goals>
<configuration>
<artifactItems>
<artifactItem>
<groupId>net.java.dev.jna</groupId>
<artifactId>jna</artifactId>
<version>5.15.0</version>
<type>jar</type>
</artifactItem>
</artifactItems>
<outputDirectory>${project.build.outputDirectory}</outputDirectory>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>jeo-maven-plugin</artifactId>
<version>@project.version@</version>
<executions>
<execution>
<id>bytecode-to-xmir</id>
<phase>process-classes</phase>
<configuration>
<outputDir>${jeo.disassemble}</outputDir>
</configuration>
<goals>
<goal>disassemble</goal>
</goals>
</execution>
<execution>
<id>unroll-phi</id>
<phase>prepare-package</phase>
<configuration>
<sourcesDir>${eo.unphi}</sourcesDir>
<outputDir>${jeo.unroll}</outputDir>
</configuration>
<goals>
<goal>unroll-phi</goal>
</goals>
</execution>
<execution>
<id>xmir-to-bytecode</id>
<phase>package</phase>
<configuration>
<sourcesDir>${jeo.unroll}</sourcesDir>
<outputDir>${jeo.assemble}</outputDir>
</configuration>
<goals>
<goal>assemble</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.eolang</groupId>
<artifactId>eo-maven-plugin</artifactId>
<version>0.40.3</version>
<executions>
<execution>
<id>xmir-to-phi</id>
<phase>process-classes</phase>
<goals>
<goal>xmir-to-phi</goal>
</goals>
<configuration>
<phiInputDir>${jeo.disassemble}</phiInputDir>
<phiOutputDir>${eo.phi}</phiOutputDir>
</configuration>
</execution>
<execution>
<id>phi-to-xmir</id>
<phase>process-classes</phase>
<goals>
<goal>phi-to-xmir</goal>
</goals>
<configuration>
<unphiInputDir>${eo.phi}</unphiInputDir>
<unphiOutputDir>${eo.unphi}</unphiOutputDir>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>exec-maven-plugin</artifactId>
<version>3.5.0</version>
<executions>
<execution>
<phase>verify</phase>
<goals>
<goal>java</goal>
</goals>
</execution>
</executions>
<configuration>
<mainClass>org.eolang.hone.App</mainClass>
</configuration>
</plugin>
<!--
We clean target/classes directory to be sure
that bytecode verification works without old
class files.
-->
<plugin>
<artifactId>maven-clean-plugin</artifactId>
<version>3.4.0</version>
<executions>
<execution>
<id>clean-target-classes</id>
<phase>process-classes</phase>
<goals>
<goal>clean</goal>
</goals>
<configuration>
<excludeDefaultDirectories>true</excludeDefaultDirectories>
<filesets>
<fileset>
<directory>target/classes</directory>
<includes>
<include>**/*.class</include>
</includes>
</fileset>
</filesets>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</profile>
</profiles>
</project>
34 changes: 34 additions & 0 deletions src/it/jna/src/main/java/org/eolang/hone/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
/*
* The MIT License (MIT)
*
* Copyright (c) 2016-2024 Objectionary.com
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included
* in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
package org.eolang.hone;

/**
* App.
* @since 0.1
*/
public class App {
public static void main(String[] args) {
System.out.print(new JnaPrinter().hello());
}
}
Loading

1 comment on commit 60c35d2

@0pdd
Copy link

@0pdd 0pdd commented on 60c35d2 Oct 31, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Puzzle 824-0b25b6fe discovered in src/it/jna/invoker.properties) and submitted as #829. Please, remember that the puzzle was not necessarily added in this particular commit. Maybe it was added earlier, but we discovered it only now.

Please sign in to comment.