replaced ant with gradle

git-svn-id: http://svn.code.sf.net/p/upnp-portmapper/code/branches/gradle@113 2bd42da9-18a5-434a-ad8e-d1ed5d6a128d
master
christoph 2013-07-14 13:14:24 +00:00
parent 2876610905
commit d2b8a12f28
31 changed files with 78 additions and 50 deletions

View File

@ -3,34 +3,11 @@
<classpathentry kind="src" path="src"/>
<classpathentry kind="src" path="src_weupnp"/>
<classpathentry kind="src" path="test"/>
<classpathentry kind="src" path="resources"/>
<classpathentry kind="con" path="GROOVY_DSL_SUPPORT"/>
<classpathentry kind="con" path="GROOVY_SUPPORT"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="lib" path="lib/commons-jxpath-1.1.jar"/>
<classpathentry kind="lib" path="lib/commons-logging.jar"/>
<classpathentry kind="lib" path="lib/log4j-1.2.15.jar">
<attributes>
<attribute name="javadoc_location" value="http://logging.apache.org/log4j/1.2/apidocs/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/sbbi-upnplib-1.0.4.jar" sourcepath="/SBBI UPnP/src"/>
<classpathentry kind="lib" path="lib/AppFramework-1.03.jar" sourcepath="lib/source/AppFramework-1.03-src.zip">
<attributes>
<attribute name="javadoc_location" value="https://appframework.dev.java.net/nonav/javadoc/AppFramework-1.03"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/swing-worker.jar"/>
<classpathentry kind="lib" path="lib/BrowserLauncher2-1_3.jar">
<attributes>
<attribute name="javadoc_location" value="http://browserlaunch2.sourceforge.net/api"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/miglayout-3.7.2.jar"/>
<classpathentry kind="lib" path="lib/commons-cli-1.2.jar" sourcepath="lib/source/commons-cli-1.2-sources.jar">
<attributes>
<attribute name="javadoc_location" value="http://commons.apache.org/cli/api-release/"/>
</attributes>
</classpathentry>
<classpathentry kind="lib" path="lib/test/hamcrest-core-1.3.jar" sourcepath="lib/source/hamcrest-core-1.3-sources.jar"/>
<classpathentry kind="lib" path="lib/test/junit-4.11.jar" sourcepath="lib/source/junit-4.11-sources.jar"/>
<classpathentry kind="lib" path="lib/test/mockito-all-1.9.5.jar" sourcepath="lib/test/mockito-all-1.9.5.jar"/>
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
<classpathentry kind="con" path="org.springsource.ide.eclipse.gradle.dsld.classpathcontainer"/>
<classpathentry kind="output" path="bin"/>
</classpath>

View File

@ -12,6 +12,8 @@
</buildCommand>
</buildSpec>
<natures>
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
<nature>org.eclipse.jdt.core.javanature</nature>
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
</natures>
</projectDescription>

View File

@ -0,0 +1,4 @@
#org.springsource.ide.eclipse.gradle.core.preferences.GradleProjectPreferences
#Sun Jul 14 14:23:32 CEST 2013
org.springsource.ide.eclipse.gradle.linkedresources=
org.springsource.ide.eclipse.gradle.rootprojectloc=

View File

@ -0,0 +1,3 @@
#org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences
#Sun Jul 14 14:23:33 CEST 2013
enableDSLD=true

View File

@ -0,0 +1,2 @@
eclipse.preferences.version=1
groovy.compiler.level=20

View File

@ -0,0 +1,4 @@
activeProfiles=
eclipse.preferences.version=1
resolveWorkspaceProjects=true
version=1

35
build.gradle Normal file
View File

