Fridrich Strba 2024-10-02 10:51:33 +00:00 committed by Git OBS Bridge
commit da72d6603c
10 changed files with 321 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

1
.gitignore vendored Normal file
View File

@ -0,0 +1 @@
.osc

View File

@ -0,0 +1,72 @@
From 1305d8d7aa5f9724e28d54a112a524f9a2fb0af7 Mon Sep 17 00:00:00 2001
From: Michal Srb <msrb@redhat.com>
Date: Wed, 16 Oct 2013 14:29:21 +0200
Subject: [PATCH] [MANTLR-34] Fix NPE when building Jenkins
---
.../mojo/antlr/metadata/MetadataExtracter.java | 40 ++++++++++++----------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java b/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
index c54f301..8637dea 100644
--- a/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
+++ b/src/main/java/org/codehaus/mojo/antlr/metadata/MetadataExtracter.java
@@ -239,34 +239,36 @@ public class MetadataExtracter
Method getRHSMethod = helper.getAntlrOptionClass().getMethod( "getRHS", Helper.NO_ARG_SIGNATURE );
getRHSMethod.setAccessible( true );
- Object importVocabOption = getElementMethod.invoke( options, new Object[] { "importVocab" } );
- if ( importVocabOption != null )
- {
- String importVocab = (String) getRHSMethod.invoke( importVocabOption, Helper.NO_ARGS );
- if ( importVocab != null )
+ if ( options != null ) {
+ Object importVocabOption = getElementMethod.invoke( options, new Object[] { "importVocab" } );
+ if ( importVocabOption != null )
{
- importVocab = importVocab.trim();
- if ( importVocab.endsWith( ";" ) )
+ String importVocab = (String) getRHSMethod.invoke( importVocabOption, Helper.NO_ARGS );
+ if ( importVocab != null )
{
- importVocab = importVocab.substring( 0, importVocab.length() - 1 );
+ importVocab = importVocab.trim();
+ if ( importVocab.endsWith( ";" ) )
+ {
+ importVocab = importVocab.substring( 0, importVocab.length() - 1 );
+ }
+ grammar.setImportVocab( importVocab );
}
- grammar.setImportVocab( importVocab );
}
- }
- Object exportVocabOption = getElementMethod.invoke( options, new Object[] { "exportVocab" } );
- if ( exportVocabOption != null )
- {
- String exportVocab = (String) getRHSMethod.invoke( exportVocabOption, Helper.NO_ARGS );
- if ( exportVocab != null )
+ Object exportVocabOption = getElementMethod.invoke( options, new Object[] { "exportVocab" } );
+ if ( exportVocabOption != null )
{
- exportVocab = exportVocab.trim();
- if ( exportVocab.endsWith( ";" ) )
+ String exportVocab = (String) getRHSMethod.invoke( exportVocabOption, Helper.NO_ARGS );
+ if ( exportVocab != null )
{
- exportVocab = exportVocab.substring( 0, exportVocab.length() - 1 );
+ exportVocab = exportVocab.trim();
+ if ( exportVocab.endsWith( ";" ) )
+ {
+ exportVocab = exportVocab.substring( 0, exportVocab.length() - 1 );
+ }
}
+ grammar.setExportVocab( exportVocab );
}
- grammar.setExportVocab( exportVocab );
}
}
catch ( Throwable t )
--
1.8.3.1

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6d55783bff4e79818930eb888cfa93a4a0511e1f9f24712f842f5aaa2cfa2ac6
size 134214

View File

