1
0
Fridrich Strba 2019-01-27 20:44:14 +00:00 committed by Git OBS Bridge
parent 83c9dddd75
commit 706d7d2d57
2 changed files with 133 additions and 24 deletions

119
beust-jcommander-build.xml Normal file
View File

@ -0,0 +1,119 @@
<?xml version="1.0" encoding="UTF-8"?>
<project name="jcommander-from-maven" default="package" basedir=".">
<!-- ====================================================================== -->
<!-- Build environment properties -->
<!-- ====================================================================== -->
<property file="build.properties"/>
<property name="project.groupId" value="com.beust"/>
<property name="project.artifactId" value="jcommander"/>
<property name="project.name" value="JCommander"/>
<property name="project.version" value="@VERSION@"/>
<property name="project.description" value="A Java framework to parse command line options with annotations."/>
<property name="project.build.sourceEncoding" value="UTF-8"/>
<property name="bundle.version" value="${project.version}.0"/>
<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.0" value="src/main/java"/>
<property name="build.resourceDir.0" value="src/main/resources"/>
<property name="compiler.source" value="1.7"/>
<property name="compiler.target" value="1.7"/>
<property name="reporting.outputDirectory" value="${build.dir}/site"/>
<!-- ====================================================================== -->
<!-- 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="${project.build.sourceEncoding}"
nowarn="false"
debug="true"
optimize="false"
deprecation="true"
target="${compiler.target}"
verbose="false"
fork="false"
source="${compiler.source}">
<src>
<pathelement location="${build.srcDir.0}"/>
</src>
</javac>
</target>
<!-- ====================================================================== -->
<!-- Javadoc target -->
<!-- ====================================================================== -->
<target name="javadoc" description="Generates the Javadoc of the application">
<javadoc sourcepath="${build.srcDir.0}"
packagenames="*"
destdir="${reporting.outputDirectory}/apidocs"
access="protected"
encoding="${project.build.sourceEncoding}"
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"
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="Bundle-Name" value="${project.name}"/>
<attribute name="Bundle-SymbolicName" value="${project.groupId}.${project.artifactId}"/>
<attribute name="Bundle-Description" value="${project.description}"/>
<attribute name="Bundle-Version" value="${bundle.version}"/>
<attribute name="JavaPackages-ArtifactId" value="${project.artifactId}"/>
<attribute name="JavaPackages-GroupId" value="${project.groupId}"/>
<attribute name="JavaPackages-Version" value="${project.version}"/>
<attribute name="Export-Package" value="com.beust.jcommander;uses:=&quot;com.beust.jcommander.converters,com.beust.jcommander.validators&quot;;version=&quot;${bundle.version}&quot;,com.beust.jcommander.converters;uses:=&quot;com.beust.jcommander&quot;;version=&quot;${bundle.version}&quot;,com.beust.jcommander.defaultprovider;uses:=&quot;com.beust.jcommander&quot;;version=&quot;${bundle.version}&quot;,com.beust.jcommander.validators;uses:=&quot;com.beust.jcommander&quot;;version=&quot;${bundle.version}&quot;"/>
<attribute name="Import-Package" value="com.beust.jcommander.validators"/>
<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

@ -1,7 +1,7 @@
#
# spec file for package beust-jcommander
#
# Copyright (c) 2018 SUSE LINUX GmbH, Nuernberg, Germany.
# Copyright (c) 2019 SUSE LINUX GmbH, Nuernberg, Germany.
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
@ -28,9 +28,11 @@ URL: http://jcommander.org/
Source0: %{name}-%{version}.tar.gz
# Adapted from earlier version that still shipped poms. It uses kobalt for building now
Source1: %{name}.pom
Source2: %{name}-build.xml
# Cleaned up bundled jars hose licensing cannot be easily verified
Source2: generate-tarball.sh
Source3: generate-tarball.sh
Patch0: 0001-ParseValues-NullPointerException-patch.patch
BuildRequires: ant
BuildRequires: fdupes
BuildRequires: java-devel >= 1.8
BuildRequires: javapackages-local
@ -57,44 +59,32 @@ This package contains the %{summary}.
chmod -x license.txt
cp -p %{SOURCE1} pom.xml
sed -i 's/@VERSION@/%{version}/g' pom.xml
cp -p %{SOURCE2} build.xml
sed -i 's/@VERSION@/%{version}/g' pom.xml build.xml
%build
mkdir -p build/classes
mkdir -p build/javadoc
javac -d build/classes -source 8 -target 8 $(find src/main/java -name *.java | xargs)
javadoc -d build/javadoc -notimestamp -source 8 $(find src/main/java -name *.java | xargs)
jar cf %{name}-%{version}.jar -C build/classes .
%{ant} jar javadoc
%install
# jars
install -d -m 0755 %{buildroot}%{_javadir}
install -m 644 %{name}-%{version}.jar \
%{buildroot}%{_javadir}/%{name}-%{version}.jar
(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{name}.jar)
(cd %{buildroot}%{_javadir} && ln -s %{name}-%{version}.jar %{short_name}-%{version}.jar)
(cd %{buildroot}%{_javadir} && ln -s %{short_name}-%{version}.jar %{short_name}.jar)
install -m 644 target/%{short_name}-%{version}.jar \
%{buildroot}%{_javadir}/%{name}.jar
# pom
install -d -m 755 %{buildroot}%{_mavenpomdir}
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}-%{version}.pom
%add_maven_depmap %{name}-%{version}.pom %{name}-%{version}.jar
install -pm 644 pom.xml %{buildroot}%{_mavenpomdir}/%{name}.pom
%add_maven_depmap %{name}.pom %{name}.jar
# javadoc
install -dm 755 %{buildroot}%{_javadocdir}/%{name}
cp -pr build/javadoc/* %{buildroot}%{_javadocdir}/%{name}/
cp -pr target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}/
%fdupes -s %{buildroot}%{_javadocdir}/%{name}/
%files
%files -f .mfiles
%license license.txt
%doc notice.md README.markdown
%{_javadir}/*
%{_mavenpomdir}/*
%if %{defined _maven_repository}
%{_mavendepmapfragdir}/%{name}
%else
%{_datadir}/maven-metadata/%{name}.xml*
%endif
%files javadoc
%license license.txt