Merge pull request #22 into master. Also closes #23.
diff --git a/.gitignore b/.gitignore
index c800a52..23c107f 100755
--- a/.gitignore
+++ b/.gitignore
@@ -21,6 +21,7 @@
war/WEB-INF
*.old
.DS_Store
+.helper
### IntelliJ Idea
.idea
diff --git a/MAINTAINERS.md b/MAINTAINERS.md
new file mode 100644
index 0000000..b7a9881
--- /dev/null
+++ b/MAINTAINERS.md
@@ -0,0 +1,33 @@
+# Apache Wave
+
+Welcome Apache Wave Maintainer.
+
+This document is your cheat sheet to the resources which are spread around the Apache Wave
+repositories and websites. Many of the Apache specific documentation will be on the Wiki linked
+below while non-apache related items will be on the website.
+
+### Helpful Links
+
+- [Confluence Wiki](https://cwiki.apache.org/confluence/display/WAVE/Maintainer+Documentation)
+- [Maintainer Website](https://incubator.apache.org/wave/maintainers)
+
+
+### Helper Tool
+
+In the Apache Wave repository is a helper tool which is designed to make our lives easier. The
+tool is ever growing to meet the demands of the project. The maintainers website is the stable
+location for documentation on the tool.
+
+**Required: You must have go 1.7+ installed.**
+
+With go installed you can run the tool with:
+
+- `go run helper/cli.go`
+- `go run helper/cli.go -h`
+- `go run helper/cli.go -help`
+
+It will produce files in the `.helper` directory which should not be used for permanent storage
+ as `-clean` will remove the entire folder.
+
+**Note: Once new website has been made and published formal docs will be located in the
+maintainers section.**
\ No newline at end of file
diff --git a/helper/cli.go b/helper/cli.go
new file mode 100644
index 0000000..fb836b7
--- /dev/null
+++ b/helper/cli.go
@@ -0,0 +1,84 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+/*
+A Simple helper program to help maintainers run the project.
+
+Current Feature List:
+ - Runs style checkers
+ - Runs style formatters ( todo )
+ - Runs build tools ( todo )
+ - Runs pre installers ( todo )
+ - Branch pull requests ( todo )
+ - Publishes website ( todo )
+
+Command line Flags:
+
+ -h | --help : shows the help.
+ -clean : removes all temporary files.
+
+@author: wisebaldone@apache.org ( Evan Hughes )
+ */
+package main
+
+import (
+ "os"
+ "fmt"
+ "./style"
+ "flag"
+ "log"
+)
+
+var openingText string = `
+ Apache Wave Maintainer Helper!
+ ------------------------------
+
+This tool is written for Apache Wave maintainers and may have undesired affects if used by other
+developers. This tool will need certain permissions which are not given to it automatically and will
+need to prompt the user for credentials.
+
+Use -h or --help to see the list of commands.
+----------------------------------------------------------------------------------------------------
+
+`
+/*
+ Main Helper entry.
+ */
+func main() {
+ // Welcome user.
+ fmt.Println(openingText)
+ // create temp folder
+ os.Mkdir(".helper", 0777)
+
+ clearFlag := flag.Bool("clear", false, "Clears all temporary files ( deletes .helper )")
+ styleFlag := flag.Bool("style", false, "Run the style checker on wave and pst projects.")
+ flag.Parse()
+
+ if (*clearFlag) {
+ clear()
+ }
+ if (*styleFlag) {
+ style.Run()
+ }
+}
+
+// Deletes the .helper folder
+func clear() {
+ log.Println("Removing all temporary files.")
+ os.RemoveAll(".helper")
+}
\ No newline at end of file
diff --git a/helper/style/style.go b/helper/style/style.go
new file mode 100644
index 0000000..c108702
--- /dev/null
+++ b/helper/style/style.go
@@ -0,0 +1,91 @@
+//
+// Licensed to the Apache Software Foundation (ASF) under one
+// or more contributor license agreements. See the NOTICE file
+// distributed with this work for additional information
+// regarding copyright ownership. The ASF licenses this file
+// to you under the Apache License, Version 2.0 (the
+// "License"); you may not use this file except in compliance
+// with the License. You may obtain a copy of the License at
+//
+// http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing,
+// software distributed under the License is distributed on an
+// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+// KIND, either express or implied. See the License for the
+// specific language governing permissions and limitations
+// under the License.
+
+/*
+Commands for running the style checkers.
+
+- Java uses stylechecker.
+
+@author: wisebaldone@apache.org ( Evan Hughes )
+ */
+package style
+
+import (
+ "os"
+ "log"
+ "net/http"
+ "io"
+ "os/exec"
+)
+
+const checkStyle = ".helper/checkstyle.jar"
+
+/*
+ Runs stylechecker based off the Google style guide.
+
+ runs on:
+ wave/src/main/java
+ pst/src/main/java
+ */
+func Run() {
+ _, err := os.Stat(checkStyle)
+ if os.IsNotExist(err) {
+ download()
+ }
+ run("wave/src/main/java/", ".helper/wave.style.xml")
+ run("pst/src/main/java/", ".helper/pst.style.xml")
+}
+
+// Downloads a set version of checkstyle, current version ( 7.6.1 )
+func download() {
+ out, err := os.Create(checkStyle)
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Println("Downloading checkstyle.")
+ resp, err := http.Get(
+ "https://nchc.dl.sourceforge.net/project/checkstyle/checkstyle/" +
+ "7.6.1/checkstyle-7.6.1-all.jar")
+ if err != nil {
+ log.Fatalln("Could not download checkstyle.")
+ }
+ defer resp.Body.Close()
+ _, err = io.Copy(out, resp.Body)
+ if err != nil {
+ log.Fatalln(err)
+ }
+}
+
+// Runs the style checker on the input and records the output in xml
+func run(directory string, outputFile string) {
+ log.Printf("Running checkstyle on %s outputting to %s\n", directory, outputFile)
+ cmd := exec.Command(
+ "java", "-jar",
+ checkStyle,
+ "-c", "/google_checks.xml",
+ directory,
+ "-o",
+ outputFile,
+ "-f",
+ "xml")
+ err := cmd.Run()
+ if err != nil {
+ log.Fatalln(err)
+ }
+ log.Printf("Finished checking %s\n", directory)
+}
\ No newline at end of file
diff --git a/pst/build.gradle b/pst/build.gradle
index 3c7bbe6..9b4dc85 100644
--- a/pst/build.gradle
+++ b/pst/build.gradle
@@ -23,6 +23,8 @@
id 'com.github.johnrengelman.shadow' version '1.2.3'
id 'com.google.protobuf' version '0.8.0'
}
+apply plugin: 'checkstyle'
+apply plugin: 'com.google.protobuf'
//=============================================================================
// Project Level Settings
@@ -93,6 +95,16 @@
}
//=============================================================================
+// CheckStyle Config
+//=============================================================================
+checkstyle {
+ toolVersion = "7.6.1"
+ configFile = file("/google_checks.xml")
+}
+
+checkstyleMain.source = "src/main/java" // only checks the manually written java
+
+//=============================================================================
// Protobuf Config
//=============================================================================
protobuf {
diff --git a/wave/build.gradle b/wave/build.gradle
index 232a286..32583b8 100644
--- a/wave/build.gradle
+++ b/wave/build.gradle
@@ -23,6 +23,8 @@
id 'application'
id "com.google.protobuf" version "0.8.0"
}
+apply plugin: 'com.google.protobuf'
+apply plugin: 'checkstyle'
//=============================================================================
// Project Level Settings
@@ -191,6 +193,15 @@
[group: "org.mockito", name: "mockito-core", version: "2.2.21"], // [11/2016, 1/2018]
)
}
+//=============================================================================
+// CheckStyle Config
+//=============================================================================
+checkstyle {
+ toolVersion = "7.6.1"
+ configFile = file("/google_checks.xml")
+}
+
+checkstyleMain.source = "src/main/java" // only checks the manually written java
//=============================================================================
// Protobuf Config