完善构建脚本,macOS平台可以直接生成最终的助手安装包dmg文件了。
							parent
							
								
									1d35922f7a
								
							
						
					
					
						commit
						b59fa23a93
					
				| 
						 | 
				
			
			@ -16,6 +16,7 @@ cmake-build
 | 
			
		|||
cmake-build-debug
 | 
			
		||||
client/tp_assist_macos/build
 | 
			
		||||
**/xcode_build
 | 
			
		||||
**/DerivedData
 | 
			
		||||
 | 
			
		||||
# for Python
 | 
			
		||||
__pycache__
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -110,28 +110,23 @@ class BuilderMacOS(BuilderBase):
 | 
			
		|||
 | 
			
		||||
        configuration = ctx.target_path.capitalize()
 | 
			
		||||
 | 
			
		||||
        proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'tp_assist.xcodeproj')
 | 
			
		||||
        out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', ctx.target_path, 'tp_assist.app')
 | 
			
		||||
        proj_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'TP-Assist.xcodeproj')
 | 
			
		||||
        out_file = os.path.join(env.root_path, 'client', 'tp_assist_macos', 'build', configuration, 'TP-Assist.app')
 | 
			
		||||
        if os.path.exists(out_file):
 | 
			
		||||
            utils.remove(out_file)
 | 
			
		||||
        utils.xcode_build(proj_file, 'tp_assist', configuration, False)
 | 
			
		||||
        utils.xcode_build(proj_file, 'TP-Assist', configuration, False)
 | 
			
		||||
        utils.ensure_file_exists(os.path.join(out_file, 'Contents', 'Info.plist'))
 | 
			
		||||
 | 
			
		||||
    def build_installer(self):
 | 
			
		||||
        cc.e('assist for macOS does not need an installer, you should make an .DMG file for release...')
 | 
			
		||||
        cc.i('make tp_assist dmg file...')
 | 
			
		||||
 | 
			
		||||
        # name = 'teleport-assist-{}-{}'.format(ctx.dist, VER_TP_ASSIST)
 | 
			
		||||
        #
 | 
			
		||||
        # out_path = os.path.join(env.root_path, 'out', 'installer')
 | 
			
		||||
        # utils.makedirs(out_path)
 | 
			
		||||
        #
 | 
			
		||||
        # out_file = os.path.join(out_path, '{}.exe'.format(name))
 | 
			
		||||
        # utils.remove(out_file)
 | 
			
		||||
        #
 | 
			
		||||
        # self._build_installer()
 | 
			
		||||
        #
 | 
			
		||||
        # utils.ensure_file_exists(out_file)
 | 
			
		||||
        json_file = os.path.join(env.root_path, 'dist', 'client', 'macos', 'dmg.json')
 | 
			
		||||
        dmg_file = os.path.join(env.root_path, 'out', 'client', 'macos', 'teleport-assist-macos-{}.dmg'.format(VER_TP_ASSIST))
 | 
			
		||||
        if os.path.exists(dmg_file):
 | 
			
		||||
            utils.remove(dmg_file)
 | 
			
		||||
 | 
			
		||||
        utils.make_dmg(json_file, dmg_file)
 | 
			
		||||
        utils.ensure_file_exists(dmg_file)
 | 
			
		||||
 | 
			
		||||
    @staticmethod
 | 
			
		||||
    def _build_installer():
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -308,9 +308,6 @@ def msvc_build(sln_file, proj_name, target, platform, force_rebuild):
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
def xcode_build(proj_file, proj_name, target, force_rebuild):
 | 
			
		||||
    # if env.msbuild is None:
 | 
			
		||||
    #     raise RuntimeError('where is `msbuild`?')
 | 
			
		||||
 | 
			
		||||
    if force_rebuild:
 | 
			
		||||
        cmd = 'xcodebuild -project "{}" -target {} -configuration {} clean'.format(proj_file, proj_name, target)
 | 
			
		||||
        ret, _ = sys_exec(cmd, direct_output=True)
 | 
			
		||||
