@@ -2144,7 +2144,6 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2144
2144
# Find the root of the program
2145
2145
program = Program (os .getcwd (), True )
2146
2146
program .check_requirements (True )
2147
- program .ignore_build_dir ()
2148
2147
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
2149
2148
orig_path = os .getcwd ()
2150
2149
@@ -2178,39 +2177,46 @@ def compile_(toolchain=None, target=None, profile=False, compile_library=False,
2178
2177
+ (['-v' ] if verbose else [])
2179
2178
+ (list (chain .from_iterable (izip (repeat ('--prefix' ), config_prefix ))) if config_prefix else []),
2180
2179
env = env )
2181
- elif compile_library :
2182
- # Compile as a library (current dir is default)
2183
- if not build :
2184
- build = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , 'libraries' , os .path .basename (orig_path ), target , tchain )
2185
-
2186
- popen (['python' , '-u' , os .path .join (tools_dir , 'build.py' )]
2187
- + list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2188
- + ['-t' , tchain , '-m' , target ]
2189
- + list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2190
- + list (chain .from_iterable (izip (repeat ('--source' ), source )))
2191
- + ['--build' , build ]
2192
- + (['-c' ] if clean else [])
2193
- + (['--artifact-name' , artifact_name ] if artifact_name else [])
2194
- + (['-v' ] if verbose else [])
2195
- + args ,
2196
- env = env )
2197
2180
else :
2198
- # Compile as application (root is default)
2181
+ # If the user hasn't supplied a build directory, ignore the default build directory
2199
2182
if not build :
2200
- build = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , target , tchain )
2183
+ program .ignore_build_dir ()
2184
+
2185
+ build_path = build
2201
2186
2202
- popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
2203
- + list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2204
- + ['-t' , tchain , '-m' , target ]
2205
- + list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2206
- + list (chain .from_iterable (izip (repeat ('--source' ), source )))
2207
- + ['--build' , build ]
2208
- + (['-c' ] if clean else [])
2209
- + (['--artifact-name' , artifact_name ] if artifact_name else [])
2210
- + (['--app-config' , app_config ] if app_config else [])
2211
- + (['-v' ] if verbose else [])
2212
- + args ,
2213
- env = env )
2187
+ if compile_library :
2188
+ # Compile as a library (current dir is default)
2189
+ if not build_path :
2190
+ build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , 'libraries' , os .path .basename (orig_path ), target , tchain )
2191
+
2192
+ popen (['python' , '-u' , os .path .join (tools_dir , 'build.py' )]
2193
+ + list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2194
+ + ['-t' , tchain , '-m' , target ]
2195
+ + list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2196
+ + list (chain .from_iterable (izip (repeat ('--source' ), source )))
2197
+ + ['--build' , build_path ]
2198
+ + (['-c' ] if clean else [])
2199
+ + (['--artifact-name' , artifact_name ] if artifact_name else [])
2200
+ + (['-v' ] if verbose else [])
2201
+ + args ,
2202
+ env = env )
2203
+ else :
2204
+ # Compile as application (root is default)
2205
+ if not build_path :
2206
+ build_path = os .path .join (os .path .relpath (program .path , orig_path ), program .build_dir , target , tchain )
2207
+
2208
+ popen (['python' , '-u' , os .path .join (tools_dir , 'make.py' )]
2209
+ + list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2210
+ + ['-t' , tchain , '-m' , target ]
2211
+ + list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2212
+ + list (chain .from_iterable (izip (repeat ('--source' ), source )))
2213
+ + ['--build' , build_path ]
2214
+ + (['-c' ] if clean else [])
2215
+ + (['--artifact-name' , artifact_name ] if artifact_name else [])
2216
+ + (['--app-config' , app_config ] if app_config else [])
2217
+ + (['-v' ] if verbose else [])
2218
+ + args ,
2219
+ env = env )
2214
2220
2215
2221
program .set_defaults (target = target , toolchain = tchain )
2216
2222
@@ -2238,7 +2244,6 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
2238
2244
# Find the root of the program
2239
2245
program = Program (os .getcwd (), True )
2240
2246
program .check_requirements (True )
2241
- program .ignore_build_dir ()
2242
2247
# Save original working directory
2243
2248
orig_path = os .getcwd ()
2244
2249
@@ -2257,15 +2262,16 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
2257
2262
source = [program .path ]
2258
2263
2259
2264
# Setup the build path if not specified
2260
- if not build :
2261
- build = os .path .join (program .path , program .build_dir , 'tests' , target , tchain )
2265
+ build_path = build
2266
+ if not build_path :
2267
+ build_path = os .path .join (program .path , program .build_dir , 'tests' , target , tchain )
2262
2268
2263
2269
if test_spec :
2264
2270
# Preserve path to given test spec
2265
2271
test_spec = os .path .relpath (os .path .join (orig_path , test_spec ), program .path )
2266
2272
else :
2267
2273
# Create the path to the test spec file
2268
- test_spec = os .path .join (build , 'test_spec.json' )
2274
+ test_spec = os .path .join (build_path , 'test_spec.json' )
2269
2275
2270
2276
if compile_list :
2271
2277
popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' ), '--list' ]
@@ -2279,13 +2285,17 @@ def test_(toolchain=None, target=None, compile_list=False, run_list=False, compi
2279
2285
env = env )
2280
2286
2281
2287
if compile_only or build_and_run_tests :
2288
+ # If the user hasn't supplied a build directory, ignore the default build directory
2289
+ if not build :
2290
+ program .ignore_build_dir ()
2291
+
2282
2292
popen (['python' , '-u' , os .path .join (tools_dir , 'test.py' )]
2283
2293
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
2284
2294
+ list (chain .from_iterable (izip (repeat ('--profile' ), profile or [])))
2285
2295
+ ['-t' , tchain , '-m' , target ]
2286
2296
+ (['-c' ] if clean else [])
2287
2297
+ list (chain .from_iterable (izip (repeat ('--source' ), source )))
2288
- + ['--build' , build ]
2298
+ + ['--build' , build_path ]
2289
2299
+ ['--test-spec' , test_spec ]
2290
2300
+ (['-n' , tests_by_name ] if tests_by_name else [])
2291
2301
+ (['-v' ] if verbose else [])
@@ -2326,7 +2336,6 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
2326
2336
# Find the root of the program
2327
2337
program = Program (os .getcwd (), True )
2328
2338
program .check_requirements (True )
2329
- program .ignore_build_dir ()
2330
2339
# Remember the original path. this is needed for compiling only the libraries and tests for the current folder.
2331
2340
orig_path = os .getcwd ()
2332
2341
# Change directories to the program root to use mbed OS tools
@@ -2350,6 +2359,8 @@ def export(ide=None, target=None, source=False, clean=False, supported=False):
2350
2359
2351
2360
if not source or len (source ) == 0 :
2352
2361
source = [os .path .relpath (program .path , orig_path )]
2362
+
2363
+ program .ignore_build_dir ()
2353
2364
2354
2365
popen (['python' , '-u' , os .path .join (tools_dir , 'project.py' )]
2355
2366
+ list (chain .from_iterable (izip (repeat ('-D' ), macros )))
0 commit comments