Skip to content

Commit

Permalink
Allow loading SkyX files on Mac desktop
Browse files Browse the repository at this point in the history
  • Loading branch information
chinmaygarde committed Jul 30, 2015
1 parent 2048316 commit 9b16add
Show file tree
Hide file tree
Showing 7 changed files with 823 additions and 35 deletions.
10 changes: 7 additions & 3 deletions build/config/mac/rules.gni
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ template("resource_copy_mac") {
set_sources_assignment_filter([])
sources = _resources
outputs = [ "$root_build_dir/$_app_name.app/$_bundle_directory/Contents/Resources/{{source_file_part}}" ]

if (defined(invoker.deps)) {
deps = invoker.deps
}
}
}

Expand Down Expand Up @@ -147,14 +151,14 @@ template("mac_app") {
script = mac_app_script

sources = [ invoker.info_plist ]
outputs = [ "$root_build_dir/Info.plist" ]
outputs = [ "$root_build_dir/plist/$app_name/Info.plist" ]

args = [
"plist",
"-i",
rebase_path(invoker.info_plist, root_build_dir),
"-o",
rebase_path(root_build_dir),
rebase_path("$root_build_dir/plist/$app_name"),
]
}

Expand All @@ -163,7 +167,7 @@ template("mac_app") {
copy_plist_gen_target_name = target_name + "_plist_copy"
copy(copy_plist_gen_target_name) {
sources = [
"$root_build_dir/Info.plist",
"$root_build_dir/plist/$app_name/Info.plist",
]

outputs = [
Expand Down
42 changes: 39 additions & 3 deletions sky/build/sky_app.gni
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import("//sky/build/skyx.gni")
template("sky_app") {
skyx_target_name = target_name

if (is_android || is_ios) {
if (is_android || is_ios || is_mac) {
skyx_target_name = "app"
}

Expand Down Expand Up @@ -113,7 +113,9 @@ template("sky_app") {
"$target_gen_dir/app.skyx",
]

resources += invoker.launcher_resources
if (defined(invoker.launcher_resources)) {
resources += invoker.launcher_resources
}

bundle_directory = "."
deps = [ ":app" ]
Expand All @@ -129,7 +131,41 @@ template("sky_app") {
deps += invoker.deps
}
}
} else if(is_ios) {
} else if(is_mac && defined(invoker.info_plist)) {
import("//build/config/mac/rules.gni")

mac_app(target_name) {

app_name = target_name + "_app"
info_plist = invoker.info_plist
xibs = invoker.xibs

resources_gen_target_name = target_name + "_res"
resource_copy_mac(resources_gen_target_name) {
resources = [
"//third_party/icu/android/icudtl.dat",
"$target_gen_dir/app.skyx",
]

if (defined(invoker.launcher_resources)) {
resources += invoker.launcher_resources
}

bundle_directory = "."
deps = [ ":app" ]
}

deps = [
":$resources_gen_target_name",
"//sky/shell:mac_scaffolding",
]

if (defined(invoker.deps)) {
deps += invoker.deps
}
}

} else if(is_ios || is_mac) {
# No Info.plist specified. But we still need an empty target
group(target_name) {
}
Expand Down
3 changes: 3 additions & 0 deletions sky/packages/sky/example/game/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,8 @@ sky_app("game") {
"assets/[email protected]",
"ios/LaunchScreen.storyboardc",
]
} else if (is_mac) {
info_plist = "mac/Info.plist"
xibs = [ "mac/sky_mac.xib" ]
}
}
34 changes: 34 additions & 0 deletions sky/packages/sky/example/game/mac/Info.plist
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>CFBundleDevelopmentRegion</key>
<string>en</string>
<key>CFBundleExecutable</key>
<string>game_app</string>
<key>CFBundleIconFile</key>
<string></string>
<key>CFBundleIdentifier</key>
<string>org.domokit.sky.asteroids</string>
<key>CFBundleInfoDictionaryVersion</key>
<string>6.0</string>
<key>CFBundleName</key>
<string>Asteroids</string>
<key>CFBundlePackageType</key>
<string>APPL</string>
<key>CFBundleShortVersionString</key>
<string>1.0</string>
<key>CFBundleSignature</key>
<string>????</string>
<key>CFBundleVersion</key>
<string>1</string>
<key>LSMinimumSystemVersion</key>
<string>10.6</string>
<key>NSHumanReadableCopyright</key>
<string>Copyright © 2015 The Chromium Authors. All rights reserved.</string>
<key>NSMainNibFile</key>
<string>sky_mac</string>
<key>NSPrincipalClass</key>
<string>SkyApplication</string>
</dict>
</plist>
Loading

0 comments on commit 9b16add

Please sign in to comment.