-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Create style.yml * Google Java Format * changed commit message * removed pr from style action * use AOSP * Fixed styles from CI * Apply google-java-formatter-1.10.0 * Add 'format.sh' script to call google-java-formatter In order to work one must crete a file `./.env` that defines `GOOGLE_JAVA_FORMATTER_JAR` as environment variable pointing to the location of the google-java-formatter jar file. Example `./.env` ``` GOOGLE_JAVA_FORMATTER_JAR="/usr/local/Cellar/google-java-format/1.10.0/libexec/google-java-format.jar" ``` * fixed ci * formatting * added distribution * fix * added code style violation * removed return value * Apply production build from CI Co-authored-by: github-actions[bot] <action@github.com> Co-authored-by: github-actions <> Co-authored-by: Oliver Herrmann <herrmann@id-on.de> Co-authored-by: github-actions[bot] <action@github.com>
- Loading branch information
1 parent
ab2e87b
commit d2de907
Showing
28 changed files
with
154 additions
and
123 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
# Example workflow | ||
name: Format | ||
|
||
on: | ||
push: | ||
|
||
jobs: | ||
formatting: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v2 # v2 minimum required | ||
|
||
- name: Setup Java | ||
uses: actions/setup-java@v2 | ||
with: | ||
distribution: 'adopt' | ||
java-version: '16' | ||
|
||
- name: Setup google-java-format | ||
run: | | ||
wget https://github.com/google/google-java-format/releases/download/v1.10.0/google-java-format-1.10.0-all-deps.jar | ||
echo -e "GOOGLE_JAVA_FORMATTER_JAR=google-java-format-1.10.0-all-deps.jar" >> .env | ||
- name: Format code | ||
run: /bin/sh bin/format.sh | ||
|
||
- name: Commit formatted code | ||
uses: EndBug/add-and-commit@v4 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
add: 'src/' | ||
|
||
author_name: ${{ github.event.pusher.name }} | ||
author_email: ${{ github.event.pusher.email }} | ||
|
||
message: 'Apply production build from CI | ||
Co-authored-by: github-actions[bot] <action@github.com>' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,3 @@ | ||
target | ||
.env | ||
google-java-format-1.10.0-all-deps.jar |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
#!/bin/sh | ||
# set -e | ||
|
||
# read 'GOOGLE_JAVA_FORMATTER_JAR' from env | ||
. ./.env | ||
|
||
java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED \ | ||
--add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED \ | ||
-jar $GOOGLE_JAVA_FORMATTER_JAR --set-exit-if-changed -a -r $(find . -type f -name "*.java") | ||
|
||
retVal=$? | ||
if [ $retVal -ne 0 ]; then | ||
echo "[ERROR]: Some files needed formatting" | ||
fi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,21 +1,21 @@ | ||
package com.github.cbl.algorithm_analyzer; | ||
|
||
import com.github.cbl.algorithm_analyzer.contracts.Algorithm; | ||
import com.github.cbl.algorithm_analyzer.contracts.Event; | ||
import com.github.cbl.algorithm_analyzer.contracts.EventConsumer; | ||
import com.github.cbl.algorithm_analyzer.contracts.Algorithm; | ||
import com.github.cbl.algorithm_analyzer.sorts.bubblesort.BubbleSort; | ||
import com.github.cbl.algorithm_analyzer.util.GeneralEventConsumer; | ||
import com.github.cbl.algorithm_analyzer.util.LogEventVisitor; | ||
|
||
public class Main { | ||
public static void main(String[] args) throws Exception { | ||
final Integer[] array = { 6, 5, 4, 3, 2, 1 }; | ||
final Integer[] array = {6, 5, 4, 3, 2, 1}; | ||
|
||
final Algorithm<Event,BubbleSort.Data<Integer>> a = new BubbleSort<Integer>(); | ||
final Algorithm<Event, BubbleSort.Data<Integer>> a = new BubbleSort<Integer>(); | ||
final EventConsumer<Event> ec = new GeneralEventConsumer(); | ||
|
||
a.run(ec, new BubbleSort.Data<>(array)); | ||
|
||
ec.visitEvents(new LogEventVisitor()); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,4 +5,4 @@ public interface Event { | |
default void accept(EventVisitor visitor) { | ||
visitor.visit(this); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/main/java/com/github/cbl/algorithm_analyzer/sorts/InsertionSort/Events/Step.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package com.github.cbl.algorithm_analyzer.sorts.InsertionSort.Events; | ||
|
||
public class Step { | ||
|
||
} | ||
public class Step {} |
4 changes: 1 addition & 3 deletions
4
src/main/java/com/github/cbl/algorithm_analyzer/sorts/InsertionSort/InsertionSort.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package com.github.cbl.algorithm_analyzer.sorts.InsertionSort; | ||
|
||
public class InsertionSort { | ||
|
||
} | ||
public class InsertionSort {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 1 addition & 3 deletions
4
src/main/java/com/github/cbl/algorithm_analyzer/trees/AvlTree/AvlTree.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,3 @@ | ||
package com.github.cbl.algorithm_analyzer.trees.AvlTree; | ||
|
||
public class AvlTree { | ||
|
||
} | ||
public class AvlTree {} |
5 changes: 0 additions & 5 deletions
5
src/main/java/com/github/cbl/algorithm_analyzer/trees/AvlTree/Events/Delete.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/java/com/github/cbl/algorithm_analyzer/trees/AvlTree/Events/Insert.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/java/com/github/cbl/algorithm_analyzer/trees/AvlTree/Events/Rotation.java
This file was deleted.
Oops, something went wrong.
5 changes: 0 additions & 5 deletions
5
src/main/java/com/github/cbl/algorithm_analyzer/trees/AvlTree/Events/TreeState.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.