Lines Matching refs:j
372 func (j *Module) CheckStableSdkVersion(ctx android.BaseModuleContext) error {
373 sdkVersion := j.SdkVersion(ctx)
378 if useLegacyCorePlatformApiByName(j.BaseModuleName()) {
390 func (j *Module) checkSdkVersions(ctx android.ModuleContext) {
391 if j.RequiresStableAPIs(ctx) {
409 j.checkSdkLinkType(ctx, module.(moduleWithSdkDep), tag.(dependencyTag))
415 func (j *Module) checkPlatformAPI(ctx android.ModuleContext) {
417 usePlatformAPI := proptools.Bool(j.deviceProperties.Platform_apis)
428 func (j *Module) addHostProperties() {
429 j.AddProperties(
430 &j.properties,
431 &j.protoProperties,
432 &j.usesLibraryProperties,
436 func (j *Module) addHostAndDeviceProperties() {
437 j.addHostProperties()
438 j.AddProperties(
439 &j.deviceProperties,
440 &j.dexer.dexProperties,
441 &j.dexpreoptProperties,
442 &j.linter.properties,
446 func (j *Module) OutputFiles(tag string) (android.Paths, error) {
449 return append(android.Paths{j.outputFile}, j.extraOutputFiles...), nil
451 return android.Paths{j.outputFile}, nil
453 return android.Paths{j.implementationAndResourcesJar}, nil
455 if j.dexer.proguardDictionary.Valid() {
456 return android.Paths{j.dexer.proguardDictionary.Path()}, nil
484 func (j *Module) shouldInstrument(ctx android.BaseModuleContext) bool {
485 return j.properties.Instrument &&
490 func (j *Module) shouldInstrumentStatic(ctx android.BaseModuleContext) bool {
491 return j.shouldInstrument(ctx) &&
496 func (j *Module) shouldInstrumentInApex(ctx android.BaseModuleContext) bool {
502 if j.DirectlyInAnyApex() && !isJacocoAgent && !apexInfo.IsForPlatform() {
512 func (j *Module) SdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
513 return android.SdkSpecFrom(ctx, String(j.deviceProperties.Sdk_version))
516 func (j *Module) SystemModules() string {
517 return proptools.String(j.deviceProperties.System_modules)
520 func (j *Module) MinSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
521 if j.deviceProperties.Min_sdk_version != nil {
522 return android.SdkSpecFrom(ctx, *j.deviceProperties.Min_sdk_version)
524 return j.SdkVersion(ctx)
527 func (j *Module) MinSdkVersionString() string {
528 return j.minSdkVersion.Raw
531 func (j *Module) TargetSdkVersion(ctx android.EarlyModuleContext) android.SdkSpec {
532 if j.deviceProperties.Target_sdk_version != nil {
533 return android.SdkSpecFrom(ctx, *j.deviceProperties.Target_sdk_version)
535 return j.SdkVersion(ctx)
538 func (j *Module) AvailableFor(what string) bool {
539 if what == android.AvailableToPlatform && Bool(j.deviceProperties.Hostdex) {
545 return j.ApexModuleBase.AvailableFor(what)
548 func (j *Module) deps(ctx android.BottomUpMutatorContext) {
550 j.linter.deps(ctx)
552 sdkDeps(ctx, android.SdkContext(j), j.dexer)
554 if j.deviceProperties.SyspropPublicStub != "" {
558 ctx.AddVariationDependencies(nil, syspropPublicStubDepTag, j.deviceProperties.SyspropPublicStub)
562 libDeps := ctx.AddVariationDependencies(nil, libTag, j.properties.Libs...)
563 ctx.AddVariationDependencies(nil, staticLibTag, j.properties.Static_libs...)
566 …ctx.AddVariationDependencies(nil, hiddenApiAnnotationsTag, j.properties.Hiddenapi_additional_annot…
578 for idx := range j.properties.Libs {
590 j.checkPartitionsForJavaDependency(ctx, "libs", javaDep)
607 …ctx.AddFarVariationDependencies(ctx.Config().BuildOSCommonTarget.Variations(), pluginTag, j.proper…
608 …dencies(ctx.Config().BuildOSCommonTarget.Variations(), errorpronePluginTag, j.properties.Errorpron…
609 …endencies(ctx.Config().BuildOSCommonTarget.Variations(), exportedPluginTag, j.properties.Exported_…
611 android.ProtoDeps(ctx, &j.protoProperties)
612 if j.hasSrcExt(".proto") {
613 protoDeps(ctx, &j.protoProperties)
616 if j.hasSrcExt(".kt") {
621 if len(j.properties.Plugins) > 0 {
631 j.properties.Instrument = true
633 } else if j.shouldInstrumentStatic(ctx) {
648 func (j *Module) hasSrcExt(ext string) bool {
649 return hasSrcExt(j.properties.Srcs, ext)
652 func (j *Module) aidlFlags(ctx android.ModuleContext, aidlPreprocess android.OptionalPath,
655 aidlIncludes := android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Local_include_dirs)
657 android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Export_include_dirs)...)
659 android.PathsForSource(ctx, j.deviceProperties.Aidl.Include_dirs)...)
664 flags = append(flags, j.deviceProperties.Aidl.Flags...)
673 if len(j.exportAidlIncludeDirs) > 0 {
674 flags = append(flags, android.JoinWithPrefix(j.exportAidlIncludeDirs.Strings(), "-I"))
686 if Bool(j.deviceProperties.Aidl.Generate_traces) {
690 if Bool(j.deviceProperties.Aidl.Generate_get_transaction_name) {
697 func (j *Module) collectBuilderFlags(ctx android.ModuleContext, deps deps) javaBuilderFlags {
702 flags.javaVersion = getJavaVersion(ctx, String(j.properties.Java_version), android.SdkContext(j))
713 errorProneFlags = append(errorProneFlags, j.properties.Errorprone.Javacflags...)
731 decodeSdkDep(ctx, android.SdkContext(j)).hasStandardLibs() {
749 if Bool(j.properties.Use_tools_jar) {
759 flags.aidlFlags, flags.aidlDeps = j.aidlFlags(ctx, deps.aidlPreprocess, deps.aidlIncludeDirs)
764 func (j *Module) collectJavacFlags(
767 javacFlags := j.properties.Javacflags
777 javacFlags = append(javacFlags, j.properties.Openjdk9.Javacflags...)
779 if j.properties.Patch_module != nil {
822 "--patch-module="+String(j.properties.Patch_module)+"="+strings.Join(patchPaths, ":"))
835 func (j *Module) compile(ctx android.ModuleContext, aaptSrcJar android.Path) {
836 …j.exportAidlIncludeDirs = android.PathsForModuleSrc(ctx, j.deviceProperties.Aidl.Export_include_di…
838 deps := j.collectDeps(ctx)
839 flags := j.collectBuilderFlags(ctx, deps)
842 j.properties.Srcs = append(j.properties.Srcs, j.properties.Openjdk9.Srcs...)
844 srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
846 flags = protoFlags(ctx, &j.properties, &j.protoProperties, flags)
849 kotlinCommonSrcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Common_srcs, nil)
854 srcFiles = j.genSources(ctx, srcFiles, flags)
858 flags = j.collectJavacFlags(ctx, flags, srcFiles)
866 if j.properties.Jarjar_rules != nil {
867 j.expandJarjarRules = android.PathForModuleSrc(ctx, *j.properties.Jarjar_rules)
883 j.expandIDEInfoCompiledSrcs = append(j.expandIDEInfoCompiledSrcs, uniqueSrcFiles.Strings()...)
889 kotlincFlags := j.properties.Kotlincflags
913 …j.expandIDEInfoCompiledSrcs = append(j.expandIDEInfoCompiledSrcs, srcFiles.FilterByExt(".kt").Stri…
914 …j.expandIDEInfoCompiledSrcs = append(j.expandIDEInfoCompiledSrcs, kotlinCommonSrcFiles.Strings()..…
945 if BoolDefault(j.properties.Static_kotlin_stdlib, true) {
953 j.compiledJavaSrcs = uniqueSrcFiles
954 j.compiledSrcJars = srcJars
959 if j.properties.Javac_shard_size != nil && *(j.properties.Javac_shard_size) > 0 {
967 headerJarFileWithoutJarjar, j.headerJarFile =
968 j.compileJavaHeader(ctx, uniqueSrcFiles, srcJars, deps, flags, jarName, kotlinJars)
988 shardSize := int(*(j.properties.Javac_shard_size))
993 classes := j.compileJavaClasses(ctx, jarName, idx, shardSrc,
999 classes := j.compileJavaClasses(ctx, jarName, len(shardSrcs),
1004 classes := j.compileJavaClasses(ctx, jarName, -1, uniqueSrcFiles, srcJars, flags, extraJarDeps)
1012 j.srcJarArgs, j.srcJarDeps = resourcePathsToJarArgs(srcFiles), srcFiles
1015 if Bool(j.properties.Include_srcs) {
1017 TransformResourcesToJar(ctx, includeSrcJar, j.srcJarArgs, j.srcJarDeps)
1020 dirArgs, dirDeps := ResourceDirsToJarArgs(ctx, j.properties.Java_resource_dirs,
1021 j.properties.Exclude_java_resource_dirs, j.properties.Exclude_java_resources)
1022 …fileArgs, fileDeps := ResourceFilesToJarArgs(ctx, j.properties.Java_resources, j.properties.Exclud…
1023 extraArgs, extraDeps := resourcePathsToJarArgs(j.extraResources), j.extraResources
1040 j.resourceJar = resourceJar
1047 if j.resourceJar != nil {
1048 resourceJars = append(resourceJars, j.resourceJar)
1050 if Bool(j.properties.Include_srcs) {
1059 j.resourceJar = combinedJar
1061 j.resourceJar = resourceJars[0]
1068 manifest := j.overrideManifest
1069 if !manifest.Valid() && j.properties.Manifest != nil {
1070 manifest = android.OptionalPathForPath(android.PathForModuleSrc(ctx, *j.properties.Manifest))
1073 services := android.PathsForModuleSrc(ctx, j.properties.Services)
1135 if j.expandJarjarRules != nil {
1138 TransformJarJar(ctx, jarjarFile, outputFile, j.expandJarjarRules)
1142 if j.resourceJar != nil {
1144 TransformJarJar(ctx, resourceJarJarFile, j.resourceJar, j.expandJarjarRules)
1145 j.resourceJar = resourceJarJarFile
1154 if len(j.properties.Permitted_packages) > 0 {
1157 CheckJarPackages(ctx, pkgckFile, outputFile, j.properties.Permitted_packages)
1158 j.additionalCheckedModules = append(j.additionalCheckedModules, pkgckFile)
1165 j.implementationJarFile = outputFile
1166 if j.headerJarFile == nil {
1167 j.headerJarFile = j.implementationJarFile
1170 if j.shouldInstrumentInApex(ctx) {
1171 j.properties.Instrument = true
1175 specs := j.jacocoModuleToZipCommand(ctx)
1180 if j.shouldInstrument(ctx) {
1181 outputFile = j.instrument(ctx, flags, outputFile, jarName, specs)
1186 if j.resourceJar != nil {
1187 jars := android.Paths{j.resourceJar, implementationAndResourcesJar}
1194 j.implementationAndResourcesJar = implementationAndResourcesJar
1198 if j.DirectlyInAnyApex() && !apexInfo.IsForPlatform() {
1199 if j.dexProperties.Compile_dex == nil {
1200 j.dexProperties.Compile_dex = proptools.BoolPtr(true)
1202 if j.deviceProperties.Hostdex == nil {
1203 j.deviceProperties.Hostdex = proptools.BoolPtr(true)
1207 if ctx.Device() && (Bool(j.properties.Installable) || Bool(j.dexProperties.Compile_dex)) {
1208 if j.hasCode(ctx) {
1209 if j.shouldInstrumentStatic(ctx) {
1210 j.dexer.extraProguardFlagFiles = append(j.dexer.extraProguardFlagFiles,
1215 dexOutputFile = j.dexer.compileDex(ctx, flags, j.MinSdkVersion(ctx), outputFile, jarName)
1221 if j.resourceJar != nil {
1222 jars := android.Paths{dexOutputFile, j.resourceJar}
1226 if *j.dexProperties.Uncompress_dex {
1236 j.initHiddenAPI(ctx, dexOutputFile, j.implementationJarFile, j.dexProperties.Uncompress_dex)
1239 dexOutputFile = j.hiddenAPIEncodeDex(ctx, dexOutputFile)
1241 j.dexJarFile = dexOutputFile
1244 j.dexpreopt(ctx, dexOutputFile)
1251 j.dexJarFile = j.resourceJar
1270 j.linter.name = ctx.ModuleName()
1271 j.linter.srcs = srcFiles
1272 j.linter.srcJars = srcJars
1273 …j.linter.classpath = append(append(android.Paths(nil), flags.bootClasspath...), flags.classpath...)
1274 j.linter.classes = j.implementationJarFile
1275 j.linter.minSdkVersion = lintSDKVersionString(j.MinSdkVersion(ctx))
1276 j.linter.targetSdkVersion = lintSDKVersionString(j.TargetSdkVersion(ctx))
1277 j.linter.compileSdkVersion = lintSDKVersionString(j.SdkVersion(ctx))
1278 j.linter.compileSdkKind = j.SdkVersion(ctx).Kind
1279 j.linter.javaLanguageLevel = flags.javaVersion.String()
1280 j.linter.kotlinLanguageLevel = "1.3"
1282 j.linter.buildModuleReportZip = true
1284 j.linter.lint(ctx)
1290 HeaderJars: android.PathsIfNonNil(j.headerJarFile),
1291 ImplementationAndResourcesJars: android.PathsIfNonNil(j.implementationAndResourcesJar),
1292 ImplementationJars: android.PathsIfNonNil(j.implementationJarFile),
1293 ResourceJars: android.PathsIfNonNil(j.resourceJar),
1294 AidlIncludeDirs: j.exportAidlIncludeDirs,
1295 SrcJarArgs: j.srcJarArgs,
1296 SrcJarDeps: j.srcJarDeps,
1297 ExportedPlugins: j.exportedPluginJars,
1298 ExportedPluginClasses: j.exportedPluginClasses,
1299 ExportedPluginDisableTurbine: j.exportedDisableTurbine,
1300 JacocoReportClassesFile: j.jacocoReportClassesFile,
1304 j.outputFile = outputFile.WithoutRel()
1307 func (j *Module) compileJavaClasses(ctx android.ModuleContext, jarName string, idx int,
1322 j.kytheFiles = append(j.kytheFiles, extractionFile)
1353 func (j *Module) compileJavaHeader(ctx android.ModuleContext, srcFiles, srcJars android.Paths,
1382 if j.expandJarjarRules != nil {
1385 TransformJarJar(ctx, jarjarFile, headerJar, j.expandJarjarRules)
1395 func (j *Module) instrument(ctx android.ModuleContext, flags javaBuilderFlags,
1403 j.jacocoReportClassesFile = jacocoReportClassesFile
1408 func (j *Module) HeaderJars() android.Paths {
1409 if j.headerJarFile == nil {
1412 return android.Paths{j.headerJarFile}
1415 func (j *Module) ImplementationJars() android.Paths {
1416 if j.implementationJarFile == nil {
1419 return android.Paths{j.implementationJarFile}
1422 func (j *Module) DexJarBuildPath() android.Path {
1423 return j.dexJarFile
1426 func (j *Module) DexJarInstallPath() android.Path {
1427 return j.installFile
1430 func (j *Module) ImplementationAndResourcesJars() android.Paths {
1431 if j.implementationAndResourcesJar == nil {
1434 return android.Paths{j.implementationAndResourcesJar}
1437 func (j *Module) AidlIncludeDirs() android.Paths {
1439 return j.exportAidlIncludeDirs
1442 func (j *Module) ClassLoaderContexts() dexpreopt.ClassLoaderContextMap {
1443 return j.classLoaderContexts
1447 func (j *Module) IDEInfo(dpInfo *android.IdeInfo) {
1448 dpInfo.Deps = append(dpInfo.Deps, j.CompilerDeps()...)
1449 dpInfo.Srcs = append(dpInfo.Srcs, j.expandIDEInfoCompiledSrcs...)
1450 dpInfo.SrcJars = append(dpInfo.SrcJars, j.compiledSrcJars.Strings()...)
1451 …dpInfo.Aidl_include_dirs = append(dpInfo.Aidl_include_dirs, j.deviceProperties.Aidl.Include_dirs..…
1452 if j.expandJarjarRules != nil {
1453 dpInfo.Jarjar_rules = append(dpInfo.Jarjar_rules, j.expandJarjarRules.String())
1455 dpInfo.Paths = append(dpInfo.Paths, j.modulePaths...)
1458 func (j *Module) CompilerDeps() []string {
1460 jdeps = append(jdeps, j.properties.Libs...)
1461 jdeps = append(jdeps, j.properties.Static_libs...)
1465 func (j *Module) hasCode(ctx android.ModuleContext) bool {
1466 srcFiles := android.PathsForModuleSrcExcludes(ctx, j.properties.Srcs, j.properties.Exclude_srcs)
1471 func (j *Module) DepIsInSameApex(ctx android.BaseModuleContext, dep android.Module) bool {
1472 return j.depIsInSameApex(ctx, dep)
1476 func (j *Module) ShouldSupportSdkVersion(ctx android.BaseModuleContext,
1478 sdkSpec := j.MinSdkVersion(ctx)
1495 func (j *Module) Stem() string {
1496 return proptools.StringDefault(j.deviceProperties.Stem, j.Name())
1499 func (j *Module) JacocoReportClassesFile() android.Path {
1500 return j.jacocoReportClassesFile
1503 func (j *Module) IsInstallable() bool {
1504 return Bool(j.properties.Installable)
1598 func (j *Module) checkSdkLinkType(
1604 myLinkType, stubs := j.getSdkLinkType(ctx, ctx.ModuleName())
1619 func (j *Module) collectDeps(ctx android.ModuleContext) deps {
1623 sdkDep := decodeSdkDep(ctx, android.SdkContext(j))
1636 sdkLinkType, _ := j.getSdkLinkType(ctx, ctx.ModuleName())
1654 deps.classpath = append(deps.classpath, dep.SdkHeaderJars(ctx, j.SdkVersion(ctx))...)
1711 j.exportedPluginJars = append(j.exportedPluginJars, dep.ImplementationAndResourcesJars...)
1713 …j.exportedPluginClasses = append(j.exportedPluginClasses, *plugin.pluginProperties.Processor_class)
1718 j.exportedDisableTurbine = Bool(plugin.pluginProperties.Generates_api)
1762 addCLCFromDep(ctx, module, j.classLoaderContexts)
1779 func (j *Module) ProvidesUsesLib() *string {
1780 return j.usesLibraryProperties.Provides_uses_lib