Merge pull request #278561 from TomaSajt/ili2c

ili2c: make deterministic and clean up
This commit is contained in:
Weijia Wang 2024-01-04 22:39:13 +01:00 committed by GitHub
commit 2c7f32afa8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 73 additions and 19 deletions

View file

@ -1,30 +1,55 @@
{ lib, stdenv, fetchFromGitHub, jdk8, ant, makeWrapper, jre8 }:
{ lib
, stdenv
, fetchFromGitHub
, ant
, jdk8
, jre8
, makeWrapper
, canonicalize-jars-hook
}:
let jdk = jdk8; jre = jre8; in
stdenv.mkDerivation rec {
let
jdk = jdk8;
jre = jre8;
in
stdenv.mkDerivation (finalAttrs: {
pname = "ili2c";
version = "5.1.1";
version = "5.1.1"; # There are newer versions, but they use gradle
nativeBuildInputs = [ ant jdk makeWrapper ];
nativeBuildInputs = [
ant
jdk
makeWrapper
canonicalize-jars-hook
];
src = fetchFromGitHub {
owner = "claeis";
repo = pname;
rev = "${pname}-${version}";
sha256 = "sha256-FHhx+f253+UdbFjd2fOlUY1tpQ6pA2aVu9CBSwUVoKQ=";
repo = "ili2c";
rev = "ili2c-${finalAttrs.version}";
hash = "sha256-FHhx+f253+UdbFjd2fOlUY1tpQ6pA2aVu9CBSwUVoKQ=";
};
buildPhase = "ant jar";
patches = [
# avoids modifying Version.properties file because that would insert the current timestamp into the file
./dont-use-build-timestamp.patch
];
installPhase =
''
mkdir -p $out/share/${pname}
cp $build/build/source/build/jar/ili2c.jar $out/share/${pname}
buildPhase = ''
runHook preBuild
ant jar
runHook postBuild
'';
mkdir -p $out/bin
makeWrapper ${jre}/bin/java $out/bin/ili2c \
--add-flags "-jar $out/share/${pname}/ili2c.jar"
'';
installPhase = ''
runHook preInstall
install -Dm644 build/jar/ili2c.jar -t $out/share/ili2c
makeWrapper ${jre}/bin/java $out/bin/ili2c \
--add-flags "-jar $out/share/ili2c/ili2c.jar"
runHook postInstall
'';
meta = with lib; {
description = "The INTERLIS Compiler";
@ -34,11 +59,11 @@ stdenv.mkDerivation rec {
homepage = "https://www.interlis.ch/downloads/ili2c";
sourceProvenance = with sourceTypes; [
fromSource
binaryBytecode # source bundles dependencies as jars
binaryBytecode # source bundles dependencies as jars
];
license = licenses.lgpl21Plus;
maintainers = [ maintainers.das-g ];
platforms = platforms.linux;
mainProgram = "ili2c";
};
}
})

View file

@ -0,0 +1,29 @@
diff --git a/build.xml b/build.xml
index d0493d8..50d4286 100644
--- a/build.xml
+++ b/build.xml
@@ -221,11 +221,6 @@
</jar>
</target>
<target depends="init,compile-core,copyres" name="jar-core">
- <propertyfile file="${versionfile}">
- <!-- <entry key="versionMicro" type="int" value="1" operation="+"/> -->
- <entry key="versionDate" type="date" value="now" pattern="yyyyMMdd"/>
- </propertyfile>
-
<jar jarfile="${build}/jar/${ant.project.name}-core.jar">
<!-- fileset dir="${build}/classes" excludes="ch/interlis/ili2c/tests/**/*.class" includes="ch/interlis/models/**/*.class,ch/interlis/ili2c/parser/**/*.class,ch/interlis/ili2c/generator/**/*.class,ch/interlis/ili2c/modelscan/**/*.class,ch/interlis/ili2c/metamodel/**/*.class,ch/interlis/ili2c/config/**/*.class,ch/interlis/ili2c/CompilerLogEvent.class,ch/interlis/ili2c/Ili2cException.class,ch/interlis/ili2c/Ili2cFailure.class,ch/interlis/ili2c/gui/UserSettings.class,ch/interlis/ilirepository/ReposManager.class,ch/interlis/ilirepository/impl/RepositoryAccessException.class,ch/interlis/ilirepository/Dataset.class"/-->
<fileset dir="${build}/classes-core" excludes="ch/interlis/ili2c/tests/**/*.class" />
diff --git a/src-core/ch/interlis/ili2c/metamodel/TransferDescription.java b/src-core/ch/interlis/ili2c/metamodel/TransferDescription.java
index 9e165af..86d8f89 100644
--- a/src-core/ch/interlis/ili2c/metamodel/TransferDescription.java
+++ b/src-core/ch/interlis/ili2c/metamodel/TransferDescription.java
@@ -219,7 +219,7 @@ public static final String MIMETYPE_XTF = "application/interlis+xml;version=2.3"
ret.append(branch);
ret.append('-');
}
- ret.append(resVersion.getString("versionDate"));
+ ret.append("nixpkgs");
version = ret.toString();
}
return version;