Example #1
0
def main():
	mode = 'default'
	submode = None
	if (len(sys.argv) > 1):
		mode = sys.argv[1]
	if (len(sys.argv) > 2):
		submode = sys.argv[2]

	if mode == 'default':
		print('usage:\n'
			'  eve.py update --- Update or install EiffelStudio; update and compile EVE.\n'
			'  eve.py finalize eve --- Finalize EVE.\n'
			'  eve.py eve --- Launch finalized EVE.\n'
			'  eve.py es --- Launch EiffelStudio.\n')
	elif mode == 'es':
		run_eiffel_studio()
	elif mode == 'eve':
		run_eve()
	elif mode == 'check':
		if not check_environment_variables():
			update_environment_variables()
	elif mode == 'update' and submode == None:
		update_EiffelStudio()
		esvn.update_repository(config.v_url_svn_trunk_src, elocation.trunk_source())
		compile_runtime()
		compile_eve('bench')
	elif mode == 'update' and (submode == 'EiffelStudio' or submode == 'es'):
		update_EiffelStudio()
	elif mode == 'update' and submode == 'source':
		esvn.update_repository(config.v_url_svn_trunk_src, elocation.trunk_source())
	elif mode == 'compile' and submode == 'runtime':
		if not check_environment_variables():
			update_environment_variables()
		ecompile.compile_runtime()
	elif mode == 'compile' and (submode == None or submode == 'eve'):
		if not check_environment_variables():
			update_environment_variables()
		#compile_eve('bench')
		compile_eve ('batch', 'ecb')
	elif mode == 'finalize' and (submode == None or submode == 'eve'):
		if not check_environment_variables():
			update_environment_variables()
		#finalize_eve('bench')
		finalize_eve ('batch', 'ecb')
	elif mode == 'delivery':
		if not check_environment_variables():
			update_environment_variables()
		make_delivery()
	elif mode == 'merge':
		make_merge()
	elif mode == 'eweasel':
		eweasel.main (sys.argv[1:])
	else:
		if submode == None:
			SystemLogger.error("invalid option " + mode)
		else:
			SystemLogger.error("invalid option " + mode + " / " + submode)
	return
Example #2
0
def test_location():
	elocation.move ("eve", "eve2")
	elocation.copy ("eve2", "eve3")
	elocation.delete ("eve3")
	elocation.move ("eve2", "eve")
	print (elocation.base_directory())
	print (elocation.trunk_source())
	print (elocation.eve_source())
	print (elocation.eweasel())
	print (elocation.nightly())
	print (elocation.build())
	print (elocation.eweasel_build())
Example #3
0
def update_environment_variables():
	# ISE_PLATFORM
	if not "ISE_PLATFORM" in os.environ or os.getenv("ISE_PLATFORM") != d_ise_platform:
		set_persistent_environment_variable("ISE_PLATFORM", d_ise_platform)
	# ISE_EIFFEL
	version, path = get_installed_version()
	if "ISE_EIFFEL" in os.environ and path == None:
		SystemLogger.debug ("WARNING: No nightly build available. Using ISE_EIFFEL = " + os.getenv("ISE_EIFFEL"))
	elif not "ISE_EIFFEL" in os.environ or os.getenv("ISE_EIFFEL") != path:
		set_persistent_environment_variable("ISE_EIFFEL", path)
#	else:
#		raise Exception ("Could not set ISE_EIFFEL environment variable.")
	# ISE_C_COMPILER
	if not "ISE_C_COMPILER" in os.environ or os.getenv("ISE_C_COMPILER") != d_ise_c_compiler:
		set_persistent_environment_variable("ISE_C_COMPILER", d_ise_c_compiler)
	# EIFFEL_SRC
	eiffel_source = os.path.realpath(elocation.trunk_source())
	if not "EIFFEL_SRC" in os.environ or os.getenv("EIFFEL_SRC") != eiffel_source:
		set_persistent_environment_variable("EIFFEL_SRC", eiffel_source)
	# EWEASEL
	if not "EWEASEL" in os.environ or os.getenv("EWEASEL") != elocation.eweasel():
		set_persistent_environment_variable("EWEASEL", elocation.eweasel())
	# ISE_LIBRARY
	eiffel_source = os.path.realpath(elocation.trunk_source())
	if not "ISE_LIBRARY" in os.environ or os.getenv("ISE_LIBRARY") != eiffel_source:
		set_persistent_environment_variable("ISE_LIBRARY", eiffel_source)
	# PATH: EiffelStudio
	# TODO: update PATH contents
	# Temporary path update for execution in same session
	os.environ['PATH'] = os.path.join(os.getenv("ISE_EIFFEL"), 'studio', 'spec', os.getenv("ISE_PLATFORM"), 'bin') + os.pathsep + os.environ['PATH']
	
	if platform.system() != "Windows":
            with open (os.path.join (elocation.base_directory(), 'scripts', 'nightly.unix.sh'), 'w') as l_file:
                l_file.write ('export ISE_EIFFEL=')
                l_file.write (path)
                l_file.write ('\n')
	return
Example #4
0
import elocation

# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
# SETUP VARIABLES
# <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

# Base directory where EiffelStudio will be installed
# EiffelStudio will be installed in a subdirectory EiffelStudioXY_zzzzzz
v_dir_eiffelstudio_base = elocation.base_directory() #"."

# Set this to a string of a specific version of EiffelStudio that is already installed (i.e. "12345")
v_force_es_version = None

# Directory where EVE source will be checked out
#v_dir_eve_source = "./eve"
v_dir_eve_source = elocation.trunk_source()

