File gradle.spec of Package gradle4

#
# 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/
#


Name:           gradle4
Version:        4.10.3
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
# Disable tests which demand gradle cache in user's home
Patch1:         0001-Search-system-jar.patch
Patch2:         0002-Fix-checkstyle-error.patch
Patch3:         0003-make-groovy-dependency-explicit-in-performance-compi.patch
Patch4:         0004-use-local-maven-repo.patch
Patch5:         0005-Fix-to-avoid-incompatibility-if-compile-with-jdk9.patch

BuildRoot:      %{_tmppath}/%{name}-%{version}-build
Provides:       gradle4 = %{version}
Conflicts:      gradle
BuildRequires:  gradle4-kit == %{version}
BuildRequires:  java-devel == 10
BuildRequires:  git-core
BuildRequires:  procps
BuildRequires:  unzip
BuildArch:      noarch
Requires:       java-headless
#Requires:       libnative-platform0

%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 gradle-%{version}
%patch1 -p1
%patch2 -p1
%patch3 -p1
%patch4 -p1
%patch5 -p1

cd ..
if [ -d %{_datadir}/tetra/gradle ]; then
  rm -rf /tmp/gradle* /tmp/apache*
  cp -Rf %{_datadir}/tetra/gradle* /tmp
  cp -Rf %{_datadir}/tetra/apache* /tmp
else
  cp -Rf %{_datadir}/tetra kit
fi

unzip -o %{_datadir}/tetra/gradle-%{version}-bin.zip

%build

# from debian:rules
#mkdir --parents buildSrc/src/main/java

export GRADLE_USER_HOME=/tmp/gradle
export BUILD_VCS_NUMBER=%{version}
export M2_HOME=`pwd`/../kit/m2
export GRADLE_OPTS="-Xmx1024m"
export LANG=en_US.UTF-8
rm -rf $GRADLE_USER_HOME/caches/*
rm -rf /tmp/gradle-project/*
mkdir -p ~/.m2
ln -snf /home/abuild/rpmbuild/BUILD/kit/m2 ~/.m2/repository
mkdir build
cp %{S:1} build
../gradle-%{version}/bin/gradle \
  --gradle-user-home $GRADLE_USER_HOME \
  --project-cache-dir /tmp/gradle-project \
  -Dfile.encoding=UTF-8 \
  -x :docs:javadocAll \
  -x :docs:userguideSinglePage \
  --project-prop finalRelease=true \
  --offline \
  --no-daemon \
  --no-parallel \
  assemble

%install
export GRADLE_USER_HOME=/tmp/gradle
export BUILD_VCS_NUMBER=%{version}
export NO_BRP_CHECK_BYTECODE_VERSION=true
export M2_HOME=`pwd`/../kit/m2
export GRADLE_OPTS="-Xmx1024m"
export LANG=en_US.UTF-8

../gradle-%{version}/bin/gradle \
  --gradle-user-home $GRADLE_USER_HOME \
  --project-cache-dir /tmp/gradle-project \
  -Dfile.encoding=UTF-8 \
  -x :docs:javadocAll \
  -x :docs:userguideSinglePage \
  --project-prop finalRelease=true \
  --offline \
  --no-daemon \
  --no-parallel \
  --project-prop gradle_installPath=%{buildroot}%{_datadir}/gradle \
  install

chmod  644 %{buildroot}%{_datadir}/gradle/lib/*.jar
chmod  644 %{buildroot}%{_datadir}/gradle/lib/plugins/*.jar

mkdir %{buildroot}%{_bindir}
ln -s %{_datadir}/gradle/bin/gradle %{buildroot}%{_bindir}
rm -f %{buildroot}%{_datadir}/gradle/bin/gradle.bat

%files
%defattr(-,root,root)
%dir %{_datadir}/gradle
%{_datadir}/gradle
%{_bindir}/*

%changelog
openSUSE Build Service is sponsored by