#!/usr/bin/env bash # set -x # generate_patches.sh [systems] # # Convenience script to generate patches for JsInterop under Dartium. Do not call from build steps or tests # - call fremontcutbuilder and dartdomgenerator instead. Do not add 'real' # functionality here - change the python code instead. # # I find it essential to generate all the systems so I know if I am breaking # other systems. My habit is to run: # # ./go.sh # # 1. After running go.sh libraries in sdk/lib may change. # 2. Build Dartium. # 3. Run this script and sdk/lib/js/dartium/cached_patches will be created. # 4. Rebuild Dartium. # 5. Commit files in sdk/lib # # NOTE: If the Dart files generated from the IDLs may cause major changes which # could cause the patch files to fail (missing classes, etc). If this # happens delete the contents of the sdk/lib/js/dartium/cached_patches.dart # build Dartium, run this script and build Dartium again with the newly # generated patches. if [[ "$1" != "" ]] { global DARTIUM := $1 } else { global LOCATION_DARTIUM := '"../../../out/Release'" global DARTIUM := $LOCATION_DARTIUM } global DART_APP_LOCATION := ""file://"$PWD"/generate_app/generate_cached_patches.html"" global DARTIUM_ARGS := '" --user-data-dir=out --disable-web-security --no-sandbox --enable-blink-features=dartGenCachedPatches'" global CACHED_PATCHES_FILE := """$PWD"/../../sdk/lib/js/dartium/cached_patches.dart"" global cmd := """$DARTIUM"/chrome "$DARTIUM_ARGS" "$DART_APP_LOCATION" | (sed -n '/START_OF_CACHED_PATCHES/,/END_OF_CACHED_PATCHES/p') > "$CACHED_PATCHES_FILE""" reset && eval $(cmd) (CommandList children: [ (C {(set)} {(-x)}) (If arms: [ (if_arm cond: [ (Sentence child: (DBracket expr: (BoolBinary op_id:BoolBinary_GlobNEqual left:{(DQ ($ VSub_Number "$1"))} right:{(DQ )}) ) terminator: ) ] action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DARTIUM) op: Equal rhs: {(DQ ($ VSub_Number "$1"))} spids: [99] ) ] spids: [99] ) ] spids: [-1 96] ) ] else_action: [ (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:LOCATION_DARTIUM) op: Equal rhs: {(DQ (../../../out/Release))} spids: [107] ) ] spids: [107] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DARTIUM) op: Equal rhs: {(DQ ($ VSub_Name "$LOCATION_DARTIUM"))} spids: [113] ) ] spids: [113] ) ] spids: [104 118] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DART_APP_LOCATION) op: Equal rhs: {(DQ ("file://")) ($ VSub_Name "$PWD") (DQ (/generate_app/generate_cached_patches.html))} spids: [121] ) ] spids: [121] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:DARTIUM_ARGS) op: Equal rhs: { (DQ ( " --user-data-dir=out --disable-web-security --no-sandbox --enable-blink-features=dartGenCachedPatches" ) ) } spids: [130] ) ] spids: [130] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:CACHED_PATCHES_FILE) op: Equal rhs: {(DQ ) ($ VSub_Name "$PWD") (DQ (/../../sdk/lib/js/dartium/cached_patches.dart))} spids: [135] ) ] spids: [135] ) (Assignment keyword: Assign_None pairs: [ (assign_pair lhs: (LhsName name:cmd) op: Equal rhs: {(DQ ) ($ VSub_Name "$DARTIUM") (DQ ("/chrome ")) ($ VSub_Name "$DARTIUM_ARGS") (DQ (" ")) ($ VSub_Name "$DART_APP_LOCATION") (DQ (" |\n") (" (sed -n '/START_OF_CACHED_PATCHES/,/END_OF_CACHED_PATCHES/p') > ")) ($ VSub_Name "$CACHED_PATCHES_FILE") (DQ ) } spids: [144] ) ] spids: [144] ) (AndOr children:[(C {(reset)})(C {(eval)} {(DQ (${ VSub_Name cmd))})] op_id:Op_DAmp) ] )