# Directory where generated deliveries will be saved
v_dir_delivery = "./delivery"
v_dir_delivery_remote = r"\\fs.meyer.inf.ethz.ch\web\htdocs\research\eve\builds"
v_remote_base_url = r"http://se.inf.ethz.ch/research/eve/builds"

# Directory where Boogie/Z3 bundle is installed
v_dir_boogie = "./eve/Delivery/studio/tools/boogie"

# Directory where merge will be performed (checkout directory for eve)
v_dir_merge = "./merge_eve"

# URLs
v_url_svn_eve = "https://svn.eiffel.com/eiffelstudio/branches/eth/eve"
#v_url_svn_eve_src = "https://svn.eiffel.com/eiffelstudio/branches/eth/eve/Src"
Example #5
0
def compile_runtime():
	builddir = os.path.join (elocation.build(), "runtime")
	build_libdir = None
	sourcedir = os.path.join (elocation.trunk_source(), "C")
	scriptdir = os.path.join (elocation.base_directory(),  "scripts")
	shell_command = os.path.expandvars (d_shell_command_raw)
	
		# TODO: Incremental compilation.
	
	copy_files (os.path.join (scriptdir, "*lua*"), sourcedir)
	elocation.delete (os.path.join (sourcedir, "config.sh"))
	
	config_sh = os.environ ["ISE_PLATFORM"]
	old_path = os.environ ["PATH"]
	
	if config_sh == 'win64':
		os.environ ["PATH"] = os.path.dirname (shell_command) + ':' + old_path
		config_sh = 'windows-x86-64-' + os.environ ['ISE_C_COMPILER']
	if config_sh == 'win32':
		os.environ ["PATH"] = dirname (shell_command) + ':' + old_path
		config_sh = 'windows-x86-' + os.environ ['ISE_C_COMPILER']
	
	elocation.copy (os.path.expandvars (os.path.join (sourcedir, "CONFIGS", config_sh)), os.path.join (sourcedir, "config.sh"))
	run_command ([shell_command, "config_lua.SH"], sourcedir)
	run_command ([shell_command, "eif_config_h.SH"], sourcedir)
	run_command ([shell_command, "eif_size_h.SH"], os.path.join (sourcedir, "run-time"))
	copy_files (os.path.join (sourcedir, "*.h"), os.path.join (sourcedir, "run-time"))
	
	os.environ ['PATH'] = old_path
	
	if platform.system() == 'Windows':
		# Shell and Nmake based build system:
		run_command ([os.path.join(sourcedir, "Configure.bat"), "clean"], sourcedir)
		run_command ([os.path.join(sourcedir, "Configure.bat"), d_windows_runtime_flag, 'm'], sourcedir)
		l_config_location = os.path.expandvars (os.path.join("$ISE_EIFFEL", "studio", "config", "$ISE_PLATFORM", "$ISE_C_COMPILER"))
		copy_files (os.path.join (sourcedir, "config.sh"), l_config_location)
		build_libdir = os.path.join (sourcedir, 'run-time', 'LIB')
		
		# Premake based build system:
		# run_command ([os.path.join (sourcedir, 'premake4.exe'), "vs2010"], sourcedir)
		# run_command (['msbuild.exe', 'EiffelRunTime.sln', '/upgrade'], builddir)
		# run_command (["msbuild.exe", "EiffelRunTime.sln"], builddir)
		# build_libdir = os.path.join (builddir, 'spec', 'lib')
	else:
		# Shell and make based build system:
#		run_command (["make", "clobber"], sourcedir)
#		run_command (["./quick_configure"], sourcedir)
#		build_libdir = os.path.join (sourcedir, 'run-time')
		
		
		# Premake based build system:
		
		# NOTE: This is a workaround for a current problem:
		# Two files are called stack.c
		# We therefore create a symlink between these files.
		l_stack_ipc = os.path.join (sourcedir, "ipc", "shared", "stack_ipc.c")
		if not os.path.exists (l_stack_ipc):
			os.symlink (os.path.join (os.path.dirname (l_stack_ipc), "stack.c"), l_stack_ipc)
		
		if os.path.exists (os.path.join (builddir, "Makefile")):
			run_command (["make", "clean"], builddir)
		run_command (["premake4", "gmake"], sourcedir)
		 #TODO: Get the correct link_command from config.sh (sharedlink Bash variable)
		fix_makefiles (os.path.join (builddir, "*_shared.make"), 'ld')
		make_command = ["make"]
		#make_command = make_command + ["config=release"] # Release
		#make_command = make_command + ["verbose=y"] # Verbose output
		run_command (make_command, builddir)

		copy_files (os.path.join (sourcedir, "config.sh"), d_target_includedir_raw)
		build_libdir = os.path.join (builddir, "spec", "lib")

		# Copy public header files and all run-times.
	copy_files (os.path.join (sourcedir, "run-time", "*.h"), d_target_includedir_raw)
	copy_files (os.path.join (sourcedir, "run-time", "eif_stack.decl"), d_target_includedir_raw)
	copy_files (os.path.join (sourcedir, "run-time", "eif_stack.interface"), d_target_includedir_raw)
	copy_files (os.path.join (build_libdir, "*finalized.*"), d_target_libdir_raw)
	copy_files (os.path.join (build_libdir, "*wkbench.*"), d_target_libdir_raw)
	

		# Compile the various C support libraries needed by Eiffel libraries.
	compile_libraries (d_platform_libs)
	compile_libraries (d_shared_libs)