Open Sch3lp opened 1 year ago
Hmm, thanks for the file, and it should work! I get
$ git clone https://github.com/dmcg/gilded-rose-tdd
Cloning into 'gilded-rose-tdd'...
$ cd gilded-rose-tdd/
$ db/start-db.sh
[+] Running 2/0
⠿ Container db-local-database-1 Running 0.0s
⠿ Container db-test-database-1 Running 0.0s
Attaching to db-local-database-1, db-test-database-1
^Z
[1]+ Stopped db/start-db.sh
$ ./gradlew flywayMigrate
Starting a Gradle Daemon (subsequent builds will be faster)
BUILD SUCCESSFUL in 6s
1 actionable task: 1 executed
$ ./gradlew generateJooq
BUILD SUCCESSFUL in 1s
1 actionable task: 1 executed
$ ./gradlew test
> Task :compileTestKotlin
w: file:///Users/duncan/To%20Delete/gilded-rose-tdd/src/test/java/com/gildedrose/foundation/ParallelMapTests.kt:38:16 'runFinalization(): Unit' is deprecated. Deprecated in Java
BUILD SUCCESSFUL in 10s
7 actionable tasks: 6 executed, 1 up-to-date
I'm getting this:
~/ws/personal/gilded-rose-tdd main wip ❯ ./gradlew flywayMigrate 23:11:48
BUILD SUCCESSFUL in 412ms
1 actionable task: 1 executed
~/ws/personal/gilded-rose-tdd main wip ❯ ./gradlew generateJooq 23:11:59
BUILD SUCCESSFUL in 317ms
1 actionable task: 1 up-to-date
~/ws/personal/gilded-rose-tdd main wip ❯ ./gradlew test 23:12:08
> Task :compileKotlin FAILED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:3:23 Unresolved reference: db
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:60:14 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:61:13 Not enough information to infer type variable R
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:61:24 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:63:22 Unresolved reference: MODIFIED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:64:22 Unresolved reference: NAME
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:65:22 Unresolved reference: QUALITY
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:66:22 Unresolved reference: SELLBYDATE
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:73:10 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:74:30 Type mismatch: inferred type is ID.Companion but SelectField<TypeVariable(T1)!>! was expected
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:74:34 Unresolved reference: MODIFIED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:74:44 Unresolved reference: NAME
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:74:50 Unresolved reference: QUALITY
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:74:59 Unresolved reference: SELLBYDATE
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:75:19 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:77:17 Unresolved reference: MODIFIED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:77:33 Not enough information to infer type variable T1
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:77:40 Not enough information to infer type variable T
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:77:44 Unresolved reference: MODIFIED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:77:60 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:80:9 'return' is not allowed here
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:83:57 Unresolved reference: MODIFIED
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:84:51 Unresolved reference: it
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:92:1 A 'return' expression required in a function with a block body ('{...}')
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:96:21 No get method providing array access
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:96:22 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:97:35 No get method providing array access
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:97:36 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:98:26 No get method providing array access
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:98:27 Unresolved reference: ITEMS
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:99:31 No get method providing array access
e: file:///Users/sch3lp/ws/personal/gilded-rose-tdd/src/main/java/com/gildedrose/persistence/DbItems.kt:99:32 Unresolved reference: ITEMS
FAILURE: Build failed with an exception.
* What went wrong:
Execution failed for task ':compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Compilation error. See log for more details
* Try:
> Run with --stacktrace option to get the stack trace.
> Run with --info or --debug option to get more log output.
> Run with --scan to get full insights.
* Get more help at https://help.gradle.org
BUILD FAILED in 1s
4 actionable tasks: 1 executed, 3 up-to-date
~/ws/personal/gilded-rose-tdd main wip ❯ java -version 23:13:57
openjdk version "19" 2022-09-20
OpenJDK Runtime Environment (build 19+36-2238)
OpenJDK 64-Bit Server VM (build 19+36-2238, mixed mode, sharing)
Hmm, thanks for the file, and it should work! I get
$ git clone https://github.com/dmcg/gilded-rose-tdd Cloning into 'gilded-rose-tdd'... $ cd gilded-rose-tdd/ $ db/start-db.sh [+] Running 2/0 ⠿ Container db-local-database-1 Running 0.0s ⠿ Container db-test-database-1 Running 0.0s Attaching to db-local-database-1, db-test-database-1 ^Z [1]+ Stopped db/start-db.sh $ ./gradlew flywayMigrate Starting a Gradle Daemon (subsequent builds will be faster) BUILD SUCCESSFUL in 6s 1 actionable task: 1 executed $ ./gradlew generateJooq BUILD SUCCESSFUL in 1s 1 actionable task: 1 executed $ ./gradlew test > Task :compileTestKotlin w: file:///Users/duncan/To%20Delete/gilded-rose-tdd/src/test/java/com/gildedrose/foundation/ParallelMapTests.kt:38:16 'runFinalization(): Unit' is deprecated. Deprecated in Java BUILD SUCCESSFUL in 10s 7 actionable tasks: 6 executed, 1 up-to-date
I'm also wondering how your flywayMigrate and jooqGenerate are working, when you've stopped running the database they both connect to. I have not set any environment variables before running those scripts by the way. Just using the defaults.
I hit the same issue as @Sch3lp, but I think I've found the root cause of the issue.
I found that removing the following line allowed the generateJooq
task to build the generated classes: https://github.com/dmcg/gilded-rose-tdd/blob/9de903160635b6db0e0e12abdba6950969dac3d9/build.gradle#L139
That line was added under a commit to improve the build time of the application by caching the generateJooq
task. I suspect that @dmcg can't reproduce the issue above because he already had the output cached.
Here's a suggestion for a
CONTRIBUTING.md
file:Contributing
Prerequisites
Before you run ./gradlew build
Since this project uses jOOQ's generated classes we'll first need to generate those. jOOQ requires a database connection to do so, and to make sure the whole team has the same database schema to generate the jOOQ classes from, we use Flyway to perform database migrations.
1) Start the dockerized PostgreSQL using docker-compose with the db/docker-compose.yml file. 1) Run
./gradlew flywayMigrate
(by default it uses your postgres running at 5433, aka the test database). 1) Run./gradlew generateJooq
This should generate classes in
build/generated-src/jooq/main
under a package ofcom.gildedrose.db
That last part is not working for me however.
I have a running database, and I can see the items table that was created because of the flyway migration.
But when I run generateJooq, I don't get any generated classes.
What am I still doing wrong?