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

Gradle plugin for scala and java #154

Merged
merged 7 commits into from
Apr 11, 2018
Merged

Gradle plugin for scala and java #154

merged 7 commits into from
Apr 11, 2018

Conversation

2m
Copy link
Member

@2m 2m commented Apr 6, 2018

Generates both server and client side.

Fixes #6 and #42

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks quite clean! We should make whether you want to generate client, server or both configurable - but that can be in a next PR.

if (req.getParameter.toLowerCase.contains("language=scala")) ScalaServerCodeGenerator.run(req)
else JavaServerCodeGenerator.run(req)
if (req.getParameter.toLowerCase.contains("language=scala")) ScalaBothCodeGenerator.run(req)
else JavaBothCodeGenerator.run(req)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess we want to make this configurable - ticketify?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

}

group = "com.lightbend.akka.grpc"
version versionDetails().gitHashFull.substring(0, 8)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 for now at least 👍

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. We might wanna tag v0.0.1 soon just to be able to find all the places that need to be changed.

}

dependencies {
classpath 'com.lightbend.akka.grpc:gradle-plugin:0.0.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we call it akka-grpc-gradle-plugin?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. I think that way it will align with other plugins better.

.travis.yml Outdated
@@ -6,11 +6,13 @@ scala:
jobs:
include:
- stage: publishLocal
script: sbt ++$TRAVIS_SCALA_VERSION publishLocal
script: sbt ++$TRAVIS_SCALA_VERSION publishLocal publishM2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hard to say how this pans out... also it doesn't seem like it's being picked up - which is strange, does that mean publishLocal didn't actually have any effect either?

Copy link
Member Author

@2m 2m Apr 6, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ahh, from https://docs.travis-ci.com/user/build-stages/#Data-persistence-between-stages-and-jobs:

If your jobs need to share files (e.g., using build artifacts from the “Test” stage for deployment in the subsequent “Deploy” stage), you need to use an external storage mechanism such as S3 and a remote scp server.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right - so we could perhaps use the pattern from https://docs.travis-ci.com/user/build-stages/warm-cache/ to warm up the ivy cache (when we configure it as a cache) but not rely on it for the pipeline. Makes sense. For now remove the publishLocal stage then?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea. Will remove the stage.

@@ -55,6 +58,9 @@ lazy val scalapbProtocPlugin = Project(
art.withClassifier(Some("assembly"))
},
mainClass in assembly := Some("akka.grpc.scalapb.Main"),
assemblyOption in assembly := (assemblyOption in assembly).value.copy(
prependShellScript = Some(sbtassembly.AssemblyPlugin.defaultShellScript)
),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Weird that this didn't seem necessary before... but 👍


dependencies {
// to bring in protobuf dependency trasitively
implementation 'com.google.protobuf:protobuf-gradle-plugin:0.8.5'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

positively trasitive

@2m 2m mentioned this pull request Apr 6, 2018
@raboof
Copy link
Member

raboof commented Apr 9, 2018

Jenkins: looks like there's a link from paradox to GreeterServiceImpl.scala that needs to be updated

Copy link
Member

@raboof raboof left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍 almost there 😄

.travis.yml Outdated
- script: cd plugin-tester-java && ./gradlew --include-build ../gradle-plugin clean compileJava
- script: cd plugin-tester-scala && ./gradlew --include-build ../gradle-plugin clean compileScala
- script: sbt publishLocal && cd plugin-tester-java && sbt compile
- script: sbt publishLocal && cd plugin-tester-scala && sbt compile
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the sbt tests might even work without publishLocal, since we use a ProjectRef here

- find $HOME/.ivy2 -name "ivydata-*.properties" -print -delete
- find $HOME/.sbt -name "*.lock" -print -delete

cache:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

curious how much of a change this will make!

project.gradle.addListener(this)
final boolean isScala = project.plugins.hasPlugin("scala")

project.configure(project) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks pretty cool

}

dependencies {
classpath 'com.lightbend.akka.grpc:akka-grpc-gradle-plugin:0.0.1'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment here explaining that this will be replaced with the 'link' to the currently-checked-out-version?

@@ -1,5 +1,5 @@
//#full-service-impl
package io.grpc.examples
package io.grpc.examples.helloworld
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still want to move these files when we configure flat_package by default?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, if we want to have the same semantics as java files.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think that makes sense as a default

@@ -1,7 +1,7 @@
syntax = "proto3";

option java_multiple_files = true;
option java_package = "io.grpc.examples";
option java_package = "io.grpc.examples.helloworld";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is more consistent with upstream though, so OK... we should get our helloworld.protos consistent again though :)

@raboof raboof merged commit 72cde95 into master Apr 11, 2018
@2m 2m deleted the wip-gradle-plugin-2m branch April 11, 2018 13:31
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

Successfully merging this pull request may close these issues.

None yet

3 participants