Skip to content

Commit c69d516

Browse files
committed
re-introduce a parent pom and add the ant and maven plugins
1 parent 7c8ba98 commit c69d516

File tree

113 files changed

+925
-204
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

113 files changed

+925
-204
lines changed

.project

+23
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>webinloop-parent</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.maven.ide.eclipse.maven2Builder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.eclipse.m2e.core.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
</buildSpec>
19+
<natures>
20+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
21+
<nature>org.maven.ide.eclipse.maven2Nature</nature>
22+
</natures>
23+
</projectDescription>

ant-webinloop-task/.classpath

+37
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<classpath>
3+
<classpathentry kind="src" output="target/classes" path="src/main/java">
4+
<attributes>
5+
<attribute name="optional" value="true"/>
6+
<attribute name="maven.pomderived" value="true"/>
7+
</attributes>
8+
</classpathentry>
9+
<classpathentry excluding="**" kind="src" output="target/classes" path="src/main/resources">
10+
<attributes>
11+
<attribute name="maven.pomderived" value="true"/>
12+
</attributes>
13+
</classpathentry>
14+
<classpathentry kind="src" output="target/test-classes" path="src/test/java">
15+
<attributes>
16+
<attribute name="optional" value="true"/>
17+
<attribute name="maven.pomderived" value="true"/>
18+
</attributes>
19+
</classpathentry>
20+
<classpathentry excluding="**" kind="src" output="target/test-classes" path="src/test/resources">
21+
<attributes>
22+
<attribute name="maven.pomderived" value="true"/>
23+
</attributes>
24+
</classpathentry>
25+
<classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
26+
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6">
27+
<attributes>
28+
<attribute name="maven.pomderived" value="true"/>
29+
</attributes>
30+
</classpathentry>
31+
<classpathentry kind="con" path="org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER">
32+
<attributes>
33+
<attribute name="maven.pomderived" value="true"/>
34+
</attributes>
35+
</classpathentry>
36+
<classpathentry kind="output" path="target/classes"/>
37+
</classpath>

ant-webinloop-task/.project

+29
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<projectDescription>
3+
<name>ant-webinloop-task</name>
4+
<comment></comment>
5+
<projects>
6+
</projects>
7+
<buildSpec>
8+
<buildCommand>
9+
<name>org.eclipse.jdt.core.javabuilder</name>
10+
<arguments>
11+
</arguments>
12+
</buildCommand>
13+
<buildCommand>
14+
<name>org.maven.ide.eclipse.maven2Builder</name>
15+
<arguments>
16+
</arguments>
17+
</buildCommand>
18+
<buildCommand>
19+
<name>org.eclipse.m2e.core.maven2Builder</name>
20+
<arguments>
21+
</arguments>
22+
</buildCommand>
23+
</buildSpec>
24+
<natures>
25+
<nature>org.eclipse.m2e.core.maven2Nature</nature>
26+
<nature>org.eclipse.jdt.core.javanature</nature>
27+
<nature>org.maven.ide.eclipse.maven2Nature</nature>
28+
</natures>
29+
</projectDescription>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#Mon Jul 27 15:00:54 CEST 2009
2+
activeProfiles=
3+
eclipse.preferences.version=1
4+
fullBuildGoals=process-test-resources
5+
includeModules=false
6+
resolveWorkspaceProjects=true
7+
resourceFilterGoals=process-resources resources\:testResources
8+
skipCompilerPlugin=true
9+
version=1

ant-webinloop-task/build.xml

+20
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?xml version="1.0" encoding="ISO-8859-1"?>
2+
<project name="WebInLoopTask" basedir="." default="jar">
3+
4+
<property name="src.dir" value="src/main/java" />
5+
<property name="classes.dir" value="target/classes" />
6+
7+
<target name="clean" description="Delete all generated files">
8+
<delete dir="${classes.dir}" failonerror="false" />
9+
<delete file="${ant.project.name}.jar" />
10+
</target>
11+
12+
<target name="compile" description="Compiles the Task">
13+
<mkdir dir="${classes.dir}" />
14+
<javac srcdir="${src.dir}" destdir="${classes.dir}" />
15+
</target>
16+
17+
<target name="jar" description="JARs the Task" depends="compile">
18+
<jar destfile="${ant.project.name}.jar" basedir="${classes.dir}" />
19+
</target>
20+
</project>

