Skip to content

Commit

Permalink
Generate Maven metadata files for engine artifacts (#22685)
Browse files Browse the repository at this point in the history
  • Loading branch information
jason-simmons committed Dec 2, 2020
1 parent b63e911 commit 1358fda
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 2 deletions.
10 changes: 8 additions & 2 deletions shell/platform/android/BUILD.gn
Expand Up @@ -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",
Expand All @@ -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",
Expand Down
33 changes: 33 additions & 0 deletions tools/androidx/generate_pom_file.py
Expand Up @@ -4,6 +4,7 @@
# found in the LICENSE file.

import argparse
import datetime
import os
import sys
import json
Expand Down Expand Up @@ -34,6 +35,33 @@
</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)
Expand Down Expand Up @@ -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())

0 comments on commit 1358fda

Please sign in to comment.