From 7a15f43c268a3cd192fedbcf6f0a65ab80f1646d Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 26 Nov 2025 00:49:39 +0800 Subject: add pack macapp test --- tests/plugins/pack/macapp/src/AppDelegate.h | 15 +++++ tests/plugins/pack/macapp/src/AppDelegate.m | 28 +++++++++ .../AppIcon.appiconset/Contents.json | 59 +++++++++++++++++ .../pack/macapp/src/Assets.xcassets/Contents.json | 7 +++ .../pack/macapp/src/Base.lproj/Main.storyboard | 73 ++++++++++++++++++++++ tests/plugins/pack/macapp/src/Info.plist | 39 ++++++++++++ tests/plugins/pack/macapp/src/ViewController.h | 15 +++++ tests/plugins/pack/macapp/src/ViewController.m | 28 +++++++++ tests/plugins/pack/macapp/src/main.m | 17 +++++ tests/plugins/pack/macapp/xmake.lua | 19 ++++++ 10 files changed, 300 insertions(+) create mode 100644 tests/plugins/pack/macapp/src/AppDelegate.h create mode 100644 tests/plugins/pack/macapp/src/AppDelegate.m create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/Contents.json create mode 100644 tests/plugins/pack/macapp/src/Base.lproj/Main.storyboard create mode 100644 tests/plugins/pack/macapp/src/Info.plist create mode 100644 tests/plugins/pack/macapp/src/ViewController.h create mode 100644 tests/plugins/pack/macapp/src/ViewController.m create mode 100644 tests/plugins/pack/macapp/src/main.m create mode 100644 tests/plugins/pack/macapp/xmake.lua (limited to 'tests/plugins/pack/macapp') diff --git a/tests/plugins/pack/macapp/src/AppDelegate.h b/tests/plugins/pack/macapp/src/AppDelegate.h new file mode 100644 index 000000000..413f74ce4 --- /dev/null +++ b/tests/plugins/pack/macapp/src/AppDelegate.h @@ -0,0 +1,15 @@ +// +// AppDelegate.h +// macapp +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import + +@interface AppDelegate : NSObject + + +@end + diff --git a/tests/plugins/pack/macapp/src/AppDelegate.m b/tests/plugins/pack/macapp/src/AppDelegate.m new file mode 100644 index 000000000..b6c5d02ab --- /dev/null +++ b/tests/plugins/pack/macapp/src/AppDelegate.m @@ -0,0 +1,28 @@ +// +// AppDelegate.m +// macapp +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import "AppDelegate.h" + +@interface AppDelegate () + +@end + +@implementation AppDelegate + +- (void)applicationDidFinishLaunching:(NSNotification *)aNotification { + // Insert code here to initialize your application +} + + +- (void)applicationWillTerminate:(NSNotification *)aNotification { + // Insert code here to tear down your application +} + + +@end + diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json new file mode 100644 index 000000000..9d5c8a516 --- /dev/null +++ b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -0,0 +1,59 @@ +{ + "images" : [ + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "16x16", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "32x32", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "128x128", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "256x256", + "scale" : "2x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "1x" + }, + { + "idiom" : "mac", + "size" : "512x512", + "scale" : "2x" + } + ], + "info" : { + "version" : 1, + "author" : "xcode" + } +} + diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/Contents.json b/tests/plugins/pack/macapp/src/Assets.xcassets/Contents.json new file mode 100644 index 000000000..7afcdfaf8 --- /dev/null +++ b/tests/plugins/pack/macapp/src/Assets.xcassets/Contents.json @@ -0,0 +1,7 @@ +{ + "info" : { + "version" : 1, + "author" : "xcode" + } +} + diff --git a/tests/plugins/pack/macapp/src/Base.lproj/Main.storyboard b/tests/plugins/pack/macapp/src/Base.lproj/Main.storyboard new file mode 100644 index 000000000..dd1212a78 --- /dev/null +++ b/tests/plugins/pack/macapp/src/Base.lproj/Main.storyboard @@ -0,0 +1,73 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/tests/plugins/pack/macapp/src/Info.plist b/tests/plugins/pack/macapp/src/Info.plist new file mode 100644 index 000000000..f111cb4c3 --- /dev/null +++ b/tests/plugins/pack/macapp/src/Info.plist @@ -0,0 +1,39 @@ + + + + + CFBundleDevelopmentRegion + $(DEVELOPMENT_LANGUAGE) + CFBundleExecutable + $(EXECUTABLE_NAME) + CFBundleIconFile + + CFBundleIdentifier + $(PRODUCT_BUNDLE_IDENTIFIER) + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + $(PRODUCT_NAME) + CFBundleDisplayName + $(PRODUCT_DISPLAY_NAME) + CFBundlePackageType + $(PRODUCT_BUNDLE_PACKAGE_TYPE) + CFBundleShortVersionString + 1.0 + CFBundleVersion + 1 + LSMinimumSystemVersion + $(MACOSX_DEPLOYMENT_TARGET) + NSHumanReadableCopyright + Copyright © 2020 tboox. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + NSSupportsAutomaticTermination + + NSSupportsSuddenTermination + + + + diff --git a/tests/plugins/pack/macapp/src/ViewController.h b/tests/plugins/pack/macapp/src/ViewController.h new file mode 100644 index 000000000..41858ce17 --- /dev/null +++ b/tests/plugins/pack/macapp/src/ViewController.h @@ -0,0 +1,15 @@ +// +// ViewController.h +// macapp +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import + +@interface ViewController : NSViewController + + +@end + diff --git a/tests/plugins/pack/macapp/src/ViewController.m b/tests/plugins/pack/macapp/src/ViewController.m new file mode 100644 index 000000000..23f78028d --- /dev/null +++ b/tests/plugins/pack/macapp/src/ViewController.m @@ -0,0 +1,28 @@ +// +// ViewController.m +// macapp +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import "ViewController.h" + +@implementation ViewController + +- (void)viewDidLoad { + [super viewDidLoad]; + + // Do any additional setup after loading the view. +} + + +- (void)setRepresentedObject:(id)representedObject { + [super setRepresentedObject:representedObject]; + + // Update the view, if already loaded. +} + + +@end + diff --git a/tests/plugins/pack/macapp/src/main.m b/tests/plugins/pack/macapp/src/main.m new file mode 100644 index 000000000..01b588b66 --- /dev/null +++ b/tests/plugins/pack/macapp/src/main.m @@ -0,0 +1,17 @@ +// +// main.m +// macapp +// +// Created by ruki on 2020/4/4. +// Copyright © 2020 tboox. All rights reserved. +// + +#import + +int main(int argc, const char * argv[]) { + @autoreleasepool { + // Setup code that might create autoreleased objects goes here. + } + return NSApplicationMain(argc, argv); +} + diff --git a/tests/plugins/pack/macapp/xmake.lua b/tests/plugins/pack/macapp/xmake.lua new file mode 100644 index 000000000..4dd391ae0 --- /dev/null +++ b/tests/plugins/pack/macapp/xmake.lua @@ -0,0 +1,19 @@ +set_version("1.0.0") +add_rules("mode.debug", "mode.release") + +includes("@builtin/xpack") + +target("macapp") + add_rules("xcode.application") + add_files("src/*.m", "src/**.storyboard", "src/*.xcassets") + add_files("src/Info.plist") + +xpack("macapp") + set_formats("dmg") + set_title("MacApp Test") + set_author("ruki ") + set_description("A test macOS application installer.") + set_homepage("https://xmake.io") + set_license("Apache-2.0") + add_targets("macapp") + -- cgit v1.3.1 From 2a9075318d77e8c7fe514754873be61ec9f2cd7d Mon Sep 17 00:00:00 2001 From: ruki Date: Wed, 26 Nov 2025 22:37:40 +0800 Subject: add icon in macapp --- .../Assets.xcassets/AppIcon.appiconset/Contents.json | 10 ++++++++++ .../AppIcon.appiconset/icon_128x128.png | Bin 0 -> 11992 bytes .../AppIcon.appiconset/icon_128x128@2x.png | Bin 0 -> 24378 bytes .../Assets.xcassets/AppIcon.appiconset/icon_16x16.png | Bin 0 -> 1377 bytes .../AppIcon.appiconset/icon_16x16@2x.png | Bin 0 -> 2478 bytes .../AppIcon.appiconset/icon_256x256.png | Bin 0 -> 24378 bytes .../AppIcon.appiconset/icon_256x256@2x.png | Bin 0 -> 91627 bytes .../Assets.xcassets/AppIcon.appiconset/icon_32x32.png | Bin 0 -> 2478 bytes .../AppIcon.appiconset/icon_32x32@2x.png | Bin 0 -> 5022 bytes .../AppIcon.appiconset/icon_512x512.png | Bin 0 -> 91627 bytes .../AppIcon.appiconset/icon_512x512@2x.png | Bin 0 -> 269353 bytes tests/plugins/pack/macapp/src/Info.plist | 2 +- tests/plugins/pack/macapp/src/assets/xmake.ico | Bin 0 -> 119943 bytes xmake/rules/xcode/application/build.lua | 2 -- 14 files changed, 11 insertions(+), 3 deletions(-) create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512.png create mode 100644 tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png create mode 100644 tests/plugins/pack/macapp/src/assets/xmake.ico (limited to 'tests/plugins/pack/macapp') diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json index 9d5c8a516..6fa879752 100644 --- a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json +++ b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/Contents.json @@ -1,51 +1,61 @@ { "images" : [ { + "filename" : "icon_16x16.png", "idiom" : "mac", "size" : "16x16", "scale" : "1x" }, { + "filename" : "icon_16x16@2x.png", "idiom" : "mac", "size" : "16x16", "scale" : "2x" }, { + "filename" : "icon_32x32.png", "idiom" : "mac", "size" : "32x32", "scale" : "1x" }, { + "filename" : "icon_32x32@2x.png", "idiom" : "mac", "size" : "32x32", "scale" : "2x" }, { + "filename" : "icon_128x128.png", "idiom" : "mac", "size" : "128x128", "scale" : "1x" }, { + "filename" : "icon_128x128@2x.png", "idiom" : "mac", "size" : "128x128", "scale" : "2x" }, { + "filename" : "icon_256x256.png", "idiom" : "mac", "size" : "256x256", "scale" : "1x" }, { + "filename" : "icon_256x256@2x.png", "idiom" : "mac", "size" : "256x256", "scale" : "2x" }, { + "filename" : "icon_512x512.png", "idiom" : "mac", "size" : "512x512", "scale" : "1x" }, { + "filename" : "icon_512x512@2x.png", "idiom" : "mac", "size" : "512x512", "scale" : "2x" diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128.png new file mode 100644 index 000000000..5d787b620 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png new file mode 100644 index 000000000..be7f6c4f2 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_128x128@2x.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16.png new file mode 100644 index 000000000..8b2771975 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png new file mode 100644 index 000000000..331c7af96 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_16x16@2x.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256.png new file mode 100644 index 000000000..be7f6c4f2 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png new file mode 100644 index 000000000..a5677925b Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_256x256@2x.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32.png new file mode 100644 index 000000000..331c7af96 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png new file mode 100644 index 000000000..c8e5ac0c2 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_32x32@2x.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512.png new file mode 100644 index 000000000..a5677925b Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512.png differ diff --git a/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png new file mode 100644 index 000000000..d6533fea6 Binary files /dev/null and b/tests/plugins/pack/macapp/src/Assets.xcassets/AppIcon.appiconset/icon_512x512@2x.png differ diff --git a/tests/plugins/pack/macapp/src/Info.plist b/tests/plugins/pack/macapp/src/Info.plist index f111cb4c3..477a62fd7 100644 --- a/tests/plugins/pack/macapp/src/Info.plist +++ b/tests/plugins/pack/macapp/src/Info.plist @@ -7,7 +7,7 @@ CFBundleExecutable $(EXECUTABLE_NAME) CFBundleIconFile - + AppIcon CFBundleIdentifier $(PRODUCT_BUNDLE_IDENTIFIER) CFBundleInfoDictionaryVersion diff --git a/tests/plugins/pack/macapp/src/assets/xmake.ico b/tests/plugins/pack/macapp/src/assets/xmake.ico new file mode 100644 index 000000000..52c8ef389 Binary files /dev/null and b/tests/plugins/pack/macapp/src/assets/xmake.ico differ diff --git a/xmake/rules/xcode/application/build.lua b/xmake/rules/xcode/application/build.lua index a98baf57a..8ea734d28 100644 --- a/xmake/rules/xcode/application/build.lua +++ b/xmake/rules/xcode/application/build.lua @@ -24,8 +24,6 @@ import("core.theme.theme") import("core.project.depend") import("private.tools.codesign") import("utils.progress") - --- main entry function main (target, opt) -- get app and resources directory -- cgit v1.3.1