%global namedreltag .Final
%global namedversion %{version}%{?namedreltag}
Name:                mvel
Version:             2.5.0
Release:             1
Summary:             MVFLEX Expression Language
License:             ASL 2.0
Url:                 https://github.com/mvel/mvel
Source0:             https://github.com/mvel/mvel/archive/%{name}2-%{namedversion}.tar.gz
Source1:             %{name}-script

BuildRequires:       maven-local mvn(com.thoughtworks.xstream:xstream) mvn(junit:junit)
BuildRequires:       mvn(org.apache.felix:maven-bundle-plugin)
BuildRequires:       mvn(org.apache.maven.plugins:maven-enforcer-plugin)
BuildRequires:       mvn(org.apache.maven.plugins:maven-surefire-report-plugin) mvn(org.ow2.asm:asm)
BuildRequires:       mvn(org.ow2.asm:asm-util) mvn(org.apache.maven.plugins:maven-shade-plugin)
Requires:            javapackages-tools
BuildArch:           noarch

%description
MVEL is a powerful expression language for Java-based applications. It
provides a plethora of features and is suited for everything from the
smallest property binding and extraction, to full blown scripts.

%package javadoc
Summary:             Javadoc for %{name}

%description javadoc
This package contains javadoc for %{name}.

%prep
%setup -q -n %{name}-%{name}2-%{namedversion}
find . -name "*.jar" -delete
find . -name "*.class" -delete
rm ASM-LICENSE.txt
rm -rf src/main/java/org/mvel2/asm
sed -i '/Unsafe/d' src/main/java/org/mvel2/util/JITClassLoader.java
%pom_remove_plugin :maven-source-plugin
%pom_xpath_remove "pom:project/pom:build/pom:extensions"
sed -i 's/\r//' LICENSE.txt
native2ascii -encoding UTF8 src/main/java/org/mvel2/sh/ShellSession.java src/main/java/org/mvel2/sh/ShellSession.java
%mvn_file :%{name}2 %{name}

%build
%mvn_build -f

%install
%mvn_install
mkdir -p %{buildroot}%{_bindir}
install -pm 755 %{SOURCE1} %{buildroot}%{_bindir}/%{name}

%files -f .mfiles
%{_bindir}/%{name}
%license LICENSE.txt

%files javadoc -f .mfiles-javadoc
%license LICENSE.txt

%changelog
* Tue Aug 22 2023 wulei <wu_lei@hoperun.com> - 2.5.0-1
- Update to 2.5.0

* Sat Jul 25 2020 leiju <leiju4@huawei.com> - 2.2.8-1
- Package init
