Co-authored-by: Henry Li <lihl@microsoft.com>
This commit is contained in:
Henry Li 2024-02-22 14:20:24 -08:00 коммит произвёл GitHub
Родитель e5a638a355
Коммит dbf21ffb8f
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: B5690EEEBB952194
6 изменённых файлов: 191 добавлений и 52 удалений

Просмотреть файл

@ -0,0 +1,31 @@
diff --git a/./src/grammar/lexer.flex b/../qdox-2.0.3/src/grammar/lexer.flex
index f81cd88..99ce34e 100644
--- a/./src/grammar/lexer.flex
+++ b/../qdox-2.0.3/src/grammar/lexer.flex
@@ -168,12 +168,8 @@ import java.util.*;
this.writer = writer;
}
- public JFlexLexer( java.io.InputStream stream ) {
- this( new InputStreamReader(stream) );
- }
-
public JFlexLexer( java.io.InputStream stream, java.io.Writer writer ) {
- this( stream );
+ this( new java.io.InputStreamReader( stream, java.nio.charset.Charset.forName( "UTF-8" ) ) );
this.writer = writer;
}
diff --git a/./src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java b/../qdox-2.0.3/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
index c947f9b..5b415c0 100644
--- a/./src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
+++ b/../qdox-2.0.3/src/main/java/com/thoughtworks/qdox/library/ClassLoaderLibrary.java
@@ -112,7 +112,7 @@ public class ClassLoaderLibrary
if ( sourceStream != null )
{
Builder builder = getModelBuilder();
- JavaLexer lexer = new JFlexLexer( sourceStream );
+ JavaLexer lexer = new JFlexLexer( new java.io.InputStreamReader( sourceStream, java.nio.charset.Charset.forName( "UTF-8" ) ) );
Parser parser = new Parser( lexer, builder );
parser.setDebugLexer( debugLexer );
parser.setDebugParser( debugParser );

Просмотреть файл

@ -1,19 +0,0 @@
Manifest-Version: 1.0
Bundle-Vendor: %providerName
Bundle-Localization: plugin
Bundle-RequiredExecutionEnvironment: J2SE-1.4
Bundle-Name: %pluginName
Bundle-SymbolicName: com.thoughtworks.qdox
Bundle-Version: 1.6.3.v20081201-1400
Export-Package: com.thoughtworks.qdox;version="1.6.3",com.thoughtworks
.qdox.ant;version="1.6.3",com.thoughtworks.qdox.directorywalker;versi
on="1.6.3",com.thoughtworks.qdox.junit;version="1.6.3",com.thoughtwor
ks.qdox.model;version="1.6.3",com.thoughtworks.qdox.model.util;versio
n="1.6.3",com.thoughtworks.qdox.parser;version="1.6.3",com.thoughtwor
ks.qdox.parser.impl;version="1.6.3",com.thoughtworks.qdox.parser.stru
cts;version="1.6.3",com.thoughtworks.qdox.tools;version="1.6.3"
Bundle-ManifestVersion: 2
Import-Package: junit.framework;version="[3.8.2,4.0.0)";resolution:=op
tional,org.apache.tools.ant;version="[1.7.0,2.0.0)";resolution:=optio
nal,org.apache.tools.ant.types;version="[1.7.0,2.0.0)";resolution:=op
tional

112
SPECS/qdox/qdox-build.xml Normal file
Просмотреть файл

@ -0,0 +1,112 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="qdox" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.artifactId" value="qdox"/>
<property name="project.version" value="2.0.3"/>
<property name="build.finalName" value="${project.artifactId}-${project.version}"/>
<property name="build.dir" value="target"/>
<property name="build.outputDir" value="${build.dir}/classes"/>
<property name="build.srcDir" value="src/main/java"/>
<property name="build.resourceDir" value="src/main/resources"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<property name="compiler.source" value="1.7"/>
<property name="compiler.target" value="${compiler.source}"/>
<!-- ====================================================================== -->
<!-- Cleaning up target -->
<!-- ====================================================================== -->
<target name="clean" description="Clean the output directory">
<delete dir="${build.dir}"/>
</target>
<!-- ====================================================================== -->
<!-- Compilation target -->
<!-- ====================================================================== -->
<target name="compile" description="Compile the code">
<mkdir dir="${build.outputDir}"/>
<javac destdir="${build.outputDir}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
additionalparam="-Xdoclint:none"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
source="${compiler.source}"
verbose="false"
version="true"
use="true"
author="true"
splitindex="false"
nodeprecated="false"
nodeprecatedlist="false"
notree="false"
noindex="false"
nohelp="false"
nonavbar="false"
serialwarn="false"
charset="ISO-8859-1"
linksource="false"
breakiterator="false"/>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Automatic-Module-Name" value="com.thoughtworks.qdox"/>
<attribute name="Bundle-Localization" value="plugin"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="%pluginName"/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-${compiler.target}"/>
<attribute name="Bundle-SymbolicName" value="com.thoughtworks.qdox"/>
<attribute name="Bundle-Vendor" value="%providerName"/>
<attribute name="Bundle-Version" value="${project.version}"/>
<attribute name="Export-Package" value="com.thoughtworks.qdox.ant;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.directorywalker;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.junit;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.model.util;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.model;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.parser.impl;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.parser.structs;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.parser;version=&quot;${project.version}&quot;,com.thoughtworks.qdox.tools;version=&quot;${project.version}&quot;,com.thoughtworks.qdox;version=&quot;${project.version}&quot;"/>
<attribute name="Import-Package" value="junit.framework;version=&quot;[3.8.2,4.0.0)&quot;;resolution:=optional,org.apache.tools.ant.types;version=&quot;[1.7.0,2.0.0)&quot;;resolution:=optional,org.apache.tools.ant;version=&quot;[1.7.0,2.0.0)&quot;;resolution:=optional"/>
</manifest>
</jar>
</target>
<!-- ====================================================================== -->
<!-- A dummy target for the package named after the type it creates -->
<!-- ====================================================================== -->
<target name="jar" depends="package" description="Builds the jar for the application"/>
</project>

Просмотреть файл

@ -1,6 +1,6 @@
{
"Signatures": {
"qdox-2.0.0.tar.gz": "6b8711d2a597bc531577a4770325c349fde726d285a52b7e62f614f30c6e9017",
"qdox-MANIFEST.MF": "04dc61c01db9693df9c0f2877a62ae90398870874ea71ee70e5b5c79e1d32548"
"qdox-2.0.3-project.tar.bz2": "74ecec80836707d1132ade7c060d7136f5da387894c5fc8a91bd7805002535c0",
"qdox-build.xml": "cc0778cf8202ca3d41621c271f7ad04e0d5581c047227c087cde9b33d37a17f9"
}
}

Просмотреть файл

@ -17,15 +17,17 @@
Summary: Tool to extract class/interface/method definitions from sources
Name: qdox
Version: 2.0.0
Release: 2%{?dist}
Version: 2.0.3
Release: 1%{?dist}
License: ASL 2.0
Group: Development/Libraries/Java
Vendor: Microsoft Corporation
Distribution: Azure Linux
URL: https://github.com/paul-hammant/qdox
Source0: https://github.com/paul-hammant/qdox/archive/refs/tags/%{name}-%{version}.tar.gz
Source1: qdox-MANIFEST.MF
Source0: https://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/%{version}/%{name}-%{version}-project.tar.bz2
Source1: qdox-build.xml
Patch0: Port-to-JFlex-1.7.0.patch
BuildRequires: ant
BuildRequires: byaccj
BuildRequires: fdupes
BuildRequires: java-cup-bootstrap
@ -39,65 +41,78 @@ QDox is a parser for extracting class/interface/method definitions
from source files complete with JavaDoc @tags. It is designed to be
used by active code generators or documentation tools.
%package javadoc
Summary: Javadoc for %{name}
Group: Development/Libraries/Java
%description javadoc
API docs for %{name}.
%prep
%setup -q -n %{name}-%{name}-%{version}
%autosetup -p1
cp %{SOURCE1} build.xml
find -name *.jar -delete
find -name *.class -delete
rm -rf bootstrap
# We don't need these plugins
%pom_remove_plugin :animal-sniffer-maven-plugin
%pom_remove_plugin :maven-assembly-plugin
%pom_remove_plugin :maven-failsafe-plugin
%pom_remove_plugin :maven-jflex-plugin
%pom_remove_plugin :maven-invoker-plugin
%pom_remove_plugin :jflex-maven-plugin
%pom_remove_plugin :maven-enforcer-plugin
%pom_xpath_set pom:workingDirectory '${basedir}/src/main/java/com/thoughtworks/qdox/parser/impl'
%pom_remove_plugin :exec-maven-plugin
%pom_remove_parent .
%build
# Generate scanners (upstream does this with maven-jflex-plugin)
# Add the --inputstreamctor option if jflex is upgraded to a version 1.6 or higher
CLASSPATH=$(build-classpath java-cup) \
jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/lexer.flex
CLASSPATH=$(build-classpath java-cup) \
jflex -d src/main/java/com/thoughtworks/qdox/parser/impl src/grammar/commentlexer.flex
# Generate the parsers using the command-line that the exec-maven-plugin uses
GRAMMAR_PATH=$(pwd)/src/grammar/commentparser.y && \
(cd src/main/java/com/thoughtworks/qdox/parser/impl && \
byaccj -v -Jnorun -Jnoconstruct -Jclass=DefaultJavaCommentParser \
-Jpackage=com.thoughtworks.qdox.parser.impl ${GRAMMAR_PATH})
GRAMMAR_PATH=$(pwd)/src/grammar/parser.y && \
(cd src/main/java/com/thoughtworks/qdox/parser/impl && \
byaccj -v -Jnorun -Jnoconstruct -Jclass=Parser \
-Jimplements=CommentHandler -Jsemantic=Value \
-Jpackage=com.thoughtworks.qdox.parser.impl \
-Jstack=500 ${GRAMMAR_PATH})
# Generate parsers (upstream does this with exec-maven-plugin)
(cd ./src/main/java/com/thoughtworks/qdox/parser/impl
byaccj -v -Jnorun -Jnoconstruct -Jclass=DefaultJavaCommentParser \
-Jpackage=com.thoughtworks.qdox.parser.impl ../../../../../../../grammar/commentparser.y
byaccj -v -Jnorun -Jnoconstruct -Jclass=Parser -Jimplements=CommentHandler -Jsemantic=Value \
-Jpackage=com.thoughtworks.qdox.parser.impl -Jstack=500 ../../../../../../../grammar/parser.y
)
# Build artifact
mkdir -p build/classes
javac -d build/classes -source 6 -target 6 \
$(find src/main/java -name \*.java)
jar cf build/%{name}-%{version}.jar -C build/classes .
# Inject OSGi manifests
jar ufm build/%{name}-%{version}.jar %{SOURCE1}
%ant jar javadoc
%install
# jar
install -dm 0755 %{buildroot}%{_javadir}
install -pm 0644 build/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
install -pm 0644 target/%{name}-%{version}.jar %{buildroot}%{_javadir}/%{name}.jar
# pom
install -dm 0755 %{buildroot}%{_mavenpomdir}
install -pm 0644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}.pom
%add_maven_depmap %{name}.pom %{name}.jar -a qdox:qdox
# javadoc
mkdir -p %{buildroot}%{_javadocdir}/%{name}
cp -aL target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license LICENSE.txt
%doc README.md
%files javadoc
%{_javadocdir}/%{name}
%license LICENSE.txt
%changelog
* Thu Feb 08 2024 Henry Li <lihl@microsoft.com> - 2.0.3-1
- Upgrade to version 2.0.3
- Update Source0
- Remove unnecessary plugins
- Apply patch to use jflex 1.7.0 and remove duplicate constructor definitions
- Add build xml file to define compilation targets and procedure
- Add qdox-javadoc subpackage
* Mon Mar 28 2022 Cameron Baird <cameronbaird@microsoft.com> - 2.0.0-2
- Move to SPECS

Просмотреть файл

@ -24914,8 +24914,8 @@
"type": "other",
"other": {
"name": "qdox",
"version": "2.0.0",
"downloadUrl": "https://github.com/paul-hammant/qdox/archive/refs/tags/qdox-2.0.0.tar.gz"
"version": "2.0.3",
"downloadUrl": "https://repo1.maven.org/maven2/com/thoughtworks/qdox/qdox/2.0.3/qdox-2.0.3-project.tar.bz2"
}
}
},