gittup / tup

Tup is a file-based build system.
http://gittup.org/tup/
GNU General Public License v2.0
1.18k stars 145 forks source link

"tup generate" in Windows #179

Open FreddieChopin opened 10 years ago

FreddieChopin commented 10 years ago

I was trying to test new "tup generate" feature, but it doesn't seem to like Windows. If I try to use it in any of my projects using tup I get:

>tup
Initializing .tup in d:\1\tup-test-case
.tup repository initialized.
[ tup ] [0.097s] Scanning filesystem...
[ tup ] [0.242s] Reading in new environment variables...
[ tup ] [0.393s] Parsing Tupfiles...
 1) [0.030s] .
 2) [0.001s] a
 [  ] 100%
[ tup ] [0.426s] No files to delete.
[ tup ] [0.426s] Checking circular dependencies among groups...
[ tup ] [0.426s] Generating .gitignore files...
[ tup ] [0.547s] Executing Commands...
 1) [0.058s] a: gcc -c main.c -o ..\main.o
 [ ] 100%
[ tup ] [0.730s] Updated.

>tup generate s.sh
.tup repository initialized.
Scanning...
fchdir: Invalid argument

>

This particular example uses the test case from the issue I reported yesterday, but the behavior is identical if I use a different project.

FreddieChopin commented 10 years ago

It seems that in Linux it also has it's problems... For one of my projects it doesn't work there either.

$ tup generate script.sh
.tup repository initialized.
Scanning...
Reading tup.config...
Parsing...
tup internal error: progress bar is sized incorrectly.
 apps/builtin/registry
tup internal error: progress bar is sized incorrectly.
 apps/builtin
... [many times the same thing]
 nuttx/arch/arm/src/armv7-m
tup internal error: progress bar is sized incorrectly.
* nuttx/arch/arm/src
tup error: Unable to find tup entry for file '/files.mk'
tup error: Failed to parse included file '/files.mk'
tup error: Error parsing Tupfile line 10
  Line was: 'include @(ARCH_CHIP)/files.mk'
$

Another problem is that I have to actually remove all output of the project (as with "make clean" - which doesn't exist for tup (; ), because otherwise tup gives another error:

tup error: Attempting to insert '../../output/test/Mutex/MutexPriorityTestCase.o' as a generated node when it already exists as a different type (normal file). You can do one of two things to fix this:
  1) If this file is really supposed to be created from the command, delete the file from the filesystem and try again.
  2) Change your rule in the Tupfile so you aren't trying to overwrite the file.

On the other hand it works fine (apart from this "progress bar is sized incorrectly" for each Tupfile) for another project, which probably doesn't use any @-variables.

FreddieChopin commented 10 years ago

OK, there's more (;

  1. script produced by "tup generate" (if it works - see above) doesn't have any commands to create directories necessary for the build.
  2. groups are not expanded, so if final linking is done with "%", the script has such string as well - with no way to expand it.
ghost commented 7 years ago

Two years and it's still not fixed

gittup commented 7 years ago

Most of these had been fixed previously:

The progress bar issue is fixed by commit 387fe016738fef7ff1b68bb2d594ab8aacd2acce, tup.config support is available from commit 01ca3415cd8ba090390c51160bedc31db49d6ac9, and @ppannuto added group expansion in issue #249.

I just pushed a fix to make 'tup generate' work on Windows, though it creates a .bat file instead of a .sh file. If a .sh file is what you would prefer on Windows, let me know and we can switch to that (or make it an option and do both). I also added t2204 which tests for mkdir support of generated directories, so hopefully those work now. I haven't tested that extensively, though.

ghost commented 7 years ago

Cool, it works.

ghost commented 7 years ago

It would be great to have an option to generate both sh and bat files.

gittup commented 7 years ago

Alright, I took a stab at having Windows support both .sh (the default) and .bat (if the filename has a ".bat" extension). Grab the latest and give it a shot.

ghost commented 7 years ago

Great, thanks, just what I needed. Seem to work fine. I'll report any bugs if I find any.