From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 76689 invoked by alias); 3 Jun 2015 03:59:45 -0000 Mailing-List: contact kawa-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: kawa-owner@sourceware.org Received: (qmail 63929 invoked by uid 89); 3 Jun 2015 03:59:41 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-0.2 required=5.0 tests=AWL,BAYES_50,KAM_LAZY_DOMAIN_SECURITY,T_RP_MATCHES_RCVD autolearn=no version=3.3.2 X-HELO: mail.theptrgroup.com Received: from mail.theptrgroup.com (HELO mail.theptrgroup.com) (71.178.251.9) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 03 Jun 2015 03:59:40 +0000 Received: from [10.11.21.42] (unknown [10.11.21.42]) by mail.theptrgroup.com (Postfix) with ESMTPS id 72218E08FC for ; Tue, 2 Jun 2015 23:59:39 -0400 (EDT) From: Jamison Hope Content-Type: multipart/mixed; boundary="Apple-Mail=_AE00AFDC-1D70-446C-8D75-7320BD1BAFD2" Subject: [patch] Kawac ant task FileNameMapper name mangling Message-Id: <56965E20-944B-426B-88F1-530AE407C122@theptrgroup.com> Date: Wed, 03 Jun 2015 03:59:00 -0000 To: "kawa@sourceware.org list" Mime-Version: 1.0 (Mac OS X Mail 6.6 \(1510\)) X-IsSubscribed: yes X-SW-Source: 2015-q2/txt/msg00048.txt.bz2 --Apple-Mail=_AE00AFDC-1D70-446C-8D75-7320BD1BAFD2 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=us-ascii Content-length: 429 The attached patch fixes the expected class file name for source files with hyphenated names by mangling "-" to "$Mn". Previously, the simple glob mapped *.scm to *.class, which meant that for string-cursors.scm it was looking for "string-cursors.class", not finding it, and always concluding that it was out-of-date. (Likewise for case-lambda.scm and process-context.scm.) -- Jamison Hope The PTR Group www.theptrgroup.com --Apple-Mail=_AE00AFDC-1D70-446C-8D75-7320BD1BAFD2 Content-Disposition: attachment; filename=gnu-kawa-ant-Kawac-name-mangling.patch Content-Type: application/octet-stream; name="gnu-kawa-ant-Kawac-name-mangling.patch" Content-Transfer-Encoding: 7bit Content-length: 2475 Index: gnu/kawa/ant/ChangeLog =================================================================== --- gnu/kawa/ant/ChangeLog (revision 8487) +++ gnu/kawa/ant/ChangeLog (working copy) @@ -1,3 +1,9 @@ +2015-06-02 Jamison Hope + + * Kawac.java (getMapper): Add file name mangling step to replace + "-" with "$Mn", so that Kawac looks for the right class files for + hyphenated source file names. + 2014-01-05 Per Bothner * Makefile.am: Merge into ../../../gnu/Makefile.am and remove. Index: gnu/kawa/ant/Kawac.java =================================================================== --- gnu/kawa/ant/Kawac.java (revision 8487) +++ gnu/kawa/ant/Kawac.java (working copy) @@ -37,6 +37,7 @@ import org.apache.tools.ant.types.selectors.SelectSelector; import org.apache.tools.ant.types.selectors.SizeSelector; import org.apache.tools.ant.types.selectors.modifiedselector.ModifiedSelector; +import org.apache.tools.ant.util.ChainedMapper; import org.apache.tools.ant.util.CompositeMapper; import org.apache.tools.ant.util.FileNameMapper; import org.apache.tools.ant.util.GlobPatternMapper; @@ -755,6 +756,30 @@ } } + private static class MangleFileNameMapper implements FileNameMapper { + // A simplified version of Language.mangleNameIfNeeded(). + private String mangleNameIfNeeded(String name) { + if (name == null || !name.contains("-")) return name; + int len = name.length(); + StringBuffer mangled = new StringBuffer(len); + for (int i = 0; i < len; ++i) { + char ch = name.charAt(i); + if (ch == '-') mangled.append("$Mn"); + else mangled.append(ch); + } + return mangled.toString(); + } + + public String[] mapFileName(String sourceFileName) { + String mangled = mangleNameIfNeeded(sourceFileName); + if (mangled == null) return null; + return new String[] { mangled }; + } + public void setFrom(String from) {} + public void setTo(String to) {} + public static MangleFileNameMapper INSTANCE = new MangleFileNameMapper(); + } + /** * Compares the language property to each of the given strings, and * returns true if there is a match. @@ -805,7 +830,10 @@ GlobPatternMapper m = new GlobPatternMapper(); m.setFrom("*" + ext); m.setTo("*.class"); - return m; + ChainedMapper c = new ChainedMapper(); + c.add(m); + c.add(MangleFileNameMapper.INSTANCE); + return c; } /** --Apple-Mail=_AE00AFDC-1D70-446C-8D75-7320BD1BAFD2--