| 
						 | 
				
			
			@ -322,6 +319,19 @@ def xcode_build(proj_file, proj_name, target, force_rebuild):
 | 
			
		|||
        raise RuntimeError('build XCode project `{}` failed.'.format(proj_name))
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def make_dmg(json_file, dmg_file):
 | 
			
		||||
    out_path = os.path.dirname(dmg_file)
 | 
			
		||||
    cc.v(out_path)
 | 
			
		||||
 | 
			
		||||
    if not os.path.exists(out_path):
 | 
			
		||||
        makedirs(out_path)
 | 
			
		||||
 | 
			
		||||
    cmd = 'appdmg "{}" "{}"'.format(json_file, dmg_file)
 | 
			
		||||
    ret, _ = sys_exec(cmd, direct_output=True)
 | 
			
		||||
    if ret != 0:
 | 
			
		||||
        raise RuntimeError('make dmg failed.')
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
def nsis_build(nsi_file, _define=''):
 | 
			
		||||
    if env.nsis is None:
 | 
			
		||||
        raise RuntimeError('where is `nsis`?')
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -82,10 +82,10 @@
 | 
			
		|||
		7A7C6C8F21973C24006869D9 /* StatusIconAlt@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIconAlt@3X.png"; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9021973C24006869D9 /* StatusIcon@3X.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = "StatusIcon@3X.png"; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9521973C69006869D9 /* tpassist.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = tpassist.png; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9921974094006869D9 /* cacert.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cacert.cer; path = ../../../cfg/cacert.cer; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9A21974094006869D9 /* localhost.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.key; path = ../../../cfg/localhost.key; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9B21974094006869D9 /* localhost.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.pem; path = ../../../cfg/localhost.pem; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "tp-assist.macos.json"; path = "../../../cfg/tp-assist.macos.json"; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6C9921974094006869D9 /* cacert.cer */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = cacert.cer; path = ../cfg/cacert.cer; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		7A7C6C9A21974094006869D9 /* localhost.key */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.key; path = ../cfg/localhost.key; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		7A7C6C9B21974094006869D9 /* localhost.pem */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text; name = localhost.pem; path = ../cfg/localhost.pem; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.json; name = "tp-assist.macos.json"; path = "../cfg/tp-assist.macos.json"; sourceTree = SOURCE_ROOT; };
 | 
			
		||||
		7A7C6CA12197786B006869D9 /* ts_ver.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = ts_ver.h; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6CA821977F07006869D9 /* iterm2.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = iterm2.scpt; sourceTree = "<group>"; };
 | 
			
		||||
		7A7C6CA921977F07006869D9 /* terminal.scpt */ = {isa = PBXFileReference; lastKnownFileType = file; path = terminal.scpt; sourceTree = "<group>"; };
 | 
			
		||||
