-
-
Notifications
You must be signed in to change notification settings - Fork 124
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Now supports test dependencies. * Now supports multiple hops between dependencies in a bundle.
- Loading branch information
1 parent
9e2ebf2
commit 63b895a
Showing
17 changed files
with
455 additions
and
167 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
85 changes: 85 additions & 0 deletions
85
src/functionalTest/groovy/com/autonomousapps/jvm/projects/TestBundleProject.groovy
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,85 @@ | ||
package com.autonomousapps.jvm.projects | ||
|
||
import com.autonomousapps.AbstractProject | ||
import com.autonomousapps.advice.Advice | ||
import com.autonomousapps.kit.GradleProject | ||
import com.autonomousapps.kit.Plugin | ||
import com.autonomousapps.kit.Source | ||
import com.autonomousapps.kit.SourceType | ||
|
||
import static com.autonomousapps.kit.Dependency.junit | ||
import static com.autonomousapps.kit.Dependency.kotestAssertions | ||
import static java.util.Collections.emptyList | ||
|
||
final class TestBundleProject extends AbstractProject { | ||
|
||
private static final junit = junit('testImplementation') | ||
private static final kotest = kotestAssertions('testImplementation') | ||
|
||
final GradleProject gradleProject | ||
|
||
TestBundleProject() { | ||
this.gradleProject = build() | ||
} | ||
|
||
private GradleProject build() { | ||
def builder = newGradleProjectBuilder() | ||
builder.withSubproject('proj') { s -> | ||
s.sources = sources | ||
s.withBuildScript { bs -> | ||
bs.plugins = [Plugin.kotlinPluginNoVersion] | ||
bs.dependencies = [kotest, junit] | ||
} | ||
} | ||
builder.withRootProject { | ||
it.withBuildScript { bs -> | ||
bs.additions = """ | ||
dependencyAnalysis { | ||
dependencies { | ||
bundle('kotest-assertions') { | ||
includeDependency('io.kotest:kotest-assertions-core-jvm') | ||
includeDependency('io.kotest:kotest-assertions-shared-jvm') | ||
} | ||
} | ||
} | ||
""".stripIndent() | ||
} | ||
} | ||
|
||
def project = builder.build() | ||
project.writer().write() | ||
return project | ||
} | ||
|
||
private List<Source> sources = [ | ||
new Source( | ||
SourceType.KOTLIN, "Main", "com/example", | ||
"""\ | ||
package com.example | ||
class Main { | ||
fun magic() = 42 | ||
} | ||
""".stripIndent() | ||
), | ||
new Source( | ||
SourceType.KOTLIN, "MainTest", "com/example", | ||
"""\ | ||
package com.example | ||
import io.kotest.matchers.shouldBe | ||
import org.junit.Test | ||
class MainTest { | ||
@Test | ||
public fun test() { | ||
"a" shouldBe "b" | ||
} | ||
} | ||
""".stripIndent(), | ||
'test' | ||
) | ||
] | ||
|
||
final List<Advice> expectedAdvice = emptyList() | ||
} |
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
Oops, something went wrong.