Flutter Engine
The Flutter Engine
Functions | Variables
generate_pom_file Namespace Reference

Functions

def utf8 (s)
 
def main ()
 

Variables

 THIS_DIR = os.path.abspath(os.path.dirname(__file__))
 
string POM_FILE_CONTENT
 
string POM_DEPENDENCY
 
string MAVEN_METADATA_CONTENT
 

Function Documentation

◆ main()

def generate_pom_file.main ( )

Definition at line 71 of file generate_pom_file.py.

71def main():
72 with open(os.path.join(THIS_DIR, 'files.json')) as f:
73 dependencies = json.load(f)
74
75 parser = argparse.ArgumentParser(description='Generate the POM file for the engine artifacts')
76 parser.add_argument(
77 '--engine-artifact-id',
78 type=utf8,
79 required=True,
80 help='The artifact id. e.g. android_arm_release'
81 )
82 parser.add_argument('--engine-version', type=utf8, required=True, help='The engine commit hash')
83 parser.add_argument(
84 '--destination', type=utf8, required=True, help='The destination directory absolute path'
85 )
86 parser.add_argument(
87 '--include-embedding-dependencies',
88 type=bool,
89 help='Include the dependencies for the embedding'
90 )
91
92 args = parser.parse_args()
93 engine_artifact_id = args.engine_artifact_id
94 engine_version = args.engine_version
95 artifact_version = '1.0.0-' + engine_version
96 out_file_name = '%s.pom' % engine_artifact_id
97
98 pom_dependencies = ''
99 if args.include_embedding_dependencies:
100 for dependency in dependencies:
101 if not dependency['provides']:
102 # Don't include transitive dependencies since they aren't used by the embedding.
103 continue
104 group_id, artifact_id, version = dependency['maven_dependency'].split(':')
105 pom_dependencies += POM_DEPENDENCY.format(group_id, artifact_id, version)
106
107 # Write the POM file.
108 with open(os.path.join(args.destination, out_file_name), 'w') as f:
109 f.write(POM_FILE_CONTENT.format(engine_artifact_id, artifact_version, pom_dependencies))
110
111 # Write the Maven metadata file.
112 with open(os.path.join(args.destination, '%s.maven-metadata.xml' % engine_artifact_id), 'w') as f:
113 timestamp = datetime.datetime.utcnow().strftime("%Y%m%d.%H%M%S")
114 f.write(MAVEN_METADATA_CONTENT.format(engine_artifact_id, artifact_version, timestamp))
115
116

◆ utf8()

def generate_pom_file.utf8 (   s)

Definition at line 67 of file generate_pom_file.py.

67def utf8(s):
68 return str(s, 'utf-8') if isinstance(s, (bytes, bytearray)) else s
69
70

Variable Documentation

◆ MAVEN_METADATA_CONTENT

string generate_pom_file.MAVEN_METADATA_CONTENT
Initial value:
1= '''
2<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">
3 <groupId>io.flutter</groupId>
4 <artifactId>{0}</artifactId>
5 <version>{1}</version>
6 <versioning>
7 <versions>
8 <version>{1}</version>
9 </versions>
10 <snapshot>
11 <timestamp>{2}</timestamp>
12 <buildNumber>0</buildNumber>
13 </snapshot>
14 <snapshotVersions>
15 <snapshotVersion>
16 <extension>jar</extension>
17 <value>{1}</value>
18 </snapshotVersion>
19 <snapshotVersion>
20 <extension>pom</extension>
21 <value>{1}</value>
22 </snapshotVersion>
23 </snapshotVersions>
24 </versioning>
25</metadata>
26'''

Definition at line 39 of file generate_pom_file.py.

◆ POM_DEPENDENCY

string generate_pom_file.POM_DEPENDENCY
Initial value:
1= '''
2 <dependency>
3 <groupId>{0}</groupId>
4 <artifactId>{1}</artifactId>
5 <version>{2}</version>
6 <scope>compile</scope>
7 </dependency>
8'''

Definition at line 30 of file generate_pom_file.py.

◆ POM_FILE_CONTENT

string generate_pom_file.POM_FILE_CONTENT
Initial value:
1= '''<?xml version="1.0" encoding="UTF-8"?>
2<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"
3 xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4 <modelVersion>4.0.0</modelVersion>
5 <groupId>io.flutter</groupId>
6 <artifactId>{0}</artifactId>
7 <version>{1}</version>
8 <packaging>jar</packaging>
9 <dependencies>
10 {2}
11 </dependencies>
12</project>
13'''

Definition at line 16 of file generate_pom_file.py.

◆ THIS_DIR

generate_pom_file.THIS_DIR = os.path.abspath(os.path.dirname(__file__))

Definition at line 13 of file generate_pom_file.py.