Skip to content

Commit d92949e

Browse files
committed
Only enable JAVA dependency minimisation when caching is enabled
1 parent aa90e97 commit d92949e

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/init-action.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -608,13 +608,17 @@ async function run() {
608608

609609
// If the feature flag to minimize Java dependency jars is enabled, and we are doing a Java
610610
// `build-mode: none` analysis (i.e. the flag is relevant), then set the environment variable
611-
// that enables the corresponding option in the Java extractor.
611+
// that enables the corresponding option in the Java extractor. We also only do this if
612+
// dependency caching is enabled, since the option is intended to reduce the size of
613+
// dependency caches, but the jar-rewriting does have a performance cost that we'd like to avoid
614+
// when caching is not being used.
612615
if (process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]) {
613616
logger.debug(
614617
`${EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS} is already set to '${process.env[EnvVar.JAVA_EXTRACTOR_MINIMIZE_DEPENDENCY_JARS]}', so the Action will not override it.`,
615618
);
616619
} else if (
617620
minimizeJavaJars &&
621+
config.dependencyCachingEnabled &&
618622
config.buildMode === BuildMode.None &&
619623
config.languages.includes(KnownLanguage.java)
620624
) {

0 commit comments

Comments
 (0)