forked from I2P_Developers/i2p.i2p
Cleaning up the code base, remove dead code and failed attempts.
This commit is contained in:
@@ -5,6 +5,13 @@
|
||||
#include <string.h>
|
||||
#include <memory.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <assert.h>
|
||||
#endif
|
||||
|
||||
#include <Cocoa/Cocoa.h>
|
||||
|
||||
|
||||
@@ -35,8 +42,26 @@
|
||||
@property (copy) NSString* zipFile;
|
||||
@property (copy) NSString* jarFile;
|
||||
@end
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include "JavaHelper.h"
|
||||
|
||||
inline const char* RealHomeDirectory() {
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
assert(pw);
|
||||
return pw->pw_dir;
|
||||
}
|
||||
|
||||
inline std::string getDefaultBaseDir()
|
||||
{
|
||||
// Figure out base directory
|
||||
auto homeDir = RealHomeDirectory();
|
||||
const char* pathFromHome = "%s/Library/I2P";
|
||||
char buffer[strlen(homeDir)+strlen(pathFromHome)];
|
||||
sprintf(buffer, pathFromHome, homeDir);
|
||||
std::string i2pBaseDir(buffer);
|
||||
return i2pBaseDir;
|
||||
}
|
||||
|
||||
inline void sendUserNotification(NSString* title, NSString* informativeText, NSImage* contentImage = NULL, bool makeSound = false) {
|
||||
NSUserNotification *userNotification = [[NSUserNotification alloc] init];
|
||||
|
||||
15
launchers/macosx/Deployer.h
Normal file
15
launchers/macosx/Deployer.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// Deployer.h
|
||||
// I2PLauncher
|
||||
//
|
||||
// Created by Mikal Villa on 19/09/2018.
|
||||
// Copyright © 2018 The I2P Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
|
||||
@interface NSObject ()
|
||||
|
||||
@end
|
||||
|
||||
13
launchers/macosx/Deployer.m
Normal file
13
launchers/macosx/Deployer.m
Normal file
@@ -0,0 +1,13 @@
|
||||
//
|
||||
// Deployer.m
|
||||
// I2PLauncher
|
||||
//
|
||||
// Created by Mikal Villa on 19/09/2018.
|
||||
// Copyright © 2018 The I2P Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
#import "Deployer.h"
|
||||
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
archiveVersion = 1;
|
||||
classes = {
|
||||
};
|
||||
objectVersion = 50;
|
||||
objectVersion = 47;
|
||||
objects = {
|
||||
|
||||
/* Begin PBXBuildFile section */
|
||||
@@ -14,7 +14,6 @@
|
||||
BF1EFA41215141110014EB07 /* RouterTask.mm in Sources */ = {isa = PBXBuildFile; fileRef = BF1EFA3E215141100014EB07 /* RouterTask.mm */; };
|
||||
BF1EFA47215141640014EB07 /* base.zip in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA44215141630014EB07 /* base.zip */; };
|
||||
BF1EFA48215141640014EB07 /* ItoopieTransparent.png in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA45215141640014EB07 /* ItoopieTransparent.png */; };
|
||||
BF1EFA4A215141CD0014EB07 /* NetworkExtension.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF5061932113C6ED0014EB07 /* NetworkExtension.framework */; };
|
||||
BF5061702113C48E0014EB07 /* I2PLauncher.xcdatamodeld in Sources */ = {isa = PBXBuildFile; fileRef = BF50616E2113C48E0014EB07 /* I2PLauncher.xcdatamodeld */; };
|
||||
BF5061722113C4900014EB07 /* Assets.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = BF5061712113C4900014EB07 /* Assets.xcassets */; };
|
||||
BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */ = {isa = PBXBuildFile; fileRef = BF5061732113C4900014EB07 /* UserInterfaces.xib */; };
|
||||
@@ -25,7 +24,12 @@
|
||||
BF53150D2150CE310014EB07 /* DateTimeUtils.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF53150C2150CE310014EB07 /* DateTimeUtils.swift */; };
|
||||
BF5315132150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */; };
|
||||
BF531515215105B40014EB07 /* LogViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF531514215105B40014EB07 /* LogViewController.swift */; };
|
||||
BF650CA92152AC7D0014EB07 /* bumpInfoPlist.sh in Resources */ = {isa = PBXBuildFile; fileRef = BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */; };
|
||||
BF650CAA2152AC7D0014EB07 /* dmgconfig.py in Resources */ = {isa = PBXBuildFile; fileRef = BF650CA62152AC7D0014EB07 /* dmgconfig.py */; };
|
||||
BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */ = {isa = PBXBuildFile; fileRef = BF650CA72152AC7D0014EB07 /* Deployer.m */; };
|
||||
BF7506CB21509CFD0014EB07 /* RouterProcessStatus.swift in Sources */ = {isa = PBXBuildFile; fileRef = BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */; };
|
||||
BF86541321515CA00014EB07 /* launcher.jar in Resources */ = {isa = PBXBuildFile; fileRef = BF1EFA46215141640014EB07 /* launcher.jar */; };
|
||||
BF865417215182820014EB07 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BF865416215182820014EB07 /* Foundation.framework */; };
|
||||
BFBDCAE9215040670014EB07 /* Subprocess.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAE8215040670014EB07 /* Subprocess.swift */; };
|
||||
BFBDCAEB215041630014EB07 /* TaskPipeline.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEA215041630014EB07 /* TaskPipeline.swift */; };
|
||||
BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */; };
|
||||
@@ -39,6 +43,7 @@
|
||||
BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFBDCAFF21505BED0014EB07 /* AppKit.framework */; };
|
||||
BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB01215060190014EB07 /* DetectJava.swift */; };
|
||||
BFBDCB04215060970014EB07 /* StatusBarController.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFBDCB03215060970014EB07 /* StatusBarController.swift */; };
|
||||
BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */; };
|
||||
BFF4581C213C48EA0014EB07 /* EventMonitor.swift in Sources */ = {isa = PBXBuildFile; fileRef = BFF4581B213C48EA0014EB07 /* EventMonitor.swift */; };
|
||||
/* End PBXBuildFile section */
|
||||
|
||||
@@ -62,7 +67,6 @@
|
||||
BF5061742113C4900014EB07 /* Base */ = {isa = PBXFileReference; lastKnownFileType = file.xib; name = Base; path = Base.lproj/UserInterfaces.xib; sourceTree = "<group>"; };
|
||||
BF5061762113C4900014EB07 /* Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
BF5061792113C4900014EB07 /* I2PLauncher.entitlements */ = {isa = PBXFileReference; lastKnownFileType = text.plist.entitlements; path = I2PLauncher.entitlements; sourceTree = "<group>"; };
|
||||
BF5061932113C6ED0014EB07 /* NetworkExtension.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = NetworkExtension.framework; path = System/Library/Frameworks/NetworkExtension.framework; sourceTree = SDKROOT; };
|
||||
BF5061952113C84E0014EB07 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
|
||||
BF5315062150C55B0014EB07 /* RouterRunner.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterRunner.swift; sourceTree = "<group>"; };
|
||||
BF5315082150C6760014EB07 /* RouterDeployer.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterDeployer.swift; sourceTree = "<group>"; };
|
||||
@@ -70,7 +74,13 @@
|
||||
BF53150C2150CE310014EB07 /* DateTimeUtils.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DateTimeUtils.swift; sourceTree = "<group>"; };
|
||||
BF5315122150EB510014EB07 /* RouterProcessStatus+ObjectiveC.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "RouterProcessStatus+ObjectiveC.swift"; sourceTree = "<group>"; };
|
||||
BF531514215105B40014EB07 /* LogViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = LogViewController.swift; sourceTree = "<group>"; };
|
||||
BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.sh; path = bumpInfoPlist.sh; sourceTree = SOURCE_ROOT; };
|
||||
BF650CA62152AC7D0014EB07 /* dmgconfig.py */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.script.python; path = dmgconfig.py; sourceTree = SOURCE_ROOT; };
|
||||
BF650CA72152AC7D0014EB07 /* Deployer.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = Deployer.m; sourceTree = SOURCE_ROOT; };
|
||||
BF650CA82152AC7D0014EB07 /* Deployer.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = Deployer.h; sourceTree = SOURCE_ROOT; };
|
||||
BF7506CA21509CFD0014EB07 /* RouterProcessStatus.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RouterProcessStatus.swift; sourceTree = "<group>"; };
|
||||
BF865414215180F60014EB07 /* libswiftDarwin.tbd */ = {isa = PBXFileReference; lastKnownFileType = "sourcecode.text-based-dylib-definition"; name = libswiftDarwin.tbd; path = System/Library/PrivateFrameworks/Swift/libswiftDarwin.tbd; sourceTree = SDKROOT; };
|
||||
BF865416215182820014EB07 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
|
||||
BFBDCAE8215040670014EB07 /* Subprocess.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = Subprocess.swift; sourceTree = "<group>"; };
|
||||
BFBDCAEA215041630014EB07 /* TaskPipeline.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = TaskPipeline.swift; sourceTree = "<group>"; };
|
||||
BFBDCAEC215041C10014EB07 /* Subprocess+CompactAPI.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Subprocess+CompactAPI.swift"; sourceTree = "<group>"; };
|
||||
@@ -85,6 +95,7 @@
|
||||
BFBDCAFF21505BED0014EB07 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
|
||||
BFBDCB01215060190014EB07 /* DetectJava.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = DetectJava.swift; sourceTree = "<group>"; };
|
||||
BFBDCB03215060970014EB07 /* StatusBarController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StatusBarController.swift; sourceTree = "<group>"; };
|
||||
BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreFoundation.framework; path = System/Library/Frameworks/CoreFoundation.framework; sourceTree = SDKROOT; };
|
||||
BFF45818213C428E0014EB07 /* I2PLauncher-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "I2PLauncher-Bridging-Header.h"; sourceTree = "<group>"; };
|
||||
BFF4581B213C48EA0014EB07 /* EventMonitor.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = EventMonitor.swift; sourceTree = "<group>"; };
|
||||
/* End PBXFileReference section */
|
||||
@@ -94,7 +105,8 @@
|
||||
isa = PBXFrameworksBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BF1EFA4A215141CD0014EB07 /* NetworkExtension.framework in Frameworks */,
|
||||
BFE1CBAD2151908F0014EB07 /* CoreFoundation.framework in Frameworks */,
|
||||
BF865417215182820014EB07 /* Foundation.framework in Frameworks */,
|
||||
BFBDCB0021505BEE0014EB07 /* AppKit.framework in Frameworks */,
|
||||
BF5061962113C84E0014EB07 /* Cocoa.framework in Frameworks */,
|
||||
);
|
||||
@@ -150,6 +162,10 @@
|
||||
BF50616A2113C48E0014EB07 /* I2PLauncher */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BF650CA52152AC7D0014EB07 /* bumpInfoPlist.sh */,
|
||||
BF650CA82152AC7D0014EB07 /* Deployer.h */,
|
||||
BF650CA72152AC7D0014EB07 /* Deployer.m */,
|
||||
BF650CA62152AC7D0014EB07 /* dmgconfig.py */,
|
||||
BF1EFA42215141220014EB07 /* include */,
|
||||
BF1EFA3F215141110014EB07 /* AppDelegate.h */,
|
||||
BF1EFA3C215141100014EB07 /* JavaHelper.h */,
|
||||
@@ -177,9 +193,11 @@
|
||||
BF5061922113C6ED0014EB07 /* Frameworks */ = {
|
||||
isa = PBXGroup;
|
||||
children = (
|
||||
BFE1CBAC2151908F0014EB07 /* CoreFoundation.framework */,
|
||||
BF865416215182820014EB07 /* Foundation.framework */,
|
||||
BF865414215180F60014EB07 /* libswiftDarwin.tbd */,
|
||||
BFBDCAFF21505BED0014EB07 /* AppKit.framework */,
|
||||
BF5061952113C84E0014EB07 /* Cocoa.framework */,
|
||||
BF5061932113C6ED0014EB07 /* NetworkExtension.framework */,
|
||||
);
|
||||
name = Frameworks;
|
||||
sourceTree = "<group>";
|
||||
@@ -236,15 +254,20 @@
|
||||
BF5061602113C48E0014EB07 /* Project object */ = {
|
||||
isa = PBXProject;
|
||||
attributes = {
|
||||
LastUpgradeCheck = 0940;
|
||||
LastUpgradeCheck = 1000;
|
||||
ORGANIZATIONNAME = "The I2P Project";
|
||||
TargetAttributes = {
|
||||
BF5061672113C48E0014EB07 = {
|
||||
CreatedOnToolsVersion = 9.4.1;
|
||||
DevelopmentTeam = DTX4Q6WZN2;
|
||||
LastSwiftMigration = 0940;
|
||||
ProvisioningStyle = Automatic;
|
||||
SystemCapabilities = {
|
||||
com.apple.ApplicationGroups.Mac = {
|
||||
enabled = 0;
|
||||
};
|
||||
com.apple.NetworkExtensions = {
|
||||
enabled = 1;
|
||||
enabled = 0;
|
||||
};
|
||||
com.apple.Sandbox = {
|
||||
enabled = 0;
|
||||
@@ -254,7 +277,7 @@
|
||||
};
|
||||
};
|
||||
buildConfigurationList = BF5061632113C48E0014EB07 /* Build configuration list for PBXProject "I2PLauncher" */;
|
||||
compatibilityVersion = "Xcode 9.3";
|
||||
compatibilityVersion = "Xcode 6.3";
|
||||
developmentRegion = en;
|
||||
hasScannedForEncodings = 0;
|
||||
knownRegions = (
|
||||
@@ -276,6 +299,9 @@
|
||||
isa = PBXResourcesBuildPhase;
|
||||
buildActionMask = 2147483647;
|
||||
files = (
|
||||
BF86541321515CA00014EB07 /* launcher.jar in Resources */,
|
||||
BF650CAA2152AC7D0014EB07 /* dmgconfig.py in Resources */,
|
||||
BF650CA92152AC7D0014EB07 /* bumpInfoPlist.sh in Resources */,
|
||||
BF07789721506C810014EB07 /* Storyboard.storyboard in Resources */,
|
||||
BF5061722113C4900014EB07 /* Assets.xcassets in Resources */,
|
||||
BF5061752113C4900014EB07 /* UserInterfaces.xib in Resources */,
|
||||
@@ -298,7 +324,7 @@
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
shellPath = /bin/sh;
|
||||
shellScript = "# Run from launchers/macosx\nexport BUILDDIR=$(pwd)\ncd ../..\nant preppkg-osx\ncd pkg-temp\nrm -f ../base.zip\nzip -r7 ../base.zip *\ncp ../base.zip $BUILDDIR\ncd $BUILDDIR\n\n\n\n";
|
||||
shellScript = "# Run from launchers/macosx\nexport BUILDDIR=$(pwd)\ncd ..\nsbt macosx:assembly\ncd ..\nant preppkg-osx\ncd pkg-temp\nrm -f ../base.zip\nzip -r -v -9 ../base.zip *\ncp ../base.zip $BUILDDIR/base.zip\ncd $BUILDDIR\ncp $BUILDDIR/target/scala-2.11/routerLauncher-assembly-0.1.0-SNAPSHOT.jar $BUILDDIR/launcher.jar\n\n\n\n";
|
||||
};
|
||||
/* End PBXShellScriptBuildPhase section */
|
||||
|
||||
@@ -320,6 +346,7 @@
|
||||
BFBDCAED215041C10014EB07 /* Subprocess+CompactAPI.swift in Sources */,
|
||||
BFBDCB02215060190014EB07 /* DetectJava.swift in Sources */,
|
||||
BF07789E21506D2B0014EB07 /* PopoverViewController.swift in Sources */,
|
||||
BF650CAB2152AC7D0014EB07 /* Deployer.m in Sources */,
|
||||
BF1EFA40215141110014EB07 /* main.mm in Sources */,
|
||||
BFBDCAF4215042670014EB07 /* AppleStuffExceptionHandler.m in Sources */,
|
||||
BF531515215105B40014EB07 /* LogViewController.swift in Sources */,
|
||||
@@ -358,7 +385,7 @@
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
@@ -400,10 +427,10 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = YES;
|
||||
ONLY_ACTIVE_ARCH = YES;
|
||||
SDKROOT = macosx;
|
||||
SDKROOT = macosx10.13;
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
@@ -416,7 +443,7 @@
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "gnu++14";
|
||||
CLANG_CXX_LIBRARY = "libc++";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CLANG_ENABLE_OBJC_WEAK = YES;
|
||||
CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
|
||||
CLANG_WARN_BOOL_CONVERSION = YES;
|
||||
@@ -452,80 +479,80 @@
|
||||
GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
|
||||
GCC_WARN_UNUSED_FUNCTION = YES;
|
||||
GCC_WARN_UNUSED_VARIABLE = YES;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.13;
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
MTL_ENABLE_DEBUG_INFO = NO;
|
||||
SDKROOT = macosx;
|
||||
SDKROOT = macosx10.13;
|
||||
SWIFT_COMPILATION_MODE = wholemodule;
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
BF50617D2113C4900014EB07 /* Debug */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = W3C42P2LA8;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = DTX4Q6WZN2;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
/Library/Frameworks,
|
||||
/System/Library/Frameworks,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/include",
|
||||
"$(SRCROOT)/include/neither",
|
||||
);
|
||||
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include;
|
||||
INFOPLIST_FILE = I2PLauncher/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.launcher.I2PLauncher;
|
||||
LD_NO_PIE = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE = "";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h";
|
||||
SWIFT_OPTIMIZATION_LEVEL = "-Onone";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**";
|
||||
USER_HEADER_SEARCH_PATHS = "";
|
||||
};
|
||||
name = Debug;
|
||||
};
|
||||
BF50617E2113C4900014EB07 /* Release */ = {
|
||||
isa = XCBuildConfiguration;
|
||||
buildSettings = {
|
||||
ALWAYS_SEARCH_USER_PATHS = YES;
|
||||
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
|
||||
CLANG_CXX_LANGUAGE_STANDARD = "c++14";
|
||||
CLANG_ENABLE_MODULES = YES;
|
||||
CLANG_ENABLE_OBJC_ARC = NO;
|
||||
CODE_SIGN_ENTITLEMENTS = I2PLauncher/I2PLauncher.entitlements;
|
||||
CODE_SIGN_IDENTITY = "Mac Developer";
|
||||
CODE_SIGN_STYLE = Automatic;
|
||||
COMBINE_HIDPI_IMAGES = YES;
|
||||
DEVELOPMENT_TEAM = W3C42P2LA8;
|
||||
GCC_C_LANGUAGE_STANDARD = gnu11;
|
||||
DEAD_CODE_STRIPPING = YES;
|
||||
DEFINES_MODULE = YES;
|
||||
DEVELOPMENT_TEAM = DTX4Q6WZN2;
|
||||
FRAMEWORK_SEARCH_PATHS = (
|
||||
/Library/Frameworks,
|
||||
/System/Library/Frameworks,
|
||||
);
|
||||
HEADER_SEARCH_PATHS = (
|
||||
"$(SRCROOT)/include",
|
||||
"$(SRCROOT)/include/neither",
|
||||
);
|
||||
INCLUDED_RECURSIVE_SEARCH_PATH_SUBDIRECTORIES = include;
|
||||
INFOPLIST_FILE = I2PLauncher/Info.plist;
|
||||
LD_RUNPATH_SEARCH_PATHS = (
|
||||
"$(inherited)",
|
||||
"@executable_path/../Frameworks",
|
||||
);
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.10;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.launcher.I2PLauncher;
|
||||
LD_NO_PIE = YES;
|
||||
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/../Frameworks @executable_path/Frameworks";
|
||||
MACOSX_DEPLOYMENT_TARGET = 10.11;
|
||||
PRODUCT_BUNDLE_IDENTIFIER = net.i2p.bootstrap.macosx.I2PLauncher;
|
||||
PRODUCT_NAME = "$(TARGET_NAME)";
|
||||
PROVISIONING_PROFILE_SPECIFIER = "";
|
||||
SDKROOT = macosx;
|
||||
SWIFT_OBJC_BRIDGING_HEADER = "I2PLauncher/I2PLauncher-Bridging-Header.h";
|
||||
SWIFT_VERSION = 3.0;
|
||||
SYSTEM_HEADER_SEARCH_PATHS = "$(SRCROOT)/include/**";
|
||||
USER_HEADER_SEARCH_PATHS = "";
|
||||
};
|
||||
name = Release;
|
||||
};
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<Workspace
|
||||
version = "1.0">
|
||||
<FileRef
|
||||
location = "group:RouterService/RouterService.xcodeproj">
|
||||
</FileRef>
|
||||
<FileRef
|
||||
location = "group:I2PLauncher.xcodeproj">
|
||||
</FileRef>
|
||||
|
||||
@@ -34,7 +34,7 @@
|
||||
</dict>
|
||||
</array>
|
||||
<key>CFBundleVersion</key>
|
||||
<string>3</string>
|
||||
<string>4</string>
|
||||
<key>LSApplicationCategoryType</key>
|
||||
<string>public.app-category.utilities</string>
|
||||
<key>LSMinimumSystemVersion</key>
|
||||
@@ -53,5 +53,7 @@
|
||||
<array>
|
||||
<dict/>
|
||||
</array>
|
||||
<key>SUFeedURL</key>
|
||||
<string>http://i2browser.i2p/updates/v1/appcast.xml</string>
|
||||
</dict>
|
||||
</plist>
|
||||
|
||||
@@ -1,9 +1,18 @@
|
||||
# The Mac OS X Launcher
|
||||
|
||||
## Misc
|
||||
|
||||
**Note** this project is WIP, cause Meeh has yet to merge in Obj-C/Swift code for GUI stuff in OSX.
|
||||
|
||||
However, this is a thin wrapper launching both Mac OS X trayicon and the I2P router - and make them talk together.
|
||||
|
||||
More code will be merged in, it's just a f* mess which Meeh needs to clean up and move into repo.
|
||||
|
||||
`./fullBuild.sh` triggers Ant jobs and prepare the base.zip, as well as starting the ninja build.
|
||||
## Howto build
|
||||
|
||||
You can both build the project from the Xcode UI or you can build it from command line.
|
||||
|
||||
An example build command:
|
||||
`xcodebuild -target I2PLauncher -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX.sdk`
|
||||
|
||||
|
||||
|
||||
@@ -49,18 +49,16 @@
|
||||
name:NSFileHandleDataAvailableNotification
|
||||
object:stdoutFileHandle];
|
||||
|
||||
[stdoutFileHandle waitForDataInBackgroundAndNotify];
|
||||
[stdoutFileHandle waitForDataInBackgroundAndNotify];
|
||||
|
||||
[self.routerTask setTerminationHandler:^(NSTask* task) {
|
||||
NSLog(@"termHandler triggered!");
|
||||
auto swiftRouterStatus = [[RouterProcessStatus alloc] init];
|
||||
[swiftRouterStatus setRouterStatus: true];
|
||||
NSBundle *launcherBundle = [NSBundle mainBundle];
|
||||
auto iconImage = [launcherBundle pathForResource:@"AppIcon" ofType:@"png"];
|
||||
sendUserNotification(APP_IDSTR, @"I2P Router has stopped");
|
||||
// Cleanup
|
||||
self.isRouterRunning = NO;
|
||||
}];
|
||||
[self.routerTask setTerminationHandler:^(NSTask* task) {
|
||||
NSLog(@"termHandler triggered!");
|
||||
auto swiftRouterStatus = [[RouterProcessStatus alloc] init];
|
||||
[swiftRouterStatus setRouterStatus: true];
|
||||
sendUserNotification(APP_IDSTR, @"I2P Router has stopped");
|
||||
// Cleanup
|
||||
//self.isRouterRunning = NO;
|
||||
}];
|
||||
/*
|
||||
self.readLogHandle = [self.processPipe fileHandleForReading];
|
||||
NSData *inData = nil;
|
||||
|
||||
15
launchers/macosx/SBridge.h
Normal file
15
launchers/macosx/SBridge.h
Normal file
@@ -0,0 +1,15 @@
|
||||
//
|
||||
// SBridge.h
|
||||
// I2PLauncher
|
||||
//
|
||||
// Created by Mikal Villa on 18/09/2018.
|
||||
// Copyright © 2018 The I2P Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import <Foundation/Foundation.h>
|
||||
|
||||
@interface SBridge : NSObject
|
||||
- (NSString*) buildClassPath:(NSString*)i2pPath;
|
||||
- (void) startupI2PRouter:(NSString*)i2pRootPath javaBinPath:(NSString*)javaBinPath;
|
||||
- (void) openUrl:(NSString*)url;
|
||||
@end
|
||||
166
launchers/macosx/SBridge.mm
Normal file
166
launchers/macosx/SBridge.mm
Normal file
@@ -0,0 +1,166 @@
|
||||
//
|
||||
// SBridge.m
|
||||
// I2PLauncher
|
||||
//
|
||||
// Created by Mikal Villa on 18/09/2018.
|
||||
// Copyright © 2018 The I2P Project. All rights reserved.
|
||||
//
|
||||
|
||||
#import "SBridge.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
#include <functional>
|
||||
#include <memory>
|
||||
#include <glob.h>
|
||||
#include <string>
|
||||
#include <list>
|
||||
#include <stdlib.h>
|
||||
#include <future>
|
||||
#include <vector>
|
||||
|
||||
#import <AppKit/AppKit.h>
|
||||
#import "I2PLauncher-Swift.h"
|
||||
|
||||
#include "AppDelegate.h"
|
||||
#include "include/fn.h"
|
||||
|
||||
|
||||
|
||||
std::future<int> startupRouter(NSString* javaBin, NSArray<NSString*>* arguments, NSString* i2pBaseDir) {
|
||||
@try {
|
||||
RTaskOptions* options = [RTaskOptions alloc];
|
||||
options.binPath = javaBin;
|
||||
options.arguments = arguments;
|
||||
options.i2pBaseDir = i2pBaseDir;
|
||||
auto instance = [[I2PRouterTask alloc] initWithOptions: options];
|
||||
//setGlobalRouterObject(instance);
|
||||
//NSThread *thr = [[NSThread alloc] initWithTarget:instance selector:@selector(execute) object:nil];
|
||||
[instance execute];
|
||||
sendUserNotification(APP_IDSTR, @"The I2P router is starting up.");
|
||||
auto pid = [instance getPID];
|
||||
return std::async(std::launch::async, [&pid]{
|
||||
return pid;
|
||||
});
|
||||
}
|
||||
@catch (NSException *e)
|
||||
{
|
||||
auto errStr = [NSString stringWithFormat:@"Expection occurred %@",[e reason]];
|
||||
NSLog(@"%@", errStr);
|
||||
sendUserNotification(APP_IDSTR, errStr);
|
||||
return std::async(std::launch::async, [&]{
|
||||
return 0;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
namespace osx {
|
||||
inline void openUrl(NSString* url)
|
||||
{
|
||||
[[NSWorkspace sharedWorkspace] openURL:[NSURL URLWithString: url]];
|
||||
}
|
||||
}
|
||||
|
||||
inline std::vector<std::string> globVector(const std::string& pattern){
|
||||
glob_t glob_result;
|
||||
glob(pattern.c_str(),GLOB_TILDE,NULL,&glob_result);
|
||||
std::vector<std::string> files;
|
||||
for(unsigned int i=0;i<glob_result.gl_pathc;++i){
|
||||
files.push_back(std::string(glob_result.gl_pathv[i]));
|
||||
}
|
||||
globfree(&glob_result);
|
||||
return files;
|
||||
}
|
||||
|
||||
inline std::string buildClassPathForObjC(std::string basePath)
|
||||
{
|
||||
NSBundle *launcherBundle = [NSBundle mainBundle];
|
||||
auto jarList = globVector(basePath+std::string("/lib/*.jar"));
|
||||
|
||||
std::string classpathStrHead = "-classpath";
|
||||
std::string classpathStr = "";
|
||||
classpathStr += [[launcherBundle pathForResource:@"launcher" ofType:@"jar"] UTF8String];
|
||||
std::string prefix(basePath);
|
||||
prefix += "/lib/";
|
||||
for_each(jarList, [&classpathStr](std::string str){ classpathStr += std::string(":") + str; });
|
||||
return classpathStr;
|
||||
}
|
||||
|
||||
|
||||
@implementation SBridge
|
||||
|
||||
|
||||
- (void) openUrl:(NSString*)url
|
||||
{
|
||||
osx::openUrl(url);
|
||||
}
|
||||
|
||||
- (NSString*) buildClassPath:(NSString*)i2pPath
|
||||
{
|
||||
const char * basePath = [i2pPath UTF8String];
|
||||
auto jarList = buildClassPathForObjC(basePath);
|
||||
const char * classpath = jarList.c_str();
|
||||
NSLog(@"Classpath from ObjC = %s", classpath);
|
||||
return [[NSString alloc] initWithUTF8String:classpath];
|
||||
}
|
||||
|
||||
|
||||
|
||||
- (void)startupI2PRouter:(NSString*)i2pRootPath javaBinPath:(NSString*)javaBinPath
|
||||
{
|
||||
std::string basePath([i2pRootPath UTF8String]);
|
||||
|
||||
// Get paths
|
||||
//NSBundle *launcherBundle = [NSBundle mainBundle];
|
||||
auto classPathStr = buildClassPathForObjC(basePath);
|
||||
|
||||
RouterProcessStatus* routerStatus = [[RouterProcessStatus alloc] init];
|
||||
try {
|
||||
std::vector<NSString*> argList = {
|
||||
@"-Xmx512M",
|
||||
@"-Xms128m",
|
||||
@"-Djava.awt.headless=true",
|
||||
@"-Dwrapper.logfile=/tmp/router.log",
|
||||
@"-Dwrapper.logfile.loglevel=DEBUG",
|
||||
@"-Dwrapper.java.pidfile=/tmp/routerjvm.pid",
|
||||
@"-Dwrapper.console.loglevel=DEBUG"
|
||||
};
|
||||
|
||||
std::string baseDirArg("-Di2p.dir.base=");
|
||||
baseDirArg += basePath;
|
||||
std::string javaLibArg("-Djava.library.path=");
|
||||
javaLibArg += basePath;
|
||||
// TODO: pass this to JVM
|
||||
//auto java_opts = getenv("JAVA_OPTS");
|
||||
|
||||
std::string cpString = std::string("-cp");
|
||||
|
||||
argList.push_back([NSString stringWithUTF8String:baseDirArg.c_str()]);
|
||||
argList.push_back([NSString stringWithUTF8String:javaLibArg.c_str()]);
|
||||
argList.push_back([NSString stringWithUTF8String:cpString.c_str()]);
|
||||
argList.push_back([NSString stringWithUTF8String:classPathStr.c_str()]);
|
||||
argList.push_back(@"net.i2p.router.Router");
|
||||
auto javaBin = std::string([javaBinPath UTF8String]);
|
||||
|
||||
|
||||
sendUserNotification(APP_IDSTR, @"I2P Router is starting up!");
|
||||
auto nsJavaBin = javaBinPath;
|
||||
auto nsBasePath = i2pRootPath;
|
||||
NSArray* arrArguments = [NSArray arrayWithObjects:&argList[0] count:argList.size()];
|
||||
// We don't really know yet, but per now a workaround
|
||||
[routerStatus setRouterStatus: true];
|
||||
NSLog(@"Trying to run command: %@", javaBinPath);
|
||||
NSLog(@"With I2P Base dir: %@", i2pRootPath);
|
||||
NSLog(@"And Arguments: %@", arrArguments);
|
||||
startupRouter(nsJavaBin, arrArguments, nsBasePath);
|
||||
} catch (std::exception &err) {
|
||||
auto errMsg = [NSString stringWithUTF8String:err.what()];
|
||||
NSLog(@"Exception: %@", errMsg);
|
||||
sendUserNotification(APP_IDSTR, [NSString stringWithFormat:@"Error: %@", errMsg]);
|
||||
[routerStatus setRouterStatus: false];
|
||||
[routerStatus setRouterRanByUs: false];
|
||||
}
|
||||
}
|
||||
@end
|
||||
|
||||
|
||||
#endif
|
||||
@@ -53,7 +53,7 @@ inline std::string extractString(CFStringRef value)
|
||||
}
|
||||
}
|
||||
|
||||
bool replace(std::string& str, const std::string& from, const std::string& to) {
|
||||
inline bool replace(std::string& str, const std::string& from, const std::string& to) {
|
||||
size_t start_pos = str.find(from);
|
||||
if(start_pos == std::string::npos)
|
||||
return false;
|
||||
|
||||
@@ -34,31 +34,26 @@
|
||||
#include "include/fn.h"
|
||||
#include "include/portcheck.h"
|
||||
|
||||
#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
|
||||
|
||||
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
|
||||
@end
|
||||
|
||||
#ifdef __cplusplus
|
||||
#import "SBridge.h"
|
||||
|
||||
#include "include/subprocess.hpp"
|
||||
#include "include/strutil.hpp"
|
||||
|
||||
using namespace subprocess;
|
||||
|
||||
JvmListSharedPtr gRawJvmList = nullptr;
|
||||
#endif
|
||||
|
||||
|
||||
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
|
||||
@end
|
||||
|
||||
#ifdef __cplusplus
|
||||
maybeAnRouterRunner getGlobalRouterObject()
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
|
||||
return globalRouterStatus; // Remember this might be nullptr now.
|
||||
std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
|
||||
return globalRouterStatus; // Remember this might be nullptr now.
|
||||
}
|
||||
|
||||
void setGlobalRouterObject(I2PRouterTask* newRouter)
|
||||
{
|
||||
std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
|
||||
globalRouterStatus = newRouter;
|
||||
std::lock_guard<std::mutex> lock(globalRouterStatusMutex);
|
||||
globalRouterStatus = newRouter;
|
||||
}
|
||||
|
||||
|
||||
@@ -66,20 +61,25 @@ pthread_mutex_t mutex;
|
||||
|
||||
bool getGlobalRouterIsRunning()
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
bool current = isRuterRunning;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return current;
|
||||
pthread_mutex_lock(&mutex);
|
||||
bool current = isRuterRunning;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
return current;
|
||||
}
|
||||
void setGlobalRouterIsRunning(bool running)
|
||||
{
|
||||
pthread_mutex_lock(&mutex);
|
||||
isRuterRunning = running;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
pthread_mutex_lock(&mutex);
|
||||
isRuterRunning = running;
|
||||
pthread_mutex_unlock(&mutex);
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#define debug(format, ...) CFShow([NSString stringWithFormat:format, ## __VA_ARGS__]);
|
||||
|
||||
@interface AppDelegate () <NSUserNotificationCenterDelegate, NSApplicationDelegate>
|
||||
@end
|
||||
|
||||
|
||||
@implementation ExtractMetaInfo : NSObject
|
||||
@end
|
||||
@@ -92,22 +92,6 @@ void setGlobalRouterIsRunning(bool running)
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
#include <unistd.h>
|
||||
#include <sys/types.h>
|
||||
#include <pwd.h>
|
||||
#include <assert.h>
|
||||
|
||||
#include "include/subprocess.hpp"
|
||||
#include "include/strutil.hpp"
|
||||
|
||||
using namespace subprocess;
|
||||
|
||||
const char* RealHomeDirectory() {
|
||||
struct passwd *pw = getpwuid(getuid());
|
||||
assert(pw);
|
||||
return pw->pw_dir;
|
||||
}
|
||||
|
||||
- (void)extractI2PBaseDir:(void(^)(BOOL success, NSError *error))completion
|
||||
{
|
||||
|
||||
@@ -223,17 +207,6 @@ const char* RealHomeDirectory() {
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
inline std::string getDefaultBaseDir()
|
||||
{
|
||||
// Figure out base directory
|
||||
const char* pathFromHome = "/Users/%s/Library/I2P";
|
||||
auto username = getenv("USER");
|
||||
char buffer[strlen(pathFromHome)+strlen(username)];
|
||||
sprintf(buffer, pathFromHome, username);
|
||||
std::string i2pBaseDir(buffer);
|
||||
return i2pBaseDir;
|
||||
}
|
||||
|
||||
- (NSString *)userSelectJavaHome:(JvmListPtr)rawJvmList
|
||||
{
|
||||
NSString *appleScriptString = @"set jvmlist to {\"Newest\"";
|
||||
|
||||
Reference in New Issue
Block a user