File gradle8.spec of Package gradle8
#
# spec file for package gradle8
#
# Copyright (c) 2017 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
# 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 http://bugs.opensuse.org/
#
%define max_javaversion 25
%if 0%{?suse_version} < 1600
%define build_javaversions 1.8.0 11 17
%else
%define build_javaversions %{max_javaversion}
%endif
%define gradlemain 8.14
%define gradlepatch 4
%if %gradlepatch == 0
%define gradlenull
%else
%define gradlenull .%{gradlepatch}
%endif
# RPM 4.20 introduced _libdir expands always to /usr/lib on noarch
%if %suse_version > 1698 && %(if uname -m | grep -q '64$'; then echo 64; else echo 0; fi) == 64
%define libdir_suffix 64
%else
%define libdir_suffix ""
%endif
%define srcname gradle
Name: gradle8
Version: %{gradlemain}%{gradlenull}
Release: 0
Summary: A powerful build system for the JVM
License: Apache-2.0
Group: Development/Libraries/Java
Url: http://www.gradle.org
Source0: %{srcname}-%{version}.tar.gz
# https://services.gradle.org/versions/all
Source1: all-released-versions.json
# generated via --write-verification-metadata pgp,sha256 in gradle-kit
Source2: verification-metadata.xml
Source3: verification-keyring.keys
Source4: %{name}-kit.tar.xz
Source5: https://services.gradle.org/distributions/%{srcname}-%{version}-bin.zip
Source6: https://services.gradle.org/distributions/%{srcname}-%{version}-bin.zip.sha256
Provides: gradle
Conflicts: gradle
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: git
BuildRequires: java-devel = 17
%if 0%{?suse_version} < 1600
BuildRequires: java-devel = 11
BuildRequires: (java-devel = 1.8.0 without java-devel-openj9)
%else
BuildRequires: java-devel = %{max_javaversion}
%endif
BuildRequires: procps
BuildRequires: unzip
BuildArch: noarch
%if 0%{?suse_version} < 1600
Requires: ((java-headless >= 11 and java-headless <= %{max_javaversion}) or java-headless = 1.8.0)
%else
Requires: java-headless = %{max_javaversion}
%endif
%description
Gradle is a build tool with a focus on build automation and support
for multi-language development. If you are building, testing,
publishing, and deploying software on any platform, Gradle offers a
flexible model that can support the entire development lifecycle from
compiling and packaging code to publishing web sites. Gradle has been
designed to support build automation across multiple languages and
platforms including Java, Scala, Android, C/C++, and Groovy, and is
closely integrated with development tools and continuous integration
servers including Eclipse, IntelliJ, and Jenkins.
For more information about Gradle, please visit: http://gradle.org
%prep
%setup -q -n %{srcname}-%{version}
# remove vendor (was not documented patch 0001-drop-setVendor-for-Java.patch).
for i in $(grep -r "vendor =.*ADOPTIUM" | sed "s;: .*;;g"); do sed -i -r "s:(vendor =.*ADOPTIUM$):// openSUSE-disabled -> \1:g" $i; done
# remove unneccessary android-studio (was patch 0002)
sed -i '/<component group="android-studio" name="android-studio".*">/,/<\/component>/d' gradle/verification-metadata.xml
# adapt javaparser to fix build error
sed -i 's:val javaParserVersion.*:val javaParserVersion = "3.25.6":g' build-logic-commons/build-platform/build.gradle.kts
cp %{S:2} gradle
cp %{S:3} gradle
cd ..
rm -rf %{srcname}-bin
rm -rf %{srcname}-src
rm -rf /tmp/gradle*
mv %{srcname}-%{version} %{srcname}-src
tar xf %{S:4} -C /tmp
unzip -qo %{S:5}
mv %{srcname}-%{version} %{srcname}-bin
mv %{srcname}-src %{srcname}-%{version}
%build
# from debian:rules
#mkdir --parents buildSrc/src/main/java
#_JAVA=$(java --version | grep openjdk | sed -r "s:^[^[0-9]*([0-9]*).*:\1:g")
#define JAVA_VER $_JAVA
export BUILD_VCS_NUMBER=%{version}
export M2_HOME=/tmp/m2
export GRADLE_OPTS="-Xmx1024m"
export LANG=en_US.UTF-8
export YARN_CACHE_FOLDER=/tmp/gradle/yarn
mkdir -p ~/.m2
ln -sf /tmp/m2 ~/.m2/repository
mkdir build
cp %{S:1} build
# --stacktrace --info --debug \
JAVA_HOMES=""
for ver in %{build_javaversions}; do
JAVA_HOMES=${JAVA_HOMES},%{_libdir}%{libdir_suffix}/jvm/java-${ver}-openjdk-${ver}
done
JAVA_HOMES=$(echo ${JAVA_HOMES} | sed "s:^,::g") \
../%{srcname}-bin/bin/gradle \
--gradle-user-home /tmp/gradle-user \
-Dfile.encoding=UTF-8 \
--project-prop finalRelease=true \
--project-prop org.gradle.java.installations.fromEnv=${JAVA_HOMES} \
--no-daemon \
--dependency-verification off \
--offline \
:distributions-full:binDistributionZip
%install
mkdir -p %{buildroot}%{_datadir}
unzip -d %{buildroot}%{_datadir} ./packaging/distributions-full/build/distributions/gradle-%{version}-bin.zip
(cd %{buildroot}%{_datadir}; mv %{srcname}-%{version} %{srcname})
chmod 644 %{buildroot}%{_datadir}/%{srcname}/lib/*.jar
chmod 644 %{buildroot}%{_datadir}/%{srcname}/lib/plugins/*.jar
mkdir %{buildroot}%{_bindir}
ln -s %{_datadir}/%{srcname}/bin/gradle %{buildroot}%{_bindir}
rm -f %{buildroot}%{_datadir}/%{srcname}/bin/gradle.bat
%files
%defattr(-,root,root)
%dir %{_datadir}/%{srcname}
%{_datadir}/%{srcname}
%{_bindir}/*
%changelog