Files
react-native/packages/react-native-codegen/android/build.gradle
T
Andrei Shikov 704dd2812f Replace jcenter with mavenCentral when possible
Summary:
Changelog:
[Android][Changed] - Initial replacement of jcenter with mavenCentral.

Replaces jcenter with Maven Central in the build files of the repository.

Some dependencies are not resolvable from maven central yet, so for now they are included from jcenter, but limited to specific modules only.

I didn't touch the template for now.

Reviewed By: mdvacca

Differential Revision: D26260977

fbshipit-source-id: 2a65e1195b6367c026089184ad6471bf3573dc37
2021-02-05 05:17:32 -08:00

77 lines
2.2 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()
jcenter {
content {
includeGroup("org.jetbrains.trove4j")
}
}
}
dependencies {
classpath("com.android.tools.build:gradle:4.1.0")
}
}
allprojects {
repositories {
mavenLocal()
google()
mavenCentral()
jcenter {
content {
includeGroup("org.jetbrains.trove4j")
}
}
}
}
// 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")
}
}