# Generated by go2rpm 1.9.0
%bcond_without check

# https://github.com/bazelbuild/bazelisk
%global goipath         github.com/bazelbuild/bazelisk
Version:                1.19.0

%gometa -f

%global common_description %{expand:
Bazelisk is a wrapper for Bazel written in Go. It automatically picks a good 
version of Bazel given your current working directory, downloads it from the 
official server (if required) and then transparently passes through all 
command-line arguments to the real Bazel binary. You can call it just like 
you would call Bazel.}

%global golicenses      LICENSE
%global godocs          CONTRIBUTING.md README.md

Name:           %{goname}
Release:        %autorelease
Summary:        A user-friendly launcher for Bazel

License:        Apache-2.0
URL:            %{gourl}
Source:         %{gosource}

%description %{common_description}

%gopkg

%prep
%goprep
%autopatch -p1

%generate_buildrequires
%go_generate_buildrequires

%build
%gobuild -o %{gobuilddir}/bin/bazelisk %{goipath}

%install
%gopkginstall
install -m 0755 -vd                     %{buildroot}%{_bindir}
install -m 0755 -vp %{gobuilddir}/bin/* %{buildroot}%{_bindir}/

%if %{with check}
%check

# httputil tests are intermittent (https://github.com/bazelbuild/bazelisk/issues/496)
%ifarch x86_64 arm64
%gocheck -d httputil
%else
# Upstream only support x86 and arm64, as that's all Bazel is built for
# Bazelisk actually works fine on any Golang-supported arch, but the tests don't understand this
%gocheck -d core -d httputil
%endif
%endif

%files
%license LICENSE
%doc CONTRIBUTING.md README.md
%{_bindir}/*

%gopkgfiles

%changelog
%autochangelog