Include Maven dependency in files.json (flutter/engine#10719)

This commit is contained in:
Emmanuel Garcia
2019-08-08 18:59:22 -07:00
committed by GitHub
parent c2cb35aa2c
commit f9058d748c
4 changed files with 165 additions and 12 deletions

View File

@@ -6,6 +6,7 @@ import("//build/config/android/config.gni")
import("$flutter_root/common/config.gni")
import("$flutter_root/shell/config.gni")
import("$flutter_root/shell/gpu/gpu.gni")
import("$flutter_root/shell/version/version.gni")
shell_gpu_configuration("android_gpu_configuration") {
enable_software = true
@@ -327,6 +328,57 @@ action("android") {
deps = [
":flutter_shell_java",
":flutter_shell_native",
":pom_embedding",
":pom_libflutter",
]
}
action("pom_libflutter") {
script = "$flutter_root/tools/android_support/generate_pom_file.py"
inputs = [
"$flutter_root/tools/android_support/files.json",
]
artifact_id =
string_replace(android_app_abi, "-", "_") + "_" + flutter_runtime_mode
outputs = [
"$root_build_dir/$artifact_id-1.0.0-$engine_version.pom",
]
args = [
"--destination",
rebase_path(root_build_dir),
"--engine-version",
engine_version,
"--engine-artifact-id",
artifact_id,
]
}
action("pom_embedding") {
script = "$flutter_root/tools/android_support/generate_pom_file.py"
inputs = [
"$flutter_root/tools/android_support/files.json",
]
artifact_id = "flutter_embedding_$flutter_runtime_mode"
outputs = [
"$root_build_dir/$artifact_id-1.0.0-$engine_version.pom",
]
args = [
"--destination",
rebase_path(root_build_dir),
"--engine-version",
engine_version,
"--engine-artifact-id",
artifact_id,
"--include-embedding-dependencies",
"true",
]
}

View File

@@ -48,8 +48,8 @@ def main():
with open (os.path.join(THIS_DIR, 'files.json')) as f:
files = json.load(f)
for file, url in files.items():
getFile(url, file)
for entry in files:
getFile(entry['url'], entry['out_file_name'])
if __name__ == '__main__':
sys.exit(main())

View File

@@ -1,10 +1,42 @@
{
"android_arch_lifecycle_common.jar": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.1.1/common-1.1.1.jar",
"android_arch_lifecycle_common_java8.jar": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common-java8/1.1.1/common-java8-1.1.1.jar",
"android_arch_lifecycle_runtime.jar": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.1/runtime-1.1.1.aar",
"android_arch_lifecycle_viewmodel.jar": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/viewmodel/1.1.1/viewmodel-1.1.1.aar",
"android_support_fragment.jar": "https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/28.0.0/support-fragment-28.0.0.aar",
"android_support_v13.jar": "https://dl.google.com/dl/android/maven2/com/android/support/support-v13/28.0.0/support-v13-28.0.0.aar",
"android_support_annotations.jar": "https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/28.0.0/support-annotations-28.0.0.jar",
"android_support_compat.jar": "https://dl.google.com/dl/android/maven2/com/android/support/support-compat/28.0.0/support-compat-28.0.0.aar"
}
[
{
"url": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common/1.1.1/common-1.1.1.jar",
"out_file_name": "android_arch_lifecycle_common.jar",
"maven_dependency": "android.arch.lifecycle:common:1.1.1"
},
{
"url": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/common-java8/1.1.1/common-java8-1.1.1.jar",
"out_file_name": "android_arch_lifecycle_common_java8.jar",
"maven_dependency": "android.arch.lifecycle:common-java8:1.1.1"
},
{
"url": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/runtime/1.1.1/runtime-1.1.1.aar",
"out_file_name": "android_arch_lifecycle_runtime.jar",
"maven_dependency": "android.arch.lifecycle:runtime:1.1.1"
},
{
"url": "https://dl.google.com/dl/android/maven2/android/arch/lifecycle/viewmodel/1.1.1/viewmodel-1.1.1.aar",
"out_file_name": "android_arch_lifecycle_viewmodel.jar",
"maven_dependency": "android.arch.lifecycle:viewmodel:1.1.1"
},
{
"url": "https://dl.google.com/dl/android/maven2/com/android/support/support-fragment/28.0.0/support-fragment-28.0.0.aar",
"out_file_name": "android_support_fragment.jar",
"maven_dependency": "com.android.support:support-fragment:28.0.0"
},
{
"url": "https://dl.google.com/dl/android/maven2/com/android/support/support-v13/28.0.0/support-v13-28.0.0.aar",
"out_file_name": "android_support_v13.jar",
"maven_dependency": "com.android.support:support-v13:28.0.0"
},
{
"url": "https://dl.google.com/dl/android/maven2/com/android/support/support-annotations/28.0.0/support-annotations-28.0.0.jar",
"out_file_name": "android_support_annotations.jar",
"maven_dependency": "com.android.support:support-annotations:28.0.0"
},
{
"url": "https://dl.google.com/dl/android/maven2/com/android/support/support-compat/28.0.0/support-compat-28.0.0.aar",
"out_file_name": "android_support_compat.jar",
"maven_dependency": "com.android.support:support-compat:28.0.0"
}
]

View File

@@ -0,0 +1,69 @@
#!/usr/bin/env python
# Copyright 2019 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.
import argparse
import os
import sys
import json
THIS_DIR = os.path.abspath(os.path.dirname(__file__))
# The template for the POM file.
POM_FILE_CONTENT = '''
<?xml version="1.0" encoding="UTF-8"?>
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>io.flutter</groupId>
<artifactId>{0}</artifactId>
<version>{1}</version>
<packaging>jar</packaging>
<dependencies>
{2}
</dependencies>
</project>
'''
POM_DEPENDENCY = '''
<dependency>
<groupId>{0}</groupId>
<artifactId>{1}</artifactId>
<version>{2}</version>
<scope>compile</scope>
</dependency>
'''
def main():
with open (os.path.join(THIS_DIR, 'files.json')) as f:
dependencies = json.load(f)
parser = argparse.ArgumentParser(description='Generate the POM file for the engine artifacts')
parser.add_argument('--engine-artifact-id', type=str, required=True,
help='The artifact id. e.g. android_arm_release')
parser.add_argument('--engine-version', type=str, required=True,
help='The engine commit hash')
parser.add_argument('--destination', type=str, required=True,
help='The destination directory absolute path')
parser.add_argument('--include-embedding-dependencies', type=bool,
help='Include the dependencies for the embedding')
args = parser.parse_args()
engine_artifact_id = args.engine_artifact_id
engine_version = args.engine_version
artifact_version = '1.0.0-' + engine_version
out_file_name = '%s-%s.pom' % (engine_artifact_id, artifact_version)
pom_dependencies = ''
if args.include_embedding_dependencies:
for dependency in dependencies:
group_id, artifact_id, version = dependency['maven_dependency'].split(':')
pom_dependencies += POM_DEPENDENCY.format(group_id, artifact_id, version)
# Write the POM file.
with open(os.path.join(args.destination, out_file_name), 'w') as f:
f.write(POM_FILE_CONTENT.format(engine_artifact_id, artifact_version, pom_dependencies))
if __name__ == '__main__':
sys.exit(main())