New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid blowing away .mbedignore files in exporters #6121

Merged
merged 1 commit into from Feb 20, 2018

Conversation

Projects
None yet
6 participants
@theotherjimmy
Contributor

theotherjimmy commented Feb 16, 2018

Resolves #5989

@bmcdonnell-ionx, @loverdeg-ep Are there other files that could use the
same behavior?

@theotherjimmy theotherjimmy force-pushed the theotherjimmy:mbedignore-append branch from 26cc56e to 85dd3c9 Feb 16, 2018

@bmcdonnell-ionx

This comment has been minimized.

Contributor

bmcdonnell-ionx commented Feb 16, 2018

Are there other files that could use the same behavior?

Not that I know of.

However, this doesn't work if .mbedignore already exists, but does not have the items that the exporter wants to exclude.

(I cherry-picked 85dd3c9 onto mbed-os-5.7.5.)

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed --version
1.4.0

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ rm .mbedignore; touch .mbedignore

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed config target LPC4088

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed export -i mcuxpresso
Scan: .
Warning: Multiple linker scripts detected: .\Debug\linker-script-debug.ld -> .\mbed-os\targets\TARGET_NXP\TARGET_LPC408X\device\TOOLCHAIN_GCC_ARM\LPC4088.ld
Scan: FEATURE_LWIP

Create a GNU ARM Eclipse C++ managed project
Project name: some-mbed-proj
Target: LPC4088
Toolchain: GCC_ARM
Source folders: 43, with 78 exclusions
Include folders: 131
Symbols: 42
Linker script: mbed-os/targets/TARGET_NXP/TARGET_LPC408X/device/TOOLCHAIN_GCC_ARM/LPC4088.ld

Build configuration: Debug
Common flags: -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g3 -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
C++ flags: -std=gnu++98 -fno-rtti -Wvla -include mbed_config.h
C flags: -std=gnu99 -include mbed_config.h
ASM flags: -x assembler-with-cpp
Linker flags: -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp

Build configuration: Release
Common flags: -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
C++ flags: -std=gnu++98 -fno-rtti -Wvla -include mbed_config.h
C flags: -std=gnu99 -include mbed_config.h
ASM flags: -x assembler-with-cpp
Linker flags: -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
Traceback (most recent call last):
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\project.py", line 259, in <module>
    main()
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\project.py", line 254, in main
    build_profile=profile, app_config=options.app_config)
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\project.py", line 96, in export
    app_config=app_config)
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\export\__init__.py", line 346, in export_project
    macros=macros)
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\export\__init__.py", line 211, in generate_project_files
    exporter.generate()
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\export\mcuxpresso\__init__.py", line 228, in generate
    '.mbedignore')
  File "C:\dev_temp\some-mbed-proj\mbed-os\tools\export\exporters.py", line 153, in gen_file_nonoverwrite
    with open(target_path, "wa") as fdout:
ValueError: Invalid mode ('wa')
[mbed] ERROR: "C:\Python27\python.exe" returned error code 1.
[mbed] ERROR: Command "C:\Python27\python.exe -u C:\dev_temp\some-mbed-proj\mbed-os\tools\project.py -i mcuxpresso -m LPC4088 --source ." in "C:\dev_temp\some-mbed-proj"
---
@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Feb 16, 2018

Huh, that worked for me. whoops. Let's drop the "w"

@theotherjimmy theotherjimmy force-pushed the theotherjimmy:mbedignore-append branch from 85dd3c9 to 8d7311d Feb 16, 2018

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Feb 16, 2018

@bmcdonnell-ionx I suppose that "wa" is not an error on linux. Weird.

I dropped the "w". Looks like it's working now.

# rm .mbedignore
# echo "foo" > .mbedignore
# mbed export -i gnuarmeclipse -m k64f
Scan: .
Scan: FEATURE_STORAGE
Scan: FEATURE_LWIP
Source folders: 51, with 82 exclusions
Include folders: 104
Symbols: 53
Linker script: mbed-os/targets/TARGET_Freescale/TARGET_MCUXpresso_MCUS/TARGET_MCU_K64F/device/TOOLCHAIN_GCC_ARM/MK64FN1M0xxx12.ld

Build configuration: Debug
Common flags: -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -O0 -g3 -DMBED_DEBUG -DMBED_TRAP_ERRORS_ENABLED=1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
C++ flags: -std=gnu++98 -fno-rtti -Wvla -include mbed_config.h
C flags: -std=gnu99 -include mbed_config.h
ASM flags: -x assembler-with-cpp
Linker flags: -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp

Build configuration: Develop
Common flags: -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -g1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
C++ flags: -std=gnu++98 -fno-rtti -Wvla -include mbed_config.h
C flags: -std=gnu99 -include mbed_config.h
ASM flags: -x assembler-with-cpp
Linker flags: -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp

