2023-06-29 21:30:06 +00:00
|
|
|
{ fetchsvn
|
|
|
|
, fetchurl
|
|
|
|
, lib
|
|
|
|
, stdenv
|
|
|
|
|
|
|
|
# Dependencies
|
|
|
|
, ant
|
|
|
|
, jdk
|
2023-06-29 23:36:13 +00:00
|
|
|
, josm
|
2023-06-29 21:30:06 +00:00
|
|
|
}:
|
|
|
|
|
2023-08-17 04:06:33 +00:00
|
|
|
{ pluginName ? args.pname, ... } @ args:
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
# Modeled after https://josm.openstreetmap.de/wiki/DevelopersGuide/DevelopingPlugins
|
|
|
|
let
|
|
|
|
inherit (lib) versionOlder warnIf;
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
josmVersion = "18721";
|
|
|
|
josmLegacyRev = "36079";
|
|
|
|
in
|
|
|
|
warnIf (versionOlder josmVersion josm.version) "JOSM plugin build environment ${josmVersion} is behind ${josm.version}"
|
|
|
|
stdenv.mkDerivation
|
|
|
|
(args // {
|
|
|
|
srcJosmLegacy = fetchsvn {
|
|
|
|
url = "https://josm.openstreetmap.de/osmsvn/applications/editors/josm";
|
|
|
|
rev = josmLegacyRev;
|
|
|
|
ignoreExternals = true;
|
|
|
|
sha256 = "sha256-1sL7tldjWvCYFfwAgbj/XPCow42CD/ezouY2PUBYF74=";
|
|
|
|
};
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
srcJosmCore = fetchsvn {
|
|
|
|
url = "https://josm.openstreetmap.de/svn/trunk";
|
|
|
|
rev = josmVersion;
|
|
|
|
ignoreExternals = true;
|
|
|
|
sha256 = "sha256-t9XtVyYUeQG8GCo3F6EqliRC7z8XljDNBqo3dmt31w0=";
|
|
|
|
};
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
srcJosmCoreDist = fetchurl {
|
|
|
|
url = "https://josm.openstreetmap.de/download/josm-snapshot-${josmVersion}.jar";
|
|
|
|
hash = "sha256-nc6itoblAzP064xTTF8q990TiRX3+zf5uk+enS+C5Jo=";
|
|
|
|
};
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
unpackPhase = ''
|
|
|
|
cp --no-preserve=mode --recursive --reflink=auto $srcJosmLegacy josm
|
|
|
|
cp --no-preserve=mode --recursive --reflink=auto $srcJosmCore josm/core
|
2023-06-30 03:31:46 +00:00
|
|
|
mkdir josm/core/dist && ln --symbolic $srcJosmCoreDist josm/core/dist/josm-custom.jar
|
|
|
|
ln --symbolic josm/core/tools josm/plugins/00_core_tools
|
2023-06-29 23:36:13 +00:00
|
|
|
cp --no-preserve=mode --recursive --reflink=auto $src josm/plugins/${pluginName}
|
|
|
|
'';
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
patches = [
|
|
|
|
(builtins.toFile "offline.patch" ''
|
|
|
|
--- a/josm/plugins/build-common.xml
|
|
|
|
+++ b/josm/plugins/build-common.xml
|
|
|
|
@@ -115 +115 @@
|
|
|
|
- <target name="compile" depends="init, pre-compile, resolve-tools" unless="skip-compile">
|
|
|
|
+ <target name="compile" depends="init, pre-compile" unless="skip-compile">
|
|
|
|
@@ -118 +117,0 @@
|
|
|
|
- <path refid="errorprone_javac.classpath"/>
|
|
|
|
@@ -135 +133,0 @@
|
|
|
|
- <compilerarg pathref="errorprone.classpath"/>
|
|
|
|
@@ -138 +135,0 @@
|
|
|
|
- <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 -Xep:RestrictedApiChecker:OFF"/>
|
|
|
|
'')
|
|
|
|
];
|
2023-06-29 21:30:06 +00:00
|
|
|
|
2023-06-29 23:36:13 +00:00
|
|
|
nativeBuildInputs = [ ant jdk ];
|
|
|
|
|
|
|
|
buildPhase = ''
|
|
|
|
cd josm/plugins/${pluginName}
|
|
|
|
ant
|
|
|
|
'';
|
|
|
|
|
|
|
|
installPhase = ''
|
|
|
|
install -D -t $out/share/JOSM/plugins /build/josm/dist/${pluginName}.jar
|
|
|
|
'';
|
|
|
|
})
|