From 79ff6aed24ebfda2ecd4628b2237b75a003e347a Mon Sep 17 00:00:00 2001 From: ruki Date: Sun, 5 Apr 2020 14:32:36 +0800 Subject: improve info.plist --- tests/projects/objc/application/src/Info.plist | 34 ++++++-------------------- tests/projects/objc/bundle/src/Info.plist | 34 +++++--------------------- tests/projects/objc/framework/src/Info.plist | 34 +++++--------------------- xmake/rules/qt/deploy/macosx.lua | 2 +- xmake/rules/xcode/application/xmake.lua | 20 +++++++++++++++ xmake/rules/xcode/bundle/xmake.lua | 19 ++++++++++++++ xmake/rules/xcode/framework/xmake.lua | 19 ++++++++++++++ 7 files changed, 79 insertions(+), 83 deletions(-) diff --git a/tests/projects/objc/application/src/Info.plist b/tests/projects/objc/application/src/Info.plist index 968bf5d3d..4bf9680cf 100644 --- a/tests/projects/objc/application/src/Info.plist +++ b/tests/projects/objc/application/src/Info.plist @@ -2,44 +2,26 @@ - BuildMachineOSBuild - 18G95 CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable - test + $(EXECUTABLE_NAME) + CFBundleIconFile + CFBundleIdentifier - org.tboox.test + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - test + $(PRODUCT_NAME) CFBundlePackageType - APPL + $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 - CFBundleSupportedPlatforms - - MacOSX - CFBundleVersion 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 11B52 - DTPlatformVersion - GM - DTSDKBuild - 19B81 - DTSDKName - macosx10.15 - DTXcode - 1120 - DTXcodeBuild - 11B52 LSMinimumSystemVersion - 10.14 + $(MACOSX_DEPLOYMENT_TARGET) NSHumanReadableCopyright Copyright © 2020 tboox. All rights reserved. NSMainStoryboardFile diff --git a/tests/projects/objc/bundle/src/Info.plist b/tests/projects/objc/bundle/src/Info.plist index 090a794fb..20608314e 100644 --- a/tests/projects/objc/bundle/src/Info.plist +++ b/tests/projects/objc/bundle/src/Info.plist @@ -2,44 +2,22 @@ - BuildMachineOSBuild - 18G95 CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable - test + $(EXECUTABLE_NAME) CFBundleIdentifier - org.tboox.test + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - test + $(PRODUCT_NAME) CFBundlePackageType - BNDL + $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 - CFBundleSupportedPlatforms - - MacOSX - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 11B52 - DTPlatformVersion - GM - DTSDKBuild - 19B81 - DTSDKName - macosx10.15 - DTXcode - 1120 - DTXcodeBuild - 11B52 - LSMinimumSystemVersion - 10.14 + $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright Copyright © 2020 tboox. All rights reserved. diff --git a/tests/projects/objc/framework/src/Info.plist b/tests/projects/objc/framework/src/Info.plist index c3ae3d9cc..20608314e 100644 --- a/tests/projects/objc/framework/src/Info.plist +++ b/tests/projects/objc/framework/src/Info.plist @@ -2,44 +2,22 @@ - BuildMachineOSBuild - 18G95 CFBundleDevelopmentRegion - en + $(DEVELOPMENT_LANGUAGE) CFBundleExecutable - test + $(EXECUTABLE_NAME) CFBundleIdentifier - org.tboox.test + $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion 6.0 CFBundleName - test1 + $(PRODUCT_NAME) CFBundlePackageType - FMWK + $(PRODUCT_BUNDLE_PACKAGE_TYPE) CFBundleShortVersionString 1.0 - CFBundleSupportedPlatforms - - MacOSX - CFBundleVersion - 1 - DTCompiler - com.apple.compilers.llvm.clang.1_0 - DTPlatformBuild - 11B52 - DTPlatformVersion - GM - DTSDKBuild - 19B81 - DTSDKName - macosx10.15 - DTXcode - 1120 - DTXcodeBuild - 11B52 - LSMinimumSystemVersion - 10.14 + $(CURRENT_PROJECT_VERSION) NSHumanReadableCopyright Copyright © 2020 tboox. All rights reserved. diff --git a/xmake/rules/qt/deploy/macosx.lua b/xmake/rules/qt/deploy/macosx.lua index 63c0ca1ff..818ff9943 100644 --- a/xmake/rules/qt/deploy/macosx.lua +++ b/xmake/rules/qt/deploy/macosx.lua @@ -58,7 +58,7 @@ function _save_info_plist(target, info_plist_file) NSPrincipalClass NSApplication -]], name, name, name, name, macos.version():major() .. "." .. macos.version():minor())) +]], name, name, name, name, get_config("target_minver") or (macos.version():major() .. "." .. macos.version():minor()))) end -- deploy application package for macosx diff --git a/xmake/rules/xcode/application/xmake.lua b/xmake/rules/xcode/application/xmake.lua index 756d94d6c..2378775b3 100644 --- a/xmake/rules/xcode/application/xmake.lua +++ b/xmake/rules/xcode/application/xmake.lua @@ -47,6 +47,23 @@ rule("xcode.application") -- imports import("private.tools.codesign") + -- generate Info.plist + local function _gen_info_plist(info_plist_file) + io.gsub(info_plist_file, "(%$%((.-)%))", function (_, variable) + local maps = + { + DEVELOPMENT_LANGUAGE = "en", + EXECUTABLE_NAME = target:basename(), + PRODUCT_BUNDLE_IDENTIFIER = "org.tboox." .. target:name(), + PRODUCT_NAME = target:name(), + PRODUCT_BUNDLE_PACKAGE_TYPE = "APPL", -- application + CURRENT_PROJECT_VERSION = target:version() and tostring(target:version()) or "1.0", + MACOSX_DEPLOYMENT_TARGET = get_config("target_minver") + } + return maps[variable] + end) + end + -- get app directory local appdir = path.absolute(target:data("xcode.appdir")) @@ -67,6 +84,9 @@ rule("xcode.application") local dstfile = dstfiles[i] if dstfile then os.vcp(srcfile, dstfile) + if path.filename(srcfile) == "Info.plist" then + _gen_info_plist(dstfile) + end end i = i + 1 end diff --git a/xmake/rules/xcode/bundle/xmake.lua b/xmake/rules/xcode/bundle/xmake.lua index 5911e5fff..97b2e9966 100644 --- a/xmake/rules/xcode/bundle/xmake.lua +++ b/xmake/rules/xcode/bundle/xmake.lua @@ -46,6 +46,22 @@ rule("xcode.bundle") -- imports import("private.tools.codesign") + -- generate Info.plist + local function _gen_info_plist(info_plist_file) + io.gsub(info_plist_file, "(%$%((.-)%))", function (_, variable) + local maps = + { + DEVELOPMENT_LANGUAGE = "en", + EXECUTABLE_NAME = target:basename(), + PRODUCT_BUNDLE_IDENTIFIER = "org.tboox." .. target:name(), + PRODUCT_NAME = target:name(), + PRODUCT_BUNDLE_PACKAGE_TYPE = "BNDL", -- bundle + CURRENT_PROJECT_VERSION = target:version() and tostring(target:version()) or "1.0" + } + return maps[variable] + end) + end + -- get bundle directory local bundledir = path.absolute(target:data("xcode.bundledir")) @@ -57,6 +73,9 @@ rule("xcode.bundle") local dstfile = dstfiles[i] if dstfile then os.vcp(srcfile, dstfile) + if path.filename(srcfile) == "Info.plist" then + _gen_info_plist(dstfile) + end end i = i + 1 end diff --git a/xmake/rules/xcode/framework/xmake.lua b/xmake/rules/xcode/framework/xmake.lua index 304ba0ea0..6cc5ec1c7 100644 --- a/xmake/rules/xcode/framework/xmake.lua +++ b/xmake/rules/xcode/framework/xmake.lua @@ -72,6 +72,22 @@ rule("xcode.framework") -- imports import("private.tools.codesign") + -- generate Info.plist + local function _gen_info_plist(info_plist_file) + io.gsub(info_plist_file, "(%$%((.-)%))", function (_, variable) + local maps = + { + DEVELOPMENT_LANGUAGE = "en", + EXECUTABLE_NAME = target:basename(), + PRODUCT_BUNDLE_IDENTIFIER = "org.tboox." .. target:name(), + PRODUCT_NAME = target:name(), + PRODUCT_BUNDLE_PACKAGE_TYPE = "FMWK", -- framework + CURRENT_PROJECT_VERSION = target:version() and tostring(target:version()) or "1.0" + } + return maps[variable] + end) + end + -- get framework directory local frameworkdir = path.absolute(target:data("xcode.frameworkdir")) local headersdir = path.join(frameworkdir, "Versions", "A", "Headers") @@ -90,6 +106,9 @@ rule("xcode.framework") local dstfile = dstfiles[i] if dstfile then os.vcp(srcfile, dstfile) + if path.filename(srcfile) == "Info.plist" then + _gen_info_plist(dstfile) + end end i = i + 1 end -- cgit v1.3.1