1# 2# Copyright (C) 2022 The Android Open Source Project 3# 4# Licensed under the Apache License, Version 2.0 (the "License"); 5# you may not use this file except in compliance with the License. 6# You may obtain a copy of the License at 7# 8# http://www.apache.org/licenses/LICENSE-2.0 9# 10# Unless required by applicable law or agreed to in writing, software 11# distributed under the License is distributed on an "AS IS" BASIS, 12# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13# See the License for the specific language governing permissions and 14# limitations under the License. 15 16def build(ctx): 17 ctx.default_build(d8_dex_container=False) 18 if ctx.jvm: 19 return 20 # Change the generated dex file to have a v35 magic number if it is version 38 21 with open(ctx.test_dir / "classes.dex", "rb+") as f: 22 assert f.read(8) == b"dex\n038\x00" 23 f.seek(0) 24 f.write(b"dex\n035\x00") 25 (ctx.test_dir / "180-native-default-method.jar").unlink() 26 ctx.soong_zip([ 27 "-o", ctx.test_dir / "180-native-default-method.jar", "-j", 28 "-f", ctx.test_dir / "classes.dex" 29 ]) 30