Build configuration: Release
Common flags: -c -Wall -Wextra -Wno-unused-parameter -Wno-missing-field-initializers -fmessage-length=0 -fno-exceptions -fno-builtin -ffunction-sections -fdata-sections -funsigned-char -MMD -fno-delete-null-pointer-checks -fomit-frame-pointer -Os -DNDEBUG -g1 -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp
C++ flags: -std=gnu++98 -fno-rtti -Wvla -include mbed_config.h
C flags: -std=gnu99 -include mbed_config.h
ASM flags: -x assembler-with-cpp
Linker flags: -Wl,--gc-sections -Wl,--wrap,main -Wl,--wrap,_malloc_r -Wl,--wrap,_free_r -Wl,--wrap,_realloc_r -Wl,--wrap,_memalign_r -Wl,--wrap,_calloc_r -Wl,--wrap,exit -Wl,--wrap,atexit -Wl,-n -mcpu=cortex-m4 -mthumb -mfpu=fpv4-sp-d16 -mfloat-abi=softfp

Create a GNU ARM Eclipse C++ managed project
Project name: fat-fs
Target: K64F
Toolchain: GCC_ARM

Done. Import the 'fat-fs' project in Eclipse.
# cat .mbedignore
foo
Debug/*
Release/*
Develop/*
# mbed export -i gnuarmeclipse -m k64f
Scan: .
Scan: FEATURE_STORAGE
Scan: FEATURE_LWIP
[SNIP]
Create a GNU ARM Eclipse C++ managed project
Project name: fat-fs
Target: K64F
Toolchain: GCC_ARM

Done. Import the 'fat-fs' project in Eclipse.
# cat .mbedignore
foo
Debug/*
Release/*
Develop/*


@bmcdonnell-ionx

This comment has been minimized.

Contributor

bmcdonnell-ionx commented Feb 16, 2018

@theotherjimmy, better, though potentially incomplete.

The items it wants to add must be all present, in order, and contiguous - otherwise it adds them all again.

Are you interested in adding smarter parsing like what I had suggested earlier?

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ rm .mbedignore ; echo 'Debug/*' > .mbedignore

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed export -i mcuxpresso

[snip]

Done. Import the 'some-mbed-proj' project in Eclipse.

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ cat .mbedignore
Debug/*
Debug/*
Release/*

##########################################################################

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ rm .mbedignore ; echo 'Release/*' > .mbedignore

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed export -i mcuxpresso

[snip]

Done. Import the 'some-mbed-proj' project in Eclipse.

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ cat .mbedignore
Release/*
Debug/*
Release/*

##########################################################################

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ rm .mbedignore ; echo 'Release/*' > .mbedignore ; echo 'Debug/*' >> .mbedignore

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ mbed export -i mcuxpresso

[snip]

Done. Import the 'some-mbed-proj' project in Eclipse.

me@mypc MINGW64 /c/dev_temp/some-mbed-proj (master)
$ cat .mbedignore
Release/*
Debug/*
Debug/*
Release/*
@cmonr

This comment has been minimized.

Contributor

cmonr commented Feb 16, 2018

@bmcdonnell-ionx Adding that functionality would go out of the scope of what this PR and the original issue is intending to point out.

I would suggest opening up a separate issue so that the bug fix (this) can be separated from the enhancement/improvement.

/morph build

@cmonr

cmonr approved these changes Feb 16, 2018

@mbed-ci

This comment has been minimized.

mbed-ci commented Feb 16, 2018

Build : SUCCESS

Build number : 1166
Build artifacts/logs : http://mbed-os.s3-website-eu-west-1.amazonaws.com/?prefix=builds/6121/

Triggering tests

/morph test
/morph uvisor-test
/morph export-build
/morph mbed2-build

@mbed-ci

This comment has been minimized.

@mbed-ci

This comment has been minimized.

@loverdeg-ep

This comment has been minimized.

loverdeg-ep commented Feb 18, 2018

@vergil-SI did we see any other changes caused by an "mbed export" that would result in mbed-cli building our project differently?

@0xc0170 0xc0170 added ready for merge and removed needs: CI labels Feb 19, 2018

@theotherjimmy

This comment has been minimized.

Contributor

theotherjimmy commented Feb 20, 2018

@0xc0170 Care to merge this now? It's been waiting for a day.

@cmonr cmonr merged commit 863b40d into ARMmbed:master Feb 20, 2018

18 checks passed

AWS-CI uVisor Build & Test Success
Details
ci-morph-build build completed
Details
ci-morph-exporter build completed
Details
ci-morph-mbed2-build build completed
Details
ci-morph-test test completed
Details
continuous-integration/jenkins/pr-head This commit looks good
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
mbed-ci-generic Build finished.
Details
travis-ci/docs/ Local docs testing has passed
Details
travis-ci/events/ Local events testing has passed
Details
travis-ci/littlefs/ Local littlefs testing has passed
Details
travis-ci/mbed2-ATMEL/ Local mbed2-ATMEL testing has passed
Details
travis-ci/mbed2-MAXIM/ Local mbed2-MAXIM testing has passed
Details
travis-ci/mbed2-NORDIC/ Local mbed2-NORDIC testing has passed
Details
travis-ci/mbed2-NUVOTON/ Local mbed2-NUVOTON testing has passed
Details
travis-ci/mbed2-NXP/ Local mbed2-NXP testing has passed
Details
travis-ci/mbed2-SILICON_LABS/ Local mbed2-SILICON_LABS testing has passed
Details
travis-ci/mbed2-STM/ Local mbed2-STM testing has passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment