github.com/westcoastroms/westcoastroms-build@v0.0.0-20190928114312-2350e5a73030/build/make/core/construct_context.sh (about)

     1  #!/bin/bash
     2  #
     3  # Copyright (C) 2018 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  set -e
    18  
    19  # inputs:
    20  # $1 is PRIVATE_CONDITIONAL_USES_LIBRARIES_HOST
    21  # $2 is PRIVATE_CONDITIONAL_USES_LIBRARIES_TARGET
    22  
    23  # class_loader_context: library paths on the host
    24  # stored_class_loader_context_libs: library paths on device
    25  # these are both comma separated paths, example: lib1.jar:lib2.jar or /system/framework/lib1.jar:/system/framework/lib2.jar
    26  
    27  # target_sdk_version: parsed from manifest
    28  # my_conditional_host_libs: libraries conditionally added for non P
    29  # my_conditional_target_libs: target libraries conditionally added for non P
    30  #
    31  # outputs
    32  # class_loader_context_arg: final class loader conext arg
    33  # stored_class_loader_context_arg: final stored class loader context arg
    34  
    35  my_conditional_host_libs=$1
    36  my_conditional_target_libs=$2
    37  
    38  # Note that SDK 28 is P.
    39  if [[ "${target_sdk_version}" -lt "28" ]]; then
    40    if [[ -z "${class_loader_context}" ]]; then
    41      export class_loader_context="${my_conditional_host_libs}"
    42    else
    43      export class_loader_context="${my_conditional_host_libs}:${class_loader_context}"
    44    fi
    45    if [[ -z "${stored_class_loader_context_libs}" ]]; then
    46      export stored_class_loader_context_libs="${my_conditional_target_libs}";
    47    else
    48      export stored_class_loader_context_libs="${my_conditional_target_libs}:${stored_class_loader_context_libs}";
    49    fi
    50  fi
    51  
    52  # Generate the actual context string.
    53  export class_loader_context_arg="--class-loader-context=PCL[${class_loader_context}]"
    54  export stored_class_loader_context_arg="--stored-class-loader-context=PCL[${stored_class_loader_context_libs}]"