Flutter Engine
The Flutter Engine
Functions | Variables
buildapp Namespace Reference

Functions

def execute (*command)
 
def createChromeApp (buildRoot, antTarget, resultFile)
 
def main ()
 

Variables

 DART_PATH = os.path.normpath(os.path.dirname(__file__) + '/../../..')
 
 CLIENT_PATH = os.path.normpath(DART_PATH + '/client')
 
string buildRoot
 

Function Documentation

◆ createChromeApp()

def buildapp.createChromeApp (   buildRoot,
  antTarget,
  resultFile 
)

Definition at line 35 of file buildapp.py.

35def createChromeApp(buildRoot, antTarget, resultFile):
36 buildDir = os.path.join(buildRoot, 'war')
37
38 # Use ant to create the 'war' directory
39 # TODO(jmesserly): we should factor out as much as possible from the ant file
40 # It's not really doing anything useful for us besides compiling Dart code
41 # with DartC and copying files. But for now, it helps us share code with
42 # our appengine update.py, which is good.
43 execute(DART_PATH + '/third_party/apache_ant/v1_7_1/bin/ant', '-f',
44 'build-appengine.xml', '-Dbuild.dir=' + buildRoot, antTarget)
45
46 # Call Dartium (could be any Chrome--but we know Dartium will be there) and
47 # ask it to create the .crx file for us using the checked in developer key.
48 chrome = CLIENT_PATH + '/tests/drt/chrome'
49
50 # On Mac Chrome is under a .app folder
51 if platform.system() == 'Darwin':
52 chrome = CLIENT_PATH + '/tests/drt/Chromium.app/Contents/MacOS/Chromium'
53
54 keyFile = DART_PATH + '/samples/swarm/swarm-dev.pem'
55 execute(chrome, '--pack-extension=' + buildDir,
56 '--pack-extension-key=' + keyFile)
57
58 resultFile = os.path.join(buildRoot, resultFile)
59 os.rename(buildDir + '.crx', resultFile)
60 return os.path.abspath(resultFile)
61
62
def createChromeApp(buildRoot, antTarget, resultFile)
Definition: buildapp.py:35
def execute(*command)
Definition: buildapp.py:25

◆ execute()

def buildapp.execute ( command)
Executes the given command in a new process. If the command fails (returns
non-zero) halts the script and returns that exit code.

Definition at line 25 of file buildapp.py.

25def execute(*command):
26 '''
27 Executes the given command in a new process. If the command fails (returns
28 non-zero) halts the script and returns that exit code.
29 '''
30 exitcode = subprocess.call(command)
31 if exitcode != 0:
32 sys.exit(exitcode)
33
34

◆ main()

def buildapp.main ( )

Definition at line 63 of file buildapp.py.

63def main():
64 # Create a DartC and Dartium app
65 dartiumResult = createChromeApp(buildRoot, 'build_dart_app', 'swarm.crx')
66 dartCResult = createChromeApp(buildRoot, 'build_js_app', 'swarm-js.crx')
67
68 print('''
69Successfully created Chrome apps!
70 Dartium: file://%s
71
72 DartC/JS: file://%s
73
74To install, open this URL in Chrome and select Continue at the bottom.
75''' % (dartiumResult, dartCResult))
76 return 0
77
78
def main()
Definition: buildapp.py:63
def print(*args, **kwargs)
Definition: run_tests.py:49

Variable Documentation

◆ buildRoot

string buildapp.buildRoot
Initial value:
1= CLIENT_PATH + '/' + utils.GetBuildRoot(utils.GuessOS(), 'debug',
2 'dartc')
def GuessOS()
Definition: utils.py:21
def GetBuildRoot(host_os, mode=None, arch=None, sanitizer=None)
Definition: utils.py:143

Definition at line 21 of file buildapp.py.

◆ CLIENT_PATH

buildapp.CLIENT_PATH = os.path.normpath(DART_PATH + '/client')

Definition at line 15 of file buildapp.py.

◆ DART_PATH

buildapp.DART_PATH = os.path.normpath(os.path.dirname(__file__) + '/../../..')

Definition at line 14 of file buildapp.py.