bazelbuild / rules_apple

Bazel rules to build apps for Apple platforms.
Apache License 2.0
494 stars 260 forks source link

How should I build a Network Extension about Xcode #2448

Open huangzqh opened 2 months ago

huangzqh commented 2 months ago

How should I build a Network Extension for iOS App?

luispadron commented 2 months ago

Can you be more specific?

keith commented 2 months ago

you probably want a ios_extension target, and then the details that make it a network extension specifically normally come from the Info.plist of that target, which is up to you to provide. The easiest way is probably to create a new network extension target in Xcode and copy the plist from there

huangzqh commented 2 months ago

you probably want a ios_extension target, and then the details that make it a network extension specifically normally come from the Info.plist of that target, which is up to you to provide. The easiest way is probably to create a new network extension target in Xcode and copy the plist from there

I want to add a Network Extension to my app, but I don't seem to be generating Targets successfully. Here is my configuration: `plist_fragment( name = "VPNTunnelInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {bundle_id}.VPNTunnel CFBundleName Telegram CFBundlePackageType XPC! NSExtension

NSExtensionPointIdentifier com.apple.networkextension.packet-tunnel NSExtensionPrincipalClass PacketTunnelProvider

""".format( bundle_id = bundle_id, ) )

ios_extension( name = "VPNTunnelExtension", bundle_id = "{bundle_id}.VPNTunnel".format( bundle_id = bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":VPNTunnelInfoPlist", ":VersionInfoPlist", ":RequiredDeviceCapabilitiesPlist", ":BuildNumberInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = minimum_os_version, entitlements = ":VPNTunnel.entitlements", frameworks = [

], )`

huangzqh commented 2 months ago

Can you be more specific?

I want to add a Network Extension to my app, but I don't seem to be generating Targets successfully. Here is my configuration: `plist_fragment( name = "VPNTunnelInfoPlist", extension = "plist", template = """ CFBundleDevelopmentRegion en CFBundleIdentifier {bundle_id}.VPNTunnel CFBundleName Telegram CFBundlePackageType XPC! NSExtension

NSExtensionPointIdentifier com.apple.networkextension.packet-tunnel NSExtensionPrincipalClass PacketTunnelProvider

""".format( bundle_id = bundle_id, ) )

ios_extension( name = "VPNTunnelExtension", bundle_id = "{bundle_id}.VPNTunnel".format( bundle_id = bundle_id, ), families = [ "iphone", "ipad", ], infoplists = [ ":VPNTunnelInfoPlist", ":VersionInfoPlist", ":RequiredDeviceCapabilitiesPlist", ":BuildNumberInfoPlist", ":AppNameInfoPlist", ], minimum_os_version = minimum_os_version, entitlements = ":VPNTunnel.entitlements", frameworks = [

], )`