-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement direct dependency tags for maven external targets
- Loading branch information
1 parent
9d7c55b
commit 3c9ad3f
Showing
8 changed files
with
162 additions
and
28 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
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
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
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
58 changes: 58 additions & 0 deletions
58
...dle-plugin/src/test/kotlin/com/grab/grazel/migrate/dependencies/ClasspathReductionTest.kt
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,58 @@ | ||
package com.grab.grazel.migrate.dependencies | ||
|
||
import com.grab.grazel.bazel.starlark.BazelDependency | ||
import com.grab.grazel.bazel.starlark.BazelDependency.MavenDependency | ||
import com.grab.grazel.bazel.starlark.BazelDependency.ProjectDependency | ||
import com.grab.grazel.buildProject | ||
import com.grab.grazel.util.truth | ||
import org.junit.Test | ||
|
||
class ClasspathReductionTest { | ||
@Test | ||
fun `test with project dependencies`() { | ||
val rootProject = buildProject("root") | ||
val subproject = buildProject("sub", parent = rootProject) | ||
val deps: List<ProjectDependency> = listOf( | ||
ProjectDependency(dependencyProject = rootProject), | ||
ProjectDependency(dependencyProject = subproject), | ||
) | ||
calculateDirectDependencyTags("self", deps).truth { | ||
containsExactly( | ||
"@direct//root:root", | ||
"@direct//sub:sub", | ||
"@self//self" | ||
) | ||
} | ||
} | ||
|
||
@Test | ||
fun `test with maven dependencies`() { | ||
val deps: List<BazelDependency> = listOf( | ||
MavenDependency(group = "com.example", name = "lib1"), | ||
MavenDependency(group = "org.test", name = "lib2", repo = "custom_repo") | ||
) | ||
calculateDirectDependencyTags("self", deps).truth { | ||
containsExactly( | ||
"@maven//:com_example_lib1", | ||
"@maven//:org_test_lib2", | ||
"@self//self" | ||
) | ||
} | ||
} | ||
|
||
@Test | ||
fun `test with mixed dependencies`() { | ||
val rootProject = buildProject("root") | ||
val deps: List<BazelDependency> = listOf( | ||
ProjectDependency(dependencyProject = rootProject), | ||
MavenDependency(group = "com.example", name = "lib1") | ||
) | ||
calculateDirectDependencyTags("self", deps).truth { | ||
containsExactly( | ||
"@direct//root:root", | ||
"@maven//:com_example_lib1", | ||
"@self//self", | ||
) | ||
} | ||
} | ||
} |