Apache Lucene open-source search software
LUCENE-7543: Parse DOAP RDF files with Ant <xmlproperty> rather than Perl XML::Simple
Steve Rowec5aa9b9adaa8
diff --git a/dev-tools/doap/lucene.rdf b/dev-tools/doap/lucene.rdfindex d1293a4a7db..4fd29424102 100644--- a/dev-tools/doap/lucene.rdf+++ b/dev-tools/doap/lucene.rdf@@ -1,3 +1,4 @@+<?xml version="1.0"?><!--Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE file@@ -16,7 +17,6 @@specific language governing permissions and limitationsunder the License.-->-<?xml version="1.0"?><rdf:RDF xml:lang="en"xmlns="http://usefulinc.com/ns/doap#"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"diff --git a/dev-tools/doap/solr.rdf b/dev-tools/doap/solr.rdfindex 87f246365f9..cc729dcaba1 100644--- a/dev-tools/doap/solr.rdf+++ b/dev-tools/doap/solr.rdf@@ -1,3 +1,4 @@+<?xml version="1.0"?><!--Licensed to the Apache Software Foundation (ASF) under oneor more contributor license agreements. See the NOTICE file@@ -16,7 +17,6 @@specific language governing permissions and limitationsunder the License.-->-<?xml version="1.0"?><rdf:RDF xml:lang="en"xmlns="http://usefulinc.com/ns/doap#"xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"diff --git a/lucene/common-build.xml b/lucene/common-build.xmlindex d2db40bbd18..42cd140e59d 100644--- a/lucene/common-build.xml+++ b/lucene/common-build.xml@@ -2503,21 +2503,26 @@ ${ant.project.name}.test.dependencies=${test.classpath.list}--><macrodef name="build-changes"><attribute name="changes.product"/>+ <attribute name="doap.property.prefix" default="doap.@{changes.product}"/><attribute name="changes.src.file" default="CHANGES.txt"/><attribute name="changes.src.doap" default="${dev-tools.dir}/doap/@{changes.product}.rdf"/>+ <attribute name="changes.version.dates" default="build/@{doap.property.prefix}.version.dates.csv"/><attribute name="changes.target.dir" default="${changes.target.dir}"/><attribute name="lucene.javadoc.url" default="${lucene.javadoc.url}"/><sequential><mkdir dir="@{changes.target.dir}"/>+ <xmlproperty keeproot="false" file="@{changes.src.doap}" collapseAttributes="false" prefix="@{doap.property.prefix}"/>+ <echo file="@{changes.version.dates}" append="false">${@{doap.property.prefix}.Project.release.Version.revision}
</echo>+ <echo file="@{changes.version.dates}" append="true">${@{doap.property.prefix}.Project.release.Version.created}
</echo><exec executable="${perl.exe}" input="@{changes.src.file}" output="@{changes.target.dir}/Changes.html"failonerror="true" logError="true"><arg value="-CSD"/><arg value="${changes.src.dir}/changes2html.pl"/><arg value="@{changes.product}"/>- <arg value="@{changes.src.doap}"/>+ <arg value="@{changes.version.dates}"/><arg value="@{lucene.javadoc.url}"/></exec>- <delete file="@{changes.target.dir}/jiraVersionList.json"/>+ <delete file="@{changes.version.dates}"/><copy todir="@{changes.target.dir}"><fileset dir="${changes.src.dir}" includes="*.css"/></copy>diff --git a/lucene/site/changes/changes2html.pl b/lucene/site/changes/changes2html.plindex b3f8fdb58c5..11a0fabd050 100755--- a/lucene/site/changes/changes2html.pl+++ b/lucene/site/changes/changes2html.pl@@ -23,7 +23,6 @@use strict;use warnings;-use XML::Simple;my $jira_url_prefix = 'http://issues.apache.org/jira/browse/';my $github_pull_request_prefix = 'https://github.com/apache/lucene-solr/pull/';@@ -823,26 +822,33 @@ sub get_release_date {# Pulls release dates from the project DOAP file.#sub setup_release_dates {- my %release_dates;+ my %release_dates = ();my $file = shift;-- my $project_info = XMLin($file)->{Project};- my $version;+print STDERR "file: $file\n";+ open(FILE, "<$file") || die "could not open $file: $!";+ my $version_list = <FILE>;+ my $created_list = <FILE>;+ close(FILE);++ $version_list =~ s/^\s+|\s+$//g;+ my @versions = split /\s*,\s*/, $version_list;+ $created_list =~ s/^\s+|\s+$//g;+ my @created = split /\s*,\s*/, $created_list;++ if (scalar(@versions) != scalar(@created)) {+ die $file . " contains" . scalar(@versions) . " versions but " . scalar(@created) . " creation dates.";+ }my $date;- for my $release (@{$project_info->{release}}) {- $version = $release->{Version};- if ($version->{created}) {- $date = normalize_date($version->{created});- my $version_name = $version->{revision};- $release_dates{$version->{revision}} = $date;- if ($version_name =~ /^([1-9]\d*\.\d+)([^.0-9].*|$)/) {- my $padded_version_name = "$1.0$2"; # Alias w/trailing ".0"- $release_dates{$padded_version_name} = $date;- } elsif ($version_name =~ /\.0(?=[^.0-9]|$)/) {- my $trimmed_version_name = $version_name;- $trimmed_version_name =~ s/\.0(?=[^.0-9]|$)//; # Alias w/o trailing ".0"- $release_dates{$trimmed_version_name} = $date;- }+ for my $pos (0..$#versions) {+ $date = normalize_date($created[$pos]);+ $release_dates{$versions[$pos]} = $date;+ if ($versions[$pos] =~ /^([1-9]\d*\.\d+)([^.0-9].*|$)/) {+ my $padded_version_name = "$1.0$2"; # Alias w/trailing ".0"+ $release_dates{$padded_version_name} = $date;+ } elsif ($versions[$pos] =~ /\.0(?=[^.0-9]|$)/) {+ my $trimmed_version_name = $versions[$pos];+ $trimmed_version_name =~ s/\.0(?=[^.0-9]|$)//; # Alias w/o trailing ".0"+ $release_dates{$trimmed_version_name} = $date;}}return %release_dates;