replaced ant with gradle
git-svn-id: http://svn.code.sf.net/p/upnp-portmapper/code/branches/gradle@113 2bd42da9-18a5-434a-ad8e-d1ed5d6a128d
This commit is contained in:
parent
2876610905
commit
d2b8a12f28
33
.classpath
33
.classpath
@ -3,34 +3,11 @@
|
|||||||
<classpathentry kind="src" path="src"/>
|
<classpathentry kind="src" path="src"/>
|
||||||
<classpathentry kind="src" path="src_weupnp"/>
|
<classpathentry kind="src" path="src_weupnp"/>
|
||||||
<classpathentry kind="src" path="test"/>
|
<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="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-jxpath-1.1.jar"/>
|
<classpathentry exported="true" kind="con" path="org.springsource.ide.eclipse.gradle.classpathcontainer"/>
|
||||||
<classpathentry kind="lib" path="lib/commons-logging.jar"/>
|
<classpathentry kind="con" path="org.springsource.ide.eclipse.gradle.dsld.classpathcontainer"/>
|
||||||
<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 kind="output" path="bin"/>
|
<classpathentry kind="output" path="bin"/>
|
||||||
</classpath>
|
</classpath>
|
||||||
|
2
.project
2
.project
@ -12,6 +12,8 @@
|
|||||||
</buildCommand>
|
</buildCommand>
|
||||||
</buildSpec>
|
</buildSpec>
|
||||||
<natures>
|
<natures>
|
||||||
|
<nature>org.springsource.ide.eclipse.gradle.core.nature</nature>
|
||||||
<nature>org.eclipse.jdt.core.javanature</nature>
|
<nature>org.eclipse.jdt.core.javanature</nature>
|
||||||
|
<nature>org.eclipse.jdt.groovy.core.groovyNature</nature>
|
||||||
</natures>
|
</natures>
|
||||||
</projectDescription>
|
</projectDescription>
|
||||||
|
@ -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=
|
@ -0,0 +1,3 @@
|
|||||||
|
#org.springsource.ide.eclipse.gradle.core.actions.GradleRefreshPreferences
|
||||||
|
#Sun Jul 14 14:23:33 CEST 2013
|
||||||
|
enableDSLD=true
|
2
.settings/org.eclipse.jdt.groovy.core.prefs
Normal file
2
.settings/org.eclipse.jdt.groovy.core.prefs
Normal file
@ -0,0 +1,2 @@
|
|||||||
|
eclipse.preferences.version=1
|
||||||
|
groovy.compiler.level=20
|
4
.settings/org.eclipse.m2e.core.prefs
Normal file
4
.settings/org.eclipse.m2e.core.prefs
Normal file
@ -0,0 +1,4 @@
|
|||||||
|
activeProfiles=
|
||||||
|
eclipse.preferences.version=1
|
||||||
|
resolveWorkspaceProjects=true
|
||||||
|
version=1
|
35
build.gradle
Normal file
35
build.gradle
Normal 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.
Binary file not shown.
Binary file not shown.
@ -21,8 +21,8 @@ import org.chris.portmapper.gui.PortMapperView;
|
|||||||
import org.chris.portmapper.logging.LogMessageListener;
|
import org.chris.portmapper.logging.LogMessageListener;
|
||||||
import org.chris.portmapper.logging.LogMessageWriter;
|
import org.chris.portmapper.logging.LogMessageWriter;
|
||||||
import org.chris.portmapper.model.PortMappingPreset;
|
import org.chris.portmapper.model.PortMappingPreset;
|
||||||
import org.chris.portmapper.router.IRouter;
|
|
||||||
import org.chris.portmapper.router.AbstractRouterFactory;
|
import org.chris.portmapper.router.AbstractRouterFactory;
|
||||||
|
import org.chris.portmapper.router.IRouter;
|
||||||
import org.chris.portmapper.router.RouterException;
|
import org.chris.portmapper.router.RouterException;
|
||||||
import org.jdesktop.application.ResourceMap;
|
import org.jdesktop.application.ResourceMap;
|
||||||
import org.jdesktop.application.SingleFrameApplication;
|
import org.jdesktop.application.SingleFrameApplication;
|
||||||
@ -62,13 +62,13 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
|
|
||||||
loadSettings();
|
loadSettings();
|
||||||
|
|
||||||
PortMapperView view = new PortMapperView();
|
final PortMapperView view = new PortMapperView();
|
||||||
addExitListener(new ExitListener() {
|
addExitListener(new ExitListener() {
|
||||||
public boolean canExit(EventObject arg0) {
|
public boolean canExit(final EventObject arg0) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void willExit(EventObject arg0) {
|
public void willExit(final EventObject arg0) {
|
||||||
disconnectRouter();
|
disconnectRouter();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@ -84,13 +84,13 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
* the current directory, use this as the configuration directory.
|
* the current directory, use this as the configuration directory.
|
||||||
*/
|
*/
|
||||||
private void setCustomConfigDir() {
|
private void setCustomConfigDir() {
|
||||||
String customConfigurationDir = System
|
final String customConfigurationDir = System
|
||||||
.getProperty(CONFIG_DIR_PROPERTY_NAME);
|
.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
|
// the property is set: check, if the given directory can be used
|
||||||
if (customConfigurationDir != null) {
|
if (customConfigurationDir != null) {
|
||||||
File dir = new File(customConfigurationDir);
|
final File dir = new File(customConfigurationDir);
|
||||||
if (!dir.isDirectory()) {
|
if (!dir.isDirectory()) {
|
||||||
logger.error("Custom configuration directory '"
|
logger.error("Custom configuration directory '"
|
||||||
+ customConfigurationDir + "' is not a directory.");
|
+ customConfigurationDir + "' is not a directory.");
|
||||||
@ -131,7 +131,7 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
try {
|
try {
|
||||||
settings = (Settings) getContext().getLocalStorage().load(
|
settings = (Settings) getContext().getLocalStorage().load(
|
||||||
SETTINGS_FILENAME);
|
SETTINGS_FILENAME);
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {
|
||||||
logger.warn("Could not load settings from file", e);
|
logger.warn("Could not load settings from file", e);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -145,13 +145,14 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void initTextAreaLogger() {
|
private void initTextAreaLogger() {
|
||||||
WriterAppender writerAppender = (WriterAppender) Logger.getLogger(
|
final WriterAppender writerAppender = (WriterAppender) Logger
|
||||||
"org.chris.portmapper").getAppender("jtextarea");
|
.getLogger("org.chris.portmapper").getAppender("jtextarea");
|
||||||
logWriter = new LogMessageWriter();
|
logWriter = new LogMessageWriter();
|
||||||
|
// FIXME: null check
|
||||||
writerAppender.setWriter(logWriter);
|
writerAppender.setWriter(logWriter);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogMessageListener(LogMessageListener listener) {
|
public void setLogMessageListener(final LogMessageListener listener) {
|
||||||
this.logWriter.registerListener(listener);
|
this.logWriter.registerListener(listener);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -161,14 +162,14 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
logger.debug("Saving settings " + settings + " to file "
|
logger.debug("Saving settings " + settings + " to file "
|
||||||
+ SETTINGS_FILENAME);
|
+ SETTINGS_FILENAME);
|
||||||
if (logger.isTraceEnabled()) {
|
if (logger.isTraceEnabled()) {
|
||||||
for (PortMappingPreset preset : settings.getPresets()) {
|
for (final PortMappingPreset preset : settings.getPresets()) {
|
||||||
logger.trace("Saving port mapping "
|
logger.trace("Saving port mapping "
|
||||||
+ preset.getCompleteDescription());
|
+ preset.getCompleteDescription());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
getContext().getLocalStorage().save(settings, SETTINGS_FILENAME);
|
getContext().getLocalStorage().save(settings, SETTINGS_FILENAME);
|
||||||
} catch (IOException e) {
|
} catch (final IOException e) {
|
||||||
logger.warn("Could not save settings to file", e);
|
logger.warn("Could not save settings to file", e);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -194,7 +195,7 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
AbstractRouterFactory routerFactory;
|
AbstractRouterFactory routerFactory;
|
||||||
try {
|
try {
|
||||||
routerFactory = createRouterFactory();
|
routerFactory = createRouterFactory();
|
||||||
} catch (RouterException e) {
|
} catch (final RouterException e) {
|
||||||
logger.error("Could not create router factory", e);
|
logger.error("Could not create router factory", e);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@ -241,9 +242,9 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
logger.info("Creating router factory for class "
|
logger.info("Creating router factory for class "
|
||||||
+ settings.getRouterFactoryClassName());
|
+ settings.getRouterFactoryClassName());
|
||||||
try {
|
try {
|
||||||
routerFactoryClass = (Class<AbstractRouterFactory>) Class.forName(settings
|
routerFactoryClass = (Class<AbstractRouterFactory>) Class
|
||||||
.getRouterFactoryClassName());
|
.forName(settings.getRouterFactoryClassName());
|
||||||
} catch (ClassNotFoundException e1) {
|
} catch (final ClassNotFoundException e1) {
|
||||||
throw new RouterException(
|
throw new RouterException(
|
||||||
"Did not find router factory class for name "
|
"Did not find router factory class for name "
|
||||||
+ settings.getRouterFactoryClassName(), e1);
|
+ settings.getRouterFactoryClassName(), e1);
|
||||||
@ -254,7 +255,7 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
+ routerFactoryClass);
|
+ routerFactoryClass);
|
||||||
try {
|
try {
|
||||||
routerFactory = routerFactoryClass.newInstance();
|
routerFactory = routerFactoryClass.newInstance();
|
||||||
} catch (Exception e) {
|
} catch (final Exception e) {
|
||||||
throw new RouterException(
|
throw new RouterException(
|
||||||
"Could not create a router factory for name "
|
"Could not create a router factory for name "
|
||||||
+ settings.getRouterFactoryClassName(), e);
|
+ settings.getRouterFactoryClassName(), e);
|
||||||
@ -313,7 +314,7 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
logger.warn("Did not get IP of localhost from network interface");
|
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.", e);
|
||||||
logger.warn("Could not get address of localhost. Please enter it manually.");
|
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
|
final List<NetworkInterface> networkInterfaces = Collections
|
||||||
.list(NetworkInterface.getNetworkInterfaces());
|
.list(NetworkInterface.getNetworkInterfaces());
|
||||||
logger.trace("Found network interfaces " + networkInterfaces);
|
logger.trace("Found network interfaces " + networkInterfaces);
|
||||||
for (NetworkInterface nInterface : networkInterfaces) {
|
for (final NetworkInterface nInterface : networkInterfaces) {
|
||||||
if (nInterface.isLoopback()) {
|
if (nInterface.isLoopback()) {
|
||||||
logger.debug("Found loopback network interface "
|
logger.debug("Found loopback network interface "
|
||||||
+ nInterface.getDisplayName() + "/"
|
+ nInterface.getDisplayName() + "/"
|
||||||
@ -365,13 +366,13 @@ public class PortMapperApp extends SingleFrameApplication {
|
|||||||
+ " has no addresses.");
|
+ " has no addresses.");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} catch (SocketException e) {
|
} catch (final SocketException e) {
|
||||||
throw new RouterException("Did not get network interfaces.", e);
|
throw new RouterException("Did not get network interfaces.", e);
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setLogLevel(String logLevel) {
|
public void setLogLevel(final String logLevel) {
|
||||||
Logger.getLogger("org.chris.portmapper").setLevel(
|
Logger.getLogger("org.chris.portmapper").setLevel(
|
||||||
Level.toLevel(logLevel));
|
Level.toLevel(logLevel));
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user