Update android_embedding_bundle CIPD instructions (flutter/engine#44644)
This PR updates the gradle build file for the android_embedding_bundle cipd package to fetch license information about the dependencies listed under `tools/androidx/files.json`. The README file for the android_embedding_bundle now explains how to fetch the license information and make sure it's correct in the cipd package. This PR also pulls a new version of android_embedding_dependencies that includes a `LICENSE` file. It turns out that Flutter does not re-ship anything from the embedding bundle to Flutter end-users. These dependencies are only used to create a classpath against which we build the Android embedder and in-tree tests. I've updated docs/comments to clarify that since I was initially confused about how these were used. I'm not adding a test that compares the license info fetched from maven against a checked-in golden, yet. Still thinking about the most effective way to do that in combination with the steps in the README.
This commit is contained in:
2
DEPS
2
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',
|
||||
|
||||
@@ -1,2 +1,2 @@
|
||||
Signature: 1e4a09fc0f2117b53a35ad1bb8b9a08d
|
||||
Signature: d8b5e1bcc7593e590ac227d01043c4a8
|
||||
|
||||
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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": []
|
||||
}
|
||||
]
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
# Don't include the jars in the engine repo.
|
||||
build/
|
||||
lib/
|
||||
.gradle
|
||||
|
||||
@@ -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"`.
|
||||
|
||||
@@ -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'
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
@@ -44,7 +44,7 @@ final Set<String> skippedPaths = <String>{
|
||||
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',
|
||||
|
||||
Reference in New Issue
Block a user