| 
						 | 
				
			
			@ -123,15 +123,15 @@
 | 
			
		|||
		A1B7B9F11DB54D8C00809327 /* zh-Hans */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = "zh-Hans"; path = "zh-Hans.lproj/AboutWindowController.strings"; sourceTree = "<group>"; };
 | 
			
		||||
		A1D700051A5DCDF4003563E4 /* AboutWindowController.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = AboutWindowController.h; sourceTree = "<group>"; };
 | 
			
		||||
		A1D700061A5DCE8D003563E4 /* AboutWindowController.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; lineEnding = 0; path = AboutWindowController.m; sourceTree = "<group>"; };
 | 
			
		||||
		C149EBF915D5214600B1F558 /* tp_assist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = tp_assist.app; sourceTree = BUILT_PRODUCTS_DIR; };
 | 
			
		||||
		C149EBF915D5214600B1F558 /* TP-Assist.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = "TP-Assist.app"; sourceTree = BUILT_PRODUCTS_DIR; };
 | 
			
		||||
		C149EBFD15D5214600B1F558 /* Cocoa.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Cocoa.framework; path = System/Library/Frameworks/Cocoa.framework; sourceTree = SDKROOT; };
 | 
			
		||||
		C149EC0015D5214600B1F558 /* AppKit.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = AppKit.framework; path = System/Library/Frameworks/AppKit.framework; sourceTree = SDKROOT; };
 | 
			
		||||
		C149EC0115D5214600B1F558 /* CoreData.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = CoreData.framework; path = System/Library/Frameworks/CoreData.framework; sourceTree = SDKROOT; };
 | 
			
		||||
		C149EC0215D5214600B1F558 /* Foundation.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Foundation.framework; path = System/Library/Frameworks/Foundation.framework; sourceTree = SDKROOT; };
 | 
			
		||||
		C149EC0515D5214600B1F558 /* tp_assist-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "tp_assist-Info.plist"; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0515D5214600B1F558 /* TP-Assist-Info.plist */ = {isa = PBXFileReference; lastKnownFileType = text.plist.xml; path = "TP-Assist-Info.plist"; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0715D5214600B1F558 /* en */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = en; path = en.lproj/InfoPlist.strings; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0915D5214600B1F558 /* main.m */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.objc; path = main.m; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "tp_assist-Prefix.pch"; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0B15D5214600B1F558 /* TP-Assist-Prefix.pch */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "TP-Assist-Prefix.pch"; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC0F15D5214600B1F558 /* AppDelegate.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = AppDelegate.h; sourceTree = "<group>"; };
 | 
			
		||||
		C149EC1015D5214600B1F558 /* AppDelegate.mm */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.cpp.objcpp; path = AppDelegate.mm; sourceTree = "<group>"; };
 | 
			
		||||
		C159DC2715D5DE7F00F5DE24 /* teleport.icns */ = {isa = PBXFileReference; lastKnownFileType = image.icns; path = teleport.icns; sourceTree = "<group>"; };
 | 
			
		||||
