Skip to content

Commit 9e5383b

Browse files
authored
Merge pull request #3113 from github/nickrolfe/minimize-jars-followup
Only enable Java dependency minimisation when caching is enabled
2 parents 8279538 + 4014b75 commit 9e5383b

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

lib/init-action.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

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)