Skip to content

Commit

Permalink
Use pom.xml for dependencies when ivy.xml is not available
Browse files Browse the repository at this point in the history
This removes ivy.xml from javafx and converts rasterfilters to use maven for
dependency management instead of jars in source control. In addition
rasterfilters dependencies were upgraded to the latest versions.

javafx now requires Java 17 since OpenJFX 21 requires Java 17+.

opendata was upgraded to use jdom2 (see
https://github.com/JOSM/josm-plugins/security/dependabot/2)

git-svn-id: https://josm.openstreetmap.de/osmsvn/applications/editors/josm/plugins@36315 b9d5c4c9-76e1-0310-9c85-f3177eceb1e4
  • Loading branch information
tsmock committed Aug 21, 2024
1 parent 8d76c20 commit 92edc5b
Show file tree
Hide file tree
Showing 39 changed files with 209 additions and 183 deletions.
111 changes: 104 additions & 7 deletions build-common.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
** Paths are relative to the build.xml that imports this template.
**
-->
<project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless" xmlns:ivy="antlib:org.apache.ivy.ant">
<project name="plugin_common" basedir="." xmlns:jacoco="antlib:org.jacoco.ant" xmlns:if="ant:if" xmlns:unless="ant:unless" xmlns:ivy="antlib:org.apache.ivy.ant" xmlns:mvn="antlib:org.apache.maven.resolver.ant" >

<property name="josm" location="../../core/dist/josm-custom.jar"/>
<property name="josm.ivy" location="../../core/ivy.xml"/>
Expand Down Expand Up @@ -42,6 +42,9 @@
<property name="ivy.jar.dir" location="${ivy.home}/lib"/>
<property name="ivy.jar.file" location="${ivy.jar.dir}/ivy.jar"/>
<property name="ivy.version" value="2.5.1"/>
<property name="maven.artifact.resolver.version" value="1.5.1"/>
<property name="maven.artifact.resolver.parent.dir" value="${user.home}/.m2/repository/org/apache/maven/resolver/maven-resolver-ant-tasks/${maven.artifact.resolver.version}/"/>
<property name="maven.artifact.resolver.jar.file" value="${maven.artifact.resolver.parent.dir}/maven-resolver-ant-tasks-${maven.artifact.resolver.version}-uber.jar"/>
<property name="jacoco.inclbootstrapclasses" value="false" />
<property name="jacoco.inclnolocationclasses" value="false" />
<property name="junit.printsummary" value="on" />
Expand Down Expand Up @@ -110,6 +113,12 @@
<!-- to be overridden by plugins that need to perform additional tasks before compiling -->
</target>
<target name="compile" depends="init, pre-compile, resolve-tools" unless="skip-compile">
<condition property="plugin.classpath.actual.defined">
<isreference refid="plugin.classpath.actual" type="path"/>
</condition>
<path id="plugin.classpath.actual" unless:set="plugin.classpath.actual.defined">
<path refid="plugin.classpath"/>
</path>
<echo message="compiling sources for ${plugin.jar} ..."/>
<path id="jdk.boot.classpath">
<path refid="errorprone_javac.classpath"/>
Expand All @@ -133,7 +142,7 @@
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-Xplugin:ErrorProne -Xep:StringSplitter:OFF -Xep:ReferenceEquality:OFF -Xep:InsecureCryptoUsage:OFF -Xep:FutureReturnValueIgnored:OFF -Xep:JdkObsolete:OFF -Xep:EqualsHashCode:OFF -Xep:JavaUtilDate:OFF -Xep:DoNotCallSuggester:OFF -Xep:BanSerializableRead:OFF" />
<compilerarg line="-Xmaxwarns 1000"/>
<classpath refid="plugin.classpath"/>
<classpath refid="plugin.classpath.actual"/>
</javac>
</target>
<!--
Expand Down Expand Up @@ -279,7 +288,8 @@
<target name="pre-javadoc">
<!-- to be overridden by plugins that need to perform additional tasks before generating javadoc -->
</target>
<target name="javadoc" depends="pre-javadoc" unless="skip-javadoc">
<target name="javadoc" depends="pre-javadoc,pre-compile" unless="skip-javadoc">
<mkdir dir="${plugin.doc.dir}"/>
<javadoc destdir="${plugin.doc.dir}"
executable="${javadoc.executable}"
encoding="UTF-8"
Expand All @@ -288,7 +298,8 @@
private="true"
linksource="true"
author="false">
<classpath refid="plugin.classpath"/>
<classpath refid="plugin.classpath" unless:set="plugin.classpath.dependencies"/>
<classpath refid="plugin.classpath.dependencies" if:set="plugin.classpath.dependencies"/>
<sourcepath>
<pathelement path="${plugin.src.dir}" />
<pathelement path="gen" />
Expand Down Expand Up @@ -660,6 +671,7 @@
org/osgeo/**/*.java,
"/>
<fileset dir="${basedir}/test" includes="**/*.java" erroronmissingdir="false"/>
<formatter type="plain"/>
<formatter type="xml" toFile="checkstyle-josm-${ant.project.name}.xml"/>
</checkstyle>
</target>
Expand All @@ -676,7 +688,8 @@
nested="false"
jvmargs="-Xmx1024m"
>
<auxClasspath refid="plugin.classpath" />
<auxClasspath refid="plugin.classpath" unless:set="plugin.classpath.dependencies"/>
<auxClasspath refid="plugin.classpath.dependencies" if:set="plugin.classpath.dependencies"/>
<sourcePath path="${basedir}/src" />
<class location="${plugin.build.dir}" />
</spotbugs>
Expand Down Expand Up @@ -714,6 +727,11 @@
<!--
** Ivy tasks
-->
<target name="is-ivy">
<condition property="isIvy">
<available file="ivy.xml"/>
</condition>
</target>
<target name="download-ivy">
<mkdir dir="${ivy.jar.dir}"/>
<get src="https://josm.openstreetmap.de/nexus/content/repositories/public/org/apache/ivy/ivy/${ivy.version}/ivy-${ivy.version}.jar"
Expand Down Expand Up @@ -742,15 +760,94 @@
</fileset>
</delete>
</target>
<target name="fetch_dependencies" depends="clean_ivy, init-ivy">
<target name="fetch-dependencies-ivy" depends="clean_ivy, init-ivy, is-ivy" if="isIvy">
<echo>fetching dependencies with ivy</echo>
<available property="plugin.ivysettings.exists" file="ivy_settings.xml"/>
<ivy:settings file="ivy_settings.xml" if:set="plugin.ivysettings.exists"/>
<ivy:settings file="${josm.ivysettings}" unless:set="plugin.ivysettings.exists"/>
<ivy:resolve />
<ivy:retrieve pattern="${plugin.lib.dir}/[artifact]-[revision](-[classifier]).[ext]" conf="default" />
</target>
<target name="ivy-checkdepsupdate" description="Display dependency updates on the console" depends="fetch_dependencies">
<target name="ivy-checkdepsupdate" description="Display dependency updates on the console" depends="fetch-dependencies-ivy">
<ivy:checkdepsupdate/>
</target>
<!--
** Maven tasks
-->
<target name="is-maven" depends="is-ivy">
<condition property="isMaven">
<and>
<available file="pom.xml"/>
<not>
<isset property="isIvy"/>
</not>
</and>
</condition>
</target>
<target name="download-maven" depends="is-maven" if="isMaven">
<mkdir dir="${maven.artifact.resolver.parent.dir}"/>
<get src="https://josm.openstreetmap.de/nexus/content/repositories/public/org/apache/maven/resolver/maven-resolver-ant-tasks/${maven.artifact.resolver.version}/maven-resolver-ant-tasks-${maven.artifact.resolver.version}-uber.jar"
dest="${maven.artifact.resolver.jar.file}"
usetimestamp="true"/>
</target>
<target name="init-maven" depends="is-maven,download-maven" if="isMaven">
<path id="maven.lib.path">
<fileset dir="${maven.artifact.resolver.parent.dir}" includes="*.jar"/>
</path>
<taskdef uri="antlib:org.apache.maven.resolver.ant" resource="org/apache/maven/resolver/ant/antlib.xml" classpathref="maven.lib.path"/>
</target>
<target name="fetch-dependencies-maven" depends="is-maven,init-maven,clean_ivy" if="isMaven">
<mvn:pom file="pom.xml"/>
<mvn:pom file="pom.xml" id="pom"/>
<!-- This stanza is necessary since the maven resolver doesn't read repo settings from the pom.xml file -->
<!-- resolver.repositories makes it global -->
<mvn:remoterepos id="resolver.repositories">
<mvn:remoterepo id="JOSM" url="https://josm.openstreetmap.de/nexus/content/repositories/public/" />
</mvn:remoterepos>
<mkdir dir="${plugin.lib.dir}"/>
<mvn:resolve>
<!-- For some reason, compile time josm-unittest dependencies get included -->
<mvn:dependencies pomRef="pom">
<mvn:exclusion groupId="org.openstreetmap.josm" artifactId="josm-unittest"/>
<mvn:exclusion groupId="org.junit.platform"/>
<mvn:exclusion groupId="org.junit.vintage"/>
<mvn:exclusion groupId="org.junit.jupiter"/>
</mvn:dependencies>
<mvn:files refid="lib.files" dir="${plugin.lib.dir}" layout="{artifactId}-{version}-{classifier}.{extension}" scopes="compile,!test"/>
</mvn:resolve>
<echo message="${toString:lib.files}"/>
<mvn:resolve>
<mvn:path refid="classpath.provided" scopes="provided"/>
</mvn:resolve>
<mvn:resolve>
<mvn:path refid="testlib.classpath" classpath="test"/>
</mvn:resolve>
<mvn:resolve>
<mvn:dependencies>
<mvn:dependency groupId="org.jacoco" artifactId="org.jacoco.ant" version="${pom.properties.jacoco.version}" classifier="nodeps" type="jar" scope="test"/>
</mvn:dependencies>
<mvn:path refid="jacocotest.classpath" classpath="test"/>
</mvn:resolve>
<mvn:resolve>
<mvn:dependencies>
<mvn:dependency groupId="com.puppycrawl.tools" artifactId="checkstyle" version="${pom.properties.checkstyle.version}" scope="compile"/>
</mvn:dependencies>
<mvn:path refid="checkstyle.classpath" classpath="compile"/>
</mvn:resolve>
<mvn:resolve>
<mvn:dependencies>
<mvn:dependency groupId="com.github.spotbugs" artifactId="spotbugs" version="${pom.properties.spotbugs.version}" scope="compile"/>
<mvn:dependency groupId="com.github.spotbugs" artifactId="spotbugs-ant" version="${pom.properties.spotbugs.version}" scope="compile"/>
</mvn:dependencies>
<mvn:path refid="spotbugs.classpath" classpath="compile"/>
</mvn:resolve>
<path id="plugin.classpath.actual">
<path refid="plugin.classpath"/>
<path refid="classpath.provided"/>
</path>
</target>

<target name="fetch_dependencies" depends="fetch-dependencies-ivy,fetch-dependencies-maven">
<!-- We can depend upon ivy and/or maven right now. -->
</target>
</project>
4 changes: 2 additions & 2 deletions build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@
<!-- Specific plugins -->
<property name="java21_plugins" value="FIT/build.xml
MicrosoftStreetside/build.xml" />
<property name="java17_plugins" value="imageio/build.xml
<property name="java17_plugins" value="javafx/build.xml
imageio/build.xml
Mapillary/build.xml
MapRoulette/build.xml
pmtiles/build.xml
todo/build.xml"/>
<property name="ordered_plugins" value="jackson/build.xml
javafx/build.xml
jaxb/build.xml
jna/build.xml
jts/build.xml
Expand Down
2 changes: 1 addition & 1 deletion javafx/build.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<property name="plugin.author" value="Don-vip"/>
<property name="plugin.class" value="org.openstreetmap.josm.plugins.javafx.JavaFxPlugin"/>
<property name="plugin.description" value="Provides additional OpenJFX (JavaFX) features such as MP3 audio playback."/>
<!--<property name="plugin.minimum.java.version" value="10"/>-->
<property name="plugin.minimum.java.version" value="17"/>
<property name="plugin.provides" value="javafx"/>
<!--<property name="plugin.icon" value="..."/>-->
<!--<property name="plugin.link" value="..."/>-->
Expand Down
58 changes: 0 additions & 58 deletions javafx/ivy.xml

This file was deleted.

1 change: 1 addition & 0 deletions javafx/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
<plugin.description>Provides additional OpenJFX (JavaFX) features such as MP3 audio playback.</plugin.description>
<plugin.early>true</plugin.early>
<plugin.stage>5</plugin.stage>
<plugin.minimum.java.version>17</plugin.minimum.java.version>
<javafx.version>21.0.2</javafx.version>
</properties>
<!-- These dependencies should be installed on the host machine - our installers bundle them -->
Expand Down
10 changes: 5 additions & 5 deletions opendata/build.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<project name="opendata" default="dist" basedir=".">
<project name="opendata" default="dist" basedir="." xmlns:mvn="antlib:org.apache.maven.resolver.ant">
<property name="plugin.main.version" value="18723"/>
<property name="plugin.author" value="Don-vip"/>
<property name="plugin.class" value="org.openstreetmap.josm.plugins.opendata.OdPlugin"/>
Expand All @@ -25,7 +25,7 @@
<property name="jts" location="${plugin.dist.dir}/jts.jar"/>
<property name="ejml" location="${plugin.dist.dir}/ejml.jar"/>
<property name="geotools" location="${plugin.dist.dir}/geotools.jar"/>

<!--
**********************************************************
** compile_poi - compiles Apache POI needed classes
Expand All @@ -40,12 +40,12 @@
** compile_jopendoc - compiles JOpenDocument needed classes
**********************************************************
-->
<target name="compile_jopendoc" depends="init">
<target name="compile_jopendoc" depends="init, fetch_dependencies">
<echo message="compiling JOpenDocument ... "/>
<javac srcdir="includes/org/jopendocument" debug="false" destdir="${plugin.build.dir}" includeAntRuntime="false" encoding="ISO-8859-1" release="${java.lang.version}">
<classpath>
<!-- JDOM is required in an older version than the one embedded in geotools jar -->
<pathelement location="lib/jdom-1.1.3.jar"/>
<pathelement location="lib/jdom2-2.0.6.1.jar"/>
<pathelement location="${apache-commons}"/>
</classpath>
</javac>
Expand Down Expand Up @@ -77,7 +77,7 @@
** compile - compiles the source tree
**********************************************************
-->
<target name="pre-compile" depends="init, compile_poi, compile_jopendoc, compile_neptune, compile_j7zip"/>
<target name="pre-compile" depends="init, fetch_dependencies, compile_poi, compile_jopendoc, compile_neptune, compile_j7zip"/>

<target name="xjc_neptune" depends="init, -jaxb_linux, -jaxb_windows" unless="jaxb.notRequired">
<exec executable="${xjc}" failonerror="true">
Expand Down
4 changes: 2 additions & 2 deletions opendata/includes/org/jopendocument/dom/ChildCreator.java
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,8 @@
import java.util.List;
import java.util.ListIterator;

import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom2.Element;
import org.jdom2.Namespace;

/**
* A helper to create children in the schema order.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
import java.util.HashSet;
import java.util.Set;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom2.Document;
import org.jdom2.Element;

public class ImmutableDocStyledNode<S extends StyleStyle, D extends ODDocument> extends StyledNode<S, D> {

Expand Down
4 changes: 2 additions & 2 deletions opendata/includes/org/jopendocument/dom/ODMeta.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@
import java.util.List;
import java.util.Map;

import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom2.Element;
import org.jdom2.Namespace;

/**
* OpenDocument metadata, obtained through {@link ODPackage#getMeta()}.
Expand Down
2 changes: 1 addition & 1 deletion opendata/includes/org/jopendocument/dom/ODNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

package org.jopendocument.dom;

import org.jdom.Element;
import org.jdom2.Element;

/**
* A node in an XML document.
Expand Down
2 changes: 1 addition & 1 deletion opendata/includes/org/jopendocument/dom/ODPackage.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
import java.util.Map;
import java.util.Set;

import org.jdom.Document;
import org.jdom2.Document;
import org.jopendocument.util.CopyUtils;
import org.jopendocument.util.FileUtils;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,9 @@
import java.util.EnumSet;
import java.util.List;

import org.jdom.Attribute;
import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom2.Attribute;
import org.jdom2.Element;
import org.jdom2.Namespace;

// eg <meta:user-defined meta:name="countOfSomething">5.2</meta:user-defined>
public class ODUserDefinedMeta extends ODNode {
Expand Down
6 changes: 3 additions & 3 deletions opendata/includes/org/jopendocument/dom/ODXMLDocument.java
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@
import java.util.List;
import java.util.Map;

import org.jdom.Document;
import org.jdom.Element;
import org.jdom.Namespace;
import org.jdom2.Document;
import org.jdom2.Element;
import org.jdom2.Namespace;

/**
* An OpenDocument XML document, like content.xml ou styles.xml.
Expand Down
Loading

0 comments on commit 92edc5b

Please sign in to comment.