| 
						 | 
				
			
			@ -173,8 +173,9 @@
 | 
			
		|||
				7A7C6C9B21974094006869D9 /* localhost.pem */,
 | 
			
		||||
				7A7C6C9F2197410B006869D9 /* tp-assist.macos.json */,
 | 
			
		||||
			);
 | 
			
		||||
			path = cfg;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
			name = cfg;
 | 
			
		||||
			path = ../cfg;
 | 
			
		||||
			sourceTree = SOURCE_ROOT;
 | 
			
		||||
		};
 | 
			
		||||
		7AA2CD3C1F6AB9560074C92B /* libex */ = {
 | 
			
		||||
			isa = PBXGroup;
 | 
			
		||||
| 
						 | 
				
			
			@ -277,7 +278,7 @@
 | 
			
		|||
		C149EBFA15D5214600B1F558 /* Products */ = {
 | 
			
		||||
			isa = PBXGroup;
 | 
			
		||||
			children = (
 | 
			
		||||
				C149EBF915D5214600B1F558 /* tp_assist.app */,
 | 
			
		||||
				C149EBF915D5214600B1F558 /* TP-Assist.app */,
 | 
			
		||||
			);
 | 
			
		||||
			name = Products;
 | 
			
		||||
			sourceTree = "<group>";
 | 
			
		||||
| 
						 | 
				
			
			@ -332,9 +333,9 @@
 | 
			
		|||
			isa = PBXGroup;
 | 
			
		||||
			children = (
 | 
			
		||||
				C159DC2715D5DE7F00F5DE24 /* teleport.icns */,
 | 
			
		||||
				C149EC0515D5214600B1F558 /* tp_assist-Info.plist */,
 | 
			
		||||
				C149EC0515D5214600B1F558 /* TP-Assist-Info.plist */,
 | 
			
		||||
				C149EC0615D5214600B1F558 /* InfoPlist.strings */,
 | 
			
		||||
				C149EC0B15D5214600B1F558 /* tp_assist-Prefix.pch */,
 | 
			
		||||
				C149EC0B15D5214600B1F558 /* TP-Assist-Prefix.pch */,
 | 
			
		||||
				A1B7B9DF1DB53ED200809327 /* Localizable.strings */,
 | 
			
		||||
			);
 | 
			
		||||
			name = "Supporting Files";
 | 
			
		||||
| 
						 | 
				
			
			@ -343,9 +344,9 @@
 | 
			
		|||
/* End PBXGroup section */
 | 
			
		||||
 | 
			
		||||
/* Begin PBXNativeTarget section */
 | 
			
		||||
		C149EBF815D5214600B1F558 /* tp_assist */ = {
 | 
			
		||||
		C149EBF815D5214600B1F558 /* TP-Assist */ = {
 | 
			
		||||
			isa = PBXNativeTarget;
 | 
			
		||||
			buildConfigurationList = C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "tp_assist" */;
 | 
			
		||||
			buildConfigurationList = C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "TP-Assist" */;
 | 
			
		||||
			buildPhases = (
 | 
			
		||||
				C149EBF515D5214600B1F558 /* Sources */,
 | 
			
		||||
				C149EBF615D5214600B1F558 /* Frameworks */,
 | 
			
		||||
| 
						 | 
				
			
			@ -355,9 +356,9 @@
 | 
			
		|||
			);
 | 
			
		||||
			dependencies = (
 | 
			
		||||
			);
 | 
			
		||||
			name = tp_assist;
 | 
			
		||||
			name = "TP-Assist";
 | 
			
		||||
			productName = Shuttle;
 | 
			
		||||
			productReference = C149EBF915D5214600B1F558 /* tp_assist.app */;
 | 
			
		||||
			productReference = C149EBF915D5214600B1F558 /* TP-Assist.app */;
 | 
			
		||||
			productType = "com.apple.product-type.application";
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXNativeTarget section */
 | 
			
		||||
| 
						 | 
				
			
			@ -378,7 +379,7 @@
 | 
			
		|||
					};
 | 
			
		||||
				};
 | 
			
		||||
			};
 | 
			
		||||
			buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */;
 | 
			
		||||
			buildConfigurationList = C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "TP-Assist" */;
 | 
			
		||||
			compatibilityVersion = "Xcode 10.0";
 | 
			
		||||
			developmentRegion = English;
 | 
			
		||||
			hasScannedForEncodings = 0;
 | 
			
		||||
| 
						 | 
				
			
			@ -392,7 +393,7 @@
 | 
			
		|||
			projectDirPath = "";
 | 
			
		||||
			projectRoot = "";
 | 
			
		||||
			targets = (
 | 
			
		||||
				C149EBF815D5214600B1F558 /* tp_assist */,
 | 
			
		||||
				C149EBF815D5214600B1F558 /* TP-Assist */,
 | 
			
		||||
			);
 | 
			
		||||
		};
 | 
			
		||||
/* End PBXProject section */
 | 
			
		||||
| 
						 | 
				
			
			@ -608,7 +609,7 @@
 | 
			
		|||
				CODE_SIGN_IDENTITY = "";
 | 
			
		||||
				COMBINE_HIDPI_IMAGES = YES;
 | 
			
		||||
				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 | 
			
		||||
				GCC_PREFIX_HEADER = "src/tp_assist-Prefix.pch";
 | 
			
		||||
				GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch";
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = (
 | 
			
		||||
					"DEBUG=1",
 | 
			
		||||
					MG_ENABLE_SSL,
 | 
			
		||||
| 
						 | 
				
			
			@ -620,7 +621,7 @@
 | 
			
		|||
					../../external/jsoncpp/include,
 | 
			
		||||
					../../external/macos/release/include,
 | 
			
		||||
				);
 | 
			
		||||
				INFOPLIST_FILE = "src/tp_assist-Info.plist";
 | 
			
		||||
				INFOPLIST_FILE = "src/TP-Assist-Info.plist";
 | 
			
		||||
				LIBRARY_SEARCH_PATHS = ../../external/macos/release/lib;
 | 
			
		||||
				MACOSX_DEPLOYMENT_TARGET = 10.13;
 | 
			
		||||
				PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}";
 | 
			
		||||
