Add module type docs to the java package
Add some overview of the java module types so that we have something to display in the autogenerated docs. Bug: 67909957 Test: m soong_docs Change-Id: I3594dd550f8272f4418f3ea12cded4083674809b
This commit is contained in:
90
java/java.go
90
java/java.go
@@ -36,7 +36,7 @@ func init() {
|
||||
android.RegisterModuleType("java_defaults", defaultsFactory)
|
||||
|
||||
android.RegisterModuleType("java_library", LibraryFactory)
|
||||
android.RegisterModuleType("java_library_static", LibraryFactory)
|
||||
android.RegisterModuleType("java_library_static", LibraryStaticFactory)
|
||||
android.RegisterModuleType("java_library_host", LibraryHostFactory)
|
||||
android.RegisterModuleType("java_binary", BinaryFactory)
|
||||
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
|
||||
@@ -1450,6 +1450,17 @@ func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
j.deps(ctx)
|
||||
}
|
||||
|
||||
// java_library builds and links sources into a `.jar` file for the device, and possibly for the host as well.
|
||||
//
|
||||
// By default, a java_library has a single variant that produces a `.jar` file containing `.class` files that were
|
||||
// compiled against the device bootclasspath. This jar is not suitable for installing on a device, but can be used
|
||||
// as a `static_libs` dependency of another module.
|
||||
//
|
||||
// Specifying `installable: true` will product a `.jar` file containing `classes.dex` files, suitable for installing on
|
||||
// a device.
|
||||
//
|
||||
// Specifying `host_supported: true` will produce two variants, one compiled against the device bootclasspath and one
|
||||
// compiled against the host bootclasspath.
|
||||
func LibraryFactory() android.Module {
|
||||
module := &Library{}
|
||||
|
||||
@@ -1463,6 +1474,15 @@ func LibraryFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
// java_library_static is an obsolete alias for java_library.
|
||||
func LibraryStaticFactory() android.Module {
|
||||
return LibraryFactory()
|
||||
}
|
||||
|
||||
// java_library_host builds and links sources into a `.jar` file for the host.
|
||||
//
|
||||
// A java_library_host has a single variant that produces a `.jar` file containing `.class` files that were
|
||||
// compiled against the host bootclasspath.
|
||||
func LibraryHostFactory() android.Module {
|
||||
module := &Library{}
|
||||
|
||||
@@ -1521,6 +1541,14 @@ func (j *Test) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
android.ExtractSourcesDeps(ctx, j.testProperties.Data)
|
||||
}
|
||||
|
||||
// java_test builds a and links sources into a `.jar` file for the device, and possibly for the host as well, and
|
||||
// creates an `AndroidTest.xml` file to allow running the test with `atest` or a `TEST_MAPPING` file.
|
||||
//
|
||||
// By default, a java_test has a single variant that produces a `.jar` file containing `classes.dex` files that were
|
||||
// compiled against the device bootclasspath.
|
||||
//
|
||||
// Specifying `host_supported: true` will produce two variants, one compiled against the device bootclasspath and one
|
||||
// compiled against the host bootclasspath.
|
||||
func TestFactory() android.Module {
|
||||
module := &Test{}
|
||||
|
||||
@@ -1538,6 +1566,11 @@ func TestFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
// java_test_host builds a and links sources into a `.jar` file for the host, and creates an `AndroidTest.xml` file to
|
||||
// allow running the test with `atest` or a `TEST_MAPPING` file.
|
||||
//
|
||||
// A java_test_host has a single variant that produces a `.jar` file containing `.class` files that were
|
||||
// compiled against the host bootclasspath.
|
||||
func TestHostFactory() android.Module {
|
||||
module := &Test{}
|
||||
|
||||
@@ -1619,6 +1652,14 @@ func (j *Binary) DepsMutator(ctx android.BottomUpMutatorContext) {
|
||||
}
|
||||
}
|
||||
|
||||
// java_binary builds a `.jar` file and a shell script that executes it for the device, and possibly for the host
|
||||
// as well.
|
||||
//
|
||||
// By default, a java_binary has a single variant that produces a `.jar` file containing `classes.dex` files that were
|
||||
// compiled against the device bootclasspath.
|
||||
//
|
||||
// Specifying `host_supported: true` will produce two variants, one compiled against the device bootclasspath and one
|
||||
// compiled against the host bootclasspath.
|
||||
func BinaryFactory() android.Module {
|
||||
module := &Binary{}
|
||||
|
||||
@@ -1636,6 +1677,10 @@ func BinaryFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
// java_binary_host builds a `.jar` file and a shell script that executes it for the host.
|
||||
//
|
||||
// A java_binary_host has a single variant that produces a `.jar` file containing `.class` files that were
|
||||
// compiled against the host bootclasspath.
|
||||
func BinaryHostFactory() android.Module {
|
||||
module := &Binary{}
|
||||
|
||||
@@ -1817,6 +1862,13 @@ func (j *Import) IDECustomizedModuleName() string {
|
||||
|
||||
var _ android.PrebuiltInterface = (*Import)(nil)
|
||||
|
||||
// java_import imports one or more `.jar` files into the build graph as if they were built by a java_library module.
|
||||
//
|
||||
// By default, a java_import has a single variant that expects a `.jar` file containing `.class` files that were
|
||||
// compiled against an Android classpath.
|
||||
//
|
||||
// Specifying `host_supported: true` will produce two variants, one for use as a dependency of device modules and one
|
||||
// for host modules.
|
||||
func ImportFactory() android.Module {
|
||||
module := &Import{}
|
||||
|
||||
@@ -1827,6 +1879,11 @@ func ImportFactory() android.Module {
|
||||
return module
|
||||
}
|
||||
|
||||
// java_import imports one or more `.jar` files into the build graph as if they were built by a java_library_host
|
||||
// module.
|
||||
//
|
||||
// A java_import_host has a single variant that expects a `.jar` file containing `.class` files that were
|
||||
// compiled against a host bootclasspath.
|
||||
func ImportFactoryHost() android.Module {
|
||||
module := &Import{}
|
||||
|
||||
@@ -1848,6 +1905,37 @@ type Defaults struct {
|
||||
func (*Defaults) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||
}
|
||||
|
||||
// java_defaults provides a set of properties that can be inherited by other java or android modules.
|
||||
//
|
||||
// A module can use the properties from a java_defaults module using `defaults: ["defaults_module_name"]`. Each
|
||||
// property in the defaults module that exists in the depending module will be prepended to the depending module's
|
||||
// value for that property.
|
||||
//
|
||||
// Example:
|
||||
//
|
||||
// java_defaults {
|
||||
// name: "example_defaults",
|
||||
// srcs: ["common/**/*.java"],
|
||||
// javacflags: ["-Xlint:all"],
|
||||
// aaptflags: ["--auto-add-overlay"],
|
||||
// }
|
||||
//
|
||||
// java_library {
|
||||
// name: "example",
|
||||
// defaults: ["example_defaults"],
|
||||
// srcs: ["example/**/*.java"],
|
||||
// }
|
||||
//
|
||||
// is functionally identical to:
|
||||
//
|
||||
// java_library {
|
||||
// name: "example",
|
||||
// srcs: [
|
||||
// "common/**/*.java",
|
||||
// "example/**/*.java",
|
||||
// ],
|
||||
// javacflags: ["-Xlint:all"],
|
||||
// }
|
||||
func defaultsFactory() android.Module {
|
||||
return DefaultsFactory()
|
||||
}
|
||||
|
Reference in New Issue
Block a user