@ -0,0 +1,42 @@
-------------------------------------------------------------------
Wed Oct 2 10:25:40 UTC 2024 - Fridrich Strba <fstrba@suse.com>
- Modified patches:
* maven-antlr-plugin-2.1-sinkfix.patch
* new-reporting-api.patch
+ port to changes in maven-doxia-sitetools 2.0.0 milestones
-------------------------------------------------------------------
Tue Feb 20 10:57:20 UTC 2024 - Dominique Leuenberger <dimstar@opensuse.org>
- Use %patch -P N instead of deprecated %patchN.
-------------------------------------------------------------------
Thu Oct 26 12:08:10 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* jdk18plus.patch
+ catch UnsupportedOperationException that SecurityManager in
JDK 21 throws instead of warning about deprecation
-------------------------------------------------------------------
Mon Sep 25 09:21:04 UTC 2023 - Fridrich Strba <fstrba@suse.com>
- Remove dependency on maven2
-------------------------------------------------------------------
Mon Mar 21 14:49:53 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Build with maven.compiler.release=8 on any JDK >= 9
-------------------------------------------------------------------
Fri Mar 11 07:10:16 UTC 2022 - Fridrich Strba <fstrba@suse.com>
- Added patch:
* new-reporting-api.patch
+ fix building with the new maven-reporting-api
-------------------------------------------------------------------
Fri Apr 5 14:50:16 UTC 2019 - Fridrich Strba <fstrba@suse.com>
- Initial packaging of antlr-maven-plugin 2.2

102
antlr-maven-plugin.spec Normal file
View File

@ -0,0 +1,102 @@
#
# spec file for package antlr-maven-plugin
#
# Copyright (c) 2024 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
Name: antlr-maven-plugin
Version: 2.2
Release: 0
Summary: Maven plugin that generates files based on grammar file(s)
License: Apache-2.0
Group: Development/Libraries/Java
URL: http://mojo.codehaus.org/antlr-maven-plugin/
Source0: https://repo1.maven.org/maven2/org/codehaus/mojo/%{name}/%{version}/%{name}-%{version}-source-release.zip
# Modern modello expects to see <models></models>, even if there is only one.
Patch0: maven-antlr-plugin-2.2-modello-issue.patch
# siteRenderer.createSink doesn't exist anymore
Patch2: maven-antlr-plugin-2.1-sinkfix.patch
# Fix grammar processing bug (bz 1020312)
Patch3: 0001-MANTLR-34-Fix-NPE-when-building-Jenkins.patch
Patch4: new-reporting-api.patch
Patch5: jdk18plus.patch
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: maven-local
BuildRequires: unzip
BuildRequires: mvn(org.apache.commons:commons-exec)
BuildRequires: mvn(org.apache.maven.plugins:maven-plugin-plugin)
BuildRequires: mvn(org.apache.maven.reporting:maven-reporting-impl)
BuildRequires: mvn(org.apache.maven.wagon:wagon-provider-api)
BuildRequires: mvn(org.apache.maven:maven-core)
BuildRequires: mvn(org.apache.maven:maven-plugin-api)
BuildRequires: mvn(org.codehaus.modello:modello-maven-plugin)
BuildRequires: mvn(org.codehaus.mojo:mojo-parent:pom:)
BuildRequires: mvn(org.codehaus.plexus:plexus-i18n)
BuildRequires: mvn(org.codehaus.plexus:plexus-utils)
BuildArch: noarch
%description
The Antlr Plugin has two goals:
- antlr:generate Generates file(s) to a target directory based on grammar
file(s).
- antlr:html Generates Antlr report for grammar file(s).
%package javadoc
Summary: Javadocs for %{name}
Group: Documentation/HTML
%description javadoc
This package contains the API documentation for %{name}.
%prep
%setup -q
%patch -P 0 -p1 -b .modello
%patch -P 2 -b .sink
%patch -P 3 -p1 -b .fixnpe
%patch -P 4 -p1
%patch -P 5 -p1
%pom_change_dep :maven-project :maven-core:3.9.3
# reporting eventually pulls in another antlr and we'd break with weird errors
%pom_xpath_inject "pom:dependency[pom:artifactId[text()='maven-reporting-impl']]/pom:exclusions" "
<exclusion>
<groupId>antlr</groupId>
<artifactId>antlr</artifactId>
</exclusion>"
# remove all binary bits
find -name '*.class' -exec rm -f '{}' \;
find -name '*.jar' -exec rm -f '{}' \;
%{mvn_file} : %{name}
%build
%{mvn_build} -f -- \
%if %{?pkg_vcmp:%pkg_vcmp java-devel >= 9}%{!?pkg_vcmp:0}
-Dmaven.compiler.release=8 \
%endif
-Dsource=8
%install
%mvn_install
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%files javadoc -f .mfiles-javadoc
%changelog

13
jdk18plus.patch Normal file
View File

