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

Invalid plugin manifest #6

Closed
don-vip opened this issue Feb 23, 2021 · 13 comments · Fixed by #13
Closed

Invalid plugin manifest #6

don-vip opened this issue Feb 23, 2021 · 13 comments · Fixed by #13

Comments

@don-vip
Copy link

don-vip commented Feb 23, 2021

Mandatory manifest entries Plugin-Version and Plugin-Date are not correctly filled:

https://josm.openstreetmap.de/plugin

Lanes.jar;https://github.com/BjornRasmussen/Lanes/releases/download/v2.3/Lanes.jar
	Manifest-Version: 1.0
	Ant-Version: Apache Ant 1.10.8
	Created-By: 15+36-Ubuntu-1 (Private Build)
	Plugin-Mainversion: 15000
	Plugin-Version: ${version.entry.commit.revision}
	Plugin-Class: org.openstreetmap.josm.plugins.lanes.LanesPlugin
	Plugin-Description: A simple on-map lane editor for :lanes tagging and connectivity relations.
	Plugin-Date: ${version.entry.commit.date}
	Author: Leif Rasmussen
	Plugin-Link: https://github.com/BjornRasmussen/Lanes
	Plugin-Icon: data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABgAAAAYAgMAAACdGdVrAAAADFBMVEURizk7m0JDRkz////gawtoAAAAcklEQVQI1yWLywmAMBBER0juBiK2o2Duiu7VQlJSAikgJW0VzprTYz4PSLlUQfDEjskRD5zkxuQDIZgHtqiNWxItdQHuYp5fiRPp7Zbi2/9LLq0eEINg0VEqLw6XUkgQHbqVF1O3J8tWA6Lh4ZPlv1H4AD07Ry4EC7SFAAAAAElFTkSuQmCC
	Plugin-Icon-Size: 24x24
@don-vip
Copy link
Author

don-vip commented Feb 24, 2021

These properties are retrieved from the SCM (svn or git). How did you build your plugin?

@BjornRasmussen
Copy link
Owner

I built it with my command line, using the simple ant dist command. I'm not sure why the version isn't correct.

@BjornRasmussen
Copy link
Owner

This is my built.xml file. Is there anything I should fix to make the version and date work properly?

<?xml version="1.0" encoding="utf-8"?>
<!--
** This is a template build file for a JOSM  plugin.
**
** Maintaining versions
** ====================
** See README.template
**
** Usage
** =====
** Call "ant help" to get possible build targets.
**
-->
<project name="Lanes" default="dist" basedir=".">

    <property name="commit.message" value="Commit message"/>

    <property name="plugin.main.version" value="15000"/>
    <property name="plugin.version" value="v2.4"/>
    <property name="plugin.author" value="Leif Rasmussen"/>
    <property name="plugin.class" value="org.openstreetmap.josm.plugins.lanes.LanesPlugin"/>
    <property name="plugin.description" value="A simple on-map lane editor for :lanes tagging and connectivity relations."/>
    <property name="plugin.icon" value="images/laneconnectivity.png"/>
    <property name="plugin.link" value="https://github.com/BjornRasmussen/Lanes"/>

    <import file="../build-common.xml"/>
  
</project>

@don-vip
Copy link
Author

don-vip commented Feb 26, 2021

