Rule with multiple actions

Added by Vassilis Poulopoulos almost 6 years ago

Hi,

if I have a rule which includes multiple actions, will the target be considered as updated when ALL actions have completed or when the LAST declared one has completed? Bear in mind that multiple actions are in flight at the same time (i.e. -j 4 or something). I don't know if I've set something up wrong, but it looks like actions are kicked off in the right order, but subsequent targets (which depend on the one with the multiple actions) are kicked off before all the actions are completed!

Thanks,

Vassilis


Replies (1)

RE: Rule with multiple actions - Added by Joshua Jensen almost 6 years ago

Targets that depend on the target with multiple actions will wait until all actions have completed:

The following Jamfile illustrates this:

actions lua Pause {
    require 'ex'
    os.sleep(5)
    print('Done with the wait!')
}

actions lua PauseAgain {
    require 'ex'
    os.sleep(4)
    print('Done with another wait!')
}

actions WriteFile {
    echo Hello, everyone! > $(1)
}

actions CopyFile {
    copy $(2) $(1)
}

Depends all : mycopiedfile.txt : myfile.txt ;

Pause myfile.txt ;
PauseAgain myfile.txt ;
WriteFile myfile.txt ;
CopyFile mycopiedfile.txt : myfile.txt ;

It yields the following output:

*** found 3 target(s)...               
*** updating 2 target(s)...            
Done with the wait!                    
@ Pause myfile.txt                     
Done with another wait!                
@ PauseAgain myfile.txt                
@ WriteFile myfile.txt                 
@ CopyFile mycopiedfile.txt            
        1 file(s) copied.              
*** updated 2 target(s)...             
*** finished in 9.13 sec

How does your circumstance differ?

-Josh

(1-1/1)