File gradle.spec of Package gradle
#
# spec file for package gradle
#
# 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 javaversion 17
Name: gradle
Version: 8.12.0
%define binversion 8.12
Release: 0
Summary: A powerful build system for the JVM
License: Apache-2.0
Group: Development/Libraries/Java
Url: http://www.gradle.org
Source0: %{name}-%{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
Source5: https://services.gradle.org/distributions/gradle-%{binversion}-bin.zip
Source6: https://services.gradle.org/distributions/gradle-%{binversion}-bin.zip.sha256
Patch1: 0001-drop-setVendor-for-Java.patch
Patch2: 0002-drop-android-studio.patch
Provides: gradle8
Conflicts: gradle7
BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: git
BuildRequires: java-devel = %{javaversion}
BuildRequires: java-devel = 11
BuildRequires: (java-devel = 1.8.0 without java-devel-openj9)
BuildRequires: procps
BuildRequires: unzip
BuildArch: noarch
Requires: java-headless = %{javaversion}
Requires: java-headless = 11
Requires: java-headless = 1.8.0
%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 %{name}-%{version}
%patch -P1 -p1
%patch -P2 -p1
cp %{S:2} gradle
cp %{S:3} gradle
cd ..
rm -rf /tmp/gradle*
tar xf %{S:4} -C /tmp
unzip -qo %{S:5}
%build
# from debian:rules
#mkdir --parents buildSrc/src/main/java
export GRADLE_USER_HOME=/tmp/gradle
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
export JAVA8_HOME=/usr/lib64/jvm/java-1.8.0-openjdk-1.8.0
export JAVA11_HOME=/usr/lib64/jvm/java-11-openjdk-11
export JAVA%{javaversion}_HOME=/usr/lib64/jvm/java-%{javaversion}-openjdk-%{javaversion}
mkdir -p ~/.m2
ln -sf /tmp/m2 ~/.m2/repository
mkdir build
cp %{S:1} build
# --stacktrace --info --debug \
../%{name}-%{binversion}/bin/gradle \
--gradle-user-home $GRADLE_USER_HOME \
-Dfile.encoding=UTF-8 \
--project-prop finalRelease=true \
--project-prop org.gradle.java.installations.auto-detect=false \
--project-prop org.gradle.java.installations.auto-download=false \
--project-prop org.gradle.java.installations.fromEnv=JAVA%{javaversion}_HOME,JAVA11_HOME,JAVA8_HOME \
--no-daemon \
--dependency-verification off \
--offline \
:distributions-full:binDistributionZip
%install
mkdir -p %{buildroot}%{_datadir}
unzip -d %{buildroot}%{_datadir} ./subprojects/distributions-full/build/distributions/gradle-%{binversion}-bin.zip
(cd %{buildroot}%{_datadir}; mv %{name}-%{binversion} %{name})
chmod 644 %{buildroot}%{_datadir}/%{name}/lib/*.jar
chmod 644 %{buildroot}%{_datadir}/%{name}/lib/plugins/*.jar
mkdir %{buildroot}%{_bindir}
ln -s %{_datadir}/%{name}/bin/gradle %{buildroot}%{_bindir}
rm -f %{buildroot}%{_datadir}/%{name}/bin/gradle.bat
%files
%defattr(-,root,root)
%dir %{_datadir}/%{name}
%{_datadir}/%{name}
%{_bindir}/*
%changelog