Return-Path: X-Original-To: apmail-buildr-commits-archive@www.apache.org Delivered-To: apmail-buildr-commits-archive@www.apache.org Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by minotaur.apache.org (Postfix) with SMTP id C902AC0DA for ; Wed, 2 May 2012 04:48:33 +0000 (UTC) Received: (qmail 94795 invoked by uid 500); 2 May 2012 04:48:33 -0000 Delivered-To: apmail-buildr-commits-archive@buildr.apache.org Received: (qmail 94749 invoked by uid 500); 2 May 2012 04:48:32 -0000 Mailing-List: contact commits-help@buildr.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@buildr.apache.org Delivered-To: mailing list commits@buildr.apache.org Received: (qmail 94722 invoked by uid 99); 2 May 2012 04:48:31 -0000 Received: from nike.apache.org (HELO nike.apache.org) (192.87.106.230) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 May 2012 04:48:31 +0000 X-ASF-Spam-Status: No, hits=-2000.0 required=5.0 tests=ALL_TRUSTED X-Spam-Check-By: apache.org Received: from [140.211.11.4] (HELO eris.apache.org) (140.211.11.4) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 02 May 2012 04:48:28 +0000 Received: from eris.apache.org (localhost [127.0.0.1]) by eris.apache.org (Postfix) with ESMTP id 3ECF4238897A for ; Wed, 2 May 2012 04:48:07 +0000 (UTC) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r1332921 - in /buildr/trunk: CHANGELOG addon/buildr/gwt.rake Date: Wed, 02 May 2012 04:48:07 -0000 To: commits@buildr.apache.org From: donaldp@apache.org X-Mailer: svnmailer-1.0.8-patched Message-Id: <20120502044807.3ECF4238897A@eris.apache.org> Author: donaldp Date: Wed May 2 04:48:06 2012 New Revision: 1332921 URL: http://svn.apache.org/viewvc?rev=1332921&view=rev Log: BUILDR-316 Add GWT extension Added: buildr/trunk/addon/buildr/gwt.rake Modified: buildr/trunk/CHANGELOG Modified: buildr/trunk/CHANGELOG URL: http://svn.apache.org/viewvc/buildr/trunk/CHANGELOG?rev=1332921&r1=1332920&r2=1332921&view=diff ============================================================================== --- buildr/trunk/CHANGELOG (original) +++ buildr/trunk/CHANGELOG Wed May 2 04:48:06 2012 @@ -1,4 +1,5 @@ 1.4.7 (Pending) +* Added: BUILDR-316 Add a GWT extension * Change: BUILDR-624 Update rspec version to 2.9.0 (Russell Teabeault) * Change: BUILDR-637 Update rubyzip version to 0.9.8 (Russell Teabeault) * Change: BUILDR-632 Update net-ssh version to 2.3.0 (Russell Teabeault) Added: buildr/trunk/addon/buildr/gwt.rake URL: http://svn.apache.org/viewvc/buildr/trunk/addon/buildr/gwt.rake?rev=1332921&view=auto ============================================================================== --- buildr/trunk/addon/buildr/gwt.rake (added) +++ buildr/trunk/addon/buildr/gwt.rake Wed May 2 04:48:06 2012 @@ -0,0 +1,82 @@ +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed with this +# work for additional information regarding copyright ownership. The ASF +# licenses this file to you under the Apache License, Version 2.0 (the +# "License"); you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, WITHOUT +# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the +# License for the specific language governing permissions and limitations under +# the License. + +module Buildr + module GWT + + class << self + # The specs for requirements + def dependencies + ['com.google.gwt:gwt-dev:jar:2.4.0'] + end + + def gwtc_main(modules, source_artifacts, output_dir, options = {}) + cp = Buildr.artifacts(self.dependencies).each(&:invoke).map(&:to_s) + Buildr.artifacts(source_artifacts).each(&:invoke).map(&:to_s) + style = options[:style] || "OBFUSCATED," # "PRETTY", "DETAILED" + log_level = options[:log_level] # ERROR, WARN, INFO, TRACE, DEBUG, SPAM, or ALL + workers = options[:workers] || 2 + + args = [] + if log_level + args << "-logLevel" + args << log_level + end + args << "-strict" + args << "-style" + args << style + args << "-localWorkers" + args << workers + args << "-war" + args << output_dir + if options[:compile_report_dir] + args << "-compileReport" + args << "-extra" + args << options[:compile_report_dir] + end + + if options[:draft_compile] + args << "-draftCompile" + end + + args += modules + + Java::Commands.java 'com.google.gwt.dev.Compiler', *(args + [{:classpath => cp, :properties => options[:properties], :java_args => options[:java_args]}]) + end + end + + module ProjectExtension + include Extension + + def gwt(module_names, options = {}) + output_key = options[:output_key] || project.id + output_dir = project._(:target, :generated, :gwt, output_key) + artifacts = (project.compile.sources + project.resources.sources).collect do |a| + a.is_a?(String) ? file(a) : a + end + dependencies = artifacts(options[:dependencies]) || project.compile.dependencies + task = file(output_dir) do + Buildr::GWT.gwtc_main(module_names, dependencies + artifacts, output_dir, options.dup) + end + task.enhance(dependencies) + task.enhance([project.compile]) + task + end + end + end +end + +class Buildr::Project + include Buildr::GWT::ProjectExtension +end \ No newline at end of file