Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Do not add JCenter dependency when building RN apps #1856

Merged
merged 8 commits into from
Nov 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ services:
- BUILDKITE
- REGISTRY_URL
- REACT_NATIVE_VERSION
- MAVEN_REPO_URL
- MAVEN_REPO_CREDS
networks:
default:
aliases:
Expand Down
13 changes: 0 additions & 13 deletions packages/react-native/android/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -72,19 +72,6 @@ allprojects {
maven { url bugsnagRepo }
mavenCentral()
google()

if (System.getenv('MAVEN_REPO_URL') && System.getenv('MAVEN_REPO_CREDS')) {
def decodedCreds = new String(System.getenv('MAVEN_REPO_CREDS').decodeBase64(), 'UTF-8').split(':')
maven {
url(System.getenv('MAVEN_REPO_URL'))
credentials {
username decodedCreds[0]
password decodedCreds[1]
}
}
} else {
jcenter()
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ buildscript {
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.1")
Expand All @@ -32,7 +32,17 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}

mavenCentral()
google()
jcenter()
if (System.getenv('MAVEN_REPO_URL') && System.getenv('MAVEN_REPO_CREDS')) {
def decodedCreds = new String(System.getenv('MAVEN_REPO_CREDS').decodeBase64(), 'UTF-8').split(':')
maven {
url(System.getenv('MAVEN_REPO_URL'))
credentials {
username decodedCreds[0]
password decodedCreds[1]
}
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.4.2")
Expand All @@ -31,8 +31,18 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}

mavenCentral()
google()
jcenter()
if (System.getenv('MAVEN_REPO_URL') && System.getenv('MAVEN_REPO_CREDS')) {
def decodedCreds = new String(System.getenv('MAVEN_REPO_CREDS').decodeBase64(), 'UTF-8').split(':')
maven {
url(System.getenv('MAVEN_REPO_URL'))
credentials {
username decodedCreds[0]
password decodedCreds[1]
}
}
}
maven { url 'https://jitpack.io' }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -197,18 +197,6 @@ dependencies {

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -43,37 +43,5 @@ public ReactNativeHost getReactNativeHost() {
public void onCreate() {
super.onCreate();
SoLoader.init(this, /* native exopackage */ false);
initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
}

/**
* Loads Flipper in React Native templates. Call this in the onCreate method with something like
* initializeFlipper(this, getReactNativeHost().getReactInstanceManager());
*
* @param context
* @param reactInstanceManager
*/
private static void initializeFlipper(
Context context, ReactInstanceManager reactInstanceManager) {
if (BuildConfig.DEBUG) {
try {
/*
We use reflection here to pick up the class that initializes Flipper,
since Flipper library is not available in release mode
*/
Class<?> aClass = Class.forName("com.rn0_62.ReactNativeFlipper");
aClass
.getMethod("initializeFlipper", Context.class, ReactInstanceManager.class)
.invoke(null, context, reactInstanceManager);
} catch (ClassNotFoundException e) {
e.printStackTrace();
} catch (NoSuchMethodException e) {
e.printStackTrace();
} catch (IllegalAccessException e) {
e.printStackTrace();
} catch (InvocationTargetException e) {
e.printStackTrace();
}
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ buildscript {
}
repositories {
google()
jcenter()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:3.5.2")
Expand All @@ -31,8 +31,18 @@ allprojects {
url("$rootDir/../node_modules/jsc-android/dist")
}

mavenCentral()
google()
jcenter()
if (System.getenv('MAVEN_REPO_URL') && System.getenv('MAVEN_REPO_CREDS')) {
def decodedCreds = new String(System.getenv('MAVEN_REPO_CREDS').decodeBase64(), 'UTF-8').split(':')
maven {
url(System.getenv('MAVEN_REPO_URL'))
credentials {
username decodedCreds[0]
password decodedCreds[1]
}
}
}
maven { url 'https://www.jitpack.io' }
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,3 @@ org.gradle.jvmargs=-Xmx4096m -XX:MaxPermSize=1024m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=true

# Version of flipper SDK to use with React Native
FLIPPER_VERSION=0.33.1
Original file line number Diff line number Diff line change
Expand Up @@ -4,33 +4,10 @@
#import <React/RCTBundleURLProvider.h>
#import <React/RCTRootView.h>

#if DEBUG
#import <FlipperKit/FlipperClient.h>
#import <FlipperKitLayoutPlugin/FlipperKitLayoutPlugin.h>
#import <FlipperKitUserDefaultsPlugin/FKUserDefaultsPlugin.h>
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>

static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient];
SKDescriptorMapper *layoutDescriptorMapper = [[SKDescriptorMapper alloc] initWithDefaults];
[client addPlugin:[[FlipperKitLayoutPlugin alloc] initWithRootNode:application withDescriptorMapper:layoutDescriptorMapper]];
[client addPlugin:[[FKUserDefaultsPlugin alloc] initWithSuiteName:nil]];
[client addPlugin:[FlipperKitReactPlugin new]];
[client addPlugin:[[FlipperKitNetworkPlugin alloc] initWithNetworkAdapter:[SKIOSNetworkAdapter new]]];
[client start];
}
#endif

@implementation AppDelegate

- (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions
{
#if DEBUG
InitializeFlipper(application);
#endif

RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"rn0_62"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -190,19 +190,6 @@ dependencies {

implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0"

debugImplementation("com.facebook.flipper:flipper:${FLIPPER_VERSION}") {
exclude group:'com.facebook.fbjni'
}

debugImplementation("com.facebook.flipper:flipper-network-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
exclude group:'com.squareup.okhttp3', module:'okhttp'
}

debugImplementation("com.facebook.flipper:flipper-fresco-plugin:${FLIPPER_VERSION}") {
exclude group:'com.facebook.flipper'
}

if (enableHermes) {
def hermesPath = "../../node_modules/hermes-engine/android/";
debugImplementation files(hermesPath + "hermes-debug.aar")
Expand Down

This file was deleted.

This file was deleted.

Loading