Fridrich Strba 2019-02-13 14:47:21 +00:00 committed by Git OBS Bridge
parent dfed21508c
commit cdb0e8c027
2 changed files with 288 additions and 19 deletions

243
snakeyaml-build.xml Normal file
View File

@ -0,0 +1,243 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="snakeyaml" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.name" value="SnakeYAML"/>
<property name="project.description" value="YAML 1.1 parser and emitter for Java"/>
<property name="project.groupId" value="org.yaml"/>
<property name="project.artifactId" value="snakeyaml"/>
<property name="project.version" value="1.17"/>
<property name="bundle.version" value="${project.version}.0"/>
<property name="compiler.source" value="1.6"/>
<property name="compiler.target" value="${compiler.source}"/>
<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="build.testOutputDir" value="${build.dir}/test-classes"/>
<property name="build.testDir" value="src/test/java"/>
<property name="build.testResourceDir" value="src/test/resources"/>
<property name="test.reports" value="${build.dir}/test-reports"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- Defining classpaths -->
<!-- ====================================================================== -->
<path id="build.classpath">
<fileset dir="lib">
<!-- base64coder commons-codec -->
<include name="**/*"/>
</fileset>
</path>
<path id="build.test.classpath">
<!-- base64coder commons-codec junit hamcrest-core velocity
commons-collections commons-lang oro joda-time -->
<fileset dir="lib">
<include name="**/*.jar"/>
</fileset>
</path>
<!-- ====================================================================== -->
<!-- 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}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir}"/>
</src>
<classpath refid="build.classpath"/>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Test-compilation target -->
<!-- ====================================================================== -->
<target name="compile-tests"
depends="compile"
description="Compile the test code"
unless="test.skip">
<mkdir dir="${build.testOutputDir}"/>
<javac destdir="${build.testOutputDir}"
encoding="UTF-8"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.testDir}"/>
</src>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
</classpath>
</javac>
<copy todir="${build.testOutputDir}">
<fileset dir="${build.testResourceDir}"/>
</copy>
</target>
<!-- ====================================================================== -->
<!-- Run all tests -->
<!-- ====================================================================== -->
<target name="test"
depends="compile-tests, junit-missing"
unless="junit.skipped"
description="Run the test cases">
<mkdir dir="${test.reports}"/>
<junit printSummary="yes" haltonerror="true" haltonfailure="true" fork="true" dir=".">
<sysproperty key="basedir" value="."/>
<formatter type="xml"/>
<formatter type="plain" usefile="false"/>
<classpath>
<path refid="build.test.classpath"/>
<pathelement location="${build.outputDir}"/>
<pathelement location="${build.testOutputDir}"/>
</classpath>
<batchtest todir="${test.reports}" unless="test">
<fileset dir="${build.testDir}">
<include name="**/*Test.java"/>
<exclude name="**/StressTest.java"/>
<exclude name="**/ParallelTest.java"/>
<exclude name="**/PyImportTest.java"/>
<exclude name="**/AbstractTest.java"/>
</fileset>
</batchtest>
<batchtest todir="${test.reports}" if="test">
<fileset dir="${build.testDir}">
<include name="**/${test}.java"/>
<exclude name="**/StressTest.java"/>
<exclude name="**/ParallelTest.java"/>
<exclude name="**/PyImportTest.java"/>
<exclude name="**/AbstractTest.java"/>
</fileset>
</batchtest>
</junit>
</target>
<target name="test-junit-present">
<available classname="junit.framework.Test" property="junit.present" classpathref="build.test.classpath"/>
</target>
<target name="test-junit-status"
depends="test-junit-present">
<condition property="junit.missing">
<and>
<isfalse value="${junit.present}"/>
<isfalse value="${test.skip}"/>
</and>
</condition>
<condition property="junit.skipped">
<or>
<isfalse value="${junit.present}"/>
<istrue value="${test.skip}"/>
</or>
</condition>
</target>
<target name="junit-missing"
depends="test-junit-status"
if="junit.missing">
<echo>=================================== WARNING ===================================</echo>
<echo> JUnit is not present in the test classpath or your $ANT_HOME/lib directory. Tests not executed.</echo>
<echo>===============================================================================</echo>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir}"
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">
<classpath refid="build.classpath"/>
</javadoc>
</target>
<!-- ====================================================================== -->
<!-- Package target -->
<!-- ====================================================================== -->
<target name="package" depends="compile,test" description="Package the application">
<jar jarfile="${build.dir}/${build.finalName}.jar"
compress="true"
index="false"
basedir="${build.outputDir}"
excludes="**/package.html">
<manifest>
<attribute name="Bundle-Description" value="${project.description}"/>
<attribute name="Bundle-License" value="http://www.apache.org/licenses/LICENSE-2.0.txt"/>
<attribute name="Bundle-ManifestVersion" value="2"/>
<attribute name="Bundle-Name" value="${project.name}"/>
<attribute name="Bundle-RequiredExecutionEnvironment" value="J2SE-1.5"/>
<attribute name="Bundle-SymbolicName" value="${project.groupId}.${project.artifactId}"/>
<attribute name="Bundle-Version" value="${bundle.version}"/>
<attribute name="Export-Package" value="org.yaml.snakeyaml;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.composer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.constructor;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.emitter;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.error;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.events;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.extensions.compactnotation;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.introspector;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.nodes;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.parser;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.reader;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.representer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.resolver;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.scanner;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.serializer;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.tokens;version=&quot;${project.version}&quot;,org.yaml.snakeyaml.util;version=&quot;${project.version}&quot;"/>
<attribute name="Import-Package" value="biz.source_code.base64Coder;version=&quot;[1.0,2)&quot;,org.apache.commons.codec.net;version=&quot;[1.11,2)&quot;,org.yaml.snakeyaml;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.composer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.constructor;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.emitter;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.error;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.events;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.introspector;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.nodes;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.parser;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.reader;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.representer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.resolver;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.scanner;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.serializer;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.tokens;version=&quot;[${project.version},2)&quot;,org.yaml.snakeyaml.util;version=&quot;[${project.version},2)&quot;"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Require-Capability" value="osgi.ee;filter:=&quot;(&amp;(osgi.ee=JavaSE)(version=${compiler.target}))&quot;"/>
</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>

