Skip to content

Commit 9562a3b

Browse files
committed
Add offline docs target for support lib gradle build
Fixes standalone docs issues like references to hidden framework class R.styleable. Removes reference to BackupAgent, which makes doclava choke for some unknown reason. Standalone online docs may now be built with ./gradlew :generateDocs Bug: 28124434 Change-Id: If76ac9018be1d17f1258802d4ef3ce1ad67b4903
1 parent 1fa246f commit 9562a3b

File tree

10 files changed

+59
-35
lines changed

10 files changed

+59
-35
lines changed

Android.mk

+6
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,12 @@ check-support-api: PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
6969
check-support-api:
7070
$(PRIVATE_LOCAL_PATH)/gradlew -p $(PRIVATE_LOCAL_PATH) checkApi
7171

72+
# Proxy to gradle task for generating docs
73+
.PHONY: support-docs
74+
support-docs: PRIVATE_LOCAL_PATH := $(LOCAL_PATH)
75+
support-docs:
76+
$(PRIVATE_LOCAL_PATH)/gradlew -p $(PRIVATE_LOCAL_PATH) generateDocs
77+
7278
# Pre-process support library AIDLs
7379
aidl_files := $(addprefix $(LOCAL_PATH)/, $(call all-subdir-named-files-exclude,*.aidl,I*.aidl))
7480
support-aidl := $(TARGET_OUT_COMMON_INTERMEDIATES)/support.aidl

build.gradle

+34-6
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
import android.support.doclava.DoclavaMultilineJavadocOptionFileOption
12
import com.android.build.gradle.internal.coverage.JacocoReportTask
23
import com.android.build.gradle.internal.tasks.DeviceProviderInstrumentTestTask
34

@@ -253,24 +254,50 @@ void setApiModuleDependencies(Project subProject, DependencyHandler handler, Lis
253254
}
254255
}
255256

256-
void registerForDocs(Project subProject, releaseVariant) {
257-
rootProject.generateApi.dependsOn releaseVariant.javaCompile
258-
rootProject.generateApi.source {
257+
void registerForDocsTask(Task task, Project subProject, releaseVariant) {
258+
task.dependsOn releaseVariant.javaCompile
259+
task.source {
259260
def buildConfig = fileTree(releaseVariant.getGenerateBuildConfig().sourceOutputDir)
260261
return releaseVariant.javaCompile.source.minus(buildConfig) +
261262
fileTree(releaseVariant.aidlCompile.sourceOutputDir) +
262263
fileTree(releaseVariant.outputs[0].processResources.sourceOutputDir)
263264
}
264-
rootProject.generateApi.classpath += files(releaseVariant.javaCompile.classpath) +
265+
task.classpath += files(releaseVariant.javaCompile.classpath) +
265266
files(releaseVariant.javaCompile.destinationDir)
266267

267268
if (subProject.hasProperty('allSS')) {
268269
subProject.allSS.each { ss ->
269-
rootProject.generateApi.source ss.java
270+
task.source ss.java
270271
}
271272
}
272273
}
273274

275+
// Generates online docs.
276+
task generateDocs(type: DoclavaTask, dependsOn: configurations.doclava) {
277+
docletpath = configurations.doclava.resolve()
278+
destinationDir = new File(project.docsDir, "online")
279+
280+
// Base classpath is Android SDK, sub-projects add their own.
281+
classpath = getAndroidPrebuilt(gradle.ext.currentSdk)
282+
283+
def hdfOption = new DoclavaMultilineJavadocOptionFileOption('hdf')
284+
hdfOption.add(
285+
['android.whichdoc', 'online'],
286+
['android.hasSamples', 'true']);
287+
288+
options {
289+
addStringOption "templatedir",
290+
"${project.rootDir}/../../build/tools/droiddoc/templates-sdk"
291+
addStringOption "federate Android", "http://developer.android.com"
292+
addStringOption "federationapi Android",
293+
"${project.rootDir}/../../prebuilts/sdk/api/24.txt"
294+
addStringOption "stubpackages", "android.support.*"
295+
addStringOption "samplesdir", "${project.rootDir}/samples"
296+
addOption hdfOption
297+
}
298+
299+
exclude '**/BuildConfig.java'
300+
}
274301

275302
// Generates API files.
276303
task generateApi(type: DoclavaTask, dependsOn: configurations.doclava) {
@@ -462,7 +489,8 @@ subprojects {
462489
&& !(p.android.hasProperty('noDocs') && p.android.noDocs)) {
463490
p.android.libraryVariants.all { v ->
464491
if (v.name == 'release') {
465-
registerForDocs(p, v)
492+
registerForDocsTask(rootProject.generateDocs, p, v)
493+
registerForDocsTask(rootProject.generateApi, p, v)
466494
}
467495
}
468496
}

compat/java/android/support/v4/app/ActivityOptionsCompat.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -273,8 +273,8 @@ public static ActivityOptionsCompat makeSceneTransitionAnimation(Activity activi
273273
* In addition, the new task wil be affiliated with the launching activity's task.
274274
* Affiliated tasks are grouped together in the recents task list.
275275
*
276-
* <p>This behavior is not supported for activities with {@link
277-
* android.R.styleable#AndroidManifestActivity_launchMode launchMode} values of
276+
* <p>This behavior is not supported for activities with
277+
* {@link android.R.attr#launchMode launchMode} values of
278278
* <code>singleInstance</code> or <code>singleTask</code>.
279279
*/
280280
public static ActivityOptionsCompat makeTaskLaunchBehind() {

compat/java/android/support/v4/content/ContextCompat.java

+2-4
Original file line numberDiff line numberDiff line change
@@ -422,17 +422,15 @@ public static int checkSelfPermission(@NonNull Context context, @NonNull String
422422
* Returns the absolute path to the directory on the filesystem similar to
423423
* {@link Context#getFilesDir()}. The difference is that files placed under this
424424
* directory will be excluded from automatic backup to remote storage on
425-
* devices running {@link android.os.Build.VERSION_CODES#LOLLIPOP} or later. See
426-
* {@link android.app.backup.BackupAgent BackupAgent} for a full discussion
427-
* of the automatic backup mechanism in Android.
425+
* devices running {@link android.os.Build.VERSION_CODES#LOLLIPOP} or later.
428426
*
429427
* <p>No permissions are required to read or write to the returned path, since this
430428
* path is internal storage.
431429
*
432430
* @return The path of the directory holding application files that will not be
433431
* automatically backed up to remote storage.
434432
*
435-
* @see android.content.Context.getFilesDir
433+
* @see android.content.Context#getFilesDir()
436434
*/
437435
public static final File getNoBackupFilesDir(Context context) {
438436
final int version = Build.VERSION.SDK_INT;

compat/java/android/support/v4/widget/TextViewCompat.java

+1-3
Original file line numberDiff line numberDiff line change
@@ -269,9 +269,7 @@ public static int getMinLines(@NonNull TextView textView) {
269269
* Sets the text appearance from the specified style resource.
270270
* <p>
271271
* Use a framework-defined {@code TextAppearance} style like
272-
* {@link android.R.style#TextAppearance_Material_Body1 @android:style/TextAppearance.Material.Body1}
273-
* or see {@link android.R.styleable#TextAppearance TextAppearance} for the
274-
* set of attributes that can be used in a custom style.
272+
* {@link android.R.style#TextAppearance_Material_Body1 @android:style/TextAppearance.Material.Body1}.
275273
*
276274
* @param textView The TextView against which to invoke the method.
277275
* @param resId The resource identifier of the style to apply.

fragment/java/android/support/v4/app/Fragment.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
import android.support.annotation.NonNull;
3131
import android.support.annotation.Nullable;
3232
import android.support.annotation.StringRes;
33-
import android.support.v4.util.SimpleArrayMap;
3433
import android.support.v4.util.DebugUtils;
34+
import android.support.v4.util.SimpleArrayMap;
3535
import android.support.v4.view.LayoutInflaterCompat;
3636
import android.util.AttributeSet;
3737
import android.util.Log;
3838
import android.util.SparseArray;
3939
import android.view.ContextMenu;
40+
import android.view.ContextMenu.ContextMenuInfo;
4041
import android.view.LayoutInflater;
4142
import android.view.Menu;
4243
import android.view.MenuInflater;
4344
import android.view.MenuItem;
4445
import android.view.View;
45-
import android.view.ViewGroup;
46-
import android.view.ContextMenu.ContextMenuInfo;
4746
import android.view.View.OnCreateContextMenuListener;
47+
import android.view.ViewGroup;
4848
import android.view.animation.Animation;
4949
import android.widget.AdapterView;
5050

@@ -1139,24 +1139,24 @@ public LayoutInflater getLayoutInflater(Bundle savedInstanceState) {
11391139
* <p>Here is a typical implementation of a fragment that can take parameters
11401140
* both through attributes supplied here as well from {@link #getArguments()}:</p>
11411141
*
1142-
* {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentArguments.java
1142+
* {@sample frameworks/support/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.java
11431143
* fragment}
11441144
*
11451145
* <p>Note that parsing the XML attributes uses a "styleable" resource. The
11461146
* declaration for the styleable used here is:</p>
11471147
*
1148-
* {@sample development/samples/ApiDemos/res/values/attrs.xml fragment_arguments}
1148+
* {@sample frameworks/support/samples/Support4Demos/res/values/attrs.xml fragment_arguments}
11491149
*
11501150
* <p>The fragment can then be declared within its activity's content layout
11511151
* through a tag like this:</p>
11521152
*
1153-
* {@sample development/samples/ApiDemos/res/layout/fragment_arguments.xml from_attributes}
1153+
* {@sample frameworks/support/samples/Support4Demos/res/layout/fragment_arguments_support.xml from_attributes}
11541154
*
11551155
* <p>This fragment can also be created dynamically from arguments given
11561156
* at runtime in the arguments Bundle; here is an example of doing so at
11571157
* creation of the containing activity:</p>
11581158
*
1159-
* {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentArguments.java
1159+
* {@sample frameworks/support/samples/Support4Demos/src/com/example/android/supportv4/app/FragmentArgumentsSupport.java
11601160
* create}
11611161
*
11621162
* @param context The Activity that is inflating this fragment.

frameworks/support/samples

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
../../samples/

transition/src/android/support/transition/Transition.java

+5-5
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@
4949
* and resizing the view) may be out of sync with the display inside those bounds.
5050
* TextureView is more compatible with transitions in general, but some
5151
* specific transitions (such as {@link Fade}) may not be compatible
52-
* with TextureView because they rely on {@link ViewOverlay} functionality,
53-
* which does not currently work with TextureView.</p>
52+
* with TextureView because they rely on {@link android.view.ViewOverlay}
53+
* functionality, which does not currently work with TextureView.</p>
5454
*
5555
* <p>Unlike the platform version, this does not support declaration by XML resources.</p>
5656
*/
@@ -445,7 +445,7 @@ public long getDuration() {
445445
*
446446
* @param duration The length of the animation, in milliseconds.
447447
* @return This transition object.
448-
* @attr ref android.R.styleable#Transition_duration
448+
* @attr name android:duration
449449
*/
450450
@NonNull
451451
public Transition setDuration(long duration) {
@@ -474,7 +474,7 @@ public TimeInterpolator getInterpolator() {
474474
*
475475
* @param interpolator The time interpolator used by the transition
476476
* @return This transition object.
477-
* @attr ref android.R.styleable#Transition_interpolator
477+
* @attr name android:interpolator
478478
*/
479479
@NonNull
480480
public Transition setInterpolator(@Nullable TimeInterpolator interpolator) {
@@ -519,7 +519,7 @@ public long getStartDelay() {
519519
*
520520
* @param startDelay The length of the delay, in milliseconds.
521521
* @return This transition object.
522-
* @attr ref android.R.styleable#Transition_startDelay
522+
* @attr name android:startDelay
523523
*/
524524
@NonNull
525525
public Transition setStartDelay(long startDelay) {

transition/src/android/support/transition/Visibility.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
* start and end scenes. Visibility is determined not just by the
2828
* {@link View#setVisibility(int)} state of views, but also whether
2929
* views exist in the current view hierarchy. The class is intended to be a
30-
* utility for subclasses such as {@link FadePort}, which use this visibility
30+
* utility for subclasses such as {@link Fade}, which use this visibility
3131
* information to determine the specific animations to run when visibility
3232
* changes occur. Subclasses should implement one or both of the methods
3333
* {@link #onAppear(ViewGroup, TransitionValues, int, TransitionValues, int)},

v7/appcompat/src/android/support/v7/app/ActionBar.java

-7
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
import android.support.annotation.Nullable;
2727
import android.support.annotation.StringRes;
2828
import android.support.v4.app.Fragment;
29-
import android.support.v4.app.FragmentManager;
3029
import android.support.v4.app.FragmentTransaction;
3130
import android.support.v4.view.GravityCompat;
3231
import android.support.v7.appcompat.R;
@@ -604,12 +603,6 @@ public void setSplitBackgroundDrawable(Drawable d) { }
604603
* Create and return a new {@link Tab}.
605604
* This tab will not be included in the action bar until it is added.
606605
*
607-
* <p>Very often tabs will be used to switch between {@link Fragment}
608-
* objects. Here is a typical implementation of such tabs:</p>
609-
*
610-
* {@sample development/samples/ApiDemos/src/com/example/android/apis/app/FragmentTabs.java
611-
* complete}
612-
*
613606
* @return A new Tab
614607
*
615608
* @see #addTab(Tab)

0 commit comments

Comments
 (0)