diff --git a/DEPS b/DEPS index ab012e9c1e..3f3b1fe8e4 100644 --- a/DEPS +++ b/DEPS @@ -735,7 +735,7 @@ deps = { 'packages': [ { 'package': 'flutter/android/embedding_bundle', - 'version': 'last_updated:2021-11-23T12:31:07-0800' + 'version': 'last_updated:2023-08-11T11:35:44-0700' } ], 'condition': 'download_android_deps', diff --git a/engine/src/flutter/ci/licenses_golden/tool_signature b/engine/src/flutter/ci/licenses_golden/tool_signature index 47f89d33c6..8ce4575097 100644 --- a/engine/src/flutter/ci/licenses_golden/tool_signature +++ b/engine/src/flutter/ci/licenses_golden/tool_signature @@ -1,2 +1,2 @@ -Signature: 1e4a09fc0f2117b53a35ad1bb8b9a08d +Signature: d8b5e1bcc7593e590ac227d01043c4a8 diff --git a/engine/src/flutter/tools/androidx/configure.gradle b/engine/src/flutter/tools/androidx/configure.gradle index 35e02b888a..cbd106ac80 100644 --- a/engine/src/flutter/tools/androidx/configure.gradle +++ b/engine/src/flutter/tools/androidx/configure.gradle @@ -5,7 +5,7 @@ import groovy.json.JsonSlurper // Configures the embedding dependencies. -ext.configureDependencies = { engineRootDir, add -> +ext.configureEmbedderDependencies = { engineRootDir, add -> def filesJson = new File(engineRootDir, 'tools/androidx/files.json') if (!filesJson.exists()) { throw new Exception("${filesJson.absolutePath} not found. Did you provide the wrong engine root directory to configureDependencies?") @@ -17,3 +17,21 @@ ext.configureDependencies = { engineRootDir, add -> add(dependency.maven_dependency) } } + +// Configures the embedding dependencies. To match the logic in +// generate_pom_file.py, this does not include transitive dependencies since +// they aren't used by the embedding. +ext.configureDependencies = { engineRootDir, add -> + def filesJson = new File(engineRootDir, 'tools/androidx/files.json') + if (!filesJson.exists()) { + throw new Exception("${filesJson.absolutePath} not found. Did you provide the wrong engine root directory to configureDependencies?") + } + def dependencies = new JsonSlurper().parseText(filesJson.text) + assert dependencies instanceof List + dependencies.each { dependency -> + assert dependency.maven_dependency instanceof String + if (dependency.provides) { + add(dependency.maven_dependency) + } + } +} diff --git a/engine/src/flutter/tools/androidx/files.json b/engine/src/flutter/tools/androidx/files.json index 2c055ebbb4..79ee484d6e 100644 --- a/engine/src/flutter/tools/androidx/files.json +++ b/engine/src/flutter/tools/androidx/files.json @@ -79,5 +79,11 @@ "androidx.window.layout.WindowLayoutInfo", "androidx.window.layout.WindowInfoRepository" ] + }, + { + "url": "https://dl.google.com/android/maven2/com/google/android/play/core/1.8.0/core-1.8.0.aar", + "out_file_name": "core-1.8.0.aar", + "maven_dependency": "com.google.android.play:core:1.8.0", + "provides": [] } ] diff --git a/engine/src/flutter/tools/cipd/android_embedding_bundle/.gitignore b/engine/src/flutter/tools/cipd/android_embedding_bundle/.gitignore index 690c5aed9f..dd74c636a5 100644 --- a/engine/src/flutter/tools/cipd/android_embedding_bundle/.gitignore +++ b/engine/src/flutter/tools/cipd/android_embedding_bundle/.gitignore @@ -1,3 +1,4 @@ # Don't include the jars in the engine repo. +build/ lib/ .gradle diff --git a/engine/src/flutter/tools/cipd/android_embedding_bundle/README.md b/engine/src/flutter/tools/cipd/android_embedding_bundle/README.md index af42e02acd..5ea9a9b054 100644 --- a/engine/src/flutter/tools/cipd/android_embedding_bundle/README.md +++ b/engine/src/flutter/tools/cipd/android_embedding_bundle/README.md @@ -1,12 +1,34 @@ # Updating the Embedding Dependencies +The instructions in this README explain how to create a CIPD package that +contains the build-time dependencies of the Android embedding of the Engine, +and the dependencies of the in-tree testing framework. The Android embedder is +shipped to Flutter end-users, but these build-time dependencies are not. +Therefore, the license script can skip over the destination of the CIPD package +in an Engine checkout at `src/third_party/android_embedding_dependencies`. +Even so, the CIPD package should contain a LICENSE file, and the instructions +below explain how to fetch the license information for the dependencies. + ## Requirements -1. Gradle. If you don't have Gradle installed, you can get it on [https://gradle.org/install/#manually](https://gradle.org/install/#manually). -2. [Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up). +1. If you have a flutter/engine checkout, then you should already have +[Depot tools](http://commondatastorage.googleapis.com/chrome-infra-docs/flat/depot_tools/docs/html/depot_tools_tutorial.html#_setting_up) on your path. +1. You should have a copy of `gradle` in a flutter/engine checkout under + `src/third_party/gradle/bin/gradle`. ## Steps -1. Update tools/androidx/files.json. (This file includes the Maven dependencies used to build Flutter apps). -2. `cd` into this directory. -3. Run `./generate.sh`. +1. Update `src/flutter/tools/androidx/files.json`. (This file includes the Maven + dependencies used to build Flutter apps). +1. `cd` into this directory: `src/flutter/tools/cipd/android_embedding_bundle`. +1. Run `gradle downloadLicenses` +1. Run `gradle updateDependencies` +1. Examine the file `./build/reports/license/license-dependency.xml`. If it + contains licenses other than "The Apache License, Version 2.0" or something + very similar, STOP. Ask Hixie for adivce on how to proceed. +1. Copy or move the `lib/` directory to `src/third_party/android_embedding_dependencies/`, + overwriting its contents, and ensure the Android build still works. +1. Run `cipd create --pkg-def cipd.yaml -tag last_updated:"$version_tag"` where + `$version_tag` is the output of `date +%Y-%m-%dT%T%z`. +1. Update the `DEPS` file entry for `android_embedding_dependencies` with the + new tag: `last_updated:"$version_tag"`. diff --git a/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle b/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle index 93c76e84fd..f110332990 100644 --- a/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle +++ b/engine/src/flutter/tools/cipd/android_embedding_bundle/build.gradle @@ -7,8 +7,6 @@ // // This script downloads the embedding dependencies into a lib/ directory, // extract jar files from AARs, so they can be used in gn. -def destinationDir = "lib" - buildscript { repositories { google() @@ -19,6 +17,12 @@ buildscript { } } +plugins { + id "com.github.hierynomus.license-report" version "0.16.1" +} + +def destinationDir = "lib" + allprojects { repositories { google() @@ -36,9 +40,14 @@ configurations { embedding } +println project.buildDir + // Configure the embedding dependencies. -apply from: new File(rootDir, '../tools/androidx/configure.gradle').absolutePath; -configureDependencies(new File(rootDir, '../..')) { dependency -> +// NB: '../../androidx/configure.gradle' is expected to resolve to the path +// 'src/flutter/tools/androidx', and '../../..' is expected to resolve to the +// path 'src/flutter'. +apply from: new File(rootDir, '../../androidx/configure.gradle').absolutePath; +configureEmbedderDependencies(new File(rootDir, '../../..')) { dependency -> dependencies { embedding "$dependency" } @@ -76,3 +85,22 @@ task updateDependencies() { } } } + +downloadLicenses { + ext.apacheTwo = license( + 'The Apache License, Version 2.0', + 'http://www.apache.org/licenses/LICENSE-2.0.txt', + ) + aliases = [ + (apacheTwo) : [ + 'The Apache Software License, Version 2.0', + 'Apache 2', + 'Apache License Version 2.0', + 'Apache License, Version 2.0', + 'Apache License 2.0', + license('Apache License', 'http://www.apache.org/licenses/LICENSE-2.0'), + license('Apache License, Version 2.0', 'http://opensource.org/licenses/Apache-2.0'), + ], + ] + dependencyConfiguration = 'embedding' +} diff --git a/engine/src/flutter/tools/cipd/android_embedding_bundle/generate.sh b/engine/src/flutter/tools/cipd/android_embedding_bundle/generate.sh deleted file mode 100755 index bf20190719..0000000000 --- a/engine/src/flutter/tools/cipd/android_embedding_bundle/generate.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -# -# Copyright 2013 The Flutter Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -set -e - -gradle updateDependencies - -version_tag=`date +%Y-%m-%dT%T%z` - -cipd create --pkg-def cipd.yaml -tag last_updated:"$version_tag" - -echo "" -echo "Update the dependency in the DEPS file:" -echo "" -echo "'src/third_party/android_embedding_dependencies': {" -echo " 'packages': [" -echo " {" -echo " 'package': 'flutter/android/embedding_bundle'," -echo " 'version': 'last_updated:$version_tag'" -echo " }" -echo " ]," -echo " 'condition': 'download_android_deps'," -echo " 'dep_type': 'cipd'," -echo "}" -echo "" -echo "Run gclient sync" diff --git a/engine/src/flutter/tools/licenses/lib/paths.dart b/engine/src/flutter/tools/licenses/lib/paths.dart index 6ffe3a4fe7..93ab31f5ff 100644 --- a/engine/src/flutter/tools/licenses/lib/paths.dart +++ b/engine/src/flutter/tools/licenses/lib/paths.dart @@ -44,7 +44,7 @@ final Set skippedPaths = { r'fuchsia/sdk/mac/NOTICE.fuchsia', r'fuchsia/sdk/mac/tools', r'out', // output of build - r'third_party/android_embedding_dependencies', // testing framework for android + r'third_party/android_embedding_dependencies', // Not shipped. Used only for the build-time classpath, and for the in-tree testing framework for Android r'third_party/android_tools', // excluded on advice r'third_party/angle/android', r'third_party/angle/doc',