1require "json"
2
3package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
5Pod::Spec.new do |s|
6  s.name           = 'expo-dev-launcher'
7  s.version        = package['version']
8  s.summary        = package['description']
9  s.description    = package['description']
10  s.license        = package['license']
11  s.author         = package['author']
12  s.homepage       = package['homepage']
13  s.platform       = :ios, '13.0'
14  s.swift_version  = '5.2'
15  s.source         = { :git => 'https://github.com/github_account/expo-development-client.git', :tag => "#{s.version}" }
16  s.static_framework = true
17  s.source_files   = 'ios/**/*.{h,m,mm,swift,cpp}'
18  s.preserve_paths = 'ios/**/*.{h,m,mm,swift}'
19  s.exclude_files  = 'ios/Unsafe/**/*.{h,m,mm,swift,cpp}', 'ios/Tests/**/*.{h,m,swift}'
20  s.requires_arc   = true
21  s.header_dir     = 'EXDevLauncher'
22
23  s.resource_bundles = {
24    'EXDevLauncher' => [
25      'ios/assets',
26      'ios/main.jsbundle',
27      'ios/Views/EXDevLauncherErrorView.storyboard'
28    ]
29  }
30
31  new_arch_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
32
33  other_c_flags = '$(inherited)'
34  dev_launcher_url = ENV['EX_DEV_LAUNCHER_URL'] || ""
35  if dev_launcher_url != ""
36    escaped_dev_launcher_url = Shellwords.escape(dev_launcher_url).gsub('/','\\/')
37    other_c_flags += " -DEX_DEV_LAUNCHER_URL=\"\\\"" + escaped_dev_launcher_url + "\\\"\""
38  end
39  other_swift_flags = "$(inherited)"
40  unless ENV['EX_DEV_CLIENT_NETWORK_INSPECTOR'] == 'false'
41    other_swift_flags += ' -DEX_DEV_CLIENT_NETWORK_INSPECTOR'
42  end
43
44  if new_arch_enabled
45    other_c_flags += ' -DRN_FABRIC_ENABLED -DRCT_NEW_ARCH_ENABLED'
46  end
47
48  s.xcconfig = {
49    'GCC_PREPROCESSOR_DEFINITIONS' => "EX_DEV_LAUNCHER_VERSION=#{s.version}",
50    'OTHER_CFLAGS' => other_c_flags,
51  }
52
53  header_search_paths = [
54    '"$(PODS_ROOT)/Headers/Private/React-Core"',
55    '"${PODS_ROOT}/Headers/Public/RNReanimated"',
56    '"$(PODS_CONFIGURATION_BUILD_DIR)/EXManifests/Swift Compatibility Header"',
57    '"$(PODS_CONFIGURATION_BUILD_DIR)/EXUpdatesInterface/Swift Compatibility Header"',
58  ]
59
60  # Swift/Objective-C compatibility
61  s.pod_target_xcconfig = {
62    'DEFINES_MODULE' => 'YES',
63    'OTHER_CFLAGS[config=Debug]' => other_c_flags,
64    'OTHER_SWIFT_FLAGS[config=Debug]' => other_swift_flags,
65    'HEADER_SEARCH_PATHS' => header_search_paths.join(' '),
66    'FRAMEWORK_SEARCH_PATHS' => '"${PODS_CONFIGURATION_BUILD_DIR}/RNReanimated"',
67    "CLANG_CXX_LANGUAGE_STANDARD" => "c++17",
68  }
69
70  s.user_target_xcconfig = {
71    'HEADER_SEARCH_PATHS' => '"${PODS_CONFIGURATION_BUILD_DIR}/expo-dev-launcher/Swift Compatibility Header"',
72  }
73
74  s.dependency "React-Core"
75  s.dependency 'React-RCTAppDelegate'
76  s.dependency "expo-dev-menu-interface"
77  s.dependency "EXManifests"
78  s.dependency "EXUpdatesInterface"
79  s.dependency "expo-dev-menu"
80  s.dependency "ExpoModulesCore"
81
82  unless defined?(install_modules_dependencies)
83    # `install_modules_dependencies` is defined from react_native_pods.rb.
84    # when running with `pod ipc spec`, this method is not defined and we have to require manually.
85    require File.join(File.dirname(`node --print "require.resolve('react-native/package.json')"`), "scripts/react_native_pods")
86  end
87  install_modules_dependencies(s)
88
89  s.subspec 'Unsafe' do |unsafe|
90    unsafe.source_files = 'ios/Unsafe/**/*.{h,m,mm,swift,cpp}'
91    unsafe.compiler_flags = '-x objective-c++ -std=c++1z -fno-objc-arc' # Disable Automatic Reference Counting
92  end
93
94  s.subspec 'Main' do |main|
95    main.dependency "expo-dev-launcher/Unsafe"
96  end
97
98  s.test_spec 'Tests' do |test_spec|
99    test_spec.source_files = 'ios/Tests/**/*.{h,m,mm,swift}'
100    test_spec.dependency 'Quick'
101    test_spec.dependency 'Nimble'
102    test_spec.dependency "React-CoreModules"
103    test_spec.dependency "OHHTTPStubs"
104    # ExpoModulesCore requires React-hermes or React-jsc in tests, add ExpoModulesTestCore for the underlying dependencies
105    test_spec.dependency 'ExpoModulesTestCore'
106  end
107
108  s.default_subspec = 'Main'
109
110end
111