Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Building gapic project with gradle fails #44

Open
ToluwaniO opened this issue Mar 8, 2020 · 4 comments
Open

Building gapic project with gradle fails #44

ToluwaniO opened this issue Mar 8, 2020 · 4 comments
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.

Comments

@ToluwaniO
Copy link

ToluwaniO commented Mar 8, 2020

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 ToluwaniO changed the title Building project with gradle fails Building gapic project with gradle fails Mar 8, 2020
@jbolinger
Copy link
Collaborator

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

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

@ToluwaniO
Copy link
Author

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
Copy link
Author

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

@jbolinger
Copy link
Collaborator

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.

@JustinBeckwith JustinBeckwith added the type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design. label Jan 28, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
type: feature request ‘Nice-to-have’ improvement, new feature or different behavior or design.
Projects
None yet
Development

No branches or pull requests

3 participants