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

[BEAM-194] Add Java 8 examples archetype including mobile gaming example, with generator script #1344

Closed
wants to merge 3 commits into from

Conversation

kennknowles
Copy link
Member

@kennknowles kennknowles commented Nov 10, 2016

Be sure to do all of the following to help us incorporate your contribution
quickly and easily:

  • Make sure the PR title is formatted like:
    [BEAM-<Jira issue #>] Description of pull request
  • Make sure tests pass via mvn clean verify. (Even better, enable
    Travis-CI on your fork and ensure the whole test matrix passes).
  • Replace <Jira issue #> in the title with the actual Jira issue
    number, if there is one.
  • If this contribution is large, please file an Apache
    Individual Contributor License Agreement.

@kennknowles kennknowles force-pushed the moar-examples branch 3 times, most recently from afca6ce to 18a33eb Compare November 10, 2016 23:17
@kennknowles
Copy link
Member Author

R: @davorbonaci / @francesperry

@kennknowles
Copy link
Member Author

Caveat: it is a bit of a copy/paste/modify job. The deps from the other archetype satisfied the gaming example, which means they need to be pruned.

@kennknowles
Copy link
Member Author

Travis failures are all IWYU flake in starter archetype.

Copy link
Member

@davorbonaci davorbonaci left a comment

Choose a reason for hiding this comment

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

I'd like to take a peek whether we can do something that reduces the amount of code duplication.

With your (awesome) scripts, perhaps we can generate the archetype source at build time, as opposed to that code being checked in.

I'd be happy to help!

@@ -0,0 +1,94 @@
<?xml version="1.0" encoding="UTF-8"?>
Copy link
Member

Choose a reason for hiding this comment

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

directory rename: java8-examples -> examples-java8?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

<relativePath>../pom.xml</relativePath>
</parent>

<artifactId>beam-sdks-java-maven-archetypes-java8-examples</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

examples-java8

Copy link
Member Author

Choose a reason for hiding this comment

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

done

</parent>

<artifactId>beam-sdks-java-maven-archetypes-java8-examples</artifactId>
<name>Apache Beam :: SDKs :: Java :: Maven Archetypes :: Java 8 Examples</name>
Copy link
Member

Choose a reason for hiding this comment

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

Examples - Java 8

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

</plugins>
</pluginManagement>
</build>
<dependencies>
Copy link
Member

Choose a reason for hiding this comment

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

empty line above

Copy link
Member Author

Choose a reason for hiding this comment

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

done


<dependency>
<groupId>com.google.api-client</groupId>
<artifactId>google-api-client</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

can you double check where some of the dependencies are coming from? Starting with this one, most of the following are suspicious.

Copy link
Member Author

Choose a reason for hiding this comment

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

Confirmed that these are all dependencies of examples-java8 or examples-java, which are both included in this archetype.

@@ -0,0 +1,164 @@
/*
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 the third copy of the wordcount pipelines; we should try to do something better.

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, it makes sense to not check these in. I don't know off the top of my head the best way to do that. Filed BEAM-1005.

@@ -0,0 +1,62 @@
<!--
Copy link
Member

Choose a reason for hiding this comment

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

I'd cut.

Copy link
Member Author

Choose a reason for hiding this comment

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

Is it worth excluding the README?

@@ -0,0 +1,131 @@
<!--
Copy link
Member

Choose a reason for hiding this comment

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

I'd cut.

Copy link
Member Author

Choose a reason for hiding this comment

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

Same

@kennknowles kennknowles force-pushed the moar-examples branch 2 times, most recently from 852d2a8 to 1619179 Compare November 18, 2016 00:07
@kennknowles
Copy link
Member Author

I have now also configured things so the content is generated, and removed sources from both archetypes. Unfortunately the way the configuration is inherited means that the exec plugin tries to execute again and fails, in some slightly curious way. One option is to move the execution to the parent, but that seems wrong. The other option is to wait until I have a few more minutes to dig into the behavior and see how to squash it.

Copy link
Member

@davorbonaci davorbonaci left a comment

Choose a reason for hiding this comment

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

I think this is a great improvement!

@@ -6,6 +6,10 @@
target/
bin/

# Ignore generated archetypes
Copy link
Member

Choose a reason for hiding this comment

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

I believe convention is that this goes to ${project.build.directory}/generated-sources/, so it should not be necessary due to target/ exclusion.

Copy link
Member Author

Choose a reason for hiding this comment

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

I've spent a couple minutes looking for documentation on this, and I don't think archetype:create-from-project has a way to support putting things in generated-sources to be instantiated to the user's src directory.


<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-dependency-plugin</artifactId>
Copy link
Member

Choose a reason for hiding this comment

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

This doesn't belong here, right? Global plugin management?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@@ -34,6 +34,7 @@
<modules>
<module>starter</module>
<module>examples</module>
<module>examples-java8</module>
Copy link
Member

Choose a reason for hiding this comment

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

Only on supported platforms?

Copy link
Member Author

Choose a reason for hiding this comment

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

Done

@kennknowles kennknowles force-pushed the moar-examples branch 3 times, most recently from 2e591f7 to e0fcb31 Compare November 18, 2016 17:59
@kennknowles
Copy link
Member Author

Both archetypes are now autogenerated and I've had local success with verification. I have included a fix of some very old and presumably obsolete configuration that was breaking things. Jenkins had a transient failure but I have kicked it.

@kennknowles
Copy link
Member Author

It is worth noting that actually building the archetypes like this involves unix scripting so it not MS Windows friendly. We either need to check in the generated code or disable these processes on MS Windows.

This archetype module is automatically generated during
the build process, and its dependencies and tests verified.
@kennknowles
Copy link
Member Author

I have updated the archetype parent to only run the unix-only builds on unix platforms. For now, at least this will make enthusiasts able to build the project on any platform, and users are not affected anyhow. If a Windows OS contributor would care to try to make this portable to Windows, that is welcome.

@asfbot
Copy link

asfbot commented Dec 3, 2016

Refer to this link for build results (access rights to CI server needed):
https://builds.apache.org/job/beam_PreCommit_Java_MavenInstall/5484/
--none--

@davorbonaci
Copy link
Member

This looks pretty awesome right now. High-level LGTM. Will take a closer look, but won't have anything more than low-level comments.

@davorbonaci
Copy link
Member

davorbonaci commented Dec 4, 2016

LGTM

Merging, since this is a clear improvement. However, java8 archetype also needs profiles to be able to run them, and possibly other fixups. Let's address them in a followup pull request.

@asfgit asfgit closed this in c22b97d Dec 4, 2016
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