@ -0,0 +1,13 @@
--- antlr-maven-plugin-2.2/src/main/java/org/codehaus/mojo/antlr/AbstractAntlrMojo.java 2010-11-16 16:59:34.000000000 +0100
+++ antlr-maven-plugin-2.2/src/main/java/org/codehaus/mojo/antlr/AbstractAntlrMojo.java 2023-10-26 14:01:46.596367163 +0200
@@ -348,6 +348,10 @@
+ "Antlr's call to System.exit() can cause application shutdown "
+ "if not handled by the current SecurityManager." );
}
+ catch ( UnsupportedOperationException exc )
+ {
+ getLog().warn( exc );
+ }
String originalUserDir = null;
if ( plan.getImportVocabTokenTypesDirectory() != null )

View File

@ -0,0 +1,33 @@
--- src/main/java/org/codehaus/mojo/antlr/AntlrHtmlReport.java.sink 2010-11-16 16:59:34.000000000 +0000
+++ src/main/java/org/codehaus/mojo/antlr/AntlrHtmlReport.java 2015-06-17 10:54:56.729105945 +0100
@@ -27,6 +27,7 @@
import org.apache.maven.doxia.siterenderer.Renderer;
import org.apache.maven.doxia.siterenderer.RendererException;
+import org.apache.maven.doxia.siterenderer.DocumentRenderingContext;
import org.apache.maven.doxia.siterenderer.sink.SiteRendererSink;
import org.apache.maven.plugin.MojoExecutionException;
import org.apache.maven.plugin.MojoFailureException;
@@ -217,20 +218,11 @@
{
try
{
- SiteRendererSink sink = siteRenderer.createSink( getReportOutputDirectory(), getOutputName() + ".html" );
+ DocumentRenderingContext context = new DocumentRenderingContext( getReportOutputDirectory(), getOutputName() + ".html", null );
+ SiteRendererSink sink = new SiteRendererSink( context );
generate( sink, Locale.getDefault() );
}
- catch ( RendererException e )
- {
- throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH )
- + " report generation.", e );
- }
- catch ( IOException e )
- {
- throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH )
- + " report generation.", e );
- }
catch ( MavenReportException e )
{
throw new MojoExecutionException( "An error has occurred in " + getName( Locale.ENGLISH )

View File

@ -0,0 +1,12 @@
diff -up antlr-maven-plugin/pom.xml.BAD antlr-maven-plugin/pom.xml
--- antlr-maven-plugin/pom.xml.BAD 2011-03-07 13:18:45.219217017 -0500
+++ antlr-maven-plugin/pom.xml 2011-03-07 13:18:57.498217062 -0500
@@ -132,7 +132,7 @@
</executions>
<configuration>
<version>1.0.0</version>
- <model>src/main/mdo/antlrOptions.mdo</model>
+ <models><model>src/main/mdo/antlrOptions.mdo</model></models>
</configuration>
</plugin>
</plugins>

20
new-reporting-api.patch Normal file
View File

@ -0,0 +1,20 @@
--- antlr-maven-plugin-2.2/src/main/java/org/codehaus/mojo/antlr/AntlrHtmlReport.java 2024-10-02 11:40:33.269689821 +0200
+++ antlr-maven-plugin-2.2/src/main/java/org/codehaus/mojo/antlr/AntlrHtmlReport.java 2024-10-02 11:42:56.144065975 +0200
@@ -34,7 +34,7 @@
import org.apache.maven.reporting.MavenReport;
import org.apache.maven.reporting.MavenReportException;
import org.apache.maven.wagon.PathUtils;
-import org.codehaus.doxia.sink.Sink;
+import org.apache.maven.doxia.sink.Sink;
import org.codehaus.plexus.i18n.I18N;
import org.codehaus.plexus.util.FileUtils;
import org.codehaus.plexus.util.StringUtils;
@@ -129,7 +129,7 @@
}
/**
- * @see org.apache.maven.reporting.MavenReport#generate(org.codehaus.doxia.sink.Sink, java.util.Locale)
+ * @see org.apache.maven.reporting.MavenReport#generate(org.apache.maven.doxia.sink.Sink, java.util.Locale)
*/
public void generate( Sink sink, Locale locale )
throws MavenReportException