Пример #1
0
def build(mode='production'):
    print("\n-- [ BUILD STARTED ] --------------------------------------")

    packer = x3dom_packer.packer()

    # building compressed files
    packer.build(prefix_path(FULL_PROFILE, SRC_ROOT), "dist/x3dom-full.js",
                 "jsmin")
    packer.build(prefix_path(CORE_PROFILE, SRC_ROOT), "dist/x3dom.js", "jsmin")

    if mode == 'debug':
        # building plain files (debug)
        packer.build(prefix_path(FULL_PROFILE, SRC_ROOT),
                     "dist/x3dom-full.debug.js", 'none')
        packer.build(prefix_path(CORE_PROFILE, SRC_ROOT),
                     "dist/x3dom.debug.js", 'none')

    # ~~~~ copy copy components extras ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    print("\nBundling components...")
    nodes_dest = os.path.join(DIST_ROOT, 'components')

    if not os.path.exists(nodes_dest):
        os.makedirs(nodes_dest)

    for src in prefix_path(COMPONENTS, SRC_ROOT):
        try:
            print "  Copying file %s to %s" % (src, nodes_dest)
            packer.build([src],
                         os.path.join(nodes_dest, os.path.basename(src)),
                         'jsmin',
                         include_version=False)


#            shutil.copy(src, nodes_dest)
        except:
            print "  Error copying file %s" % src
    # done with components

    # ~~ copy other files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dist_docs = os.path.join(DIST_ROOT, 'docs')
    if not os.path.exists(dist_docs):
        os.makedirs(dist_docs)

    print("\nCopying additional files")
    shutil.copy('README.md', DIST_ROOT)
    shutil.copy('LICENSE', DIST_ROOT)
    shutil.copy('CHANGELOG', DIST_ROOT)
    shutil.copy('AUTHORS', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/x3dom.css', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/flashbackend/bin/x3dom.swf', DIST_ROOT)
    shutil.copy(DOC_ROOT + '/help/dumpNodeTypeTree.html', DIST_ROOT + '/docs')
Пример #2
0
def build(mode='production'):
    prepare()
    print("\n-- [ BUILD STARTED ] --------------------------------------")

    packer = x3dom_packer.packer()
    
    # building compressed files
    packer.build(prefix_path(FULL_PROFILE, SRC_ROOT), "dist/x3dom-full.js", "jsmin", include_version=True)
    packer.build(prefix_path(CORE_PROFILE, SRC_ROOT), "dist/x3dom.js", "jsmin", include_version=True)
        
    if not mode == 'no-debug':
        # building plain files (debug)
        packer.build(prefix_path(FULL_PROFILE, SRC_ROOT), "dist/x3dom-full.debug.js", 'none')
        packer.build(prefix_path(CORE_PROFILE, SRC_ROOT), "dist/x3dom.debug.js", 'none')

    # ~~~~ copy copy components extras ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    print("\nBundling components...")
    nodes_dest = os.path.join(DIST_ROOT, 'components')

    if not os.path.exists(nodes_dest):
        os.makedirs(nodes_dest)
        
    for src in prefix_path(COMPONENTS, SRC_ROOT):
        try:
            print "  Copying file %s to %s" % (src, nodes_dest)
            packer.build([src], os.path.join(nodes_dest, os.path.basename(src)), 'jsmin', include_version=False)
#            shutil.copy(src, nodes_dest)
        except:
            print "  Error copying file %s" % src
    # done with components
    
    # ~~ copy other files ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    dist_docs = os.path.join(DIST_ROOT, 'docs')
    if not os.path.exists(dist_docs):
        os.makedirs(dist_docs)

    print("\nCopying additional files")
    shutil.copy('README.md', DIST_ROOT)
    shutil.copy('LICENSE', DIST_ROOT)
    shutil.copy('CHANGELOG', DIST_ROOT)
    shutil.copy('AUTHORS', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/x3dom.css', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/flashbackend/bin/x3dom.swf', DIST_ROOT)
    shutil.copy(DOC_ROOT + '/help/dumpNodeTypeTree.html', DIST_ROOT + '/docs')
    shutil.copy(SRC_ROOT + '/dash.all.js', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/ammo.js', DIST_ROOT)
    shutil.copy(SRC_ROOT + '/x3domBulletPhysics.js', DIST_ROOT)
Пример #3
0
def stats():
    # TODO: use a python lib to do this
    print("Statistics for X3DOM")
    all_files = ' '.join(prefix_path(FULL_PROFILE, 'src'));
    subprocess.call("wc -l " + all_files, shell=True)
Пример #4
0
def stats():
    # TODO: use a python lib to do this
    print("Statistics for X3DOM")
    all_files = ' '.join(prefix_path(FULL_PROFILE, 'src'))
    subprocess.call("wc -l " + all_files, shell=True)