This chapter continues from where The command line interface and bootstrapping left us.

Creating the workspace definition

After defining the iwant revision to use, the wizard requested us to describe the workspace by editing a configuration file it created. We'll do so now. We name our workspace "iwant-tutorial" and we also define a fully qualified name for the class that defines the entrypoint to our own build code, the workspace definition definition.

It is advisable to follow the convention of naming the last part of the workspace definition definition package "wsdefdef". It will help iwant to generate a good workspace definition name in the next phase.

~/iwant-tutorial $ $EDITOR "as-iwant-tutorial-developer/i-have/conf/ws-info"
# paths are relative to this file's directory
WSNAME=example
WSNAME=iwant-tutorial
WSROOT=../../..
WSDEFDEF_MODULE=../wsdefdef
WSDEFDEF_CLASS=com.example.wsdefdef.ExampleWorkspaceProvider
WSDEFDEF_CLASS=com.example.wsdefdef.IwantTutorialWorkspaceProvider

We make another wish for help to continue.

~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/help.sh
I created
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/i-have/wsdefdef/src/main/java/com/example/wsdefdef/IwantTutorialWorkspaceProvider.java
and
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/i-have/wsdef/src/main/java/com/example/wsdef/IwanttutorialWorkspaceFactory.java
and
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/i-have/wsdef/src/main/java/com/example/wsdef/IwanttutorialWorkspace.java
Please edit them and rerun me.
If you want to use Eclipse for editing, run /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/with/bash/iwant/side-effect/eclipse-settings/effective first.
Output asserted

Now we have a functional workspace definition, also known as a build script, for our workspace.

As we can see from the output, there is at least one new wish available for us, the side-effect of creating eclipse settings. iwant maintains a bash script, a wish script for each wish defined in the workspace definition. This makes it very convenient to make wishes by using tab.

Let's find out what wish scripts we have.

~/iwant-tutorial $ find as-iwant-tutorial-developer/with/bash/iwant -type f | sort
as-iwant-tutorial-developer/with/bash/iwant/help.sh
as-iwant-tutorial-developer/with/bash/iwant/list-of/side-effects
as-iwant-tutorial-developer/with/bash/iwant/list-of/targets
as-iwant-tutorial-developer/with/bash/iwant/side-effect/eclipse-settings/effective
as-iwant-tutorial-developer/with/bash/iwant/target/hello/as-path
Output asserted

It is advisable to ignore the wish scripts (except for help.sh, the iwant cli) from the version control, since iwant regenerates them at every wish, according to the workspace definition.

Let's end the wizard by wishing for help one more time.

~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/help.sh
(0/1 D! net.sf.iwant.api.javamodules.JavaClasses iwant-tutorial-wsdefdef-main-classes)
(0/1 D! net.sf.iwant.api.javamodules.JavaClasses iwant-tutorial-wsdef-main-classes)
(Using default user preferences (file /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/i-have/conf/user-preferences is missing):
[workerCount=1])
Try /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/with/bash/iwant/list-of/side-effects
or
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/with/bash/iwant/list-of/targets
Output asserted

Configuring the worker thread count

In this tutorial we'll use only one worker thread to keep the output deterministic. You should probably use a bigger number, depending on your machine.

~/iwant-tutorial $ echo workerCount=1 > as-iwant-tutorial-developer/i-have/conf/user-preferences
~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/help.sh
(Using user preferences from file /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/i-have/conf/user-preferences:
[workerCount=1])
Try /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/with/bash/iwant/list-of/side-effects
or
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/with/bash/iwant/list-of/targets
Output asserted