Generate Maven metadata files for engine artifacts (flutter/engine#22685)

This commit is contained in:
Jason Simmons
2020-12-02 12:43:01 -08:00
committed by GitHub
parent 63e46b8b90
commit 111a924c83
2 changed files with 41 additions and 2 deletions

View File

@@ -403,7 +403,10 @@ action("pom_libflutter") {
artifact_id =
string_replace(android_app_abi, "-", "_") + "_" + flutter_runtime_mode
outputs = [ "$root_build_dir/$artifact_id.pom" ]
outputs = [
"$root_build_dir/$artifact_id.pom",
"$root_build_dir/$artifact_id.maven-metadata.xml",
]
args = [
"--destination",
@@ -422,7 +425,10 @@ action("pom_embedding") {
artifact_id = "flutter_embedding_$flutter_runtime_mode"
outputs = [ "$root_build_dir/$artifact_id.pom" ]
outputs = [
"$root_build_dir/$artifact_id.pom",
"$root_build_dir/$artifact_id.maven-metadata.xml",
]
args = [
"--destination",

View File

@@ -4,6 +4,7 @@
# found in the LICENSE file.
import argparse
import datetime
import os
import sys
import json
@@ -34,6 +35,33 @@ POM_DEPENDENCY = '''
</dependency>
'''
MAVEN_METADATA_CONTENT ='''
<metadata xmlns="http://maven.apache.org/METADATA/1.1.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/METADATA/1.1.0 http://maven.apache.org/xsd/metadata-1.1.0.xsd" modelVersion="1.1.0">
<groupId>io.flutter</groupId>
<artifactId>{0}</artifactId>
<version>{1}</version>
<versioning>
<versions>
<version>{1}</version>
</versions>
<snapshot>
<timestamp>{2}</timestamp>
<buildNumber>0</buildNumber>
</snapshot>
<snapshotVersions>
<snapshotVersion>
<extension>jar</extension>
<value>{1}</value>
</snapshotVersion>
<snapshotVersion>
<extension>pom</extension>
<value>{1}</value>
</snapshotVersion>
</snapshotVersions>
</versioning>
</metadata>
'''
def main():
with open (os.path.join(THIS_DIR, 'files.json')) as f:
dependencies = json.load(f)
@@ -67,5 +95,10 @@ def main():
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))
# Write the Maven metadata file.
with open(os.path.join(args.destination, '%s.maven-metadata.xml' % engine_artifact_id), 'w') as f:
timestamp = datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S")
f.write(MAVEN_METADATA_CONTENT.format(engine_artifact_id, artifact_version, timestamp))
if __name__ == '__main__':
sys.exit(main())