[KT] Support both the current and updated srcjar structure
@@ -179,6 +179,12 @@ final class BazelJ2clBuilder extends BazelWorker {
"Transpilation of Java and Kotlin files together is not supported yet.");
}
+ // TODO(b/144721781): Remove this guard when we now that common srcs will always end up in the
+ // srcjar under a common-srcs/ root folder.
+ boolean isUsingNewKotlinSrcJarZipper =
+ allKotlinSources.stream()
+ .anyMatch(fileInfo -> fileInfo.originalPath().startsWith("common-srcs/"));
+ if (!isUsingNewKotlinSrcJarZipper) {
// Common kotlin file paths should be a strict subset of the sources.
Set<String> unmatchedKotlinCommonSources =
Sets.difference(
@@ -189,6 +195,7 @@ final class BazelJ2clBuilder extends BazelWorker {
FatalError.INVALID_KOTLIN_COMMON_SOURCES,
Joiner.on(", ").join(unmatchedKotlinCommonSources));
}
+ }
ImmutableList<FileInfo> allNativeSources =
allSources.stream()
