Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id F33F4200BBE for ; Fri, 11 Nov 2016 17:20:07 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id F1DA3160AF6; Fri, 11 Nov 2016 16:20:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 44EA9160AEE for ; Fri, 11 Nov 2016 17:20:07 +0100 (CET) Received: (qmail 52167 invoked by uid 500); 11 Nov 2016 16:20:06 -0000 Mailing-List: contact commits-help@flex.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@flex.apache.org Delivered-To: mailing list commits@flex.apache.org Received: (qmail 52159 invoked by uid 99); 11 Nov 2016 16:20:06 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 11 Nov 2016 16:20:06 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 4700AE0362; Fri, 11 Nov 2016 16:20:06 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: joshtynjala@apache.org To: commits@flex.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: git commit: [flex-falcon] [refs/heads/develop] - compiler-jx: fixed issue where MXMLFlexJSPublisher could not find Closure lib if not in classpath and not specified explicitly as compiler option Date: Fri, 11 Nov 2016 16:20:06 +0000 (UTC) archived-at: Fri, 11 Nov 2016 16:20:08 -0000 Repository: flex-falcon Updated Branches: refs/heads/develop 53d64d6be -> 494693b7f compiler-jx: fixed issue where MXMLFlexJSPublisher could not find Closure lib if not in classpath and not specified explicitly as compiler option Project: http://git-wip-us.apache.org/repos/asf/flex-falcon/repo Commit: http://git-wip-us.apache.org/repos/asf/flex-falcon/commit/494693b7 Tree: http://git-wip-us.apache.org/repos/asf/flex-falcon/tree/494693b7 Diff: http://git-wip-us.apache.org/repos/asf/flex-falcon/diff/494693b7 Branch: refs/heads/develop Commit: 494693b7f9a9200858ff13773adb801c4184251e Parents: 53d64d6 Author: Josh Tynjala Authored: Fri Nov 11 08:19:59 2016 -0800 Committer: Josh Tynjala Committed: Fri Nov 11 08:19:59 2016 -0800 ---------------------------------------------------------------------- .../mxml/flexjs/MXMLFlexJSPublisher.java | 36 ++++++++++++++------ 1 file changed, 25 insertions(+), 11 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/flex-falcon/blob/494693b7/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java ---------------------------------------------------------------------- diff --git a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java index d742162..2d979db 100644 --- a/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java +++ b/compiler-jx/src/main/java/org/apache/flex/compiler/internal/codegen/mxml/flexjs/MXMLFlexJSPublisher.java @@ -212,18 +212,13 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher // List of source files we need to pass into the closure compiler. As we have to // read the content in order to dump it to the intermediate, we can just keep it // and eventually use it in case of a release build. - List closureSourceFiles; + List closureSourceFiles = null; // If the closure lib dir is explicitly set, use that directory. If it // is not set, check if its content is available in the classpath. If // it is found in the classpath, use that as closure lib dir. - if (googConfiguration.isClosureLibSet()) { - File closureLibDir = new File(googConfiguration.getClosureLib()); - if(!closureLibDir.exists() || !closureLibDir.isDirectory()) { - throw new RuntimeException("Parameter 'closure-lib' doesn't point to a valid directory."); - } - closureSourceFiles = getDirectoryResources(new File(closureLibDir, "closure")); - } else { + if (!googConfiguration.isClosureLibSet()) + { // Check if the "goog/deps.js" is available in the classpath. File closureLibraryJar = getJarThatContainsClasspathResources("goog/deps.js"); if (closureLibraryJar != null) @@ -236,11 +231,30 @@ public class MXMLFlexJSPublisher extends JSGoogPublisher implements IJSPublisher // Add the closure files from classpath. closureSourceFiles = getClasspathResources(closureLibraryJar, whiteList); - } else { - throw new RuntimeException( - "Parameter 'closure-lib' not specified and closure resources not available in classpath."); } } + if (closureSourceFiles == null) + { + File closureLibDir = new File(googConfiguration.getClosureLib()); + if (!closureLibDir.exists() || !closureLibDir.isDirectory()) + { + //only throw this error if closure-lib is set because it + //wouldn't make sense with the default fallback path + if (googConfiguration.isClosureLibSet()) + { + throw new RuntimeException("Parameter 'closure-lib' doesn't point to a valid directory."); + } + } + else + { + closureSourceFiles = getDirectoryResources(new File(closureLibDir, "closure")); + } + } + if (closureSourceFiles == null || closureSourceFiles.size() == 0) + { + throw new RuntimeException( + "Parameter 'closure-lib' not specified and closure resources not available in classpath."); + } // Dump a copy of the closure lib files to the intermediate directory. Without this // the application will not be able to run. for(SourceFile closureSourceFile : closureSourceFiles) {