Commit edf06a33 authored by Peter Kotwicz's avatar Peter Kotwicz Committed by Commit Bot

Move androidx dependencies to dedicated folder part 1/3

This CL:
- Adds --android-deps-dir parameter to fetch_all.py This avoids having
  to place the androidx build.gradle in
  //third_party/androidx/third_party/android_deps/build.gradle
- Adds 'internalTargetVisibility' parameter to build.gradle. This will
  be used to enable //third_party/android_deps to depend on
  //third_party/androidx targets
- Removes 'depsPath' parameter in build.gradle and changes fetch_all.py
  to ignore --android-deps-dir parameter in computation of where in build
  directory DEPS is copied ot.
- Adds //third_party/android_deps to the 'ANDROID_DEPS' environment
  variable when running jetification. This fixes jetification for
  internal chrome

BUG=1064277

Change-Id: I2165846c032071315581278036bcee4ccea97262
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2422518
Commit-Queue: Peter Kotwicz <pkotwicz@chromium.org>
Reviewed-by: default avatarAndrew Grieve <agrieve@chromium.org>
Cr-Commit-Position: refs/heads/master@{#809196}
parent 843771e1
......@@ -234,7 +234,7 @@ dependencies {
task setUpRepository(type: BuildConfigGenerator) {
// Paths are relative to the chromium source root.
repositoryPath 'third_party/android_deps'
depsPath 'DEPS'
chromiumSourceRoot '../..'
cipdBucket 'chromium'
internalTargetVisibility = [ ':*' ]
}
......@@ -56,11 +56,6 @@ class BuildConfigGenerator extends DefaultTask {
*/
String repositoryPath
/**
* Relative path to the DEPS file where the cipd packages are specified.
*/
String depsPath
/**
* Relative path to the Chromium source root from the build.gradle file.
*/
......@@ -88,6 +83,11 @@ class BuildConfigGenerator extends DefaultTask {
*/
boolean onlyPlayServices
/**
* Array with visibility for targets which are not listed in build.gradle
*/
String[] internalTargetVisibility
@TaskAction
void main() {
skipLicenses = skipLicenses || project.hasProperty("skipLicenses")
......@@ -149,17 +149,19 @@ class BuildConfigGenerator extends DefaultTask {
downloadExecutor.awaitTermination(Long.MAX_VALUE, TimeUnit.NANOSECONDS);
// 3. Generate the root level build files
updateBuildTargetDeclaration(graph, "${normalisedRepoPath}/BUILD.gn", onlyPlayServices)
updateBuildTargetDeclaration(graph, repositoryPath, normalisedRepoPath, onlyPlayServices,
internalTargetVisibility)
updateDepsDeclaration(graph, cipdBucket, stripFromCipdPath, repositoryPath,
"${rootDirPath}/${depsPath}", onlyPlayServices)
"${rootDirPath}/DEPS", onlyPlayServices)
dependencyDirectories.sort { path1, path2 -> return path1.compareTo(path2) }
updateReadmeReferenceFile(dependencyDirectories,
"${normalisedRepoPath}/additional_readme_paths.json")
}
private static void updateBuildTargetDeclaration(ChromiumDepGraph depGraph, String path,
boolean onlyPlayServices) {
File buildFile = new File(path)
private static void updateBuildTargetDeclaration(ChromiumDepGraph depGraph,
String repositoryPath, String normalisedRepoPath, boolean onlyPlayServices,
String[] internalTargetVisibility) {
File buildFile = new File("${normalisedRepoPath}/BUILD.gn");
def sb = new StringBuilder()
// Comparator to sort the dependency in alphabetical order, with the visible ones coming
......@@ -229,8 +231,8 @@ class BuildConfigGenerator extends DefaultTask {
if (!dependency.visible) {
sb.append(" # To remove visibility constraint, add this dependency to\n")
sb.append(" # //third_party/android_deps/build.gradle.\n")
sb.append(" visibility = [ \":*\" ]\n")
sb.append(" # //${repositoryPath}/build.gradle.\n")
sb.append(" visibility = " + makeGnArray(internalTargetVisibility) + "\n")
}
if (dependency.testOnly) sb.append(" testonly = true\n")
if (!depsStr.empty) sb.append(" deps = [${depsStr}]\n")
......@@ -569,6 +571,18 @@ class BuildConfigGenerator extends DefaultTask {
return project.file("${chromiumSourceRoot}/${pathRelativeToChromiumRoot}").absolutePath
}
private static String makeGnArray(String[] values) {
def sb = new StringBuilder();
sb.append("[");
for (String value : values) {
sb.append("\"");
sb.append(value);
sb.append("\",");
}
sb.replace(sb.length() - 1, sb.length(), "]");
return sb.toString();
}
static String makeOwners() {
// Make it easier to upgrade existing dependencies without full third_party review.
return "file://third_party/android_deps/OWNERS"
......
This diff is collapsed.
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment