mirror of https://github.com/apache/lucene.git
LUCENE-7543: Parse DOAP RDF files with Ant <xmlproperty> rather than Perl XML::Simple
This commit is contained in:
parent
b768a83a1e
commit
c5aa9b9ada
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
|
@ -16,7 +17,6 @@
|
|||
specific language governing permissions and limitations
|
||||
under 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#"
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
<?xml version="1.0"?>
|
||||
<!--
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
|
@ -16,7 +17,6 @@
|
|||
specific language governing permissions and limitations
|
||||
under 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#"
|
||||
|
|
|
@ -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>
|
||||
|
|
|
@ -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;
|
||||
print STDERR "file: $file\n";
|
||||
open(FILE, "<$file") || die "could not open $file: $!";
|
||||
my $version_list = <FILE>;
|
||||
my $created_list = <FILE>;
|
||||
close(FILE);
|
||||
|
||||
my $project_info = XMLin($file)->{Project};
|
||||
my $version;
|
||||
$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;
|
||||
|
|
Loading…
Reference in New Issue