File scalacheck.spec of Package scalacheck

#
# spec file for package scalacheck
#
# Copyright (c) 2023 SUSE LLC
#
# 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 https://bugs.opensuse.org/
#


# Scala build version
%global scala_version 2.13
Name:           scalacheck
Version:        1.17.0
Release:        0
Summary:        Property-based testing for Scala
License:        BSD-3-Clause
URL:            https://scalacheck.org/
Source0:        https://github.com/typelevel/scalacheck/archive/v%{version}/%{name}-%{version}.tar.gz
# We don't generate a POM from the ant build
Source1:        https://repo1.maven.org/maven2/org/scalacheck/%{name}_%{scala_version}/%{version}/%{name}_%{scala_version}-%{version}.pom
Source2:        %{name}.mf
Source3:        Generate.java
BuildRequires:  maven-local
BuildRequires:  mvn(org.apache.commons:commons-lang3)
BuildRequires:  mvn(org.scala-lang:scala-compiler)
BuildRequires:  mvn(org.scala-sbt:test-interface)
BuildArch:      noarch

%description
ScalaCheck is a library written in Scala and used for automated
property-based testing of Scala or Java programs.  ScalaCheck was
originally inspired by the Haskell library QuickCheck, but has also
ventured into its own.

ScalaCheck has no external dependencies other than the Scala runtime,
and works great with sbt, the Scala build tool.  It is also fully
integrated in the test frameworks ScalaTest, specs2, and LambdaTest.
You can of course also use ScalaCheck completely standalone, with its
built-in test runner.

%prep
%autosetup

%{mvn_file} org.%{name}:%{name}_%{scala_version} %{name}

%build
# Generate files
GENDIR=$PWD/core/shared/src/main/scala/org/scalacheck
cd project
cp -p %{SOURCE3} .
CLASSPATH=.:$(build-classpath scala/scala-library)
scalac -nobootcp -g:vars -release 8 codegen.scala
javac -cp $CLASSPATH -source 8 -target 8 Generate.java
java -cp $CLASSPATH Generate $GENDIR
cd -

# Build the jar
mkdir target
files="project/codegen.scala $(find core/shared/src/main/scala -name \*.scala)"
files="$files $(find core/shared/src/main/scala-2.13+ -name \*.scala)"
files="$files $(find core/jvm/src/main -name \*.scala)"
scalac -nobootcp -g:vars -release 8 -classpath $(build-classpath test-interface) \
  -d target $files
cd target
sed 's/@VERSION@/%{version}/g' %{SOURCE2} > %{name}.mf
jar -c -m %{name}.mf -f %{name}.jar org
cd -
%{mvn_artifact} %{SOURCE1} target/%{name}.jar

%install
%mvn_install

%files -f .mfiles
%doc CHANGELOG.markdown README.markdown doc/UserGuide.md
%license LICENSE

%changelog
openSUSE Build Service is sponsored by