Bug 1088 - Code in scratch directory assumes all modules are enabled
Code in scratch directory assumes all modules are enabled
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: build system
pre-release
All All
: P5 major
Assigned To: Mitch Watrous
:
: 1091 (view as bug list)
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2011-03-31 15:28 EDT by Mitch Watrous
Modified: 2011-04-17 23:09 EDT (History)
4 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Mitch Watrous 2011-03-31 15:28:58 EDT
Waf currently makes code in the scratch directory depend on the set of enabled modules.

The code users place in scratch, however, can depend on any module even if only a few modules have been enabled.

Also, there is no wscript file for the scratch directory to let waf know what modules scratch should depend on.

Therefore, all modules will have to be enabled in waf when there is code in scratch.

One problem with this solution is that there are currently files in the scratch directory in ns-3-dev, which means that all modules will always be enabled until the scratch directory is cleared.

Is it possible to remove these files from ns-3-dev/scratch?
Comment 1 Gustavo J. A. M. Carneiro 2011-04-01 12:51:51 EDT
I'm not sure I agree with "all modules will have to be enabled in waf when there is code in scratch"; maybe we could do the also:

  1- "scratch programs are only built if all modules are enabled"

  2- or just "we always build scratch programs, let the user worry about whether or not the scratch programs are buildable".

You outlined only one option of 3 possible.
Comment 2 Mitch Watrous 2011-04-01 16:25:33 EDT
One idea from Tom is to create (In reply to comment #1)
> I'm not sure I agree with "all modules will have to be enabled in waf when
> there is code in scratch"; maybe we could do the also:
> 
>   1- "scratch programs are only built if all modules are enabled"
> 
>   2- or just "we always build scratch programs, let the user worry about
> whether or not the scratch programs are buildable".
> 
> You outlined only one option of 3 possible.

We could do 2 and use Tom's idea of having the files in ns-3-dev/scratch only depend on core. An example of such a script is hello-simulator.cc in examples/tutorial.

Since every module has to depend on core, the scripts in ns-3-dev/scratch would always be able to be built.
Comment 3 Tom Henderson 2011-04-03 23:42:19 EDT
*** Bug 1091 has been marked as a duplicate of this bug. ***
Comment 4 Mitch Watrous 2011-04-04 12:29:57 EDT
I am proposing to remove the existing scratch programs from Mercurial and then add the following very simple program (scratch-simulator.cc) to the scratch directory that only depends on core:

#include "ns3/core-module.h"

NS_LOG_COMPONENT_DEFINE ("ScratchSimulator");

using namespace ns3;

int 
main (int argc, char *argv[])
{
  NS_LOG_UNCOND ("Scratch Simulator");
}
Comment 5 Tom Henderson 2011-04-06 10:13:45 EDT
(In reply to comment #4)
> I am proposing to remove the existing scratch programs from Mercurial and then
> add the following very simple program (scratch-simulator.cc) to the scratch
> directory that only depends on core:
> 
> #include "ns3/core-module.h"
> 
> NS_LOG_COMPONENT_DEFINE ("ScratchSimulator");
> 
> using namespace ns3;
> 
> int 
> main (int argc, char *argv[])
> {
>   NS_LOG_UNCOND ("Scratch Simulator");
> }

+1
Comment 6 Mitch Watrous 2011-04-17 23:09:09 EDT
Bug closed.

ns-3-dev changeset: 7b2e9458bff1