expo-gl 12.0.0 → 12.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -10,6 +10,17 @@
10
10
 
11
11
  ### 💡 Others
12
12
 
13
+ ## 12.1.0 — 2022-12-05
14
+
15
+ ### 🎉 New features
16
+
17
+ - Migrated the view manager to the new Expo modules API and thus added support for Fabric. ([#19859](https://github.com/expo/expo/pull/19859) by [@tsapeta](https://github.com/tsapeta))
18
+
19
+ ### 🐛 Bug fixes
20
+
21
+ - Fixed build errors when testing on React Native nightly builds. ([#19805](https://github.com/expo/expo/pull/19805) by [@kudo](https://github.com/kudo))
22
+ - Fixed error for duplicated META-INF files when building on Android. ([#20251](https://github.com/expo/expo/pull/20251) by [@kudo](https://github.com/kudo))
23
+
13
24
  ## 12.0.0 — 2022-10-25
14
25
 
15
26
  ### 🛠 Breaking changes
@@ -3,7 +3,7 @@ require 'json'
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
 
5
5
  Pod::Spec.new do |s|
6
- s.name = 'EXGL'
6
+ s.name = 'ExpoGL'
7
7
  s.version = package['version']
8
8
  s.summary = package['description']
9
9
  s.description = package['description']
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.static_framework = true
16
16
 
17
17
  s.dependency 'ExpoModulesCore'
18
- s.dependency 'React-jsi'
18
+ s.dependency 'ReactCommon/turbomodule/core'
19
19
 
20
20
  s.compiler_flags = '-x objective-c++ -std=c++1z'
21
21
  s.pod_target_xcconfig = {
@@ -26,6 +26,8 @@ Pod::Spec.new do |s|
26
26
  s.source_files = "ios/**/*.h"
27
27
  s.vendored_frameworks = "#{s.name}.xcframework"
28
28
  else
29
- s.source_files = "ios/**/*.{h,m,mm}", "common/**/*.{h,cpp,def}"
29
+ s.source_files = "ios/**/*.{h,m,mm,swift}", "common/**/*.{h,cpp,def}"
30
30
  end
31
+
32
+ s.public_header_files = ['ios/**/*.h', 'common/EXGLNativeApi.h']
31
33
  end
package/README.md CHANGED
@@ -4,7 +4,7 @@ Provides GLView that acts as OpenGL ES render target and gives GL context object
4
4
 
5
5
  # API documentation
6
6
 
7
- - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/gl-view.md)
7
+ - [Documentation for the main branch](https://github.com/expo/expo/blob/main/docs/pages/versions/unversioned/sdk/gl-view.mdx)
8
8
  - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/gl-view/)
9
9
 
10
10
  # Installation in managed Expo projects
@@ -3,16 +3,26 @@ import java.nio.file.Paths
3
3
  apply plugin: 'com.android.library'
4
4
  apply plugin: 'kotlin-android'
5
5
  apply plugin: 'maven-publish'
6
+ apply plugin: "de.undercouch.download"
6
7
 
7
8
  group = 'host.exp.exponent'
8
- version = '12.0.0'
9
-
10
- def REACT_NATIVE_DIR = new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent
11
- def RN_BUILD_FROM_SOURCE = findProject(":ReactAndroid") != null
12
- def RN_SO_DIR = RN_BUILD_FROM_SOURCE
13
- ? Paths.get(findProject(":ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni")
14
- : "${buildDir}/react-native-0*/jni"
15
- def RN_AAR_DIR = "${REACT_NATIVE_DIR}/android"
9
+ version = '12.1.0'
10
+
11
+ def customDownloadsDir = System.getenv("REACT_NATIVE_DOWNLOADS_DIR")
12
+ def downloadsDir = customDownloadsDir ? new File(customDownloadsDir) : new File("$buildDir/downloads")
13
+
14
+ def REACT_NATIVE_BUILD_FROM_SOURCE = findProject(":ReactAndroid") != null
15
+ def REACT_NATIVE_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
16
+ ? findProject(":ReactAndroid").getProjectDir().parent
17
+ : new File(["node", "--print", "require.resolve('react-native/package.json')"].execute(null, rootDir).text.trim()).parent
18
+ def RN_SO_DIR = REACT_NATIVE_BUILD_FROM_SOURCE
19
+ ? Paths.get(findProject(":ReactAndroid").getProjectDir().toString(), "build", "intermediates", "library_*", "*", "jni")
20
+ : "${buildDir}/react-native.aar/jni"
21
+
22
+ def reactProperties = new Properties()
23
+ file("$REACT_NATIVE_DIR/ReactAndroid/gradle.properties").withInputStream { reactProperties.load(it) }
24
+ def reactNativeIsNightly = reactProperties.getProperty("VERSION_NAME").startsWith("0.0.0-")
25
+
16
26
  def reactNativeArchitectures() {
17
27
  def value = project.getProperties().get("reactNativeArchitectures")
18
28
  return value ? value.split(",") : ["armeabi-v7a", "x86", "x86_64", "arm64-v8a"]
@@ -45,6 +55,7 @@ buildscript {
45
55
 
46
56
  dependencies {
47
57
  classpath("org.jetbrains.kotlin:kotlin-gradle-plugin:${getKotlinVersion()}")
58
+ classpath("de.undercouch:gradle-download-task:5.3.0")
48
59
  }
49
60
  }
50
61
 
@@ -94,7 +105,7 @@ android {
94
105
  minSdkVersion safeExtGet("minSdkVersion", 21)
95
106
  targetSdkVersion safeExtGet("targetSdkVersion", 31)
96
107
  versionCode 31
97
- versionName "12.0.0"
108
+ versionName "12.1.0"
98
109
 
99
110
  externalNativeBuild {
100
111
  cmake {
@@ -114,7 +125,7 @@ android {
114
125
 
115
126
  packagingOptions {
116
127
  // Gradle will add cmake target dependencies into packaging.
117
- excludes = [
128
+ excludes += [
118
129
  "**/libc++_shared.so",
119
130
  "**/libjsi.so",
120
131
  ]
@@ -141,27 +152,44 @@ dependencies {
141
152
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${getKotlinVersion()}"
142
153
  }
143
154
 
155
+ def downloadReactNativeNightlyAAR = { buildType, version, downloadFile ->
156
+ def classifier = buildType == 'Debug' ? 'debug' : 'release'
157
+ download.run {
158
+ src("https://oss.sonatype.org/service/local/artifact/maven/redirect?r=snapshots&g=com.facebook.react&a=react-native&c=${classifier}&e=aar&v=${version}-SNAPSHOT")
159
+ onlyIfNewer(true)
160
+ overwrite(false)
161
+ dest(downloadFile)
162
+ }
163
+ }
164
+
144
165
  def extractReactNativeAAR = { buildType ->
145
166
  def suffix = buildType == 'Debug' ? '-debug' : '-release'
146
- def rnAARs = fileTree(RN_AAR_DIR).matching { include "**/react-native/**/*${suffix}.aar" }
147
- if (rnAARs.isEmpty()) {
148
- rnAARs = fileTree(RN_AAR_DIR).matching { include "**/react-native/**/*.aar" }
149
- }
150
- if (rnAARs.any()) {
151
- // node_modules/react-native has a .aar, extract headers
152
- if (rnAARs.size() > 1) {
153
- logger.error("More than one React Native AAR file has been found:")
154
- rnAARs.each {println(it) }
155
- throw new GradleException("Multiple React Native AARs found:\n${rnAARs.join("\n")}" +
156
- "\nRemove the old ones and try again")
167
+ def rnAAR
168
+ if (reactNativeIsNightly) {
169
+ def downloadFile = file("${downloadsDir}/react-native-nightly.aar")
170
+ downloadReactNativeNightlyAAR(buildType, reactProperties.getProperty("VERSION_NAME"), downloadFile)
171
+ rnAAR = downloadFile
172
+ } else {
173
+ def rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*${suffix}.aar" }
174
+ if (rnAARs.isEmpty()) {
175
+ rnAARs = fileTree(REACT_NATIVE_DIR).matching { include "**/react-native/**/*.aar" }
176
+ }
177
+ if (rnAARs.any()) {
178
+ // node_modules/react-native has a .aar, extract headers
179
+ if (rnAARs.size() > 1) {
180
+ logger.error("More than one React Native AAR file has been found:")
181
+ rnAARs.each {println(it) }
182
+ throw new GradleException("Multiple React Native AARs found:\n${rnAARs.join("\n")}" +
183
+ "\nRemove the old ones and try again")
184
+ }
157
185
  }
186
+ rnAAR = rnAARs.singleFile
158
187
  }
159
- def rnAAR = rnAARs.singleFile
160
188
  def file = rnAAR.absoluteFile
161
189
  def packageName = file.name.tokenize('-')[0]
162
190
  copy {
163
191
  from zipTree(file)
164
- into "$buildDir/$file.name"
192
+ into "$buildDir/react-native.aar"
165
193
  include "jni/**/*"
166
194
  }
167
195
  }
@@ -195,12 +223,12 @@ tasks.whenTaskAdded { task ->
195
223
  if (!task.name.contains("Clean") && (task.name.contains('externalNativeBuild') || task.name.startsWith('configureCMake'))) {
196
224
  def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
197
225
  task.dependsOn(extractJNIFiles)
198
- if (RN_BUILD_FROM_SOURCE) {
226
+ if (REACT_NATIVE_BUILD_FROM_SOURCE) {
199
227
  task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
200
228
  } else {
201
229
  task.dependsOn("extractReactNativeAAR${buildType}")
202
230
  }
203
- } else if (task.name.startsWith('generateJsonModel') && RN_BUILD_FROM_SOURCE) {
231
+ } else if (task.name.startsWith('generateJsonModel') && REACT_NATIVE_BUILD_FROM_SOURCE) {
204
232
  def buildType = task.name.endsWith('Debug') ? 'Debug' : 'Release'
205
233
  task.dependsOn(":ReactAndroid:copy${buildType}JniLibsProjectOnly")
206
234
  }
@@ -28,11 +28,12 @@ typedef unsigned int EXGLObjectId;
28
28
 
29
29
  EXGLContextId EXGLContextCreate();
30
30
 
31
-
31
+ #ifdef __cplusplus
32
32
  // [JS thread] Create an EXGL context and return its id number. Saves the
33
33
  // JavaScript interface object (has a WebGLRenderingContext-style API) at
34
34
  // `global.__EXGLContexts[id]` in JavaScript.
35
35
  void EXGLContextPrepare(void *runtime, EXGLContextId exglCtxId, std::function<void(void)> flushMethod);
36
+ #endif // __cplusplus
36
37
 
37
38
  // [Any thread] Check whether we should redraw the surface
38
39
  bool EXGLContextNeedsRedraw(EXGLContextId exglCtxId);
@@ -2,6 +2,7 @@
2
2
  "name": "expo-gl",
3
3
  "platforms": ["ios", "android"],
4
4
  "ios": {
5
- "podspecPath": "./EXGL.podspec"
5
+ "podspecPath": "./ExpoGL.podspec",
6
+ "modules": ["GLViewModule"]
6
7
  }
7
8
  }
@@ -2,8 +2,8 @@
2
2
 
3
3
  #import <ExpoModulesCore/EXCameraInterface.h>
4
4
 
5
- #import <EXGL/EXGLContext.h>
6
- #import <EXGL/EXGLObject.h>
5
+ #import <ExpoGL/EXGLContext.h>
6
+ #import <ExpoGL/EXGLObject.h>
7
7
 
8
8
  @interface EXGLCameraObject : EXGLObject
9
9
 
@@ -7,8 +7,8 @@
7
7
 
8
8
  #import <ExpoModulesCore/EXCameraInterface.h>
9
9
 
10
- #import <EXGL/EXGLCameraObject.h>
11
- #import <EXGL/EXGLContext.h>
10
+ #import <ExpoGL/EXGLCameraObject.h>
11
+ #import <ExpoGL/EXGLContext.h>
12
12
 
13
13
  @interface EXGLCameraObject () <AVCaptureVideoDataOutputSampleBufferDelegate>
14
14
 
@@ -1,7 +1,7 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <OpenGLES/EAGL.h>
4
- #import <EXGL/EXGLNativeApi.h>
4
+ #import <ExpoGL/EXGLNativeApi.h>
5
5
  #import <ExpoModulesCore/EXModuleRegistry.h>
6
6
 
7
7
  @class EXGLContext;
@@ -1,7 +1,7 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
- #import <EXGL/EXGLContext.h>
4
- #import <EXGL/EXGLObjectManager.h>
3
+ #import <ExpoGL/EXGLContext.h>
4
+ #import <ExpoGL/EXGLObjectManager.h>
5
5
 
6
6
  #import <ExpoModulesCore/EXUtilities.h>
7
7
  #import <ExpoModulesCore/EXUIManager.h>
@@ -1,7 +1,7 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <Foundation/Foundation.h>
4
- #import <EXGL/EXGLNativeApi.h>
4
+ #import <ExpoGL/EXGLNativeApi.h>
5
5
 
6
6
  @interface EXGLObject : NSObject
7
7
 
@@ -1,6 +1,6 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
- #import <EXGL/EXGLObject.h>
3
+ #import <ExpoGL/EXGLObject.h>
4
4
 
5
5
  @implementation EXGLObject
6
6
 
@@ -4,10 +4,10 @@
4
4
  #import <ExpoModulesCore/EXUIManager.h>
5
5
  #import <ExpoModulesCore/EXCameraInterface.h>
6
6
 
7
- #import <EXGL/EXGLObjectManager.h>
8
- #import <EXGL/EXGLObject.h>
9
- #import <EXGL/EXGLView.h>
10
- #import <EXGL/EXGLCameraObject.h>
7
+ #import <ExpoGL/EXGLObjectManager.h>
8
+ #import <ExpoGL/EXGLObject.h>
9
+ #import <ExpoGL/EXGLView.h>
10
+ #import <ExpoGL/EXGLCameraObject.h>
11
11
 
12
12
  @interface EXGLObjectManager ()
13
13
 
@@ -1,14 +1,14 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
- #import <EXGL/EXGLNativeApi.h>
4
- #import <EXGL/EXGLContext.h>
3
+ #import <ExpoGL/EXGLNativeApi.h>
4
+ #import <ExpoGL/EXGLContext.h>
5
5
  #import <ExpoModulesCore/EXModuleRegistry.h>
6
+ #import <ExpoModulesCore/EXLegacyExpoViewProtocol.h>
6
7
 
7
8
  NS_ASSUME_NONNULL_BEGIN
8
9
 
9
- @interface EXGLView : UIView <EXGLContextDelegate>
10
+ @interface EXGLView : UIView <EXGLContextDelegate, EXLegacyExpoViewProtocol>
10
11
 
11
- - (instancetype)initWithModuleRegistry:(EXModuleRegistry *)moduleRegistry;
12
12
  - (EXGLContextId)exglCtxId;
13
13
 
14
14
  // AR
@@ -16,7 +16,7 @@ NS_ASSUME_NONNULL_BEGIN
16
16
  - (void)maybeStopARSession;
17
17
 
18
18
  @property (nonatomic, copy, nullable) EXDirectEventBlock onSurfaceCreate;
19
- @property (nonatomic, assign) NSNumber *msaaSamples;
19
+ @property (nonatomic, assign) NSInteger msaaSamples;
20
20
 
21
21
  // "protected"
22
22
  @property (nonatomic, strong, nullable) EXGLContext *glContext;
@@ -1,8 +1,8 @@
1
1
  // Copyright 2016-present 650 Industries. All rights reserved.
2
2
 
3
3
  #import <ExpoModulesCore/EXUtilities.h>
4
- #import <EXGL/EXGLView.h>
5
- #import <EXGL/EXGLContext.h>
4
+ #import <ExpoGL/EXGLView.h>
5
+ #import <ExpoGL/EXGLContext.h>
6
6
 
7
7
  #include <OpenGLES/ES2/glext.h>
8
8
  #include <OpenGLES/ES3/gl.h>
@@ -188,7 +188,7 @@
188
188
  glGenRenderbuffers(1, &self->_msaaRenderbuffer);
189
189
  glBindFramebuffer(GL_FRAMEBUFFER, self->_msaaFramebuffer);
190
190
  glBindRenderbuffer(GL_RENDERBUFFER, self->_msaaRenderbuffer);
191
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, self.msaaSamples.intValue, GL_RGBA8,
191
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, self.msaaSamples, GL_RGBA8,
192
192
  self->_layerWidth, self->_layerHeight);
193
193
  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0,
194
194
  GL_RENDERBUFFER, self->_msaaRenderbuffer);
@@ -198,7 +198,7 @@
198
198
  // Set up new depth+stencil renderbuffer
199
199
  glGenRenderbuffers(1, &self->_viewDepthStencilbuffer);
200
200
  glBindRenderbuffer(GL_RENDERBUFFER, self->_viewDepthStencilbuffer);
201
- glRenderbufferStorageMultisample(GL_RENDERBUFFER, self.msaaSamples.intValue, GL_DEPTH24_STENCIL8,
201
+ glRenderbufferStorageMultisample(GL_RENDERBUFFER, self.msaaSamples, GL_DEPTH24_STENCIL8,
202
202
  self->_layerWidth, self->_layerHeight);
203
203
  glFramebufferRenderbuffer(GL_FRAMEBUFFER, GL_DEPTH_ATTACHMENT,
204
204
  GL_RENDERBUFFER, self->_viewDepthStencilbuffer);
@@ -1,6 +1,6 @@
1
1
  #import <Foundation/Foundation.h>
2
2
 
3
- #include <EXGL/EXPlatformUtils.h>
3
+ #include <ExpoGL/EXPlatformUtils.h>
4
4
 
5
5
  namespace expo {
6
6
  namespace gl_cpp {
@@ -0,0 +1,17 @@
1
+ // Copyright 2022-present 650 Industries. All rights reserved.
2
+
3
+ import ExpoModulesCore
4
+
5
+ public final class GLViewModule: Module {
6
+ public func definition() -> ModuleDefinition {
7
+ Name("ExponentGLView")
8
+
9
+ View(EXGLView.self) {
10
+ Events("onSurfaceCreate")
11
+
12
+ Prop("msaaSamples") { (view, msaaSamples: Int) in
13
+ view.msaaSamples = msaaSamples
14
+ }
15
+ }
16
+ }
17
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "expo-gl",
3
- "version": "12.0.0",
3
+ "version": "12.1.0",
4
4
  "description": "Provides GLView that acts as OpenGL ES render target and gives GL context object implementing WebGL 2.0 specification.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -49,5 +49,5 @@
49
49
  "peerDependencies": {
50
50
  "expo": "*"
51
51
  },
52
- "gitHead": "eab2b09c735fb0fc2bf734a3f29a6593adba3838"
52
+ "gitHead": "6e6bb61bb071a269e62c87aca1d579bec6361aa8"
53
53
  }
@@ -1,8 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <ExpoModulesCore/EXViewManager.h>
4
- #import <ExpoModulesCore/EXModuleRegistryConsumer.h>
5
-
6
- @interface EXGLViewManager : EXViewManager <EXModuleRegistryConsumer>
7
-
8
- @end
@@ -1,42 +0,0 @@
1
- // Copyright 2016-present 650 Industries. All rights reserved.
2
-
3
- #import <EXGL/EXGLView.h>
4
- #import <EXGL/EXGLViewManager.h>
5
- #import <ExpoModulesCore/EXUIManager.h>
6
-
7
- @interface EXGLViewManager ()
8
-
9
- @property (nonatomic, weak) EXModuleRegistry *moduleRegistry;
10
-
11
- @end
12
-
13
- @implementation EXGLViewManager
14
-
15
- EX_EXPORT_MODULE(ExponentGLViewManager);
16
-
17
- - (UIView *)view
18
- {
19
- return [[EXGLView alloc] initWithModuleRegistry:_moduleRegistry];
20
- }
21
-
22
- - (NSString *)viewName
23
- {
24
- return @"ExponentGLView";
25
- }
26
-
27
- - (NSArray<NSString *> *)supportedEvents
28
- {
29
- return @[@"onSurfaceCreate"];
30
- }
31
-
32
- EX_VIEW_PROPERTY(msaaSamples, NSNumber *, EXGLView)
33
- {
34
- [view setMsaaSamples:value];
35
- }
36
-
37
- - (void)setModuleRegistry:(EXModuleRegistry *)moduleRegistry
38
- {
39
- _moduleRegistry = moduleRegistry;
40
- }
41
-
42
- @end
@@ -1,40 +0,0 @@
1
- <?xml version="1.0" encoding="UTF-8"?>
2
- <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
- <plist version="1.0">
4
- <dict>
5
- <key>AvailableLibraries</key>
6
- <array>
7
- <dict>
8
- <key>LibraryIdentifier</key>
9
- <string>ios-arm64</string>
10
- <key>LibraryPath</key>
11
- <string>EXGL.framework</string>
12
- <key>SupportedArchitectures</key>
13
- <array>
14
- <string>arm64</string>
15
- </array>
16
- <key>SupportedPlatform</key>
17
- <string>ios</string>
18
- </dict>
19
- <dict>
20
- <key>LibraryIdentifier</key>
21
- <string>ios-arm64_x86_64-simulator</string>
22
- <key>LibraryPath</key>
23
- <string>EXGL.framework</string>
24
- <key>SupportedArchitectures</key>
25
- <array>
26
- <string>arm64</string>
27
- <string>x86_64</string>
28
- </array>
29
- <key>SupportedPlatform</key>
30
- <string>ios</string>
31
- <key>SupportedPlatformVariant</key>
32
- <string>simulator</string>
33
- </dict>
34
- </array>
35
- <key>CFBundlePackageType</key>
36
- <string>XFWK</string>
37
- <key>XCFrameworkFormatVersion</key>
38
- <string>1.0</string>
39
- </dict>
40
- </plist>