Files
react-native/packages/react-native-codegen/android/build.gradle
T
Dulmandakh 70da640946 remove jcenter (#31609)
Summary:
jcenter is read-only now, and newer versions of dependencies will be published to either MavenCentral or Jitpack. This PR removes jcenter to avoid future issues, then uses MavenCentral and Jitpack as replacement. Current flipper depends on Stetho version that is not available on MavenCentral, so had to exclude and bump the version.

Both Gradle and Buck successfully download all the dependencies.

## Changelog

[Android] [Changed] - Remove jcenter

Pull Request resolved: https://github.com/facebook/react-native/pull/31609

Test Plan: rn-tester builds and runs as expected.

Reviewed By: mdvacca

Differential Revision: D28802444

Pulled By: ShikaSD

fbshipit-source-id: 043ef079d0cda77a1f8dd732678452ed712741a4
2021-06-02 09:57:28 -07:00

67 lines
2.0 KiB
Groovy

/*
* Copyright (c) Facebook, Inc. and its affiliates.
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
*/
import org.apache.tools.ant.taskdefs.condition.Os
buildscript {
repositories {
mavenLocal()
google()
mavenCentral()
}
dependencies {
classpath("com.android.tools.build:gradle:4.2.1")
}
}
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
}
}
// This task is required when using react-native-codegen from source, instead of npm.
task('buildCodegenCLI', type: Exec) {
def codegenRoot = "$projectDir/.."
inputs.files(
file("$codegenRoot/scripts"),
file("$codegenRoot/src"),
file("$codegenRoot/package.json"),
file("$codegenRoot/.babelrc"),
file("$codegenRoot/.prettierrc"),
)
def libDir = file("$codegenRoot/lib")
libDir.mkdirs()
def nodeModulesDir = file("$codegenRoot/node_modules")
nodeModulesDir.mkdirs();
outputs.dirs(libDir, nodeModulesDir)
if (Os.isFamily(Os.FAMILY_WINDOWS)) {
// Convert path to Linux format: use canonical path to strip it off relative elements in the middle of the string.
// Then replace baskslashes with slashes, remove leading colon, add leading slash.
// Eg. D:\path1\sub2/.. -> /D/path1/path2
String canonicalPath = new File(codegenRoot).getCanonicalPath()
String linuxPath = canonicalPath.replace('\\', '/');
linuxPath = linuxPath.replace(':', '')
linuxPath = '/' + linuxPath
// Get the location of bash in the system; assume environment variable created to store it.
String bashHome = "$System.env.REACT_WINDOWS_BASH"
if (bashHome == null) {
throw new GradleException("REACT_WINDOWS_BASH is not defined.")
}
commandLine(bashHome, "-c", "$linuxPath/scripts/oss/build.sh")
}
else {
commandLine("$codegenRoot/scripts/oss/build.sh")
}
}