1#!/bin/bash
2#
3# Copyright (C) 2014 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
18# TODO: $ANDROID_BUILD_TOP/prebuilts/clang/host/linux-x86/clang-stable/bin
19# no longer contains clang on AOSP master. Need a stable way to reach clang
20# binaries here.
21
22if [ x"$1" == "x" ]; then
23  echo "Please specify the top-level Piper client directory."
24  exit 1
25fi
26
27DOC_DIR="$1/googledata/devsite/site-android/en/guide/topics/renderscript/"
28if [ ! -d $DOC_DIR ]; then
29  echo "Expecting top-level Piper client directory."
30  exit 2
31fi
32
33cd `dirname $0`
34
35set -e
36
37mkdir -p test
38mkdir -p include
39mkdir -p docs
40mkdir -p slangtest
41
42# The order of the arguments passed to generator matter because:
43# 1. The overview is expected to be in the first file.
44# 2. The order specified will be the order they will show in the guide_toc.cs snippet.
45#    This can be manually changed when cut&pasting the snippet into guide_toc.cs.
46# 3. rsIs/Clear/SetObject is documented in rs_object_info but also found in rs_graphics.
47#    The latter must appear after the former.
48$ANDROID_HOST_OUT/bin/rs-api-doc-generator rs_core.spec rs_value_types.spec rs_object_types.spec rs_convert.spec rs_math.spec rs_vector_math.spec rs_matrix.spec rs_quaternion.spec rs_atomic.spec rs_time.spec rs_allocation_create.spec rs_allocation_data.spec rs_object_info.spec rs_for_each.spec rs_io.spec rs_debug.spec rs_graphics.spec
49
50rm -f ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/generated/*
51mv test/* ../../../cts/tests/tests/renderscript/src/android/renderscript/cts/generated/
52rmdir test
53
54rm -f "$DOC_DIR"/reference/*.html
55mv docs/*.html "$DOC_DIR"/reference
56
57# Current API level : 24
58RS_API_LEVEL=24
59
60for ((i=11; i<=RS_API_LEVEL; i++))
61  do
62    mv slangtest/all$i.rscript ../../compile/slang/tests/P_all_api_$i
63done
64rm -rf slangtest
65
66mv RSFunctionsList.cpp ../../compile/libbcc/lib/
67mv RsFunctionsList.h ../../compile/libbcc/lib/
68