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
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<?xml version="1.0"?>
|
|
||||||
<rdf:RDF xml:lang="en"
|
<rdf:RDF xml:lang="en"
|
||||||
xmlns="http://usefulinc.com/ns/doap#"
|
xmlns="http://usefulinc.com/ns/doap#"
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
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
|
Licensed to the Apache Software Foundation (ASF) under one
|
||||||
or more contributor license agreements. See the NOTICE file
|
or more contributor license agreements. See the NOTICE file
|
||||||
|
@ -16,7 +17,6 @@
|
||||||
specific language governing permissions and limitations
|
specific language governing permissions and limitations
|
||||||
under the License.
|
under the License.
|
||||||
-->
|
-->
|
||||||
<?xml version="1.0"?>
|
|
||||||
<rdf:RDF xml:lang="en"
|
<rdf:RDF xml:lang="en"
|
||||||
xmlns="http://usefulinc.com/ns/doap#"
|
xmlns="http://usefulinc.com/ns/doap#"
|
||||||
xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#"
|
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">
|
<macrodef name="build-changes">
|
||||||
<attribute name="changes.product"/>
|
<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.file" default="CHANGES.txt"/>
|
||||||
<attribute name="changes.src.doap" default="${dev-tools.dir}/doap/@{changes.product}.rdf"/>
|
<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="changes.target.dir" default="${changes.target.dir}"/>
|
||||||
<attribute name="lucene.javadoc.url" default="${lucene.javadoc.url}"/>
|
<attribute name="lucene.javadoc.url" default="${lucene.javadoc.url}"/>
|
||||||
<sequential>
|
<sequential>
|
||||||
<mkdir dir="@{changes.target.dir}"/>
|
<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"
|
<exec executable="${perl.exe}" input="@{changes.src.file}" output="@{changes.target.dir}/Changes.html"
|
||||||
failonerror="true" logError="true">
|
failonerror="true" logError="true">
|
||||||
<arg value="-CSD"/>
|
<arg value="-CSD"/>
|
||||||
<arg value="${changes.src.dir}/changes2html.pl"/>
|
<arg value="${changes.src.dir}/changes2html.pl"/>
|
||||||
<arg value="@{changes.product}"/>
|
<arg value="@{changes.product}"/>
|
||||||
<arg value="@{changes.src.doap}"/>
|
<arg value="@{changes.version.dates}"/>
|
||||||
<arg value="@{lucene.javadoc.url}"/>
|
<arg value="@{lucene.javadoc.url}"/>
|
||||||
</exec>
|
</exec>
|
||||||
<delete file="@{changes.target.dir}/jiraVersionList.json"/>
|
<delete file="@{changes.version.dates}"/>
|
||||||
<copy todir="@{changes.target.dir}">
|
<copy todir="@{changes.target.dir}">
|
||||||
<fileset dir="${changes.src.dir}" includes="*.css"/>
|
<fileset dir="${changes.src.dir}" includes="*.css"/>
|
||||||
</copy>
|
</copy>
|
||||||
|
|
|
@ -23,7 +23,6 @@
|
||||||
|
|
||||||
use strict;
|
use strict;
|
||||||
use warnings;
|
use warnings;
|
||||||
use XML::Simple;
|
|
||||||
|
|
||||||
my $jira_url_prefix = 'http://issues.apache.org/jira/browse/';
|
my $jira_url_prefix = 'http://issues.apache.org/jira/browse/';
|
||||||
my $github_pull_request_prefix = 'https://github.com/apache/lucene-solr/pull/';
|
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.
|
# Pulls release dates from the project DOAP file.
|
||||||
#
|
#
|
||||||
sub setup_release_dates {
|
sub setup_release_dates {
|
||||||
my %release_dates;
|
my %release_dates = ();
|
||||||
my $file = shift;
|
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};
|
$version_list =~ s/^\s+|\s+$//g;
|
||||||
my $version;
|
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;
|
my $date;
|
||||||
for my $release (@{$project_info->{release}}) {
|
for my $pos (0..$#versions) {
|
||||||
$version = $release->{Version};
|
$date = normalize_date($created[$pos]);
|
||||||
if ($version->{created}) {
|
$release_dates{$versions[$pos]} = $date;
|
||||||
$date = normalize_date($version->{created});
|
if ($versions[$pos] =~ /^([1-9]\d*\.\d+)([^.0-9].*|$)/) {
|
||||||
my $version_name = $version->{revision};
|
my $padded_version_name = "$1.0$2"; # Alias w/trailing ".0"
|
||||||
$release_dates{$version->{revision}} = $date;
|
$release_dates{$padded_version_name} = $date;
|
||||||
if ($version_name =~ /^([1-9]\d*\.\d+)([^.0-9].*|$)/) {
|
} elsif ($versions[$pos] =~ /\.0(?=[^.0-9]|$)/) {
|
||||||
my $padded_version_name = "$1.0$2"; # Alias w/trailing ".0"
|
my $trimmed_version_name = $versions[$pos];
|
||||||
$release_dates{$padded_version_name} = $date;
|
$trimmed_version_name =~ s/\.0(?=[^.0-9]|$)//; # Alias w/o trailing ".0"
|
||||||
} elsif ($version_name =~ /\.0(?=[^.0-9]|$)/) {
|
$release_dates{$trimmed_version_name} = $date;
|
||||||
my $trimmed_version_name = $version_name;
|
|
||||||
$trimmed_version_name =~ s/\.0(?=[^.0-9]|$)//; # Alias w/o trailing ".0"
|
|
||||||
$release_dates{$trimmed_version_name} = $date;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return %release_dates;
|
return %release_dates;
|
||||||
|
|
Loading…
Reference in New Issue