@dolami-inc/react-native-expo-unity 0.3.0 → 0.3.2

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.
@@ -2,8 +2,12 @@ apply plugin: 'com.android.library'
2
2
  apply plugin: 'kotlin-android'
3
3
  apply plugin: 'expo-module-gradle-plugin'
4
4
 
5
+ def packageJson = new groovy.json.JsonSlurper().parse(file("../package.json"))
6
+ def semver = packageJson.version.split('\\.')
7
+ def computedVersionCode = semver[0].toInteger() * 10000 + semver[1].toInteger() * 100 + semver[2].toInteger()
8
+
5
9
  group = 'expo.modules.unity'
6
- version = '0.2.0'
10
+ version = packageJson.version
7
11
 
8
12
  android {
9
13
  namespace "expo.modules.unity"
@@ -11,6 +15,8 @@ android {
11
15
 
12
16
  defaultConfig {
13
17
  minSdk 24
18
+ versionCode computedVersionCode
19
+ versionName packageJson.version
14
20
  }
15
21
 
16
22
  compileOptions {
package/app.plugin.js CHANGED
@@ -1,6 +1,7 @@
1
1
  const {
2
2
  withXcodeProject,
3
3
  withSettingsGradle,
4
+ withProjectBuildGradle,
4
5
  withAppBuildGradle,
5
6
  } = require('@expo/config-plugins');
6
7
  const path = require('path');
@@ -15,9 +16,9 @@ const fs = require('fs');
15
16
  * bundle at build time (device builds only)
16
17
  *
17
18
  * Android:
18
- * - Includes the :unityLibrary Gradle module from the Unity export
19
- * - Adds flatDir repos for Unity's .aar/.jar libs
20
- * - Adds the unityLibrary dependency and NDK abiFilters
19
+ * - Includes the :unityLibrary Gradle module in settings.gradle
20
+ * - Adds flatDir repos for Unity's .aar/.jar libs in root build.gradle
21
+ * - Adds the unityLibrary dependency and NDK abiFilters in app/build.gradle
21
22
  *
22
23
  * @param {object} config - Expo config
23
24
  * @param {object} options
@@ -83,7 +84,7 @@ const withExpoUnity = (config, options = {}) => {
83
84
  return config;
84
85
  });
85
86
 
86
- // -- Android: settings.gradle --
87
+ // -- Android: settings.gradle (include :unityLibrary module) --
87
88
  config = withSettingsGradle(config, (config) => {
88
89
  const projectRoot = config.modRequest.projectRoot;
89
90
  const androidUnityPath =
@@ -103,28 +104,22 @@ const withExpoUnity = (config, options = {}) => {
103
104
  `\n// Unity as a Library\n${includeSnippet}\n${projectSnippet}\n`;
104
105
  }
105
106
 
106
- // Add flatDir repos for Unity's native libs
107
+ return config;
108
+ });
109
+
110
+ // -- Android: build.gradle (flatDir repos for Unity's native libs) --
111
+ // This must go in the root build.gradle (not settings.gradle) because
112
+ // `allprojects` is not a valid method in settings.gradle on Gradle 8+.
113
+ config = withProjectBuildGradle(config, (config) => {
107
114
  const flatDirSnippet = `flatDir { dirs "\${project(':unityLibrary').projectDir}/libs" }`;
108
115
  if (!config.modResults.contents.includes(flatDirSnippet)) {
109
- // Insert into dependencyResolutionManagement.repositories or allprojects.repositories
110
- const repoBlockRegex =
111
- /dependencyResolutionManagement\s*\{[\s\S]*?repositories\s*\{/;
112
116
  const allProjectsRegex = /allprojects\s*\{[\s\S]*?repositories\s*\{/;
113
117
 
114
- if (repoBlockRegex.test(config.modResults.contents)) {
115
- config.modResults.contents = config.modResults.contents.replace(
116
- repoBlockRegex,
117
- (match) => `${match}\n ${flatDirSnippet}`
118
- );
119
- } else if (allProjectsRegex.test(config.modResults.contents)) {
118
+ if (allProjectsRegex.test(config.modResults.contents)) {
120
119
  config.modResults.contents = config.modResults.contents.replace(
121
120
  allProjectsRegex,
122
121
  (match) => `${match}\n ${flatDirSnippet}`
123
122
  );
124
- } else {
125
- // Fallback: append a standalone block
126
- config.modResults.contents +=
127
- `\nallprojects {\n repositories {\n ${flatDirSnippet}\n }\n}\n`;
128
123
  }
129
124
  }
130
125
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolami-inc/react-native-expo-unity",
3
- "version": "0.3.0",
3
+ "version": "0.3.2",
4
4
  "description": "Unity as a Library (UaaL) bridge for React Native / Expo",
5
5
  "main": "src/index.ts",
6
6
  "types": "src/index.ts",