1#!/bin/bash 2 3declare -A INNER 4declare -A PARAMETER 5declare -A IMPORT 6 7ANNOTATIONS=( 8 org.checkerframework.checker.nullness.compatqual.NullableDecl 9 net.ltgt.gradle.incap.IncrementalAnnotationProcessor 10) 11 12PARAMETER["net.ltgt.gradle.incap.IncrementalAnnotationProcessor"]="IncrementalAnnotationProcessorType" 13IMPORT["net.ltgt.gradle.incap.IncrementalAnnotationProcessor"]="net.ltgt.gradle.incap.IncrementalAnnotationProcessorType" 14 15for a in ${ANNOTATIONS[@]}; do 16 package=${a%.*} 17 class=${a##*.} 18 dir=$(dirname $0)/src/${package//.//} 19 file=${class}.java 20 inner=${INNER[$a]} 21 parameter=${PARAMETER[$a]} 22 import= 23 24 if [ -n "${parameter}" ]; then 25 parameter="${parameter} value();" 26 fi 27 28 for i in ${IMPORT[$a]}; do 29 import="${import}import ${i};" 30 done 31 32 mkdir -p ${dir} 33 sed -e"s/__PACKAGE__/${package}/" \ 34 -e"s/__CLASS__/${class}/" \ 35 -e"s/__INNER__/${inner}/" \ 36 -e"s/__PARAMETER__/${parameter}/" \ 37 -e"s/__IMPORT__/${import}/" \ 38 $(dirname $0)/tmpl.java > ${dir}/${file} 39 google-java-format -i ${dir}/${file} 40done 41 42f=$(dirname $0)/src/net/ltgt/gradle/incap/IncrementalAnnotationProcessorType.java 43cat > ${f} <<EOF 44/* 45 * Copyright (C) 2019 The Android Open Source Project 46 * 47 * Licensed under the Apache License, Version 2.0 (the "License"); 48 * you may not use this file except in compliance with the License. 49 * You may obtain a copy of the License at 50 * 51 * http://www.apache.org/licenses/LICENSE-2.0 52 * 53 * Unless required by applicable law or agreed to in writing, software 54 * distributed under the License is distributed on an "AS IS" BASIS, 55 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 56 * See the License for the specific language governing permissions and 57 * limitations under the License. 58 */ 59 60package net.ltgt.gradle.incap; 61public enum IncrementalAnnotationProcessorType { 62 DYNAMIC 63} 64EOF 65