Commit graph

222 commits

Author SHA1 Message Date
Jeremy Baxter
a51571a0bb improve rdmd help message 2024-05-13 08:56:31 +03:00
Vladimir Panteleev
c950a65bd9
rdmd: Use .dylib instead of .so on macOS 2023-05-01 17:27:02 +00:00
Vladimir Panteleev
b7d2ef2f41
rdmd: Support -shared in the same way as -lib 2023-05-01 09:38:23 +00:00
Iain Buclaw
8a683b6751 rdmd: Don't import std.xml for --eval and --loop 2022-08-28 14:44:42 +02:00
rikki cattermole
2d0c822203 Add support for environment variable RDMD_DMD into rdmd 2022-02-09 10:42:29 +13:00
MoonlightSentinel
75a5fe5334
rdmd: Allow selection of default compiler independent from the host one
Extends the `defaultCompiler` selection s.t. custom defaults can be
selected at compile time via `-version=DefaultCompiler_XXX` (where `XXX`
is either `DMD`, `LDC` or `GDC`).

This allows the `rdmd` bundled with DMD to be built with LDC while still
defaulting to DMD.
2022-02-08 13:17:26 +01:00
berni44
58a999c6d4 Remove typetuple 2021-04-08 20:48:02 +02:00
Tobias Pankrath
608a5d0770 rdmd: remove left-over comment 2021-03-04 17:52:45 +01:00
Tobias Pankrath
bc7b2acc6d rdmd: clarify docs on the usage of --loop 2021-03-04 17:06:05 +01:00
Tobias Pankrath
2b839fa3b7 rdmd: handle exceptions thrown by getopt 2021-03-04 16:56:31 +01:00
Geod24
5e0317a4e8 Fix issue 13345 - Add argument support to rdmd --eval 2020-06-06 01:47:42 +09:00
Vladimir Panteleev
2e516ab51a
rdmd: Append binExt to the compiler path to check from the same directory
Fixes using the compiler from rdmd's directory (issue 11997) on
Windows.
2018-04-10 16:17:47 +00:00
Superstar64
e88c44d181 rdmd: support --eval <arg> to make it Makefile friendly 2018-03-26 03:13:21 +02:00
Joseph Rushton Wakeling
348610de2d rdmd: fix parsing of -o- and -op command-line flags
By checking only `value[0]`, the `dashOh` callback used to parse `-o...`
flags would give false positives (e.g. for `-o-foo` or `-opbar`).  This
patch fixes the discrepancy by requiring exact comparison to `value`.

A few test cases have been added to `rdmd_test` to cover these failures.

Thanks to @CyberShadow for spotting the bug and proposing the fix.
2018-03-25 19:35:14 +02:00
Joseph Rushton Wakeling
8f84fcda79 rdmd: support -of=... and -od=... flags as well as -of... and -od...
This fixes a discrepancy between `rdmd` and `dmd` in terms of the output
flags they support: `dmd` now requests `-of=...` and `-od=...` in help
output but still supports the old `-of...` and `-od...` style, while
`rdmd` was still supporting only the older variant.

Thanks to @CyberShadow for suggesting the `skipOver`-based solution.

Extra test cases have been added to `rdmd_test` to cover this, although
the way this has been done is a little bit cheeky (it turns out the only
place where `-of` and `-od` are really tested rigorously is in tests for
the case where the output file is a library in a subdirectory).  At some
point it would be a good idea to add some more rigorous test cases for
the `-o...` flags, but in the short term the tests added in this patch
should validate the changes to `rdmd` itself.
2018-03-25 19:33:19 +02:00
Sebastian Wilzbach
40ef4335a0
Revert "Partially revert #303 until #317 is resolved" 2018-02-13 20:55:42 +01:00
Sebastian Wilzbach
6a1b3fb21e Partially revert #303 until #317 is resolved 2018-02-13 18:12:06 +01:00
Jonathan Marler
5fed01b44c Improve logging accuracy and make it harder to violate. 2018-02-07 22:15:39 -07:00
Jonathan Marler
7db1c3c366 Changed !isDir to isFile
File types are split into more than just directories and files. In this case, fullExe must be a regular file, so checking isFile removes any question about whether or not it is actually a file. The current implementation uses !isDir which could still be true even if fullExe is not a regular file, which is not the logic we want here.
2018-02-06 08:15:53 -07:00
Joseph Rushton Wakeling
1a29cdbe66 Prevent empty statements at the end of --eval or --loop code
This patch replaces the old ad-hoc generation of `--eval` or `--loop`
program code with calls to the new `makeEvalCode` function.  Besides
improving separation of concerns, this also ensures that the generated
code will never have a trailing blank statement (i.e. two `;` separated
at most by whitespace).  This should prevent issues when using `--eval`
or `--loop` with a `--compiler` choice that is fussy about such things;
see https://github.com/dlang/tools/pull/297#issuecomment-362447334 for
an example.
2018-02-03 12:11:12 +01:00
Joseph Rushton Wakeling
f2dae5ac86 Add standalone functions to generate code for --eval and --loop flags
The `--eval` and `--loop` flags allow the user to specify small snippets
of code that are placed inside the body of an auto-generated `main` that
is written to a file and evaluated.

The existing implementation uses two separate string concatenations for
the two different cases.  Besides the code duplication, this means that
the resulting code generation cannot be tested.