View File

@ -17,15 +17,16 @@
%global vertag 70abb5efa4c0
%bcond_with spring
%bcond_with tests
Name: snakeyaml
Version: 1.17
Release: 0
Summary: YAML parser and emitter for the Java programming language
License: Apache-2.0
Group: Development/Libraries/Java
URL: https://bitbucket.org/asomov/%{name}/
URL: https://bitbucket.org/asomov/snakeyaml/
Source0: https://bitbucket.org/asomov/snakeyaml/get/v%{version}.tar.bz2#/%{name}-%{version}.tar.bz2
Source1: %{name}-build.xml
# Upstream has forked gdata-java and base64 and refuses [1] to
# consider replacing them by external dependencies. Bundled libraries
# need to be removed and their use replaced by system libraries.
@ -35,15 +36,27 @@ Source0: https://bitbucket.org/asomov/snakeyaml/get/v%{version}.tar.bz2#/
Patch0: 0001-Replace-bundled-base64-implementation.patch
# We don't have gdata-java in Fedora any longer, use commons-codec instead
Patch1: 0002-Replace-bundled-gdata-java-client-classes-with-commo.patch
BuildRequires: ant
BuildRequires: apache-commons-codec
BuildRequires: base64coder
BuildRequires: fdupes
BuildRequires: maven-local
BuildRequires: mvn(biz.source_code:base64coder)
BuildRequires: mvn(commons-codec:commons-codec)
BuildRequires: mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires: mvn(org.apache.maven.plugins:maven-source-plugin)
BuildRequires: javapackages-local
Requires: mvn(biz.source_code:base64coder)
Requires: mvn(commons-codec:commons-codec)
BuildArch: noarch
%if %{with spring}
BuildRequires: mvn(org.springframework:spring-core)
%if %{with tests}
BuildRequires: ant-junit
BuildRequires: apache-commons-collections
BuildRequires: apache-commons-lang
BuildRequires: hamcrest-core
BuildRequires: joda-time
BuildRequires: junit
BuildRequires: oro
BuildRequires: velocity
# Differently sorted collections make fail some tests that rely on a particular order
BuildConflicts: java >= 9
BuildConflicts: java-devel >= 9
BuildConflicts: java-headless >= 9
%endif
%description
@ -65,11 +78,10 @@ This package contains %{summary}.
%prep
%setup -q -n asomov-%{name}-%{vertag}
cp %{SOURCE1} build.xml
%patch0 -p1
%patch1 -p1
%{mvn_file} : %{name}
%pom_remove_plugin :cobertura-maven-plugin
%pom_remove_plugin :maven-changes-plugin
%pom_remove_plugin :maven-license-plugin
@ -84,9 +96,6 @@ rm -f src/test/java/examples/SpringTest.java
# Re-add bundled base64coder
%pom_add_dep biz.source_code:base64coder
# remove bundled stuff
rm -rf target
# fails in rpmbuild only due to different locale
rm src/test/java/org/yaml/snakeyaml/issues/issue67/NonAsciiCharsInClassNameTest.java
# fails after unbundling
@ -95,22 +104,39 @@ rm src/test/java/org/yaml/snakeyaml/issues/issue318/ContextClassLoaderTest.java
# convert CR+LF to LF
sed -i 's/\r//g' LICENSE.txt
%if %{without spring}
%pom_remove_dep org.springframework
rm -r src/test/java/org/yaml/snakeyaml/issues/issue9
%endif
%build
%{mvn_build} -f -- -Dsource=6
mkdir -p lib
build-jar-repository -s lib base64coder commons-codec
%if %{with tests}
build-jar-repository -s lib junit hamcrest/core velocity commons-collections commons-lang oro joda-time
%endif
%{ant} \
%if %{without tests}
-Dtest.skip=true \
%endif
clean package javadoc
%install
%mvn_install
# jar
install -dm 0755 %{buildroot}%{_javadir}
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
# javadoc
install -dm 0755 %{buildroot}%{_javadocdir}/%{name}
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}
%files -f .mfiles
%license LICENSE.txt
%files javadoc -f .mfiles-javadoc
%files javadoc
%license LICENSE.txt
%{_javadocdir}/%{name}
%changelog