config/rebuild_check.py
author Boris Zbarsky <bzbarsky@mit.edu>
Mon, 12 Feb 2018 15:44:40 -0500
changeset 403504 91d647c847e56cb0db2be19647507cec207b1d08
parent 142757 0e91dc91caf177531722ee33ef74da6ad1d664d2
child 419629 fba6f974041a3d3c22ef95c44f6e4262e8e5c52f
permissions -rw-r--r--
Bug 1436902 part 3. Replace usage of NS_IMPL_ISUPPORTS_INHERITED0 with NS_INLINE_DECL_REFCOUNTING_INHERITED when possible. r=mccr8 The change to RootAccessible.cpp fixes an obvious bug introduced in bug 741707. The visibility changes in gfx/thebes are because NS_DECL_ISUPPORTS has a trailing "public:" that those classes were relying on to have public constructors. MozReview-Commit-ID: IeB8KIJCGhU

# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.

import os
import errno

def mtime(path):
    try:
        return os.stat(path).st_mtime
    except OSError as e:
        if e.errno == errno.ENOENT:
            return -1
        raise

def rebuild_check(args):
    target = args[0]
    deps = args[1:]
    t = mtime(target)
    if t < 0:
        print target
        return

    newer = []
    removed = []
    for dep in deps:
        deptime = mtime(dep)
        if deptime < 0:
            removed.append(dep)
        elif mtime(dep) > t:
            newer.append(dep)

    if newer and removed:
        print 'Rebuilding %s because %s changed and %s was removed' % (target, ', '.join(newer), ', '.join(removed))
    elif newer:
        print 'Rebuilding %s because %s changed' % (target, ', '.join(newer))
    elif removed:
        print 'Rebuilding %s because %s was removed' % (target, ', '.join(removed))
    else:
        print 'Rebuilding %s for an unknown reason' % target

if __name__ == '__main__':
    import sys
    rebuild_check(sys.argv[1:])