-
-
Notifications
You must be signed in to change notification settings - Fork 144
A new task to build type usage report (ComputeTypeUsageTask). #1639
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
|
Owner
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Solid specs! I'm curious why we can't make more straightforward equality checks.
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Fixed it |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,64 @@ | ||
| // Copyright (c) 2026. Tony Robalik. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| package com.autonomousapps.jvm | ||
|
|
||
| import com.autonomousapps.jvm.projects.TypeUsageProject | ||
| import com.autonomousapps.jvm.projects.TypeUsageWithFiltersProject | ||
| import com.autonomousapps.jvm.projects.TypeUsageMultiModuleProject | ||
|
|
||
| import static com.autonomousapps.utils.Runner.build | ||
| import static com.google.common.truth.Truth.assertThat | ||
|
|
||
| final class TypeUsageSpec extends AbstractJvmSpec { | ||
|
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Following project convention to test |
||
|
|
||
| def "generates type usage report (#gradleVersion)"() { | ||
| given: | ||
| def project = new TypeUsageProject() | ||
| gradleProject = project.gradleProject | ||
|
|
||
| when: | ||
| build(gradleVersion, gradleProject.rootDir, 'computeTypeUsageMain') | ||
|
|
||
| then: | ||
| assertThat(project.actualTypeUsage()).isEqualTo(project.expectedTypeUsage()) | ||
|
|
||
| where: | ||
| gradleVersion << gradleVersions() | ||
| } | ||
|
|
||
| def "excludes filtered types (#gradleVersion)"() { | ||
| given: | ||
| def project = new TypeUsageWithFiltersProject() | ||
| gradleProject = project.gradleProject | ||
|
|
||
| when: | ||
| build(gradleVersion, gradleProject.rootDir, 'computeTypeUsageMain') | ||
|
|
||
| then: | ||
| assertThat(project.actualTypeUsage()).isEqualTo(project.expectedTypeUsage()) | ||
|
|
||
| where: | ||
| gradleVersion << gradleVersions() | ||
| } | ||
|
|
||
| def "tracks type usage across multiple modules (#gradleVersion)"() { | ||
| given: | ||
| def project = new TypeUsageMultiModuleProject() | ||
| gradleProject = project.gradleProject | ||
|
|
||
| when: | ||
| build(gradleVersion, gradleProject.rootDir, 'computeTypeUsageMain') | ||
|
|
||
| then: 'app module' | ||
| assertThat(project.actualTypeUsageFor(':app')).isEqualTo(project.expectedAppTypeUsage()) | ||
|
|
||
| and: 'core module' | ||
| assertThat(project.actualTypeUsageFor(':core')).isEqualTo(project.expectedCoreTypeUsage()) | ||
|
|
||
| and: 'utils module' | ||
| assertThat(project.actualTypeUsageFor(':utils')).isEqualTo(project.expectedUtilsTypeUsage()) | ||
|
|
||
| where: | ||
| gradleVersion << gradleVersions() | ||
| } | ||
| } | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is not related to this PR