A further more subtle issue arises from the existing implementation's
insistence on adding a closing `;` to the generated code.  While this
takes care of the careless user who forgets to write one themselves, it
means that if the user does close their statements correctly, we end up
with an empty statement on the end of the code to be evaluated.  While
some D compilers don't care about this, some object:
https://github.com/dlang/tools/pull/297#issuecomment-362447334

... meaning that `rdmd` will fail to successfully evaluate the code.

This patch therefore implements two new code functions to generate the
required code.  The first, `innerEvalCode`, takes care of the innermost
code (the body of either the `main` function for `--eval`, or the loop
for `--loop`), adding a terminating `;` if one is not present, but not
doing so if one is already in place.

The second, `makeEvalCode`, takes two parameters: the `string[]` of code
snippets to be evaluated, and a boolean `Flag` indicating whether or not
this is the body of a loop (in other words, whether this code should be
generated for the `--eval` flag or the `--loop` flag).

Unittests have been provided with both to ensure that they produce the
expected outcomes.
2018-02-03 12:08:54 +01:00
Jonathan Marler
f9dac0d869 Modify which function to match Windows search behavior.
Note, this doesn't affect linux, only windows.  The problem is that the inner/outer loops for searching for a program in the `which` function is in the wrong order.  You should go through each PATH, in in each one search for a program matching every extension in PATHEXT.
2018-01-21 20:58:29 -07:00
Sebastian Wilzbach
57866cccf1
Revert "Use "-i" to prevent rdmd from having to invoke compiler twice." 2018-01-18 07:37:55 +01:00
Jonathan Marler
671a3bd111 Use "-i" to prevent rdmd from having to invoke compiler twice. 2018-01-08 19:40:46 -07:00
Martin Nowak
e6c18a97ec fix slice to temporary static array 2017-09-01 10:26:08 +02:00
Joakim
f7e6f4ed92 Fix Issue 11997 - rdmd should search it's binary path for the compiler 2017-07-16 16:26:43 +05:30
Andrei Alexandrescu
d2418886c8 Update imports for --eval and --loop 2017-07-04 13:13:28 -04:00
Sebastian Wilzbach
245187c7b5 Make scripts executable + runnable 2017-07-03 02:09:29 +02:00
Sebastian Wilzbach
e1b90d2058 Remove deprecated stdc import 2017-07-03 00:43:36 +02:00
Sebastian Wilzbach
e11129de67 Issue 17262 - Better docs for rdmd 2017-06-15 07:06:27 +02:00
anonymous
5ffca7b0e0 fix issue 17198 - rdmd does not recompile when --extra-file is added 2017-02-20 15:23:24 +01:00
The Dlang Bot
bfbcd086ba Merge pull request #207 from CyberShadow/issue-16962
rdmd fixes (issues 14296, 16962 and 16978)
merged-on-behalf-of: Martin Nowak <code@dawg.eu>
2016-12-24 12:03:18 +01:00
Sebastian Wilzbach
617f0d2309 Remove cstream, stream, socketstream from rdmd 2016-12-22 17:03:56 +01:00
Vladimir Panteleev
b4b2cc35af rdmd: Add spaces around ~ 2016-12-17 19:39:39 +00:00
Vladimir Panteleev
9be1e23e10 Use correct default output file extension when using -c 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
a875b5451b Assume --build-only if -c or -lib is given 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
2ec57f8e51 Filter out -lib with -o-, to avoid creating an empty library file 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
e245e29d8b Fix Issue 14296 - RDMD fails at building a lib when the source is in a subdir 2016-12-17 16:00:40 +00:00
Vladimir Panteleev
8a5b9d6224 Revert "Merge pull request #194 from aG0aep6G/rdmd-single-out-root"
This reverts commit a63233c22d, reversing
changes made to 6f92f7f1b0.
2016-12-17 16:00:39 +00:00
Andrej Mitrović
c568ac7a81 Merge pull request #183 from CyberShadow/pull-20160412-193525
rdmd: Add --include switch
2016-08-31 23:35:10 +02:00
Andrei Alexandrescu
a63233c22d Merge pull request #194 from aG0aep6G/rdmd-single-out-root
rdmd: compile the root module in the same step as getting the dependencies
2016-08-28 19:41:12 -04:00
anonymous
4da871db19 missed one 2016-08-29 00:59:52 +02:00
anonymous
0e44ee7569 spaces around ~ please 2016-08-29 00:52:49 +02:00
anonymous
821d038171 name object files after root module
Moving --main functionality from linking to compilation of root module so
that dmd doesn't mess with the object files.
2016-08-28 12:57:08 +02:00
anonymous
4ab9444d8b explicit !is null 2016-08-28 12:16:49 +02:00
Sebastian Wilzbach
3693575c2d use ctRegex + avoid array allocation 2016-08-28 07:03:34 +02:00
anonymous
10ca1582c4 compile the root module in the same step as getting the dependencies
This avoids calling dmd twice when running a single file, which is a common
task.
2016-08-28 00:40:34 +02:00
Andrei Alexandrescu
1260719a9c Merge pull request #192 from wilzbach/remove-allocation
Remove unneccsary array allocation
2016-08-26 15:47:41 -04:00
Sebastian Wilzbach
3d402e92b0 allow rdmd to be executed with -unittest 2016-08-26 20:04:39 +02:00
Sebastian Wilzbach
eaf92453fe Remove deprecated single-threaded compilation loop 2016-08-26 19:12:52 +02:00