<< Defining a web archive (war) | ^ Site index ^ | ^ Tutorial index ^ | Using a module of the workspace in the build >>

This chapter continues from where Creating the workspace definition left us.

(Code) from github

First we add the iwant github plugin to the project.

~/iwant-tutorial $ $EDITOR "as-iwant-tutorial-developer/i-have/wsdefdef/src/main/java/com/example/wsdefdef/IwantTutorialWorkspaceProvider.java"
package com.example.wsdefdef;
import net.sf.iwant.api.javamodules.JavaSrcModule;
import net.sf.iwant.api.wsdef.IwantWorkspaceProvider;
import net.sf.iwant.api.wsdef.WorkspaceDefinitionContext;
public class IwantTutorialWorkspaceProvider implements IwantWorkspaceProvider {
@Override
public JavaSrcModule workspaceModule(WorkspaceDefinitionContext ctx) {
return JavaSrcModule.with().name("iwant-tutorial-wsdef")
return JavaSrcModule
.with()
.name("iwant-tutorial-wsdef")
.locationUnderWsRoot("as-iwant-tutorial-developer/i-have/wsdef")
.mainJava("src/main/java").mainDeps(ctx.iwantApiModules())
.mainDeps(ctx.wsdefdefModule()).end();
.mainDeps(ctx.wsdefdefModule())
.mainDeps(ctx.iwantPlugin().github().withDependencies()).end();
}
@Override
public String workspaceClassname() {
return "com.example.wsdef.IwanttutorialWorkspace";
}
}

We refresh eclipse settings so we can use the plugin in our workspace definition.

~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/side-effect/eclipse-settings/effective
(0/1 S~ net.sf.iwant.api.javamodules.JavaClasses iwant-tutorial-wsdefdef-main-classes)
(0/1 D! net.sf.iwant.core.download.SvnExported iwant-plugin-github-main-java)
svn exporting (may take a while) https://svn.code.sf.net/p/iwant/code/trunk/optional/iwant-plugin-github/src/main/java@796
(0/1 D! net.sf.iwant.core.download.SvnExported iwant-plugin-ant-main-java)
svn exporting (may take a while) https://svn.code.sf.net/p/iwant/code/trunk/optional/iwant-plugin-ant/src/main/java@796
(0/1 D! net.sf.iwant.core.download.Downloaded ant-1.9.4.jar)
(0/1 D! net.sf.iwant.core.download.Downloaded ant-launcher-1.9.4.jar)
(0/1 D! net.sf.iwant.api.javamodules.JavaClasses iwant-plugin-ant)
(0/1 D! net.sf.iwant.api.javamodules.JavaClasses iwant-plugin-github)
(0/1 D~ net.sf.iwant.api.javamodules.JavaClasses iwant-tutorial-wsdef-main-classes)
(0/1 D! net.sf.iwant.api.core.Concatenated eclipse-settings.bin-refs)
(as-iwant-tutorial-developer/i-have/wsdef)
( .project)
( .classpath)
( .settings/org.eclipse.jdt.core.prefs)
( .settings/org.eclipse.jdt.ui.prefs)
(as-iwant-tutorial-developer/i-have/wsdefdef)
( .project)
( .classpath)
( .settings/org.eclipse.jdt.core.prefs)
( .settings/org.eclipse.jdt.ui.prefs)

After refreshing eclipse we define a java classes target compiled from sources gotten from github.

~/iwant-tutorial $ $EDITOR "as-iwant-tutorial-developer/i-have/wsdef/src/main/java/com/example/wsdef/IwanttutorialWorkspace.java"
package com.example.wsdef;
import java.util.Arrays;
import java.util.List;
import net.sf.iwant.api.core.HelloTarget;
import net.sf.iwant.api.model.SideEffect;
import net.sf.iwant.api.model.Target;
import net.sf.iwant.api.wsdef.IwantWorkspace;
import net.sf.iwant.api.wsdef.SideEffectDefinitionContext;
import net.sf.iwant.eclipsesettings.EclipseSettings;
import net.sf.iwant.plugin.github.FromGithub;
public class IwanttutorialWorkspace implements IwantWorkspace {
@Override
public List<? extends Target> targets() {
return Arrays.asList(new HelloTarget("hello", "hello from iwant\n"));
return Arrays.asList(new HelloTarget("hello", "hello from iwant\n"),
jouluCode());
}
public Target jouluCode() {
return FromGithub.user("wipu").project("joulu")
.commit("1e913b69b31b145cebf89f5e7821060ddecc8f38");
}
@Override
public List<? extends SideEffect> sideEffects(
SideEffectDefinitionContext ctx) {
return Arrays
.asList(EclipseSettings
.with()
.name("eclipse-settings")
.modules(ctx.wsdefdefJavaModule(),
ctx.wsdefJavaModule()).end());
}
}
~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/list-of/targets
(0/1 S~ net.sf.iwant.api.javamodules.JavaClasses iwant-tutorial-wsdef-main-classes)
hello
joulu-code
~/iwant-tutorial $ as-iwant-tutorial-developer/with/bash/iwant/target/joulu-code/as-path
(0/1 D! net.sf.iwant.core.download.Downloaded joulu-code.zip)
(0/1 D! net.sf.iwant.plugin.ant.Unzipped joulu-code.zip.unzipped)
Expanding: /home/hacker/.net.sf.iwant/cached/UnmodifiableUrl/https%3A/%2Fgithub.com/wipu/joulu/archive/1e913b69b31b145cebf89f5e7821060ddecc8f38.zip into /home/hacker/iwant-tutorial/as-iwant-tutorial-developer/.i-cached/target/joulu-code.zip.unzipped
(0/1 D! net.sf.iwant.api.core.SubPath joulu-code)
/home/hacker/iwant-tutorial/as-iwant-tutorial-developer/.i-cached/target/joulu-code
~/iwant-tutorial $ ls as-iwant-tutorial-developer/.i-cached/target/joulu-code
LICENSE
README.md
as-joulu-developer
byte-consumer
byte-producer
byte-producers
collections
equivalence
optional
stories
strongly-typed
unsigned-byte
Output asserted
<< Defining a web archive (war) | ^ Site index ^ | ^ Tutorial index ^ | Using a module of the workspace in the build >>