@ -0,0 +1,35 @@
apply plugin: 'java'
apply plugin:'application'
mainClassName = 'org.chris.portmapper.PortMapperStarter'
sourceSets {
main {
java {
srcDir 'src'
srcDir 'src_weupnp'
}
resources { srcDir 'resources' }
}
test {
java { srcDir 'test' }
}
}
repositories {
flatDir { dirs 'lib' }
mavenCentral()
}
dependencies {
testCompile 'junit:junit:4.11'
testCompile 'org.mockito:mockito-core:1.9.5'
compile 'commons-cli:commons-cli:1.2'
compile 'log4j:log4j:1.2.17'
compile 'commons-logging:commons-logging-api:1.1'
compile 'com.miglayout:miglayout:3.7.4'
compile 'net.java.dev.appframework:appframework:1.03'
compile 'edu.stanford.ejalbert:BrowserLauncher2:1.3'
compile ':sbbi-upnplib:1.0.4'
runtime 'commons-jxpath:commons-jxpath:1.1' // sbbi
}

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -21,8 +21,8 @@ import org.chris.portmapper.gui.PortMapperView;
import org.chris.portmapper.logging.LogMessageListener;
import org.chris.portmapper.logging.LogMessageWriter;
import org.chris.portmapper.model.PortMappingPreset;
import org.chris.portmapper.router.IRouter;
import org.chris.portmapper.router.AbstractRouterFactory;
import org.chris.portmapper.router.IRouter;
import org.chris.portmapper.router.RouterException;
import org.jdesktop.application.ResourceMap;
import org.jdesktop.application.SingleFrameApplication;
@ -62,13 +62,13 @@ public class PortMapperApp extends SingleFrameApplication {
loadSettings();
PortMapperView view = new PortMapperView();
final PortMapperView view = new PortMapperView();
addExitListener(new ExitListener() {
public boolean canExit(EventObject arg0) {
public boolean canExit(final EventObject arg0) {
return true;
}
public void willExit(EventObject arg0) {
public void willExit(final EventObject arg0) {
disconnectRouter();
}
});
@ -84,13 +84,13 @@ public class PortMapperApp extends SingleFrameApplication {
* the current directory, use this as the configuration directory.
*/
private void setCustomConfigDir() {
String customConfigurationDir = System
final String customConfigurationDir = System
.getProperty(CONFIG_DIR_PROPERTY_NAME);
File portableAppConfigDir = new File("PortMapperConf");
final File portableAppConfigDir = new File("PortMapperConf");
// the property is set: check, if the given directory can be used
if (customConfigurationDir != null) {
File dir = new File(customConfigurationDir);
final File dir = new File(customConfigurationDir);
if (!dir.isDirectory()) {
logger.error("Custom configuration directory '"
+ customConfigurationDir + "' is not a directory.");
@ -131,7 +131,7 @@ public class PortMapperApp extends SingleFrameApplication {
try {
settings = (Settings) getContext().getLocalStorage().load(
SETTINGS_FILENAME);
} catch (IOException e) {
} catch (final IOException e) {
logger.warn("Could not load settings from file", e);
}
@ -145,13 +145,14 @@ public class PortMapperApp extends SingleFrameApplication {
}
private void initTextAreaLogger() {
WriterAppender writerAppender = (WriterAppender) Logger.getLogger(
"org.chris.portmapper").getAppender("jtextarea");
final WriterAppender writerAppender = (WriterAppender) Logger
.getLogger("org.chris.portmapper").getAppender("jtextarea");
logWriter = new LogMessageWriter();
// FIXME: null check
writerAppender.setWriter(logWriter);
}
public void setLogMessageListener(LogMessageListener listener) {
public void setLogMessageListener(final LogMessageListener listener) {
this.logWriter.registerListener(listener);
}
@ -161,14 +162,14 @@ public class PortMapperApp extends SingleFrameApplication {
logger.debug("Saving settings " + settings + " to file "
+ SETTINGS_FILENAME);
if (logger.isTraceEnabled()) {
for (PortMappingPreset preset : settings.getPresets()) {
for (final PortMappingPreset preset : settings.getPresets()) {
logger.trace("Saving port mapping "
+ preset.getCompleteDescription());
}
}
try {
getContext().getLocalStorage().save(settings, SETTINGS_FILENAME);
} catch (IOException e) {
} catch (final IOException e) {
logger.warn("Could not save settings to file", e);
}
}
@ -194,7 +195,7 @@ public class PortMapperApp extends SingleFrameApplication {
AbstractRouterFactory routerFactory;
try {
routerFactory = createRouterFactory();
} catch (RouterException e) {
} catch (final RouterException e) {
logger.error("Could not create router factory", e);
return;
}
@ -241,9 +242,9 @@ public class PortMapperApp extends SingleFrameApplication {
logger.info("Creating router factory for class "
+ settings.getRouterFactoryClassName());
try {
routerFactoryClass = (Class<AbstractRouterFactory>) Class.forName(settings
.getRouterFactoryClassName());
} catch (ClassNotFoundException e1) {
routerFactoryClass = (Class<AbstractRouterFactory>) Class
.forName(settings.getRouterFactoryClassName());
} catch (final ClassNotFoundException e1) {
throw new RouterException(
"Did not find router factory class for name "
+ settings.getRouterFactoryClassName(), e1);
@ -254,7 +255,7 @@ public class PortMapperApp extends SingleFrameApplication {
+ routerFactoryClass);
try {
routerFactory = routerFactoryClass.newInstance();
} catch (Exception e) {
} catch (final Exception e) {
throw new RouterException(
"Could not create a router factory for name "
+ settings.getRouterFactoryClassName(), e);
@ -313,7 +314,7 @@ public class PortMapperApp extends SingleFrameApplication {
logger.warn("Did not get IP of localhost from network interface");
}
} catch (RouterException e) {
} catch (final RouterException e) {
logger.warn("Could not get address of localhost.", e);
logger.warn("Could not get address of localhost. Please enter it manually.");
}
@ -330,7 +331,7 @@ public class PortMapperApp extends SingleFrameApplication {
final List<NetworkInterface> networkInterfaces = Collections
.list(NetworkInterface.getNetworkInterfaces());
logger.trace("Found network interfaces " + networkInterfaces);
for (NetworkInterface nInterface : networkInterfaces) {
for (final NetworkInterface nInterface : networkInterfaces) {
if (nInterface.isLoopback()) {
logger.debug("Found loopback network interface "
+ nInterface.getDisplayName() + "/"
@ -365,13 +366,13 @@ public class PortMapperApp extends SingleFrameApplication {
+ " has no addresses.");
}
}
} catch (SocketException e) {
} catch (final SocketException e) {
throw new RouterException("Did not get network interfaces.", e);
}
return null;
}
public void setLogLevel(String logLevel) {
public void setLogLevel(final String logLevel) {
Logger.getLogger("org.chris.portmapper").setLevel(
Level.toLevel(logLevel));
}