From 5d8652fcaff35961d59a639f8deb9355016625bc Mon Sep 17 00:00:00 2001 From: Anton Hansson Date: Mon, 29 Mar 2021 16:11:35 +0100 Subject: [PATCH] Set min_sdk_version for java imports in pom2bp Previously min_sdk_version was only set for *_library build rules, and not for *_import targets. This made min_sdk_version default to sdk_version, which is usually "current", which is not correct for these libraries. Test: pom2bp -default-min_sdk_version 24 for androidx Change-Id: I3b029315abeb559e66efad847ae664efb79f4509 --- cmd/pom2bp/pom2bp.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cmd/pom2bp/pom2bp.go b/cmd/pom2bp/pom2bp.go index d9116b081..d31489e3a 100644 --- a/cmd/pom2bp/pom2bp.go +++ b/cmd/pom2bp/pom2bp.go @@ -401,6 +401,8 @@ var bpTemplate = template.Must(template.New("bp").Parse(` {{- end}} ], {{- end}} + {{- else if not .IsHostOnly}} + min_sdk_version: "{{.DefaultMinSdkVersion}}", {{- end}} } `)) @@ -442,6 +444,8 @@ var bpDepsTemplate = template.Must(template.New("bp").Parse(` {{- end}} ], {{- end}} + {{- else if not .IsHostOnly}} + min_sdk_version: "{{.DefaultMinSdkVersion}}", {{- end}} }