Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Resolve cli version from resolved runtime dependencies #105

Merged
merged 1 commit into from
Oct 16, 2023

Conversation

hpmellema
Copy link
Contributor

Issue #, if available:
fixes smithy-lang/smithy#1297

Description of changes:

Updates the resolution of the smithy-cli dependency to use the resolved version of smithy-model dependencies from the runtime configuration. This prevents the cli version from being resolved to a a higher version than the project can support.

Testing

Created a project with the following dependencies (following the project in the linked issue):

 dependencies {
     implementation("software.amazon.smithy:smithy-model:[1.17.0, 2.0[")
     implementation("software.amazon.smithy.typescript:smithy-typescript-codegen:0.11.0")
 }

The resolved dependencies ended up with the smithy-cli version being 1.39.0 which is the latest CLI version and does not match the required smithy-model version that is resolved.

Resolved depenendencies after the changes in this PR:

smithyCli - Configuration for Smithy CLI and associated dependencies for the source set 'main' sourceSet.
+--- software.amazon.smithy:smithy-model:[1.17.0, 2.0[ -> 1.19.0
|    \--- software.amazon.smithy:smithy-utils:1.19.0
+--- software.amazon.smithy.typescript:smithy-typescript-codegen:0.11.0
|    +--- software.amazon.smithy:smithy-protocol-test-traits:[1.19.0,1.20.0[ -> 1.19.0
|    |    \--- software.amazon.smithy:smithy-model:1.19.0 (*)
|    +--- software.amazon.smithy:smithy-codegen-core:[1.19.0,1.20.0[ -> 1.19.0
|    |    +--- software.amazon.smithy:smithy-utils:1.19.0
|    |    +--- software.amazon.smithy:smithy-model:1.19.0 (*)
|    |    \--- software.amazon.smithy:smithy-build:1.19.0
|    |         +--- software.amazon.smithy:smithy-utils:1.19.0
|    |         \--- software.amazon.smithy:smithy-model:1.19.0 (*)
|    \--- software.amazon.smithy:smithy-waiters:[1.19.0,1.20.0[ -> 1.19.0
|         +--- software.amazon.smithy:smithy-model:1.19.0 (*)
|         \--- software.amazon.smithy:smithy-jmespath:1.19.0
\--- software.amazon.smithy:smithy-cli:1.19.0
     +--- software.amazon.smithy:smithy-model:1.19.0 (*)
     +--- software.amazon.smithy:smithy-build:1.19.0 (*)
     +--- software.amazon.smithy:smithy-linters:1.19.0
     |    +--- software.amazon.smithy:smithy-model:1.19.0 (*)
     |    \--- software.amazon.smithy:smithy-utils:1.19.0
     \--- software.amazon.smithy:smithy-diff:1.19.0
          +--- software.amazon.smithy:smithy-utils:1.19.0
          \--- software.amazon.smithy:smithy-model:1.19.0 (*)

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@hpmellema hpmellema requested a review from a team as a code owner October 16, 2023 17:57
boolean supported = GradleVersion.version(cliVersion).compareTo(MIN_SMITHY_FORMAT_VERSION) >= 0;

if (!supported) {
if (!supported && SourceSet.isMain(sourceSet)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Prevents message from being printed multiple times.

@hpmellema hpmellema merged commit 3217682 into smithy-lang:main Oct 16, 2023
4 checks passed
@hpmellema hpmellema deleted the correct-dependency-issue branch October 16, 2023 18:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Smithy gradle plugin dependency resolution can result in projects that won't build
2 participants