Example 2

Compile all Java projects from the ProjectRepository eWos (in this case, an EclipseWorkspace under the Directory wosDir). Put all class files under bin. The compile tasks are run by the TaskExecutor te.

Groovy

import org.entityfs.util.* import org.schmant.project.eclipse.* import org.schmant.run.TaskExecutor import org.schmant.task.jdk.javac.jdk6.Jdk6JavacTF import org.schmant.task.project.JavaWorkspaceBuilderTF // This is a classpath variable used by some of the Eclipse Java projects. // wosLibDir is a Directory variable for a library directory in the Eclipse // workspace. def settings = new EclipseWorkspaceSettings(). addClasspathVariable( "ENTITYFS", Directories.getFileMatching(wosLibDir, "entityfs-*.jar")) // Create the ProjectRepository (an EclipseWorkspace in this example) def eWos = new EclipseWorkspace(wosDir, settings) // Create a task executor and start it def te = new TaskExecutor(). setNumberOfThreads(2). start() try { // Use a JavaWorkspaceBuilderTF to build the workspace new JavaWorkspaceBuilderTF(). setWorkspace(eWos). // // Set the task executor. The task will use the task executor to run the // tasks that it creates for compiling all projects in the workspace setTaskExecutor(te). // // Set a custom factory for the compilation tasks. setCompileTaskFactory( new Jdk6JavacTF(). setTargetVersion("6")). setTarget(bin).run() // Wait for all compilation tasks to complete te.waitFor() } finally { te.shutdown() }

JavaScript

// This is a classpath variable used by some of the Eclipse Java projects. // wosLibDir is a Directory variable for a library directory in the Eclipse // workspace. settings = new EclipseWorkspaceSettings(). addClasspathVariable( "ENTITYFS", Directories.getFileMatching(wosLibDir, "entityfs-*.jar")); // Create the ProjectRepository (an EclipseWorkspace in this example) eWos = new EclipseWorkspace(wosDir, settings); // Create a task executor and start it te = new TaskExecutor(). setNumberOfThreads(2). start(); try { // Use a JavaWorkspaceBuilderTF to build the workspace new JavaWorkspaceBuilderTF(). setWorkspace(eWos). // // Set the task executor. The task will use the task executor to run the // tasks that it creates for compiling all projects in the workspace setTaskExecutor(te). // // Set a custom factory for the compilation tasks. setCompileTaskFactory( new Jdk6JavacTF(). setTargetVersion("6")). setTarget(bin).run(); // Wait for all compilation tasks to complete te.waitFor(); } finally { te.shutdown(); }

JRuby

# This is a classpath variable used by some of the Eclipse Java projects. # wosLibDir is a Directory variable for a library directory in the Eclipse # workspace. settings = Schmant::EclipseWorkspaceSettings.new. addClasspathVariable( "ENTITYFS", Schmant::Directories.getFileMatching($wosLibDir, "entityfs-*.jar")) # Create the ProjectRepository (an EclipseWorkspace in this example) eWos = Schmant::EclipseWorkspace.new($wosDir, settings) # Create a task executor and start it te = Schmant::TaskExecutor.new.start begin # Use a JavaWorkspaceBuilderTF to build the workspace Schmant::JavaWorkspaceBuilderTF.new. setWorkspace(eWos). # # Set the task executor. The task will use the task executor to run the # tasks that it creates for compiling all projects in the workspace setTaskExecutor(te). # # Set a custom factory for the compilation tasks. setCompileTaskFactory( Schmant::Jdk6JavacTF.new. setTargetVersion("6")). setTarget($bin).run # Wait for all compilation tasks to complete te.waitFor ensure te.shutdown end

Jython

# This is a classpath variable used by some of the Eclipse Java projects. # wosLibDir is a Directory variable for a library directory in the Eclipse # workspace. settings = EclipseWorkspaceSettings(). \ addClasspathVariable( "ENTITYFS", \ Directories.getFileMatching(wosLibDir, "entityfs-*.jar")) # Create the ProjectRepository (an EclipseWorkspace in this example) eWos = EclipseWorkspace(wosDir, settings) # Create a task executor and start it te = TaskExecutor(). \ setNumberOfThreads(2). \ start() try: # Use a JavaWorkspaceBuilderTF to build the workspace # # The task will use the task executor that is assigned to it to run # the tasks that it creates for compiling all projects in the workspace # # Use a custom compile task factory JavaWorkspaceBuilderTF(). \ setWorkspace(eWos). \ setTaskExecutor(te). \ setCompileTaskFactory( Jdk6JavacTF(). \ setTargetVersion("6")). \ setTarget(bin).run() # Wait for all compilation tasks to complete te.waitFor() finally: te.shutdown()


* An EntityFS-aware task is implemented using EntityFS. This means that it uses the filter settings of DirectoryView:s and also that it often can work with other file system implementations than File-based, such as the RAM file system.