Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect version of native library? #93

Open
jirutka opened this issue Dec 4, 2020 · 4 comments
Open

Incorrect version of native library? #93

jirutka opened this issue Dec 4, 2020 · 4 comments
Milestone

Comments

@jirutka
Copy link

jirutka commented Dec 4, 2020

The latest jffi has been released as 1.3.1, but native jffi library is still on 1.2.8 (defined in version.xml). Is this intentional or a mistake?

@headius
Copy link
Member

headius commented Dec 8, 2020

Ah no, I guess I was unaware of that file needing to be updated. It should reflect the same version.

headius added a commit that referenced this issue Dec 8, 2020
This is a temporary fix; this file needs to source the version
from the same place that the Maven release tasks do.

See #93
@headius
Copy link
Member

headius commented Dec 8, 2020

I updated this so it will match for 1.3.2 but this is just a temporary fix... we need to get this version sourced from the same place as the Maven build or it will get stale again.

@headius
Copy link
Member

headius commented Mar 17, 2021

I have to revert this because the prebuilt JNI stubs all are set up with the old "1.2" version, so changing this manually will cause them to not be found and we will unpack new versions of them.

I will open a PR to fix the versioning issue correctly, but it will be messy.

@headius headius added this to the 1.4.0 milestone Mar 17, 2021
headius added a commit that referenced this issue Mar 17, 2021
This reverts commit eb475ee.

The version used here is stale, but it matches the filenames of
the prebuilt native stubs. We can't change it here without also
rebuilding all those libraries renaming them (pushing the problem
to next release) or eliminating version numbers from the packaged
stubs.

See #93.
@headius
Copy link
Member

headius commented Mar 17, 2021

Here is a diff I started to do this, but I think we should look into the maven native plugin and helper library for doing this, rather than having all these weird builds and version numbers floating around:

diff --git a/pom.xml b/pom.xml
index fc3258d..b57b69e 100644
--- a/pom.xml
+++ b/pom.xml
@@ -224,6 +224,7 @@
                 <property name="dist.dir" value="${project.build.directory}" />
                 <property name="build.dir" value="${project.build.directory}" />
                 <property name="build.classes.dir" value="${project.build.outputDirectory}" />
+                <property name="jffi.version" value="${project.version}" />
                 <ant antfile="version.xml" dir="." target="-generate-version-source" />
               </tasks>
               <sourceRoot>
diff --git a/version.xml b/version.xml
index 14889e3..9a99cfe 100644
--- a/version.xml
+++ b/version.xml
@@ -1,7 +1,4 @@
 <project name="version" default="default" basedir=".">
-    <property name="jffi.version.major" value="1"/>
-    <property name="jffi.version.minor" value="3"/>
-    <property name="jffi.version.micro" value="2"/>
     <target name="-generate-version-source" depends="">
         <echo message="Generating Version.java"/>
         <mkdir dir="${build.classes.dir}"/>
@@ -12,11 +9,16 @@
             public final class Version {
                 private Version() {}
                 @Native
-                public static final int MAJOR = ${jffi.version.major};
+                public static final String VERSION = "${jffi.version}".replace("-SNAPSHOT", "");
+
+                private static final String[] VERSION_COMPONENTS = VERSION.split(".");
+
                 @Native
-                public static final int MINOR = ${jffi.version.minor};
+                public static final int MAJOR = Integer.valueOf(VERSION_COMPONENTS[0]);
                 @Native
-                public static final int MICRO = ${jffi.version.micro};
+                public static final int MINOR = Integer.valueOf(VERSION_COMPONENTS[1]);
+                @Native
+                public static final int MICRO = Integer.valueOf(VERSION_COMPONENTS[2]);
             }
         </echo>
     </target>

headius added a commit to headius/jffi that referenced this issue Mar 18, 2021
This was disabled over a decade ago, perhaps to avoid building the
native library for every mvn package. This is a first step to
getting these tests enabled, which would have prevented the
regression almost caused by naively fixing jnr#93.
@headius headius mentioned this issue Mar 18, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants