Blob Blame History Raw
#global _check 1

Summary:    JavaScript minifier and checker
Name:       closure-compiler
%define commit ad29f06d581fb8c54ad031334b82a5c301b6ce0a
%define shorthash %(printf %%.7s %commit)
Version:    20140923
Release:    1%{?dist}
License:    ASL 2.0
URL:        https://developers.google.com/closure/compiler/
Source0:    https://github.com/google/closure-compiler/archive/%{commit}.zip
Source1:    closure-compiler.xml
BuildArch:  noarch

BuildRequires: jpackage-utils
BuildRequires: java-devel
BuildRequires: maven-local
BuildRequires: jarjar
BuildRequires: args4j
BuildRequires: guava >= 15
BuildRequires: android-json-org-java
BuildRequires: jsr-305
BuildRequires: junit
BuildRequires: protobuf-java
BuildRequires: rhino
BuildRequires: nekohtml
BuildRequires: plexus-classworlds
BuildRequires: plexus-component-api
BuildRequires: plexus-utils
BuildRequires: findbugs
%if 0%{?_check}
BuildRequires: mockito
%endif
BuildRequires: libxslt
BuildRequires: docbook-style-xsl

Requires:      jpackage-utils
Requires:      java-headless
Requires:      args4j
Requires:      guava
Requires:      android-json-org-java
Requires:      jsr-305
Requires:      protobuf-java
Requires:      rhino

%description
The Closure Compiler is a tool for making JavaScript download and run
faster. It is a true compiler for JavaScript. Instead of compiling
from a source language to machine code, it compiles from JavaScript to
better JavaScript. It parses your JavaScript, analyzes it, removes
dead code and rewrites and minimizes what’s left. It also checks
syntax, variable references, and types, and warns about common
JavaScript pitfalls.

%package javadoc
Summary:        API documentation for %{name}

%description javadoc
This package contains the %{summary}.

%prep
%setup -q -n %{name}-%{commit}
rm -rf lib/*
build-jar-repository -s -p lib/ \
    jarjar \
    args4j \
    android-json-org-java \
    jsr-305 \
    junit \
    protobuf \
    js \
    findbugs \
%if 0%{?_check}
    mockito \
%endif
    guava
ln -s android-json-org-java.jar lib/json.jar
%if 0%{?_check} == 0
%pom_remove_dep :mockito-core pom-main.xml
rm test/com/google/javascript/jscomp/fuzzing/FuzzerTest.java
%endif

%build
%mvn_build -- \
%if 0%{?_check} == 0
    -DskipTests
%endif

xsltproc \
        --nonet \
        --stringparam man.output.quietly 1 \
        --stringparam funcsynopsis.style ansi \
        --stringparam man.authors.section.enabled 0 \
        --stringparam man.copyright.section.enabled 0 \
        http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl %{SOURCE1}

%install
%mvn_install
%jpackage_script com.google.javascript.jscomp.CommandLineRunner "" "" jarjar:args4j:android-json-org-java:jsr-305:junit:protobuf:js:guava:%{name} %{name} true

mkdir -p $RPM_BUILD_ROOT%{_mandir}/man1
cp %{name}.1 $RPM_BUILD_ROOT%{_mandir}/man1

%files -f .mfiles
%{_bindir}/%{name}
%{_mandir}/man1/%{name}.*

%doc COPYING

%files javadoc -f .mfiles-javadoc
%doc CONTRIBUTORS COPYING README.md

%changelog
* Wed Oct 01 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20140923-1
- Update to the latest release.

* Fri Jun 13 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20140613.gite5cfc63-1
- Convert to maven build and update to latest version from git (#1106062).

* Sat Jun 07 2014 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 20140110-3
- Rebuilt for https://fedoraproject.org/wiki/Fedora_21_Mass_Rebuild

* Wed Feb 05 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20140110-2
- Use java-headless (#1068009).

* Wed Feb 05 2014 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20140110-1
- Fix requires.
- Convert manpage to docbook.
- Add disabled %%check.
- Update license.
- Update to newest upstream version.

* Tue Oct 29 2013 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20131118-1
- Update to latest upstream release.
- Remove bundled tools/maven-ant-tasks in %%prep and add dependencies
  on replacement packages.
- Replace json with android-json-org-java completely.

* Tue Oct 29 2013 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20131014-2
- Replace json with android-json-org-java.
- Put requires java libraries in Requires.
- Add main-class manifests to the jar.

* Mon Oct 28 2013 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 20131014-1
- Initial packaging.