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 751EA200BD4 for ; Fri, 2 Dec 2016 01:08:59 +0100 (CET) Received: by cust-asf.ponee.io (Postfix) id 73D6E160B10; Fri, 2 Dec 2016 00:08:59 +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 BCEFA160B0B for ; Fri, 2 Dec 2016 01:08:58 +0100 (CET) Received: (qmail 41986 invoked by uid 500); 2 Dec 2016 00:08:58 -0000 Mailing-List: contact commits-help@mynewt.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@mynewt.incubator.apache.org Delivered-To: mailing list commits@mynewt.incubator.apache.org Received: (qmail 41975 invoked by uid 99); 2 Dec 2016 00:08:57 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd2-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 02 Dec 2016 00:08:57 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd2-us-west.apache.org (ASF Mail Server at spamd2-us-west.apache.org) with ESMTP id 821891A9D5B for ; Fri, 2 Dec 2016 00:08:57 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd2-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -6.219 X-Spam-Level: X-Spam-Status: No, score=-6.219 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-2.999] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd2-us-west.apache.org [10.40.0.9]) (amavisd-new, port 10024) with ESMTP id wB1zhRcVBGMF for ; Fri, 2 Dec 2016 00:08:56 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id 93D755F369 for ; Fri, 2 Dec 2016 00:08:55 +0000 (UTC) Received: (qmail 41944 invoked by uid 99); 2 Dec 2016 00:08:54 -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, 02 Dec 2016 00:08:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id A30BDE0A77; Fri, 2 Dec 2016 00:08:54 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: ccollins@apache.org To: commits@mynewt.incubator.apache.org Message-Id: X-Mailer: ASF-Git Admin Mailer Subject: incubator-mynewt-newt git commit: MYNEWT-500 newt - preserve src dir tree in bin dir Date: Fri, 2 Dec 2016 00:08:54 +0000 (UTC) archived-at: Fri, 02 Dec 2016 00:08:59 -0000 Repository: incubator-mynewt-newt Updated Branches: refs/heads/develop ee1764750 -> 46103ff05 MYNEWT-500 newt - preserve src dir tree in bin dir This addresses an ambiguity that occurs when a package contains two source files with the same filename. For example, the arduino repo (until very recently) contained the following two files: hw/mcu/atmel/samd21xx/src/sam0/utils/cmsis/samd21/source/gcc/startup_samd21.c hw/mcu/atmel/samd21xx/src/startup_samd21.c Both of these files are in the same package (hw/mcu/atmel/samd21) and they both have the same filename (startup_samd21c). During a build, newt compiles both, but only links in one object file. The problem is that the bin directory structure does not mirror that of the source tree. Specifically, all of a package's object files get put in the same directory; subtrees are not preserved. Consequently, the second .o file overwrites the first. The fix is to preserve the source directory structure in the bin directory. Project: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/commit/46103ff0 Tree: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/tree/46103ff0 Diff: http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/diff/46103ff0 Branch: refs/heads/develop Commit: 46103ff05fa4c639f64e68fd47ac89a3de3b90e1 Parents: ee17647 Author: Christopher Collins Authored: Thu Dec 1 15:59:33 2016 -0800 Committer: Christopher Collins Committed: Thu Dec 1 15:59:33 2016 -0800 ---------------------------------------------------------------------- newt/toolchain/compiler.go | 14 ++++++++++++-- newt/toolchain/deps.go | 3 +++ 2 files changed, 15 insertions(+), 2 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/46103ff0/newt/toolchain/compiler.go ---------------------------------------------------------------------- diff --git a/newt/toolchain/compiler.go b/newt/toolchain/compiler.go index 627fcc3..e885ef4 100644 --- a/newt/toolchain/compiler.go +++ b/newt/toolchain/compiler.go @@ -711,9 +711,19 @@ func (c *Compiler) processEntry(wd string, node os.FileInfo, cType int, } } - // if not, recurse into the directory + // If not, recurse into the directory. Make the output directory + // structure mirror that of the source tree. + prevDstDir := c.dstDir + c.dstDir += "/" + node.Name() + os.Chdir(wd + "/" + node.Name()) - return c.RecursiveCompile(cType, ignDirs) + err := c.RecursiveCompile(cType, ignDirs) + + // Restore the compiler destination directory now that the child directory + // has been fully built. + c.dstDir = prevDstDir + + return err } func (c *Compiler) RecursiveCompile(cType int, ignDirs []string) error { http://git-wip-us.apache.org/repos/asf/incubator-mynewt-newt/blob/46103ff0/newt/toolchain/deps.go ---------------------------------------------------------------------- diff --git a/newt/toolchain/deps.go b/newt/toolchain/deps.go index a8c7f97..59d958d 100644 --- a/newt/toolchain/deps.go +++ b/newt/toolchain/deps.go @@ -232,6 +232,9 @@ func (tracker *DepTracker) CompileRequired(srcFile string, // the dependency file is out of date, so it needs to be deleted. // We cannot regenerate it now because the source file might be // including a nonexistent header. + util.StatusMessage(util.VERBOSITY_VERBOSE, + "%s - rebuild required; dependency \"%s\" has been deleted\n", + srcFile, dep) os.Remove(depFile) return true, nil } else {