it should work out the box if you have the standard JOSM plugin directory structure (https://josm.openstreetmap.de/browser/osm/applications/editors/josm/plugins) AND your plugin folder is a valid Git or SVN repository.

Check if the following works from build-common.xml:

    <!--
      ** Initializes the REVISION.XML file from git-svn information.
         Obtains the revision from the git-svn-id field.
    -->
    <target name="init-git-svn-revision-xml" if="svn.info.fail" unless="skip-revision">
        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.svn.info.result">
            <arg value="log"/>
            <arg value="-1"/>
            <arg value="--grep=git-svn-id"/>
            <!--
            %B:  raw body (unwrapped subject and body)
            %n:  new line
            %ai: author date, ISO 8601 format
            -->
            <arg value="--pretty=format:%B%n%ai"/>
            <arg value="."/>
        </exec>
        <replaceregexp file="REVISION.XML" flags="s"
                       match=".*git-svn-id: [^@]*@([0-9]+).*(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
       <condition property="git.svn.fail">
           <not>
               <and>
                   <equals arg1="${git.svn.info.result}" arg2="0" />
                   <length file="REVISION.XML" when="greater" length="1" />
               </and>
           </not>
       </condition>
    </target>
    <!--
      ** Initializes the REVISION.XML file from git (w/o svn) information.
         Uses Unix date as revision number.
    -->
    <target name="init-git-revision-xml" if="git.svn.fail" unless="skip-revision">
        <exec append="false" output="REVISION.XML" executable="git" failifexecutionfails="false" resultproperty="git.info.result">
            <arg value="log"/>
            <arg value="-1"/>
            <arg value="--pretty=format:%at%n%ai"/>
            <arg value="."/>
        </exec>
        <replaceregexp file="REVISION.XML" flags="s"
                       match="\s*(\d*)\s+(\d{4}-\d{2}-\d{2}.\d{2}\:\d{2}\:\d{2}\s*[+-]\d{2}:?\d{2})\s*$"
                       replace="&lt;info&gt;&lt;entry&gt;&lt;commit revision=&quot;\1&quot;&gt;&lt;date&gt;\2&lt;/date&gt;&lt;/commit&gt;&lt;/entry&gt;&lt;/info&gt;"/>
       <condition property="git.fail">
           <not>
               <and>
                   <equals arg1="${git.info.result}" arg2="0" />
                   <length file="REVISION.XML" when="greater" length="1" />
               </and>
           </not>
       </condition>
    </target>
    <target name="init-revision-fallback" if="git.fail" unless="skip-revision">
        <tstamp>
            <format property="current.time" pattern="yyyy-MM-dd'T'HH:mm:ss.SSS" />
        </tstamp>
        <echo file="REVISION.XML"><![CDATA[<info><entry><commit revision="UNKNOWN"><date>${current.time}</date></commit></entry></info>]]></echo>
    </target>
    <target name="revision" depends="init-svn-revision-xml, init-git-svn-revision-xml, init-git-revision-xml, init-revision-fallback" unless="skip-revision">
      <xmlproperty file="REVISION.XML" prefix="version" keepRoot="false" collapseAttributes="true"/>
      <delete file="REVISION.XML"/>
    </target>

The manifest is then built as follows (still in build-common.xml):

        <manifest file="${manifest}" mode="update">
            <attribute name="Plugin-Mainversion" value="${plugin.main.version}"/>
            <attribute name="Plugin-Version" value="${version.entry.commit.revision}"/>
            <attribute name="Plugin-Class" value="${plugin.class}" />
            <attribute name="Plugin-Description" value="${plugin.description}" />
            <attribute name="Plugin-Date" value="${version.entry.commit.date}" />
            <attribute name="Author" value="${plugin.author}"/>
        </manifest>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Link"/>
            <param name="property.name" value="plugin.link"/>
            <param name="property.value" value="${plugin.link}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Icon"/>
            <param name="property.name" value="plugin.icon"/>
            <param name="property.value" value="${plugin.icon}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Early"/>
            <param name="property.name" value="plugin.early"/>
            <param name="property.value" value="${plugin.early}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Provides"/>
            <param name="property.name" value="plugin.provides"/>
            <param name="property.value" value="${plugin.provides}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Requires"/>
            <param name="property.name" value="plugin.requires"/>
            <param name="property.value" value="${plugin.requires}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Stage"/>
            <param name="property.name" value="plugin.stage"/>
            <param name="property.value" value="${plugin.stage}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Canloadatruntime"/>
            <param name="property.name" value="plugin.canloadatruntime"/>
            <param name="property.value" value="${plugin.canloadatruntime}"/>
        </antcall>
        <antcall target="add-manifest-attribute">
            <param name="manifest.attribute" value="Plugin-Minimum-Java-Version"/>
            <param name="property.name" value="plugin.minimum.java.version"/>
            <param name="property.value" value="${plugin.minimum.java.version}"/>
        </antcall>
        <antcall target="additional-manifest" />

@don-vip
Copy link
Author

don-vip commented Mar 16, 2021

Did you make progress? Your plugin is the only one failing our integration tests. It cannot remain in the default list of JOSM plugins if the manifest is not correct.

@BjornRasmussen
Copy link
Owner

No, I wasn't able to. Should I try using ant publish or something instead of ant dist?

@don-vip
Copy link
Author

don-vip commented Mar 16, 2021

No, ant dist is the way to go. It looks like like you built your plugin from an extracted zip archive instead of a cloned git repository?

@BjornRasmussen
Copy link
Owner

I've built it from the source code on my computer. I've got the plugin as a checked out git repository, and the rest as a checked out svn repository. Could the issue be that the plugin source code isn't part of an SVN repo?

@don-vip
Copy link
Author

don-vip commented Jul 11, 2021

From a valid Git repository it should work too.
@stoecker do you see what could be wrong here?

@stoecker
Copy link

Maybe the commandline tools are missing? There must be a "git" executable callable.

@don-vip
Copy link
Author

don-vip commented Jul 11, 2021

@BjornRasmussen I've removed the plugin from the default list until this issue is fixed, please add it back once you manage to release a version with a correct manifest:

https://josm.openstreetmap.de/wiki/PluginsSource?action=diff&version=653&old_version=652

@tsmock
Copy link
Contributor

tsmock commented Mar 31, 2022

@BjornRasmussen : If you don't mind using gradle and GitLab CI, you can reuse the pipeline I've got for the MapWithAI plugin.

@tsmock tsmock mentioned this issue Apr 26, 2022
@tsmock
Copy link
Contributor

tsmock commented Apr 26, 2022

I just created a workflow for releases. We might want to do the same thing for other GitHub plugins, which means we would want to copy the action into its own repository for reuse.

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

Successfully merging a pull request may close this issue.

4 participants