Home | History | Annotate | Download | only in script
      1 #!/bin/bash
      2 #
      3 # Copyright 2016 The Android Open Source Project
      4 #
      5 # Licensed under the Apache License, Version 2.0 (the "License");
      6 # you may not use this file except in compliance with the License.
      7 # You may obtain a copy of the License at
      8 #
      9 #     http://www.apache.org/licenses/LICENSE-2.0
     10 #
     11 # Unless required by applicable law or agreed to in writing, software
     12 # distributed under the License is distributed on an "AS IS" BASIS,
     13 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     14 # See the License for the specific language governing permissions and
     15 # limitations under the License.
     16 
     17 # Modifies any import statements (to remove subdir path)
     18 pushd ${ANDROID_BUILD_TOP}/test/vts
     19 
     20 ## Modifies import statement in proto files.
     21 sed -i 's/import "test\/vts\/proto\/ComponentSpecificationMessage.proto";/import "ComponentSpecificationMessage.proto";/g' proto/AndroidSystemControlMessage.proto
     22 sed -i 's/import "test\/vts\/proto\/ComponentSpecificationMessage.proto";/import "ComponentSpecificationMessage.proto";/g' proto/VtsProfilingMessage.proto
     23 
     24 ## Compiles modified proto files to .py files.
     25 protoc -I=proto --python_out=proto proto/AndroidSystemControlMessage.proto
     26 protoc -I=proto --python_out=proto proto/ComponentSpecificationMessage.proto
     27 protoc -I=proto --python_out=proto proto/VtsProfilingMessage.proto
     28 
     29 ## Restores import statement in proto files.
     30 sed -i 's/import "ComponentSpecificationMessage.proto";/import "test\/vts\/proto\/ComponentSpecificationMessage.proto";/g' proto/AndroidSystemControlMessage.proto
     31 sed -i 's/import "ComponentSpecificationMessage.proto";/import "test\/vts\/proto\/ComponentSpecificationMessage.proto";/g' proto/VtsProfilingMessage.proto
     32 
     33 protoc -I=proto --python_out=proto proto/ComponentSpecificationMessage.proto
     34 protoc -I=proto --python_out=proto proto/TestSchedulingPolicyMessage.proto
     35 protoc -I=proto --python_out=proto proto/VtsReportMessage.proto
     36 
     37 # Compiles all the python source codes.
     38 python -m compileall .
     39 
     40 popd
     41