AirPlayAuth icon indicating copy to clipboard operation
AirPlayAuth copied to clipboard

Building gapic project with gradle fails

Open ToluwaniO opened this issue 4 years ago • 4 comments

Toluwanis-MacBook-Pro:generator tolu$ gradle build && docker build . -t kgen

> Configure project :
e: /Users/tolu/src/gapic-generator-kotlin/generator/build.gradle.kts:57:17: Type mismatch: inferred type is NamedDomainObjectProvider<Configuration> but Configuration! was expected
e: /Users/tolu/src/gapic-generator-kotlin/generator/build.gradle.kts:156:9: Val cannot be reassigned

FAILURE: Build failed with an exception.

* Where:
Build file '/Users/tolu/src/gapic-generator-kotlin/generator/build.gradle.kts' line: 57

* What went wrong:
Script compilation errors:

  Line 057:     extendsFrom(configurations.implementation)
                            ^ Type mismatch: inferred type is NamedDomainObjectProvider<Configuration> but Configuration! was expected

  Line 156:         sourceDirectories = files(listOf("src/main/kotlin"))
                    ^ Val cannot be reassigned

2 errors

* 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


ToluwaniO avatar Mar 08 '20 04:03 ToluwaniO

I think the docs are out of date. Try running ./docker-build.sh instead.

Thanks for pointing it out. I updated them in #46

jbolinger avatar Mar 10 '20 05:03 jbolinger

this is the error I get when i run the script

Toluwanis-MacBook-Pro:gapic-generator-kotlin tolu$ sudo ./docker-build.sh 
~/src/gapic-generator-kotlin/gax-kotlin ~/src/gapic-generator-kotlin
./docker-build.sh: line 21: ./gradlew: No such file or directory
~/src/gapic-generator-kotlin
~/src/gapic-generator-kotlin/generator ~/src/gapic-generator-kotlin
Downloading https://services.gradle.org/distributions/gradle-4.10.1-bin.zip
..........................................................................

Welcome to Gradle 4.10.1!

Here are the highlights of this release:
 - Incremental Java compilation by default
 - Periodic Gradle caches cleanup
 - Gradle Kotlin DSL 1.0-RC6
 - Nested included builds
 - SNAPSHOT plugin versions in the `plugins {}` block

For more details see https://docs.gradle.org/4.10.1/release-notes.html

Starting a Gradle Daemon (subsequent builds will be faster)

FAILURE: Build failed with an exception.

* What went wrong:
Could not determine the dependencies of task ':bootJar'.
> Could not resolve all task dependencies for configuration ':runtimeClasspath'.
   > Could not find com.google.api:kgax-grpc:0.7.0-SNAPSHOT.
     Searched in the following locations:
       - https://dl.google.com/dl/android/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://dl.google.com/dl/android/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.pom
       - https://dl.google.com/dl/android/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.jar
       - https://repo.maven.apache.org/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://repo.maven.apache.org/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.pom
       - https://repo.maven.apache.org/maven2/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.jar
       - https://jcenter.bintray.com/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/maven-metadata.xml
       - https://jcenter.bintray.com/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.pom
       - https://jcenter.bintray.com/com/google/api/kgax-grpc/0.7.0-SNAPSHOT/kgax-grpc-0.7.0-SNAPSHOT.jar
     Required by:
         project :

* 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

Deprecated Gradle features were used in this build, making it incompatible with Gradle 5.0.
Use '--warning-mode all' to show the individual deprecation warnings.
See https://docs.gradle.org/4.10.1/userguide/command_line_interface.html#sec:command_line_warnings

BUILD FAILED in 4m 15s
~/src/gapic-generator-kotlin
cp: /Users/tolu/.m2/repository/com/google/api/kgax*: No such file or directory
cp: /Users/tolu/.m2/repository/com/google/api/gapic-generator-kotlin: No such file or directory
./docker-build.sh: line 30: tree: command not found
Sending build context to Docker daemon  38.75MB
Step 1/35 : FROM openjdk:8-alpine as ktlint
 ---> a3562aa0b991
Step 2/35 : RUN apk add --no-cache curl gnupg
 ---> Using cache
 ---> f50963daab38
Step 3/35 : RUN curl -sSLO https://github.com/shyiko/ktlint/releases/download/0.29.0/ktlint &&     curl -sSLO https://github.com/shyiko/ktlint/releases/download/0.29.0/ktlint.asc &&     curl -sS https://keybase.io/shyiko/pgp_keys.asc | gpg --import && gpg --verify ktlint.asc &&     chmod a+x ktlint &&     rm ktlint.asc &&     mv ktlint /usr/local/bin/
 ---> Using cache
 ---> 1a521e2f251c
Step 4/35 : RUN mkdir /src
 ---> Using cache
 ---> 5d1c382872b1
Step 5/35 : VOLUME ["/src"]
 ---> Using cache
 ---> c37ed72858b0
Step 6/35 : CMD ["--color", "--android", "-F", "/src/**/*.kt"]
 ---> Using cache
 ---> d9f54c315da7
Step 7/35 : ENTRYPOINT ["/usr/local/bin/ktlint"]
 ---> Using cache
 ---> a77081a2b882
Step 8/35 : FROM openjdk:8-alpine as javaformatter
 ---> a3562aa0b991
Step 9/35 : RUN apk add --no-cache curl
 ---> Using cache
 ---> 28a7f6d3c287
Step 10/35 : RUN mkdir -p /usr/google-java-format &&     curl -sSL https://github.com/google/google-java-format/releases/download/google-java-format-1.7/google-java-format-1.7-all-deps.jar > /usr/google-java-format/formatter.jar
 ---> Using cache
 ---> c6f1f9f65044
Step 11/35 : RUN mkdir /src
 ---> Using cache
 ---> b69b0cf66597
Step 12/35 : VOLUME ["/src"]
 ---> Using cache
 ---> 32d9da7e805a
Step 13/35 : ENTRYPOINT exec java -jar /usr/google-java-format/formatter.jar --replace $(find /src -type f -name "*.java")
 ---> Using cache
 ---> 2c7bdc710bd3
Step 14/35 : FROM openjdk:8 as generator
 ---> cdf26cc71b50
Step 15/35 : COPY --from=ktlint /usr/local/bin/ktlint /usr/local/bin/ktlint
 ---> Using cache
 ---> 4dca3ccb9253
Step 16/35 : COPY --from=javaformatter /usr/google-java-format/formatter.jar /usr/google-java-format/formatter.jar
 ---> Using cache
 ---> 5fd9c83d3fdd
Step 17/35 : RUN apt-get update && apt-get install -y     tree     && rm -rf /var/lib/apt/lists/*
 ---> Using cache
 ---> 9b9993663bfc
Step 18/35 : RUN mkdir -p                 /usr/local/kgax/repository/com/google/api
 ---> Using cache
 ---> 23662b9f1505
Step 19/35 : COPY build/kgax-core         /usr/local/kgax/repository/com/google/api/kgax-core
COPY failed: stat /var/lib/docker/tmp/docker-builder304814604/build/kgax-core: no such file or directory

ToluwaniO avatar Mar 10 '20 13:03 ToluwaniO

Also, it would be nice to have more details on how to use the protoc plugin to generate kotlin files.

ToluwaniO avatar Mar 10 '20 13:03 ToluwaniO

I think you may not have cloned the entire repo (it has git submodules). Try doing this first: git submodule update --init --recursive. I'll add that to the instructions as well.

jbolinger avatar Mar 10 '20 16:03 jbolinger