-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: work around non-mergeable configs in Android builds (#59)
- Loading branch information
Showing
3 changed files
with
46 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -273,14 +273,34 @@ async function getAllDeps(root, targetFile, options): Promise<JsonDepsScriptResu | |
// intentionally empty | ||
} | ||
const orange = chalk.rgb(255, 128, 0); | ||
const blackOnYellow = chalk.bgYellowBright.black; | ||
gradleVersionOutput = orange(gradleVersionOutput); | ||
const subProcessError = orange(error.message); | ||
const mainErrorMessage = `Error running Gradle dependency analysis. | ||
let mainErrorMessage = `Error running Gradle dependency analysis. | ||
Please ensure you are calling the \`snyk\` command with correct arguments. | ||
If the problem persists, contact [email protected], providing the full error | ||
message from above, starting with ===== DEBUG INFORMATION START =====.`; | ||
const blackOnYellow = chalk.bgYellowBright.black; | ||
|
||
// Special case for Android, where merging the configurations is sometimes | ||
// impossible. | ||
// There are no automated tests for this yet (setting up Android SDK is quite problematic). | ||
// See test/manual/README.md | ||
|
||
if (/Cannot choose between the following configurations/.test(error.message) | ||
|| /Could not select value from candidates/.test(error.message)) { | ||
mainErrorMessage = `Error running Gradle dependency analysis. | ||
It seems like you are scanning an Android build with ambiguous dependency variants. | ||
We cannot automatically resolve dependencies for such builds. | ||
We recommend converting your subproject dependency specifications from the form of | ||
implementation project(":mymodule") | ||
to | ||
implementation project(path: ':mymodule', configuration: 'default') | ||
or running Snyk CLI tool for a specific configuration, e.g.: | ||
snyk test --all-sub-projects -- --configuration=releaseRuntimeClasspath`; | ||
} | ||
|
||
error.message = `${blackOnYellow('===== DEBUG INFORMATION START =====')} | ||
${orange(gradleVersionOutput)} | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
## Android build issues | ||
|
||
Since installing Android SDK is quite a hassle, there's no automated test for the Android Build Type problem | ||
(https://snyksec.atlassian.net/browse/BST-528). | ||
|
||
Instead, please install Androd Studio or SDK on your own | ||
and run `snyk test` on https://github.com/snyk-fixtures/android-cannot-auto-resolve to test |