1#!/bin/sh
2#
3# Copyright (C) 2008 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
17export A_STUBS=out/stubs/a/stubs
18export B_STUBS=out/stubs/b/stubs
19export EXPECTED_STUBS=out/stubs/expected/stubs
20export EXPECTED=$DIR/expected
21
22function build_stubs()
23{
24    ID=$1
25    SRC_DIR=$2
26    STUBS_DIR=$3
27
28    OBJ_DIR=out/stubs/$ID
29    PLATFORM=${HOST_OS}-${HOST_ARCH}
30
31    rm -rf $OBJ_DIR &> /dev/null
32    mkdir -p $OBJ_DIR
33
34    find $SRC_DIR -name '*.java' > $OBJ_DIR/javadoc-src-list
35    ( \
36        LD_LIBRARY_PATH=out/host/$PLATFORM/lib \
37        javadoc \
38            \@$OBJ_DIR/javadoc-src-list \
39            -J-Xmx512m \
40            -J-Djava.library.path=out/host/$PLATFORM/lib \
41             \
42            -quiet \
43            -doclet DroidDoc \
44            -docletpath out/host/$PLATFORM/framework/clearsilver.jar:out/host/$PLATFORM/framework/droiddoc.jar:out/host/$PLATFORM/framework/apicheck.jar \
45            -templatedir tools/droiddoc/templates \
46            -classpath out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \
47            -sourcepath $SRC_DIR:out/target/common/obj/JAVA_LIBRARIES/core_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/ext_intermediates/classes.jar:out/target/common/obj/JAVA_LIBRARIES/framework_intermediates/classes.jar \
48            -d $OBJ_DIR/docs \
49            -hdf page.build MAIN-eng.joeo.20080710.121320 -hdf page.now "10 Jul 2008 12:13" \
50            -stubs $STUBS_DIR \
51            -stubpackages com.android.stubs:com.android.stubs.a:com.android.stubs.b:com.android.stubs.hidden \
52        && rm -rf $OBJ_DIR/docs/assets \
53        && mkdir -p $OBJ_DIR/docs/assets \
54        && cp -fr tools/droiddoc/templates/assets/* $OBJ_DIR/docs/assets/ \
55    )# || (rm -rf $OBJ_DIR; exit 45)
56}
57
58function compile_stubs()
59{
60    ID=$1
61    STUBS_DIR=$2
62
63    OBJ_DIR=out/stubs/$ID
64    CLASS_DIR=$OBJ_DIR/class
65    mkdir -p $CLASS_DIR
66
67    find $STUBS_DIR -name "*.java" > $OBJ_DIR/java-src-list
68    javac @$OBJ_DIR/java-src-list -d $CLASS_DIR
69}
70