Skip to content

Commit

Permalink
Change the Android package name to not be the default name generated …
Browse files Browse the repository at this point in the history
…by the React Native CLI (#99)

We never changed the default Android package name generated by the React Native CLI when you first create the module/package. This didn't seem to matter as it is basically an implementation detail, but it turns out if multiple packages do this, they conflict in the gradle build. So this change just gives the Android package a unique name (babylonreactnative), which should resolve this issue.
  • Loading branch information
ryantrem authored Oct 20, 2020
1 parent e5410ed commit e092698
Show file tree
Hide file tree
Showing 11 changed files with 25 additions and 25 deletions.
2 changes: 1 addition & 1 deletion Modules/@babylonjs/react-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def configureReactNativePom(def pom) {
name packageJson.title
artifactId packageJson.name
version = packageJson.version
group = "com.reactlibrary"
group = "com.babylonreactnative"
description packageJson.description
url packageJson.repository.baseUrl

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="com.reactlibrary">
package="com.babylonreactnative">

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ namespace Babylon
};
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_initialize(JNIEnv* env, jclass obj, jobject context)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_initialize(JNIEnv* env, jclass obj, jobject context)
{
JavaVM* javaVM{};
if (env->GetJavaVM(&javaVM) != JNI_OK)
Expand All @@ -113,22 +113,22 @@ extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_ini
android::global::Initialize(javaVM, context);
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setCurrentActivity(JNIEnv* env, jclass obj, jobject activity)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setCurrentActivity(JNIEnv* env, jclass obj, jobject activity)
{
android::global::SetCurrentActivity(activity);
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_pause(JNIEnv* env, jclass obj)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_pause(JNIEnv* env, jclass obj)
{
android::global::Pause();
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_resume(JNIEnv* env, jclass obj)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_resume(JNIEnv* env, jclass obj)
{
android::global::Resume();
}

extern "C" JNIEXPORT jlong JNICALL Java_com_reactlibrary_BabylonNativeInterop_create(JNIEnv* env, jclass obj, jlong jsiRuntimeRef, jobject jsCallInvokerHolder, jobject surface)
extern "C" JNIEXPORT jlong JNICALL Java_com_babylonreactnative_BabylonNativeInterop_create(JNIEnv* env, jclass obj, jlong jsiRuntimeRef, jobject jsCallInvokerHolder, jobject surface)
{
auto jsiRuntime = reinterpret_cast<jsi::Runtime*>(jsiRuntimeRef);
auto callInvoker = jni::alias_ref<react::CallInvokerHolder::javaobject> {reinterpret_cast<react::CallInvokerHolder::javaobject>(jsCallInvokerHolder)}->cthis()->getCallInvoker();
Expand All @@ -137,26 +137,26 @@ extern "C" JNIEXPORT jlong JNICALL Java_com_reactlibrary_BabylonNativeInterop_cr
return reinterpret_cast<intptr_t>(native);
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_refresh(JNIEnv* env, jclass obj, jlong instanceRef, jobject surface)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_refresh(JNIEnv* env, jclass obj, jlong instanceRef, jobject surface)
{
auto native = reinterpret_cast<Babylon::Native*>(instanceRef);
ANativeWindow* windowPtr = ANativeWindow_fromSurface(env, surface);
native->Refresh(windowPtr);
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setPointerButtonState(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setPointerButtonState(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint buttonId, jboolean isDown, jint x, jint y)
{
auto native = reinterpret_cast<Babylon::Native*>(instanceRef);
native->SetPointerButtonState(static_cast<uint32_t>(pointerId), static_cast<uint32_t>(buttonId), isDown, static_cast<uint32_t>(x), static_cast<uint32_t>(y));
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_setPointerPosition(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint x, jint y)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_setPointerPosition(JNIEnv* env, jclass obj, jlong instanceRef, jint pointerId, jint x, jint y)
{
auto native = reinterpret_cast<Babylon::Native*>(instanceRef);
native->SetPointerPosition(static_cast<uint32_t>(pointerId), static_cast<uint32_t>(x), static_cast<uint32_t>(y));
}

extern "C" JNIEXPORT void JNICALL Java_com_reactlibrary_BabylonNativeInterop_destroy(JNIEnv* env, jclass obj, jlong instanceRef)
extern "C" JNIEXPORT void JNICALL Java_com_babylonreactnative_BabylonNativeInterop_destroy(JNIEnv* env, jclass obj, jlong instanceRef)
{
auto native = reinterpret_cast<Babylon::Native*>(instanceRef);
delete native;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import android.os.Handler;
import android.os.Looper;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import android.app.Activity;
import android.content.Context;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import java.util.Arrays;
import java.util.List;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import android.annotation.TargetApi;
import android.graphics.Bitmap;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package com.reactlibrary;
package com.babylonreactnative;

import com.facebook.react.bridge.Arguments;
import com.facebook.react.bridge.WritableMap;
Expand Down
2 changes: 1 addition & 1 deletion Package/Android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ def configureReactNativePom(def pom) {
name packageJson.title
artifactId packageJson.name
version = packageJson.version
group = "com.reactlibrary"
group = "com.babylonreactnative"
description packageJson.description
url packageJson.repository.baseUrl

Expand Down
14 changes: 7 additions & 7 deletions Package/gulpfile.js
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,13 @@ Assembled/android/src/main
Assembled/android/src/main/AndroidManifest.xml
Assembled/android/src/main/java
Assembled/android/src/main/java/com
Assembled/android/src/main/java/com/reactlibrary
Assembled/android/src/main/java/com/reactlibrary/BabylonNativeInterop.java
Assembled/android/src/main/java/com/reactlibrary/SnapshotDataReturnedEvent.java
Assembled/android/src/main/java/com/reactlibrary/BabylonModule.java
Assembled/android/src/main/java/com/reactlibrary/BabylonPackage.java
Assembled/android/src/main/java/com/reactlibrary/EngineViewManager.java
Assembled/android/src/main/java/com/reactlibrary/EngineView.java
Assembled/android/src/main/java/com/babylonreactnative
Assembled/android/src/main/java/com/babylonreactnative/BabylonNativeInterop.java
Assembled/android/src/main/java/com/babylonreactnative/SnapshotDataReturnedEvent.java
Assembled/android/src/main/java/com/babylonreactnative/BabylonModule.java
Assembled/android/src/main/java/com/babylonreactnative/BabylonPackage.java
Assembled/android/src/main/java/com/babylonreactnative/EngineViewManager.java
Assembled/android/src/main/java/com/babylonreactnative/EngineView.java
Assembled/android/src/main/jniLibs
Assembled/android/src/main/jniLibs/armeabi-v7a
Assembled/android/src/main/jniLibs/armeabi-v7a/libturbomodulejsijni.so
Expand Down

0 comments on commit e092698

Please sign in to comment.