| 
						 | 
				
			
			@ -636,7 +637,7 @@
 | 
			
		|||
				CODE_SIGN_IDENTITY = "";
 | 
			
		||||
				COMBINE_HIDPI_IMAGES = YES;
 | 
			
		||||
				GCC_PRECOMPILE_PREFIX_HEADER = YES;
 | 
			
		||||
				GCC_PREFIX_HEADER = "src/tp_assist-Prefix.pch";
 | 
			
		||||
				GCC_PREFIX_HEADER = "src/TP-Assist-Prefix.pch";
 | 
			
		||||
				GCC_PREPROCESSOR_DEFINITIONS = MG_ENABLE_SSL;
 | 
			
		||||
				HEADER_SEARCH_PATHS = (
 | 
			
		||||
					../../common/teleport,
 | 
			
		||||
| 
						 | 
				
			
			@ -645,7 +646,7 @@
 | 
			
		|||
					../../external/jsoncpp/include,
 | 
			
		||||
					../../external/macos/release/include,
 | 
			
		||||
				);
 | 
			
		||||
				INFOPLIST_FILE = "src/tp_assist-Info.plist";
 | 
			
		||||
				INFOPLIST_FILE = "src/TP-Assist-Info.plist";
 | 
			
		||||
				LIBRARY_SEARCH_PATHS = ../../external/macos/release/lib;
 | 
			
		||||
				MACOSX_DEPLOYMENT_TARGET = 10.13;
 | 
			
		||||
				PRODUCT_BUNDLE_IDENTIFIER = "teleport.${PRODUCT_NAME:rfc1034identifier}";
 | 
			
		||||
| 
						 | 
				
			
			@ -658,7 +659,7 @@
 | 
			
		|||
/* End XCBuildConfiguration section */
 | 
			
		||||
 | 
			
		||||
/* Begin XCConfigurationList section */
 | 
			
		||||
		C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "tp_assist" */ = {
 | 
			
		||||
		C149EBF315D5214600B1F558 /* Build configuration list for PBXProject "TP-Assist" */ = {
 | 
			
		||||
			isa = XCConfigurationList;
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				C149EC1515D5214600B1F558 /* Debug */,
 | 
			
		||||
| 
						 | 
				
			
			@ -667,7 +668,7 @@
 | 
			
		|||
			defaultConfigurationIsVisible = 0;
 | 
			
		||||
			defaultConfigurationName = Release;
 | 
			
		||||
		};
 | 
			
		||||
		C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "tp_assist" */ = {
 | 
			
		||||
		C149EC1715D5214600B1F558 /* Build configuration list for PBXNativeTarget "TP-Assist" */ = {
 | 
			
		||||
			isa = XCConfigurationList;
 | 
			
		||||
			buildConfigurations = (
 | 
			
		||||
				C149EC1815D5214600B1F558 /* Debug */,
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							| 
		 Before Width: | Height: | Size: 20 KiB  | 
| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
{
 | 
			
		||||
  "title": "Teleport助手安装",
 | 
			
		||||
  "icon": "dmg_icon.icns",
 | 
			
		||||
  "background": "dmg_bg.png",
 | 
			
		||||
  "icon-size": 80,
 | 
			
		||||
  "contents": [
 | 
			
		||||
    { "x": 448, "y": 344, "type": "link", "path": "/Applications" },
 | 
			
		||||
    { "x": 192, "y": 344, "type": "file", "path": "../../../client/tp_assist_macos/build//Release/TP-Assist.app" }
 | 
			
		||||
  ]
 | 
			
		||||
}
 | 
			
		||||
										
											Binary file not shown.
										
									
								
							
		Loading…
	
		Reference in New Issue