Skip to content

Commit

Permalink
统一tools中env相关的接口到env_helper.py文件,并同步调整ci
Browse files Browse the repository at this point in the history
  • Loading branch information
ComerLater committed Jul 13, 2024
1 parent 4e8b829 commit d709561
Show file tree
Hide file tree
Showing 12 changed files with 491 additions and 675 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/bsp_buildings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -369,9 +369,9 @@ jobs:
chmod 777 install_ubuntu.sh
./install_ubuntu.sh
git config --global http.postBuffer 524288000
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV
echo "export PATH=~/.env/tools/scripts:$PATH" > ~/.env/env.sh
- name: Install Arm ToolChains
if: ${{ matrix.legs.RTT_TOOL_CHAIN == 'sourcery-arm' && success() }}
Expand Down
5 changes: 2 additions & 3 deletions .github/workflows/compile_bsp_with_drivers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,6 @@ jobs:
git config --global http.postBuffer 524288000
git remote -v
git fetch origin
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
- name: Install Arm ToolChains
if: ${{ success() }}
Expand All @@ -67,5 +66,5 @@ jobs:
if: ${{ success() }}
shell: bash
run: |
source ~/.env/env.sh
#python tools/ci/compile_bsp_with_drivers.py
# source ~/.env/env.sh
# python tools/ci/compile_bsp_with_drivers.py
3 changes: 1 addition & 2 deletions .github/workflows/manual_dist.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:
chmod 777 install_ubuntu.sh
./install_ubuntu.sh
git config --global http.postBuffer 524288000
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV
Expand Down Expand Up @@ -145,7 +144,7 @@ jobs:
RTT_BSP: ${{ github.event.inputs.bsp_options }}
RTT_TOOL_CHAIN: ${{ github.event.inputs.bsp_tool_chain}}
run: |
source ~/.env/env.sh
# source ~/.env/env.sh
echo $RTT_BSP
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
config=${{ github.event.inputs.bsp_config}}
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/manual_trigger_scons_STM32_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,6 @@ jobs:
chmod 777 install_ubuntu.sh
./install_ubuntu.sh
git config --global http.postBuffer 524288000
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV
Expand All @@ -161,7 +160,7 @@ jobs:
RTT_BSP: ${{ matrix.legs.RTT_BSP }}
RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }}
run: |
source ~/.env/env.sh
# source ~/.env/env.sh
echo $RTT_BSP
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
sed -i "s/# ${{ github.event.inputs.bsp_config }} is not set/${{ github.event.inputs.bsp_config }}=y/g" bsp/$RTT_BSP/.config
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/manual_trigger_scons_except_STM32_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ jobs:
chmod 777 install_ubuntu.sh
./install_ubuntu.sh
git config --global http.postBuffer 524288000
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV
Expand Down Expand Up @@ -354,7 +353,7 @@ jobs:
RTT_BSP: ${{ matrix.legs.RTT_BSP }}
RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }}
run: |
source ~/.env/env.sh
# source ~/.env/env.sh
echo $RTT_BSP
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
sed -i "s/# ${{ github.event.inputs.bsp_config }} is not set/${{ github.event.inputs.bsp_config }}=y/g" bsp/$RTT_BSP/.config
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/manual_trigger_scons_fail_bsp_all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,6 @@ jobs:
chmod 777 install_ubuntu.sh
./install_ubuntu.sh
git config --global http.postBuffer 524288000
python -c "import tools.menukconfig; tools.menukconfig.touch_env()"
echo "RTT_ROOT=${{ github.workspace }}" >> $GITHUB_ENV
echo "RTT_CC=gcc" >> $GITHUB_ENV
Expand Down Expand Up @@ -175,7 +174,7 @@ jobs:
RTT_BSP: ${{ matrix.legs.RTT_BSP }}
RTT_TOOL_CHAIN: ${{ matrix.legs.RTT_TOOL_CHAIN }}
run: |
source ~/.env/env.sh
# source ~/.env/env.sh
echo $RTT_BSP
ls bsp/$RTT_BSP/Kconfig && scons -C bsp/$RTT_BSP --pyconfig-silent
sed -i "s/# ${{ github.event.inputs.bsp_config }} is not set/${{ github.event.inputs.bsp_config }}=y/g" bsp/$RTT_BSP/.config
Expand Down
29 changes: 9 additions & 20 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,17 +142,6 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
# set BSP_ROOT in ENV
Env['BSP_ROOT'] = Dir('#').abspath
os.environ["BSP_DIR"] = Dir('#').abspath
# set PKGS_ROOT in ENV
if "PKGS_DIR" in os.environ:
pass
elif "PKGS_ROOT" in os.environ:
os.environ["PKGS_DIR"] = os.environ["PKGS_ROOT"]
elif "ENV_ROOT" in os.environ:
os.environ["PKGS_DIR"] = os.path.join(os.environ["ENV_ROOT"], "packages")
elif sys.platform == "win32":
os.environ["PKGS_DIR"] = os.path.join(os.environ["USERPROFILE"], ".env", "packages")
else:
os.environ["PKGS_DIR"] = os.path.join(os.environ["HOME"], ".env", "packages")

sys.path += os.path.join(Rtt_Root, 'tools')

Expand Down Expand Up @@ -205,7 +194,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [

try:
# try to detect toolchains in env
envm = utils.ImportModule('env')
envm = utils.ImportModule('env_helper')
# from env import GetSDKPath
exec_path = envm.GetSDKPath(rtconfig.CC)
if 'gcc' in rtconfig.CC:
Expand Down Expand Up @@ -331,7 +320,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
print('--global-macros arguments are illegal!')

if GetOption('genconfig'):
from menukconfig import genconfig
from env_helper import genconfig
genconfig()
exit(0)

Expand All @@ -341,23 +330,23 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
exit(0)

if GetOption('menuconfig'):
from menukconfig import menuconfig
from env_helper import menuconfig
menuconfig(Rtt_Root)
exit(0)

if GetOption('pyconfig-silent'):
from menukconfig import guiconfig_silent
guiconfig_silent(Rtt_Root)
if GetOption('defconfig'):
from env_helper import defconfig
defconfig(Rtt_Root)
exit(0)

elif GetOption('pyconfig'):
from menukconfig import guiconfig
elif GetOption('guiconfig'):
from env_helper import guiconfig
guiconfig(Rtt_Root)
exit(0)

configfn = GetOption('useconfig')
if configfn:
from menukconfig import mk_rtconfig
from env_helper import mk_rtconfig
mk_rtconfig(configfn)
exit(0)

Expand Down
55 changes: 0 additions & 55 deletions tools/env.py

This file was deleted.

Loading

0 comments on commit d709561

Please sign in to comment.