Merge "Don't install java libraries by default"
This commit is contained in:
@@ -323,7 +323,6 @@ func AndroidLibraryFactory() android.Module {
|
|||||||
&module.androidLibraryProperties)
|
&module.androidLibraryProperties)
|
||||||
|
|
||||||
module.androidLibraryProperties.BuildAAR = true
|
module.androidLibraryProperties.BuildAAR = true
|
||||||
module.properties.Installable = proptools.BoolPtr(false)
|
|
||||||
|
|
||||||
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
android.InitAndroidArchModule(module, android.DeviceSupported, android.MultilibCommon)
|
||||||
return module
|
return module
|
||||||
|
@@ -37,7 +37,7 @@ func (library *Library) AndroidMk() android.AndroidMkData {
|
|||||||
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(logtags, " "))
|
fmt.Fprintln(w, "LOCAL_LOGTAGS_FILES :=", strings.Join(logtags, " "))
|
||||||
}
|
}
|
||||||
|
|
||||||
if library.properties.Installable != nil && *library.properties.Installable == false {
|
if library.installFile == nil {
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
}
|
}
|
||||||
if library.dexJarFile != nil {
|
if library.dexJarFile != nil {
|
||||||
@@ -85,7 +85,7 @@ func (library *Library) AndroidMk() android.AndroidMkData {
|
|||||||
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_IS_HOST_MODULE := true")
|
||||||
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := JAVA_LIBRARIES")
|
fmt.Fprintln(w, "LOCAL_MODULE_CLASS := JAVA_LIBRARIES")
|
||||||
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.implementationJarFile.String())
|
fmt.Fprintln(w, "LOCAL_PREBUILT_MODULE_FILE :=", library.implementationJarFile.String())
|
||||||
if library.properties.Installable != nil && *library.properties.Installable == false {
|
if library.installFile == nil {
|
||||||
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
fmt.Fprintln(w, "LOCAL_UNINSTALLABLE_MODULE := true")
|
||||||
}
|
}
|
||||||
if library.dexJarFile != nil {
|
if library.dexJarFile != nil {
|
||||||
|
@@ -187,6 +187,7 @@ func AndroidAppFactory() android.Module {
|
|||||||
module.Module.deviceProperties.Optimize.Shrink = proptools.BoolPtr(true)
|
module.Module.deviceProperties.Optimize.Shrink = proptools.BoolPtr(true)
|
||||||
|
|
||||||
module.Module.properties.Instrument = true
|
module.Module.properties.Instrument = true
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
module.AddProperties(
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
@@ -225,6 +226,7 @@ func AndroidTestFactory() android.Module {
|
|||||||
module := &AndroidTest{}
|
module := &AndroidTest{}
|
||||||
|
|
||||||
module.Module.deviceProperties.Optimize.Enabled = proptools.BoolPtr(true)
|
module.Module.deviceProperties.Optimize.Enabled = proptools.BoolPtr(true)
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
module.AddProperties(
|
module.AddProperties(
|
||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
|
53
java/java.go
53
java/java.go
@@ -34,8 +34,8 @@ import (
|
|||||||
func init() {
|
func init() {
|
||||||
android.RegisterModuleType("java_defaults", defaultsFactory)
|
android.RegisterModuleType("java_defaults", defaultsFactory)
|
||||||
|
|
||||||
android.RegisterModuleType("java_library", LibraryFactory(true))
|
android.RegisterModuleType("java_library", LibraryFactory)
|
||||||
android.RegisterModuleType("java_library_static", LibraryFactory(false))
|
android.RegisterModuleType("java_library_static", LibraryFactory)
|
||||||
android.RegisterModuleType("java_library_host", LibraryHostFactory)
|
android.RegisterModuleType("java_library_host", LibraryHostFactory)
|
||||||
android.RegisterModuleType("java_binary", BinaryFactory)
|
android.RegisterModuleType("java_binary", BinaryFactory)
|
||||||
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
|
android.RegisterModuleType("java_binary_host", BinaryHostFactory)
|
||||||
@@ -107,7 +107,8 @@ type CompilerProperties struct {
|
|||||||
// If not blank, set the java version passed to javac as -source and -target
|
// If not blank, set the java version passed to javac as -source and -target
|
||||||
Java_version *string
|
Java_version *string
|
||||||
|
|
||||||
// If set to false, don't allow this module to be installed. Defaults to true.
|
// If set to true, allow this module to be dexed and installed on devices. Has no
|
||||||
|
// effect on host modules, which are always considered installable.
|
||||||
Installable *bool
|
Installable *bool
|
||||||
|
|
||||||
// If set to true, include sources used to compile the module in to the final jar
|
// If set to true, include sources used to compile the module in to the final jar
|
||||||
@@ -1182,13 +1183,13 @@ func (j *Module) compile(ctx android.ModuleContext, extraSrcJars ...android.Path
|
|||||||
outputFile = j.instrument(ctx, flags, outputFile, jarName)
|
outputFile = j.instrument(ctx, flags, outputFile, jarName)
|
||||||
}
|
}
|
||||||
|
|
||||||
if ctx.Device() && j.createDexRule() {
|
if ctx.Device() && (Bool(j.properties.Installable) || Bool(j.deviceProperties.Compile_dex)) {
|
||||||
var dexOutputFile android.Path
|
var dexOutputFile android.Path
|
||||||
dexOutputFile = j.compileDex(ctx, flags, outputFile, jarName)
|
dexOutputFile = j.compileDex(ctx, flags, outputFile, jarName)
|
||||||
if ctx.Failed() {
|
if ctx.Failed() {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
if j.installable() {
|
if Bool(j.properties.Installable) {
|
||||||
outputFile = dexOutputFile
|
outputFile = dexOutputFile
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1250,14 +1251,6 @@ func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags,
|
|||||||
return instrumentedJar
|
return instrumentedJar
|
||||||
}
|
}
|
||||||
|
|
||||||
func (j *Module) installable() bool {
|
|
||||||
return BoolDefault(j.properties.Installable, true)
|
|
||||||
}
|
|
||||||
|
|
||||||
func (j *Module) createDexRule() bool {
|
|
||||||
return Bool(j.deviceProperties.Compile_dex) || j.installable()
|
|
||||||
}
|
|
||||||
|
|
||||||
var _ Dependency = (*Library)(nil)
|
var _ Dependency = (*Library)(nil)
|
||||||
|
|
||||||
func (j *Module) HeaderJars() android.Paths {
|
func (j *Module) HeaderJars() android.Paths {
|
||||||
@@ -1293,7 +1286,7 @@ type Library struct {
|
|||||||
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
func (j *Library) GenerateAndroidBuildActions(ctx android.ModuleContext) {
|
||||||
j.compile(ctx)
|
j.compile(ctx)
|
||||||
|
|
||||||
if j.installable() {
|
if Bool(j.properties.Installable) || ctx.Host() {
|
||||||
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
j.installFile = ctx.InstallFile(android.PathForModuleInstall(ctx, "framework"),
|
||||||
ctx.ModuleName()+".jar", j.outputFile)
|
ctx.ModuleName()+".jar", j.outputFile)
|
||||||
}
|
}
|
||||||
@@ -1303,22 +1296,16 @@ func (j *Library) DepsMutator(ctx android.BottomUpMutatorContext) {
|
|||||||
j.deps(ctx)
|
j.deps(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func LibraryFactory(installable bool) func() android.Module {
|
func LibraryFactory() android.Module {
|
||||||
return func() android.Module {
|
module := &Library{}
|
||||||
module := &Library{}
|
|
||||||
|
|
||||||
if !installable {
|
module.AddProperties(
|
||||||
module.properties.Installable = proptools.BoolPtr(false)
|
&module.Module.properties,
|
||||||
}
|
&module.Module.deviceProperties,
|
||||||
|
&module.Module.protoProperties)
|
||||||
|
|
||||||
module.AddProperties(
|
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||||
&module.Module.properties,
|
return module
|
||||||
&module.Module.deviceProperties,
|
|
||||||
&module.Module.protoProperties)
|
|
||||||
|
|
||||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
|
||||||
return module
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func LibraryHostFactory() android.Module {
|
func LibraryHostFactory() android.Module {
|
||||||
@@ -1328,6 +1315,8 @@ func LibraryHostFactory() android.Module {
|
|||||||
&module.Module.properties,
|
&module.Module.properties,
|
||||||
&module.Module.protoProperties)
|
&module.Module.protoProperties)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
InitJavaModule(module, android.HostSupported)
|
InitJavaModule(module, android.HostSupported)
|
||||||
return module
|
return module
|
||||||
}
|
}
|
||||||
@@ -1367,6 +1356,8 @@ func TestFactory() android.Module {
|
|||||||
&module.Module.protoProperties,
|
&module.Module.protoProperties,
|
||||||
&module.testProperties)
|
&module.testProperties)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
InitJavaModule(module, android.HostAndDeviceSupported)
|
InitJavaModule(module, android.HostAndDeviceSupported)
|
||||||
android.InitDefaultableModule(module)
|
android.InitDefaultableModule(module)
|
||||||
return module
|
return module
|
||||||
@@ -1380,6 +1371,8 @@ func TestHostFactory() android.Module {
|
|||||||
&module.Module.protoProperties,
|
&module.Module.protoProperties,
|
||||||
&module.testProperties)
|
&module.testProperties)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
InitJavaModule(module, android.HostSupported)
|
InitJavaModule(module, android.HostSupported)
|
||||||
android.InitDefaultableModule(module)
|
android.InitDefaultableModule(module)
|
||||||
return module
|
return module
|
||||||
@@ -1449,6 +1442,8 @@ func BinaryFactory() android.Module {
|
|||||||
&module.Module.protoProperties,
|
&module.Module.protoProperties,
|
||||||
&module.binaryProperties)
|
&module.binaryProperties)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommonFirst)
|
android.InitAndroidArchModule(module, android.HostAndDeviceSupported, android.MultilibCommonFirst)
|
||||||
android.InitDefaultableModule(module)
|
android.InitDefaultableModule(module)
|
||||||
return module
|
return module
|
||||||
@@ -1462,6 +1457,8 @@ func BinaryHostFactory() android.Module {
|
|||||||
&module.Module.protoProperties,
|
&module.Module.protoProperties,
|
||||||
&module.binaryProperties)
|
&module.binaryProperties)
|
||||||
|
|
||||||
|
module.Module.properties.Installable = proptools.BoolPtr(true)
|
||||||
|
|
||||||
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommonFirst)
|
android.InitAndroidArchModule(module, android.HostSupported, android.MultilibCommonFirst)
|
||||||
android.InitDefaultableModule(module)
|
android.InitDefaultableModule(module)
|
||||||
return module
|
return module
|
||||||
|
@@ -74,7 +74,7 @@ func testContext(config android.Config, bp string,
|
|||||||
ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(AndroidAppFactory))
|
ctx.RegisterModuleType("android_app", android.ModuleFactoryAdaptor(AndroidAppFactory))
|
||||||
ctx.RegisterModuleType("android_library", android.ModuleFactoryAdaptor(AndroidLibraryFactory))
|
ctx.RegisterModuleType("android_library", android.ModuleFactoryAdaptor(AndroidLibraryFactory))
|
||||||
ctx.RegisterModuleType("java_binary_host", android.ModuleFactoryAdaptor(BinaryHostFactory))
|
ctx.RegisterModuleType("java_binary_host", android.ModuleFactoryAdaptor(BinaryHostFactory))
|
||||||
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory(true)))
|
ctx.RegisterModuleType("java_library", android.ModuleFactoryAdaptor(LibraryFactory))
|
||||||
ctx.RegisterModuleType("java_library_host", android.ModuleFactoryAdaptor(LibraryHostFactory))
|
ctx.RegisterModuleType("java_library_host", android.ModuleFactoryAdaptor(LibraryHostFactory))
|
||||||
ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(ImportFactory))
|
ctx.RegisterModuleType("java_import", android.ModuleFactoryAdaptor(ImportFactory))
|
||||||
ctx.RegisterModuleType("java_defaults", android.ModuleFactoryAdaptor(defaultsFactory))
|
ctx.RegisterModuleType("java_defaults", android.ModuleFactoryAdaptor(defaultsFactory))
|
||||||
|
@@ -331,7 +331,7 @@ func (module *sdkLibrary) createStubsLibrary(mctx android.TopDownMutatorContext,
|
|||||||
props.Product_specific = proptools.BoolPtr(true)
|
props.Product_specific = proptools.BoolPtr(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory(false)), &props)
|
mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory), &props)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates a droiddoc module that creates stubs source files from the given full source
|
// Creates a droiddoc module that creates stubs source files from the given full source
|
||||||
@@ -453,6 +453,7 @@ func (module *sdkLibrary) createImplLibrary(mctx android.TopDownMutatorContext)
|
|||||||
Soc_specific *bool
|
Soc_specific *bool
|
||||||
Device_specific *bool
|
Device_specific *bool
|
||||||
Product_specific *bool
|
Product_specific *bool
|
||||||
|
Installable *bool
|
||||||
Required []string
|
Required []string
|
||||||
Errorprone struct {
|
Errorprone struct {
|
||||||
Javacflags []string
|
Javacflags []string
|
||||||
@@ -463,6 +464,7 @@ func (module *sdkLibrary) createImplLibrary(mctx android.TopDownMutatorContext)
|
|||||||
props.Srcs = module.properties.Srcs
|
props.Srcs = module.properties.Srcs
|
||||||
props.Libs = module.properties.Libs
|
props.Libs = module.properties.Libs
|
||||||
props.Static_libs = module.properties.Static_libs
|
props.Static_libs = module.properties.Static_libs
|
||||||
|
props.Installable = proptools.BoolPtr(true)
|
||||||
// XML file is installed along with the impl lib
|
// XML file is installed along with the impl lib
|
||||||
props.Required = []string{module.xmlFileName()}
|
props.Required = []string{module.xmlFileName()}
|
||||||
props.Errorprone.Javacflags = module.properties.Errorprone.Javacflags
|
props.Errorprone.Javacflags = module.properties.Errorprone.Javacflags
|
||||||
@@ -475,7 +477,7 @@ func (module *sdkLibrary) createImplLibrary(mctx android.TopDownMutatorContext)
|
|||||||
props.Product_specific = proptools.BoolPtr(true)
|
props.Product_specific = proptools.BoolPtr(true)
|
||||||
}
|
}
|
||||||
|
|
||||||
mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory(true)), &props, &module.deviceProperties)
|
mctx.CreateModule(android.ModuleFactoryAdaptor(LibraryFactory), &props, &module.deviceProperties)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Creates the xml file that publicizes the runtime library
|
// Creates the xml file that publicizes the runtime library
|
||||||
|
Reference in New Issue
Block a user