xref: /aosp_15_r20/libcore/check-ojluni-files (revision 89a6322812dc8573315e60046e7959c50dad91d4)
1*89a63228SAndroid Build Coastguard Worker#!/bin/bash
2*89a63228SAndroid Build Coastguard Worker
3*89a63228SAndroid Build Coastguard Worker
4*89a63228SAndroid Build Coastguard Worker# Copyright (C) 2016 The Android Open Source Project
5*89a63228SAndroid Build Coastguard Worker#
6*89a63228SAndroid Build Coastguard Worker# Licensed under the Apache License, Version 2.0 (the "License");
7*89a63228SAndroid Build Coastguard Worker# you may not use this file except in compliance with the License.
8*89a63228SAndroid Build Coastguard Worker# You may obtain a copy of the License at
9*89a63228SAndroid Build Coastguard Worker#
10*89a63228SAndroid Build Coastguard Worker#      http://www.apache.org/licenses/LICENSE-2.0
11*89a63228SAndroid Build Coastguard Worker#
12*89a63228SAndroid Build Coastguard Worker# Unless required by applicable law or agreed to in writing, software
13*89a63228SAndroid Build Coastguard Worker# distributed under the License is distributed on an "AS IS" BASIS,
14*89a63228SAndroid Build Coastguard Worker# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15*89a63228SAndroid Build Coastguard Worker# See the License for the specific language governing permissions and
16*89a63228SAndroid Build Coastguard Worker# limitations under the License.
17*89a63228SAndroid Build Coastguard Worker
18*89a63228SAndroid Build Coastguard Worker
19*89a63228SAndroid Build Coastguard Worker##### Script to check whether the files openjdk_java_files.mk match
20*89a63228SAndroid Build Coastguard Worker##### those in the corresponding directory.
21*89a63228SAndroid Build Coastguard WorkerCOMMAND='diff <(for i in $(openjdk_java_files); do echo "\$$i"; done | sort) '
22*89a63228SAndroid Build Coastguard WorkerCOMMAND=${COMMAND}'<( find ojluni/src/main/java -type f | grep '\''\.java$$'\'' | sort )'
23*89a63228SAndroid Build Coastguard Worker
24*89a63228SAndroid Build Coastguard Worker# Need to do it this nasty way (creating a Makefile on the fly and
25*89a63228SAndroid Build Coastguard Worker# executing the bash command inside it) as to read the openjdk_java_files
26*89a63228SAndroid Build Coastguard Worker# variable from an .mk file.
27*89a63228SAndroid Build Coastguard Workermake -s -f <(cat <<EOF
28*89a63228SAndroid Build Coastguard Workerinclude openjdk_java_files.mk
29*89a63228SAndroid Build Coastguard Workercheck_openjdk_java_files: ; /bin/bash -c "$COMMAND"
30*89a63228SAndroid Build Coastguard WorkerEOF)
31*89a63228SAndroid Build Coastguard Worker
32*89a63228SAndroid Build Coastguard Workerif [ $? -eq 0 ]; then
33*89a63228SAndroid Build Coastguard Worker    echo 'No differences found'
34*89a63228SAndroid Build Coastguard Workerelse
35*89a63228SAndroid Build Coastguard Worker    echo 'Differences found'
36*89a63228SAndroid Build Coastguard Worker    exit 1
37*89a63228SAndroid Build Coastguard Workerfi
38*89a63228SAndroid Build Coastguard Worker
39