ufbt: changed toolchain environment invocation; updated .gitignore for app template (#3300)
This commit is contained in:
		
							parent
							
								
									6f6074dc01
								
							
						
					
					
						commit
						1e1d9fcb69
					
				| @ -11,6 +11,27 @@ WINPATHSEP_RE = re.compile(r"\\([^\"'\\]|$)") | ||||
| # Excludes all files ending with ~, usually created by editors as backup files | ||||
| GLOB_FILE_EXCLUSION = ["*~"] | ||||
| 
 | ||||
| # List of environment variables to proxy to child processes | ||||
| FORWARDED_ENV_VARIABLES = [ | ||||
|     # CI/CD variables | ||||
|     "WORKFLOW_BRANCH_OR_TAG", | ||||
|     "DIST_SUFFIX", | ||||
|     # Python & other tools | ||||
|     "HOME", | ||||
|     "APPDATA", | ||||
|     "PYTHONHOME", | ||||
|     "PYTHONNOUSERSITE", | ||||
|     "TMP", | ||||
|     "TEMP", | ||||
|     # ccache | ||||
|     "CCACHE_DISABLE", | ||||
|     # Colors for tools | ||||
|     "TERM", | ||||
|     # Toolchain | ||||
|     "FBT_TOOLCHAIN_PATH", | ||||
|     "UFBT_HOME", | ||||
| ] | ||||
| 
 | ||||
| 
 | ||||
| def tempfile_arg_esc_func(arg): | ||||
|     arg = quote_spaces(arg) | ||||
|  | ||||
| @ -25,33 +25,10 @@ forward_os_env = { | ||||
|     "PATH": os.environ["PATH"], | ||||
| } | ||||
| 
 | ||||
| # Proxying environment to child processes & scripts | ||||
| variables_to_forward = [ | ||||
|     # CI/CD variables | ||||
|     "WORKFLOW_BRANCH_OR_TAG", | ||||
|     "DIST_SUFFIX", | ||||
|     # Python & other tools | ||||
|     "HOME", | ||||
|     "APPDATA", | ||||
|     "PYTHONHOME", | ||||
|     "PYTHONNOUSERSITE", | ||||
|     "TMP", | ||||
|     "TEMP", | ||||
|     # Colors for tools | ||||
|     "TERM", | ||||
| ] | ||||
| 
 | ||||
| if proxy_env := GetOption("proxy_env"): | ||||
|     variables_to_forward.extend(proxy_env.split(",")) | ||||
| 
 | ||||
| for env_value_name in variables_to_forward: | ||||
|     if environ_value := os.environ.get(env_value_name, None): | ||||
|         forward_os_env[env_value_name] = environ_value | ||||
| 
 | ||||
| # Core environment init - loads SDK state, sets up paths, etc. | ||||
| core_env = Environment( | ||||
|     variables=ufbt_variables, | ||||
|     ENV=forward_os_env, | ||||
|     UFBT_STATE_DIR=ufbt_state_dir, | ||||
|     UFBT_CURRENT_SDK_DIR=ufbt_current_sdk_dir, | ||||
|     UFBT_SCRIPT_DIR=ufbt_script_dir, | ||||
| @ -69,6 +46,7 @@ core_env.Append(CPPDEFINES=GetOption("extra_defines")) | ||||
| from fbt.appmanifest import FlipperApplication, FlipperAppType | ||||
| from fbt.sdk.cache import SdkCache | ||||
| from fbt.util import ( | ||||
|     FORWARDED_ENV_VARIABLES, | ||||
|     path_as_posix, | ||||
|     resolve_real_dir_node, | ||||
|     single_quote, | ||||
| @ -76,8 +54,19 @@ from fbt.util import ( | ||||
|     wrap_tempfile, | ||||
| ) | ||||
| 
 | ||||
| variables_to_forward = list(FORWARDED_ENV_VARIABLES) | ||||
| 
 | ||||
| if proxy_env := GetOption("proxy_env"): | ||||
|     variables_to_forward.extend(proxy_env.split(",")) | ||||
| 
 | ||||
| for env_value_name in variables_to_forward: | ||||
|     if environ_value := os.environ.get(env_value_name, None): | ||||
|         forward_os_env[env_value_name] = environ_value | ||||
| 
 | ||||
| 
 | ||||
| # Base environment with all tools loaded from SDK | ||||
| env = core_env.Clone( | ||||
|     ENV=forward_os_env, | ||||
|     toolpath=[core_env["FBT_SCRIPT_DIR"].Dir("fbt_tools")], | ||||
|     tools=[ | ||||
|         "fbt_tweaks", | ||||
| @ -477,9 +466,12 @@ else: | ||||
| 
 | ||||
|     dist_env.PhonyTarget("dolphin_ext", Action(missing_dolphin_folder, None)) | ||||
| 
 | ||||
| # print(env.Dump()) | ||||
| dist_env.PhonyTarget( | ||||
|     "env", | ||||
|     "@echo $( ${FBT_SCRIPT_DIR.abspath}/toolchain/fbtenv.sh $)", | ||||
|     '@echo "FBT_TOOLCHAIN_PATH=' | ||||
|     + forward_os_env["FBT_TOOLCHAIN_PATH"] | ||||
|     + '" source $( "${FBT_SCRIPT_DIR.abspath}/toolchain/fbtenv.sh" $)', | ||||
| ) | ||||
| 
 | ||||
| dist_env.PostConfigureUfbtEnvionment() | ||||
|  | ||||
							
								
								
									
										2
									
								
								scripts/ufbt/project_template/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										2
									
								
								scripts/ufbt/project_template/.gitignore
									
									
									
									
										vendored
									
									
								
							| @ -2,3 +2,5 @@ dist/* | ||||
| .vscode | ||||
| .clang-format | ||||
| .editorconfig | ||||
| .env | ||||
| .ufbt | ||||
|  | ||||
| @ -44,7 +44,11 @@ How to create a new application: | ||||
|     4. Run `ufbt launch` to build and upload your application. | ||||
| 
 | ||||
| How to open a shell with toolchain environment and other build tools: | ||||
|     In your shell, type "source `ufbt -s env`". You can also use "." instead of "source". | ||||
|     In your shell, type "eval `ufbt -s env`". | ||||
| 
 | ||||
| How to update uFBT SDK: | ||||
|     Run "ufbt update" to fetch latest SDK. | ||||
|     You can also specify branch, target and/or channel options. See "ufbt update -h" for details. | ||||
| """ | ||||
| 
 | ||||
| 
 | ||||
|  | ||||
| @ -1,6 +1,5 @@ | ||||
| import json | ||||
| import os | ||||
| import pathlib | ||||
| import sys | ||||
| from functools import reduce | ||||
| 
 | ||||
|  | ||||
| @ -1,13 +1,14 @@ | ||||
| from SCons.Platform import TempFileMunge | ||||
| from fbt.util import ( | ||||
|     tempfile_arg_esc_func, | ||||
|     single_quote, | ||||
|     wrap_tempfile, | ||||
|     resolve_real_dir_node, | ||||
| ) | ||||
| 
 | ||||
| import os | ||||
| import multiprocessing | ||||
| import os | ||||
| 
 | ||||
| from fbt.util import ( | ||||
|     FORWARDED_ENV_VARIABLES, | ||||
|     resolve_real_dir_node, | ||||
|     single_quote, | ||||
|     tempfile_arg_esc_func, | ||||
|     wrap_tempfile, | ||||
| ) | ||||
| from SCons.Platform import TempFileMunge | ||||
| 
 | ||||
| Import("VAR_ENV") | ||||
| 
 | ||||
| @ -15,23 +16,9 @@ forward_os_env = { | ||||
|     # Import PATH from OS env - scons doesn't do that by default | ||||
|     "PATH": os.environ["PATH"], | ||||
| } | ||||
| # Proxying CI environment to child processes & scripts | ||||
| variables_to_forward = [ | ||||
|     # CI/CD variables | ||||
|     "WORKFLOW_BRANCH_OR_TAG", | ||||
|     "DIST_SUFFIX", | ||||
|     # Python & other tools | ||||
|     "HOME", | ||||
|     "APPDATA", | ||||
|     "PYTHONHOME", | ||||
|     "PYTHONNOUSERSITE", | ||||
|     "TMP", | ||||
|     "TEMP", | ||||
|     # ccache | ||||
|     "CCACHE_DISABLE", | ||||
|     # Colors for tools | ||||
|     "TERM", | ||||
| ] | ||||
| 
 | ||||
| variables_to_forward = list(FORWARDED_ENV_VARIABLES) | ||||
| 
 | ||||
| if proxy_env := GetOption("proxy_env"): | ||||
|     variables_to_forward.extend(proxy_env.split(",")) | ||||
| 
 | ||||
|  | ||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user
	 hedger
						hedger