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

Add TravisCI support #78

Closed
jaredsburrows opened this issue Jun 9, 2016 · 20 comments
Closed

Add TravisCI support #78

jaredsburrows opened this issue Jun 9, 2016 · 20 comments

Comments

@jaredsburrows
Copy link
Contributor

Add TravisCI support

Right after cloning the project, simply running gradlew tasks fails:

FAILURE: Build failed with an exception.

* What went wrong:
A problem occurred configuring project ':testProject'.
> Could not resolve all dependencies for configuration ':testProject:classpath'.
   > Could not find com.google.protobuf:protobuf-gradle-plugin:0.7.8-SNAPSHOT.
     Searched in the following locations:
         https://jcenter.bintray.com/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/maven-metadata.xml
         https://jcenter.bintray.com/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/protobuf-gradle-plugin-0.7.8-SNAPSHOT.pom
         https://jcenter.bintray.com/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/protobuf-gradle-plugin-0.7.8-SNAPSHOT.jar
         file:/Users/noname/.m2/repository/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/maven-metadata.xml
         file:/Users/noname/.m2/repository/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/protobuf-gradle-plugin-0.7.8-SNAPSHOT.pom
         file:/Users/noname/.m2/repository/com/google/protobuf/protobuf-gradle-plugin/0.7.8-SNAPSHOT/protobuf-gradle-plugin-0.7.8-SNAPSHOT.jar
     Required by:
         protobuf-gradle-plugin:testProject:unspecified

* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 9.575 secs

Adding CI will fix these issues.

@zhangkun83
Copy link
Collaborator

This issue is not actually CI-specific. ./gradlew tasks fails because the test projects require ./gradlew install first (see "Testing the plugin" in README.md). Hopefully #76 will fix this issue.

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 Yeah. There has just gotta be a better way. Normal maven/gradle projects do not require you to install the snapshot locally.

Normally the examples would use the "release". I am guessing you have the examples use the "latest snapshot" for CI integration testing.

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 Either way, I can help you add TravisCI support, we can run gradlew install and then assemble test. Let me know.

@zhangkun83
Copy link
Collaborator

That would be great. TravisCI is indeed useful, though installing Android SDK on Travis may be tricky.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 9, 2016

Android is actually not too bad on TravisCI. The only reason we don't do it with grpc is because it is incompatible with also testing on osx (and the emulator is slow, but that wouldn't impact this project).

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 The SDK is easy to install on Travis. Please see: https://github.com/jaredsburrows/android-gradle-java-app-template

@ejona86 I see needs osx: https://github.com/grpc/grpc/blob/master/.travis.yml. But for this plugin, which is written in groovy we can add just the normal android CI for now?

@ejona86
Copy link
Collaborator

ejona86 commented Jun 9, 2016

@jaredsburrows, I agree there's no need for OS X on this project. @zhangkun83 is familiar with grpc-java and I was mentioning why it is hard specifically for that project, but shouldn't be difficult for this one.

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 @ejona86 Sounds good. I'll make a PR as soon as TravisCI is turned on for this project.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 9, 2016

@zhangkun83, I can't enable Travis for this project. I think can do it at https://travis-ci.org/profile/google

@zhangkun83
Copy link
Collaborator

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 Thank you. All test projects run except the testProjectAndroid does not. Are you all able to run gradlew assemble?

@zhangkun83
Copy link
Collaborator

No, I never tried to do it. First I needed to run under JDK 7 to avoid the "bad class file magic (cafebabe) or version (0034.0000)" error. After that I got the "Duplicate files copied in APK io/grpc/testing/integration/messages.proto".

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 Yeah. Adding:

sourceCompatibility = JavaVersion.VERSION_1_7
targetCompatibility = JavaVersion.VERSION_1_7

to testProject and adding:

    compileOptions {
        sourceCompatibility = JavaVersion.VERSION_1_7
        targetCompatibility = JavaVersion.VERSION_1_7
    }

to testProjectAndroid solves that issue.

I am still looking into it.

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 Now I am seeing:

:testProjectAndroid:transformResourcesWithMergeJavaResForArmFreeappDebug FAILED

FAILURE: Build failed with an exception.

* What went wrong:
Execution failed for task ':testProjectAndroid:transformResourcesWithMergeJavaResForArmFreeappDebug'.
> com.android.build.api.transform.TransformException: com.android.builder.packaging.DuplicateFileException: Duplicate files copied in APK io/grpc/testing/integration/empty.proto
    File1: /Users/noname/repo/protobuf-gradle-plugin/testProject/build/libs/testProject.jar
    File2: /Users/noname/repo/protobuf-gradle-plugin/testProject/build/libs/testProject.jar


* Try:
Run with --stacktrace option to get the stack trace. Run with --info or --debug option to get more log output.

BUILD FAILED

Total time: 19.725 secs

@ejona86
Copy link
Collaborator

ejona86 commented Jun 9, 2016

You can use packagingOptions to workaround that (like I used here). It is probably worth figuring out where the dups are coming from though (maybe make an issue to track it).

@jaredsburrows
Copy link
Contributor Author

@ejona86 packagingOptions to remove duplicate .proto files? I am looking into the dupes now.

@ejona86
Copy link
Collaborator

ejona86 commented Jun 9, 2016

@jaredsburrows, yeah, to exclude/pickfirst the dup'ed .proto files (they aren't used anyway). It looks like they are duped because testProject has a copy of the .proto to test normal proto vs nano proto.

@jaredsburrows
Copy link
Contributor Author

@ejona86 Thanks.
This works:

    packagingOptions {
        exclude 'io/grpc/testing/integration/empty.proto'
        exclude 'io/grpc/testing/integration/test.proto'
        exclude 'io/grpc/testing/integration/messages.proto'
        exclude 'tmp/stuff.proto'
    }

This did not:

    packagingOptions {
        pickFirst 'io/grpc/testing/integration/empty.proto'
        pickFirst 'io/grpc/testing/integration/test.proto'
        pickFirst 'io/grpc/testing/integration/messages.proto'
        pickFirst 'tmp/stuff.proto'
    }

@jaredsburrows
Copy link
Contributor Author

@zhangkun83 @ejona86 Thanks. I have solved the problem and the build passes.

@jaredsburrows
Copy link
Contributor Author

Closing this because code was merged: #79.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants