예제 #1
0
파일: circular.py 프로젝트: biern/check.js
    # Loader
    loader = DirLoader()

    # Arguments
    files_data = loader.load("test_inputs/circular/", parser, [GlobalsAnalyzer()])

    if loader.errors:
        print("Loader Errors:")
        for e in loader.errors:
            print(e)

        print("")

    # Creating dependency list
    deps, missing = utils.to_dep_dict(files_data, ["globals"])
    print("Undefined Dependencies:")
    for m in sorted(missing):
        print(m)
    print("")

    # Merging
    m = Merger()

    print("Circular dependencies?")
    circular = m.check_circular(deps)
    for c in circular:
        print(c)

    if circular:
        exit()
예제 #2
0
파일: merge.py 프로젝트: biern/check.js
        files_data = pickle.load(open(cache))
        print("Using Cache")
    except IOError:
        files_data = loader.load(files, parser, [GlobalsAnalyzer()])

        if loader.errors:
            print("Loader Errors:")
            for e in loader.errors:
                print(e)

            print('')

        pickle.dump(files_data, open(cache, 'w'))

    # Creating dependency list
    deps, missing = utils.to_dep_dict(files_data, ['ext', 'globals'], 'Ext.')
    print('Undefined Dependencies:')
    for m in sorted(missing):
        print(m)
    print('')

    # Merging
    m = Merger()
    print('Merge order:')
    for i, files in enumerate(m.make_dep_list(deps)):
        print('{0}: {1}'.format(i, ', '.join(files)))

    print('')

    print('Merging Files')
    m.merge(deps, open('merged.js', 'w'), loader)