mirror of
https://github.com/angryip/ipscan.git
synced 2025-10-26 11:18:17 +00:00
exclude windows fetchers/pingers (that rely on JNA) from non-windows builds
This commit is contained in:
parent
e87d409424
commit
b892fc2a04
2
.idea/ipscan.iml
generated
2
.idea/ipscan.iml
generated
@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module external.linked.project.id="ipscan" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="3.7.3-13-g07a0daf.dirty" type="JAVA_MODULE" version="4">
|
||||
<module external.linked.project.id="ipscan" external.linked.project.path="$MODULE_DIR$" external.root.project.path="$MODULE_DIR$" external.system.id="GRADLE" external.system.module.group="" external.system.module.version="3.7.4-7-ge87d409.dirty" type="JAVA_MODULE" version="4">
|
||||
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
||||
<exclude-output />
|
||||
<content url="file://$MODULE_DIR$">
|
||||
|
||||
@ -117,7 +117,10 @@ def packageTask(String platform, def moreLibs = [], Closure doMore) {
|
||||
'com/sun/jna/*/*.a',
|
||||
'com/sun/jna/*/*.so',
|
||||
'com/sun/jna/*/*.jnilib',
|
||||
"com/sun/jna/win32-${platform == 'win32' ? 'x86-64' : platform == 'win64' ? 'x86' : '*'}/*.dll"
|
||||
"com/sun/jna/win32-${platform == 'win32' ? 'x86-64' : platform == 'win64' ? 'x86' : '*'}/*.dll",
|
||||
// Win-specific stuff
|
||||
!platform.startsWith('win') ? 'net/azib/ipscan/core/net/Win*' : '',
|
||||
!platform.startsWith('win') ? 'net/azib/ipscan/fetchers/Win*' : ''
|
||||
)
|
||||
with jar
|
||||
|
||||
@ -139,7 +142,6 @@ def minimizeTask(String platform, Closure doMore) {
|
||||
libraryjars System.getProperty('java.home') + "/jmods/java.logging.jmod"
|
||||
libraryjars System.getProperty('java.home') + "/jmods/java.net.http.jmod"
|
||||
libraryjars System.getProperty('java.home') + "/jmods/java.prefs.jmod"
|
||||
libraryjars 'lib/jna.jar'
|
||||
dontobfuscate
|
||||
dontoptimize
|
||||
dontnote '**'
|
||||
|
||||
@ -28,7 +28,7 @@ import org.eclipse.swt.widgets.Shell;
|
||||
* @author Anton Keks
|
||||
*/
|
||||
public class ComponentRegistry {
|
||||
public void register(Injector i) {
|
||||
public void register(Injector i) throws Exception {
|
||||
Display display = Display.getDefault();
|
||||
i.register(Display.class, display);
|
||||
Shell shell = new Shell();
|
||||
@ -43,13 +43,13 @@ public class ComponentRegistry {
|
||||
i.register(TXTExporter.class, CSVExporter.class, XMLExporter.class, IPListExporter.class);
|
||||
|
||||
i.register(IPFetcher.class, PingFetcher.class, PingTTLFetcher.class, HostnameFetcher.class, PortsFetcher.class);
|
||||
i.register(MACFetcher.class, Platform.WINDOWS ? new WinMACFetcher() : new UnixMACFetcher());
|
||||
i.register(MACFetcher.class, (MACFetcher) Class.forName(MACFetcher.class.getPackage().getName() + (Platform.WINDOWS ? ".WinMACFetcher" : ".UnixMACFetcher")).newInstance());
|
||||
i.register(CommentFetcher.class, FilteredPortsFetcher.class, WebDetectFetcher.class, HTTPSenderFetcher.class,
|
||||
NetBIOSInfoFetcher.class, PacketLossFetcher.class, HTTPProxyFetcher.class, MACVendorFetcher.class);
|
||||
i.register(FeederRegistry.class, i.require(FeederGUIRegistry.class));
|
||||
}
|
||||
|
||||
public Injector init() {
|
||||
public Injector init() throws Exception {
|
||||
Injector i = new Injector();
|
||||
new ConfigModule().register(i);
|
||||
new ComponentRegistry().register(i);
|
||||
|
||||
@ -33,12 +33,13 @@ public class PingerRegistry {
|
||||
/** All available Pinger implementations */
|
||||
Map<String, Class<? extends Pinger>> pingers;
|
||||
|
||||
public PingerRegistry(ScannerConfig scannerConfig) {
|
||||
@SuppressWarnings("unchecked")
|
||||
public PingerRegistry(ScannerConfig scannerConfig) throws ClassNotFoundException {
|
||||
this.scannerConfig = scannerConfig;
|
||||
|
||||
pingers = new LinkedHashMap<>();
|
||||
if (Platform.WINDOWS)
|
||||
pingers.put("pinger.windows", WindowsPinger.class);
|
||||
pingers.put("pinger.windows", (Class<Pinger>) Class.forName(getClass().getPackage().getName() + ".WindowsPinger"));
|
||||
if (Platform.LINUX && Platform.ARCH_64)
|
||||
pingers.put("pinger.icmp", ICMPSharedPinger.class);
|
||||
pingers.put("pinger.udp", UDPPinger.class);
|
||||
|
||||
@ -20,7 +20,7 @@ public class PingerRegistryTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void getRegisteredNames() {
|
||||
public void getRegisteredNames() throws ClassNotFoundException {
|
||||
String[] names = new PingerRegistry(null).getRegisteredNames();
|
||||
assertNotNull(names);
|
||||
for (String name : names) {
|
||||
@ -54,7 +54,7 @@ public class PingerRegistryTest {
|
||||
}
|
||||
|
||||
@Test
|
||||
public void checkSelectedPinger() {
|
||||
public void checkSelectedPinger() throws ClassNotFoundException {
|
||||
ScannerConfig config = Config.getConfig().forScanner();
|
||||
PingerRegistry registry = new PingerRegistry(config);
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user