コード例 #1
0
ファイル: build.py プロジェクト: sric0880/unity-framework
#-*- coding: utf-8
import sys, os, platform, pycsharpmake
__script_path__ = os.path.dirname(os.path.abspath(__file__))
__project_path__ = os.path.dirname(os.path.dirname(__script_path__))
__assets_path__ = os.path.join(__project_path__, 'Assets')
__plugins_path__ = os.path.join(__assets_path__, 'Plugins')

## Fixme
allProtoFiles = {'client/*.proto', 'common/*.proto'}

protoDir = os.path.join(__script_path__, 'protos')
protoFileName = ' '.join({os.path.join(protoDir, x) for x in allProtoFiles})
makeFileName = os.path.join(__script_path__, 'protos_makefile.yml')

windows = platform.system().startswith("Windows")

if windows:
    exe = '%s/bin/protoc.exe --proto_path=%s --csharp_out=src/Protos %s' % (
        __script_path__, protoDir, protoFileName)
else:
    exe = '%s/bin/protoc --proto_path=%s --csharp_out=src/Protos %s' % (
        __script_path__, protoDir, protoFileName)

if os.system(exe) != 0:
    raise Exception('run protoc failed')

makefile = pycsharpmake.Makefile()
makefile.make(makeFileName, __plugins_path__, __script_path__)
コード例 #2
0
ファイル: configgen.py プロジェクト: sric0880/unity-framework
					luafilename = filename.replace('.xlsx', '.lua')
					srcluapathname = pathname.replace('.xlsx', '.lua')
					desluapathname = os.path.join(luaExportDir, luafilename)
					destdir = os.path.dirname(desluapathname)
					if not os.path.exists(destdir):
						os.mkdir(destdir)
					shutil.move(srcluapathname, desluapathname)
				else:
					print('convert %s to json file' % filename)
					convertXlsx2Json(pathname)

def removeJsonFiles():
	for parent, dirs, files in os.walk(xlsxConfigFolder):
		if 'server' in parent: continue
		for filename in files:
			pathname = os.path.join(parent, filename)
			if os.path.isfile(pathname) and pathname.endswith('.json'):
				os.remove(pathname)

if __name__ == "__main__":
	# 编译codegen
	printStep('convert excel to json or lua')
	__convertXlsx2JsonOrLua();

	printStep('config gen')
	makefile = pycsharpmake.Makefile(os.path.join(__script_path__, 'bin/configgen.exe'))
	makefile.run(xlsxConfigFolder, binaryConfigFolder, debug=True)

	printStep('remove json files')
	removeJsonFiles()