@dolami-inc/react-native-expo-unity 0.3.1 → 0.3.3

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
@@ -16,7 +16,7 @@ const fs = require('fs');
16
16
  * bundle at build time (device builds only)
17
17
  *
18
18
  * Android:
19
- * - Includes the :unityLibrary Gradle module in settings.gradle
19
+ * - Includes the :unityLibrary Gradle module and .androidlib subprojects in settings.gradle
20
20
  * - Adds flatDir repos for Unity's .aar/.jar libs in root build.gradle
21
21
  * - Adds the unityLibrary dependency and NDK abiFilters in app/build.gradle
22
22
  *
@@ -84,7 +84,7 @@ const withExpoUnity = (config, options = {}) => {
84
84
  return config;
85
85
  });
86
86
 
87
- // -- Android: settings.gradle (include :unityLibrary module) --
87
+ // -- Android: settings.gradle (include :unityLibrary module + subprojects) --
88
88
  config = withSettingsGradle(config, (config) => {
89
89
  const projectRoot = config.modRequest.projectRoot;
90
90
  const androidUnityPath =
@@ -92,18 +92,32 @@ const withExpoUnity = (config, options = {}) => {
92
92
  process.env.EXPO_UNITY_ANDROID_PATH ||
93
93
  path.join(projectRoot, 'unity', 'builds', 'android');
94
94
 
95
- const contents = config.modResults.contents;
95
+ const unityLibDir = path.join(androidUnityPath, 'unityLibrary');
96
96
 
97
97
  // Include :unityLibrary module
98
98
  const includeSnippet = `include ':unityLibrary'`;
99
- const projectSnippet = `project(':unityLibrary').projectDir = new File('${androidUnityPath}/unityLibrary')`;
99
+ const projectSnippet = `project(':unityLibrary').projectDir = new File('${unityLibDir}')`;
100
100
 
101
- if (!contents.includes(includeSnippet)) {
102
- config.modResults.contents =
103
- contents +
101
+ if (!config.modResults.contents.includes(includeSnippet)) {
102
+ config.modResults.contents +=
104
103
  `\n// Unity as a Library\n${includeSnippet}\n${projectSnippet}\n`;
105
104
  }
106
105
 
106
+ // Auto-discover .androidlib subprojects (e.g. xrmanifest.androidlib)
107
+ if (fs.existsSync(unityLibDir)) {
108
+ const subprojects = fs.readdirSync(unityLibDir).filter((name) =>
109
+ name.endsWith('.androidlib') &&
110
+ fs.existsSync(path.join(unityLibDir, name, 'build.gradle'))
111
+ );
112
+
113
+ for (const sub of subprojects) {
114
+ const subInclude = `include ':unityLibrary:${sub}'`;
115
+ if (!config.modResults.contents.includes(subInclude)) {
116
+ config.modResults.contents += `${subInclude}\n`;
117
+ }
118
+ }
119
+ }
120
+
107
121
  return config;
108
122
  });
109
123
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dolami-inc/react-native-expo-unity",
3
- "version": "0.3.1",
3
+ "version": "0.3.3",
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",