ant-webinloop-task/pom.xml

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
<!--
2+
DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3+
4+
Copyright 2009-2011 by sprylab technologies GmbH
5+
6+
WebInLoop - a program for testing web applications
7+
8+
This file is part of WebInLoop.
9+
10+
WebInLoop is free software: you can redistribute it and/or modify
11+
it under the terms of the GNU Lesser General Public License version 3
12+
only, as published by the Free Software Foundation.
13+
14+
WebInLoop is distributed in the hope that it will be useful,
15+
but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
GNU Lesser General Public License version 3 for more details
18+
(a copy is included in the LICENSE file that accompanied this code).
19+
20+
You should have received a copy of the GNU Lesser General Public License
21+
version 3 along with WebInLoop. If not, see
22+
<http://www.gnu.org/licenses/lgpl-3.0.html>
23+
for a copy of the LGPLv3 License.
24+
-->
25+
26+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
27+
<modelVersion>4.0.0</modelVersion>
28+
29+
<parent>
30+
<groupId>com.sprylab.webinloop</groupId>
31+
<artifactId>webinloop-parent</artifactId>
32+
<version>0.8.4</version>
33+
</parent>
34+
35+
<artifactId>ant-webinloop-task</artifactId>
36+
37+
<dependencies>
38+
<dependency>
39+
<groupId>org.apache.ant</groupId>
40+
<artifactId>ant</artifactId>
41+
</dependency>
42+
<dependency>
43+
<groupId>com.sprylab.webinloop</groupId>
44+
<artifactId>webinloop</artifactId>
45+
</dependency>
46+
</dependencies>
47+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
/*******************************************************************************
2+
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3+
*
4+
* Copyright 2009 by sprylab technologies GmbH
5+
*
6+
* WebInLoop - a program for testing web applications
7+
*
8+
* This file is part of WebInLoop.
9+
*
10+
* WebInLoop is free software: you can redistribute it and/or modify
11+
* it under the terms of the GNU Lesser General Public License version 3
12+
* only, as published by the Free Software Foundation.
13+
*
14+
* WebInLoop is distributed in the hope that it will be useful,
15+
* but WITHOUT ANY WARRANTY; without even the implied warranty of
16+
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17+
* GNU Lesser General Public License version 3 for more details
18+
* (a copy is included in the LICENSE file that accompanied this code).
19+
*
20+
* You should have received a copy of the GNU Lesser General Public License
21+
* version 3 along with WebInLoop. If not, see
22+
* <http://www.gnu.org/licenses/lgpl-3.0.html>
23+
* for a copy of the LGPLv3 License.
24+
******************************************************************************/
25+
26+
package com.sprylab.webinloop.ant_webinloop_task;
27+
28+
import java.io.File;
29+
import java.util.ArrayList;
30+
import java.util.HashSet;
31+
import java.util.List;
32+
import java.util.Set;
33+
34+
import org.apache.tools.ant.BuildException;
35+
import org.apache.tools.ant.Task;
36+
import org.apache.tools.ant.types.Path;
37+
38+
import com.sprylab.webinloop.WebInLoop;
39+
40+
/**
41+
* Ant task that executes WebInLoop.
42+
*
43+
* @author rzimmer
44+
*
45+
*/
46+
public class WebInLoopTask extends Task {
47+
48+
private File configDir;
49+
50+
private boolean debugMode;
51+
52+
private List<Path> inputFiles = new ArrayList<Path>();
53+
54+
private File outputDir;
55+
56+
private boolean translatorMode;
57+
58+
/**
59+
* Adds a path to the inputFiles list.
60+
*
61+
* @param path
62+
* the path to add
63+
*/
64+
public void addPath(Path path) {
65+
inputFiles.add(path);
66+
}
67+
68+
/*
69+
* (non-Javadoc)
70+
*
71+
* @see org.apache.tools.ant.Task#execute()
72+
*/
73+
public void execute() throws BuildException {
74+
try {
75+
WebInLoop webInLoop = new WebInLoop();
76+
77+
// configure WebInLoop
78+
webInLoop.setTranslatorMode(translatorMode);
79+
webInLoop.setDebugMode(debugMode);
80+
webInLoop.setOutputDir(outputDir);
81+
webInLoop.setConfigDir(configDir);
82+
webInLoop.setInputFiles(toFileList(inputFiles));
83+
84+
// execute WebInLoop
85+
try {
86+
webInLoop.start();
87+
} catch (Exception e) {
88+
e.printStackTrace();
89+
}
90+
} catch (Exception e) {
91+
throw new BuildException(e);
92+
}
93+
}
94+
95+
/**
96+
* @param configDir
97+
* the configDir to set
98+
*/
99+
public void setConfigDir(File configDir) {
100+
this.configDir = configDir;
101+
}
102+
103+
/**
104+
* @param debugMode
105+
* the debugMode to set
106+
*/
107+
public void setDebugMode(boolean debugMode) {
108+
this.debugMode = debugMode;
109+
}
110+
111+
/**
112+
* @param inputFiles
113+
* the inputFiles to set
114+
*/
115+
public void setInputFiles(List<Path> inputFiles) {
116+
this.inputFiles = inputFiles;
117+
}
118+
119+
/**
120+
* @param outputDir
121+
* the outputDir to set
122+
*/
123+
public void setOutputDir(File outputDir) {
124+
this.outputDir = outputDir;
125+
}
126+
127+
/**
128+
* @param translatorMode
129+
* the translatorMode to set
130+
*/
131+
public void setTranslatorMode(boolean translatorMode) {
132+
this.translatorMode = translatorMode;
133+
}
134+
135+
public List<File> toFileList(List<Path> paths) {
136+
// using set to avoid duplicates
137+
Set<File> files = new HashSet<File>();
138+
139+
for (Path path : paths) {
140+
String[] fileNames = path.list();
141+
for (int i = 0; i < fileNames.length; i++) {
142+
File file = new File(fileNames[i]);
143+
if (file.exists()) {
144+
files.add(file);
145+
}
146+
}
147+
}
148+
149+
return new ArrayList<File>(files);
150+
}
151+
}

0 commit comments

Comments
 (0)