-
-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fix build dependencies between 'core' and 'faker' modules
The f*ing thing was driving me crazy... Why did I ever make :core:integrationTest depend on :faker:XXX:shadowJar?.. Also made 'faker' modules depend on implementation of 'core' project rather than having compileOnly. The latter doesn't seems to work when using e.g. `kotlin-faker:2.0.0-rc.2` and `kotlin-faker-books:2.0.0-rc.1`
- Loading branch information
Showing
13 changed files
with
156 additions
and
57 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
22 changes: 11 additions & 11 deletions
22
buildSrc/src/main/kotlin/faker-provider-conventions.gradle.kts
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 |
---|---|---|
@@ -1,21 +1,21 @@ | ||
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | ||
|
||
plugins { | ||
} | ||
|
||
dependencies { | ||
val compileOnly by configurations | ||
val testImplementation by configurations | ||
// In order to use an additional fake data provider, | ||
// core faker needs to be on the classpath. | ||
// Don't add it as transitive dependency to each faker provider | ||
compileOnly(project(":core")) | ||
// we need implementation dependency for tests to be able to access 'core' functionality | ||
testImplementation(project(":core")) | ||
val implementation by configurations | ||
implementation(project(":core")) | ||
} | ||
|
||
// since we're adding :core as testImplementation dependency, | ||
// since we're adding :core as implementation dependency, | ||
// we also need to make sure ShadowJar tasks depend on core having been built | ||
val shadowJar by tasks.getting(ShadowJar::class) { | ||
dependsOn(":core:assemble") | ||
} | ||
|
||
// since we're adding :core as implementation dependency, and effectively testImplementation | ||
// we also need to make sure Test tasks depend on core having been built | ||
tasks.withType<Test> { | ||
dependsOn(":core:shadowJar") | ||
dependsOn(":core:assemble") | ||
} | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,10 +3,7 @@ | |
package io.github.serpro69.kfaker.docs | ||
|
||
import io.github.serpro69.kfaker.Faker | ||
import io.github.serpro69.kfaker.commerce.CommerceFaker | ||
import io.github.serpro69.kfaker.fakerConfig | ||
import io.github.serpro69.kfaker.movies.MoviesFaker | ||
import io.github.serpro69.kfaker.tv.TvShowsFaker | ||
import io.kotest.core.spec.DisplayName | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import org.junit.jupiter.api.Assertions.assertEquals | ||
|
@@ -43,33 +40,13 @@ class Homepage : DescribeSpec({ | |
faker.address.streetAddress() // => 474 Kilback Manor | ||
// END data_provider_two | ||
} | ||
it("should print a SWIFT BIC code") { | ||
// START data_provider_four | ||
CommerceFaker().bank.swiftBic() // => AACCGB21 | ||
// END data_provider_four | ||
} | ||
it("should print a safe email address") { | ||
// START data_provider_three | ||
faker.internet.safeEmail() // => [email protected] | ||
// END data_provider_three | ||
} | ||
it("should print a ship name from The Expanse") { | ||
// START data_provider_five | ||
TvShowsFaker().theExpanse.ships() // => Rocinante | ||
// END data_provider_five | ||
} | ||
it("should print a Star Wars character name") { | ||
// START data_provider_six_a | ||
MoviesFaker().starWars.characters() // => Darth Vader | ||
// END data_provider_six_a | ||
} | ||
it("should print a character name from Friends") { | ||
// START data_provider_six_b | ||
TvShowsFaker().friends.characters() // => Phoebe Buffay | ||
// END data_provider_six_b | ||
} | ||
// START data_provider_seven | ||
// a total of 171 different data providers | ||
// a total of 213 different data providers | ||
// END data_provider_seven | ||
} | ||
|
||
|
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
32 changes: 32 additions & 0 deletions
32
faker/books/src/integration/kotlin/io/github/serpro69/kfaker/books/docs/Homepage.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,32 @@ | ||
package io.github.serpro69.kfaker.books.docs | ||
|
||
import io.github.serpro69.kfaker.books.BooksFaker | ||
import io.kotest.core.spec.DisplayName | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import java.util.* | ||
|
||
/** | ||
* Documentation code snippets for the docs website homepage. | ||
* | ||
* This approach has the benefit over using something like code-blocks in .md files directly in a way | ||
* that this becomes a "live-documentation", | ||
* and additionally it's also being tested since this is, after all, a test class. | ||
* | ||
* Usage: | ||
* ❶ Wrap each code snippet in comments like `// START snippet_name` and `// END snippet_name` | ||
* ❷ Code snippets can be referenced from the docs using the {% snippet snippet_name %} tag. | ||
* ❸ (See https://orchid.run/plugins/orchidsnippets for snippets docs) | ||
*/ | ||
@DisplayName("Snippets used in Orchid docs 'homepage'") | ||
class Homepage : DescribeSpec({ | ||
describe("BooksFaker") { | ||
context("Fake Data Providers in Books domain") { | ||
it("should print a book genre") { | ||
// START books_faker_one | ||
val faker = BooksFaker() | ||
faker.book.genre() // => Fantasy | ||
// END books_faker_one | ||
} | ||
} | ||
} | ||
}) |
32 changes: 32 additions & 0 deletions
32
faker/commerce/src/integration/kotlin/io/github/serpro69/kfaker/commerce/docs/Homepage.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,32 @@ | ||
package io.github.serpro69.kfaker.commerce.docs | ||
|
||
import io.github.serpro69.kfaker.commerce.CommerceFaker | ||
import io.kotest.core.spec.DisplayName | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import java.util.* | ||
|
||
/** | ||
* Documentation code snippets for the docs website homepage. | ||
* | ||
* This approach has the benefit over using something like code-blocks in .md files directly in a way | ||
* that this becomes a "live-documentation", | ||
* and additionally it's also being tested since this is, after all, a test class. | ||
* | ||
* Usage: | ||
* ❶ Wrap each code snippet in comments like `// START snippet_name` and `// END snippet_name` | ||
* ❷ Code snippets can be referenced from the docs using the {% snippet snippet_name %} tag. | ||
* ❸ (See https://orchid.run/plugins/orchidsnippets for snippets docs) | ||
*/ | ||
@DisplayName("Snippets used in Orchid docs 'homepage'") | ||
class Homepage : DescribeSpec({ | ||
describe("CommerceFaker") { | ||
context("Fake Data Providers in Commerce domain") { | ||
it("should print a SWIFT BIC code") { | ||
// START commerce_faker_one | ||
val faker = CommerceFaker() | ||
faker.bank.swiftBic() // => AACCGB21 | ||
// END commerce_faker_one | ||
} | ||
} | ||
} | ||
}) |
32 changes: 32 additions & 0 deletions
32
faker/movies/src/integration/kotlin/io/github/serpro69/kfaker/movies/docs/Homepage.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,32 @@ | ||
package io.github.serpro69.kfaker.movies.docs | ||
|
||
import io.github.serpro69.kfaker.movies.MoviesFaker | ||
import io.kotest.core.spec.DisplayName | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import java.util.* | ||
|
||
/** | ||
* Documentation code snippets for the docs website homepage. | ||
* | ||
* This approach has the benefit over using something like code-blocks in .md files directly in a way | ||
* that this becomes a "live-documentation", | ||
* and additionally it's also being tested since this is, after all, a test class. | ||
* | ||
* Usage: | ||
* ❶ Wrap each code snippet in comments like `// START snippet_name` and `// END snippet_name` | ||
* ❷ Code snippets can be referenced from the docs using the {% snippet snippet_name %} tag. | ||
* ❸ (See https://orchid.run/plugins/orchidsnippets for snippets docs) | ||
*/ | ||
@DisplayName("Snippets used in Orchid docs 'homepage'") | ||
class Homepage : DescribeSpec({ | ||
describe("MoviesFaker") { | ||
context("Fake Data Providers in Movies domain") { | ||
it("should print a Star Wars character name") { | ||
// START movies_faker_one | ||
val faker = MoviesFaker() | ||
faker.starWars.characters() // => Darth Vader | ||
// END movies_faker_one | ||
} | ||
} | ||
} | ||
}) |
32 changes: 32 additions & 0 deletions
32
faker/tvshows/src/integration/kotlin/io/github/serpro69/kfaker/tv/docs/Homepage.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,32 @@ | ||
package io.github.serpro69.kfaker.tv.docs | ||
|
||
import io.github.serpro69.kfaker.tv.TvShowsFaker | ||
import io.kotest.core.spec.DisplayName | ||
import io.kotest.core.spec.style.DescribeSpec | ||
import java.util.* | ||
|
||
/** | ||
* Documentation code snippets for the docs website homepage. | ||
* | ||
* This approach has the benefit over using something like code-blocks in .md files directly in a way | ||
* that this becomes a "live-documentation", | ||
* and additionally it's also being tested since this is, after all, a test class. | ||
* | ||
* Usage: | ||
* ❶ Wrap each code snippet in comments like `// START snippet_name` and `// END snippet_name` | ||
* ❷ Code snippets can be referenced from the docs using the {% snippet snippet_name %} tag. | ||
* ❸ (See https://orchid.run/plugins/orchidsnippets for snippets docs) | ||
*/ | ||
@DisplayName("Snippets used in Orchid docs 'homepage'") | ||
class Homepage : DescribeSpec({ | ||
describe("TvShowsFaker") { | ||
context("Fake Data Providers in TvShows domain") { | ||
it("should print a character name from Friends") { | ||
// START tvshows_faker_one | ||
val faker = TvShowsFaker() | ||
faker.friends.characters() // => Phoebe Buffay | ||
// END tvshows_faker_one | ||
} | ||
} | ||
} | ||
}) |