1// Copyright 2017 Google Inc. All rights reserved.
2//
3// Licensed under the Apache License, Version 2.0 (the "License");
4// you may not use this file except in compliance with the License.
5// You may obtain a copy of the License at
6//
7//     http://www.apache.org/licenses/LICENSE-2.0
8//
9// Unless required by applicable law or agreed to in writing, software
10// distributed under the License is distributed on an "AS IS" BASIS,
11// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12// See the License for the specific language governing permissions and
13// limitations under the License.
14
15package config
16
17import (
18	"strings"
19
20	"android/soong/android"
21)
22
23func init() {
24	android.RegisterMakeVarsProvider(pctx, makeVarsProvider)
25}
26
27func makeVarsProvider(ctx android.MakeVarsContext) {
28	ctx.Strict("FRAMEWORK_LIBRARIES", strings.Join(FrameworkLibraries, " "))
29
30	// These are used by make when LOCAL_PRIVATE_PLATFORM_APIS is set (equivalent to platform_apis in blueprint):
31	ctx.Strict("LEGACY_CORE_PLATFORM_BOOTCLASSPATH_LIBRARIES", strings.Join(LegacyCorePlatformBootclasspathLibraries, " "))
32	ctx.Strict("LEGACY_CORE_PLATFORM_SYSTEM_MODULES", LegacyCorePlatformSystemModules)
33
34	ctx.Strict("ANDROID_JAVA_HOME", "${JavaHome}")
35	ctx.Strict("ANDROID_JAVA8_HOME", "prebuilts/jdk/jdk8/${hostPrebuiltTag}")
36	ctx.Strict("ANDROID_JAVA9_HOME", "prebuilts/jdk/jdk9/${hostPrebuiltTag}")
37	ctx.Strict("ANDROID_JAVA11_HOME", "prebuilts/jdk/jdk11/${hostPrebuiltTag}")
38	ctx.Strict("ANDROID_JAVA_TOOLCHAIN", "${JavaToolchain}")
39	ctx.Strict("JAVA", "${JavaCmd} ${JavaVmFlags}")
40	ctx.Strict("JAVAC", "${JavacCmd} ${JavacVmFlags}")
41	ctx.Strict("JAR", "${JarCmd}")
42	ctx.Strict("JAR_ARGS", "${JarArgsCmd}")
43	ctx.Strict("JAVADOC", "${JavadocCmd}")
44	ctx.Strict("COMMON_JDK_FLAGS", "${CommonJdkFlags}")
45
46	ctx.Strict("DX", "${D8Cmd}")
47	ctx.Strict("DX_COMMAND", "${D8Cmd} -JXms16M -JXmx2048M")
48	ctx.Strict("R8_COMPAT_PROGUARD", "${R8Cmd}")
49
50	ctx.Strict("TURBINE", "${TurbineJar}")
51
52	if ctx.Config().RunErrorProne() {
53		ctx.Strict("ERROR_PRONE_JARS", strings.Join(ErrorProneClasspath, " "))
54		ctx.Strict("ERROR_PRONE_FLAGS", "${ErrorProneFlags}")
55		ctx.Strict("ERROR_PRONE_CHECKS", "${ErrorProneChecks}")
56	}
57
58	ctx.Strict("TARGET_JAVAC", "${JavacCmd}  ${JavacVmFlags} ${CommonJdkFlags}")
59	ctx.Strict("HOST_JAVAC", "${JavacCmd}  ${JavacVmFlags} ${CommonJdkFlags}")
60
61	ctx.Strict("JLINK", "${JlinkCmd}")
62	ctx.Strict("JMOD", "${JmodCmd}")
63
64	ctx.Strict("SOONG_JAVAC_WRAPPER", "${SoongJavacWrapper}")
65	ctx.Strict("DEXPREOPT_GEN", "${DexpreoptGen}")
66	ctx.Strict("ZIPSYNC", "${ZipSyncCmd}")
67
68	ctx.Strict("JACOCO_CLI_JAR", "${JacocoCLIJar}")
69	ctx.Strict("DEFAULT_JACOCO_EXCLUDE_FILTER", strings.Join(DefaultMakeJacocoExcludeFilter, ","))
70
71	ctx.Strict("EXTRACT_JAR_PACKAGES", "${ExtractJarPackagesCmd}")
72
73	ctx.Strict("MANIFEST_CHECK", "${ManifestCheckCmd}")
74	ctx.Strict("MANIFEST_FIXER", "${ManifestFixerCmd}")
75
76	ctx.Strict("ANDROID_MANIFEST_MERGER", "${ManifestMergerCmd}")
77
78	ctx.Strict("CLASS2NONSDKLIST", "${Class2NonSdkList}")
79	ctx.Strict("HIDDENAPI", "${HiddenAPI}")
80
81	ctx.Strict("DEX_FLAGS", "${DexFlags}")
82
83	ctx.Strict("AIDL", "${AidlCmd}")
84	ctx.Strict("AAPT2", "${Aapt2Cmd}")
85	ctx.Strict("ZIPALIGN", "${ZipAlign}")
86	ctx.Strict("SIGNAPK_JAR", "${SignapkCmd}")
87	ctx.Strict("SIGNAPK_JNI_LIBRARY_PATH", "${SignapkJniLibrary}")
88
89	ctx.Strict("SOONG_ZIP", "${SoongZipCmd}")
90	ctx.Strict("MERGE_ZIPS", "${MergeZipsCmd}")
91	ctx.Strict("ZIP2ZIP", "${Zip2ZipCmd}")
92
93	ctx.Strict("ZIPTIME", "${Ziptime}")
94
95}
96