Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Generate Maven metadata files for engine artifacts #22685

Merged
merged 1 commit into from
Dec 2, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions shell/platform/android/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -402,7 +402,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 @@ -421,7 +424,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
Original file line number Diff line number Diff line change
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())