Skip to content

Commit

Permalink
ignore Eclipse files + incremental 4-space indent Java formatter (#254)
Browse files Browse the repository at this point in the history
  • Loading branch information
echeran authored Jun 15, 2022
1 parent fe12abc commit 70dce2c
Show file tree
Hide file tree
Showing 578 changed files with 77,084 additions and 57,714 deletions.
27 changes: 22 additions & 5 deletions .github/workflows/cli-build-instructions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ env:

jobs:

# Using the Java style formatter google-java-style provided by the Spotless
# plugin configured in the root pom.xml using 4-space indents (AOSP style).
# Spotless is configured to run only on files in this branch (PR) that differ
# from origin/main
formatter:
name: Formatter + Style checker
runs-on: ubuntu-latest
steps:
- name: Checkout Unicode Tools
uses: actions/checkout@v3
with:
fetch-depth: 0 # fetch all branches so that Spotless can resolve `origin/main`
- name: Check Java style
run: mvn spotless:check || (echo "Style checker failed. Formatting changes can be applied by 'mvn spotless:apply'" && exit 1)

# Only run 1 or 2 commands for in-source build instructions, just to demonstrate
# what translating between an out-of-source build and an in-source build would
# look like. Rely on out-of-source build steps as the canonical way to
Expand All @@ -23,9 +38,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Unicode Tools
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Check out CLDR
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: unicode-org/cldr
path: cldr
Expand Down Expand Up @@ -66,12 +81,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Checkout Unicode Tools
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: unicode-org/unicodetools
path: unicodetools/mine/src
- name: Checkout CLDR
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
repository: unicode-org/cldr
path: cldr/mine/src
Expand Down Expand Up @@ -158,6 +173,8 @@ jobs:
cd unicodetools/mine/src
# run GenerateEnums
mvn -s .github/workflows/mvn-settings.xml exec:java -Dexec.mainClass="org.unicode.props.GenerateEnums" -Dexec.args="" -pl unicodetools -DCLDR_DIR=$(cd ../../../cldr/mine/src ; pwd) -DUNICODETOOLS_GEN_DIR=$(cd ../Generated ; pwd) -DUNICODETOOLS_REPO_DIR=$(pwd) -DUVERSION=$CURRENT_UVERSION
# apply formatting because generated file will not pass Java formatter
mvn spotless:apply
# TODO(#100) Get rid of need for fake version 13.1 of Unicode enum val
# Fail if we haven't committed changes from Generate Enums, but make exception for fake Unicode version hack (#100)
echo "Check if GenerateEnums output has been committed to repo"
Expand All @@ -170,7 +187,7 @@ jobs:
names=`git diff --name-status | awk '{print $2;}'`
if [[ "$names" == "unicodetools/src/main/java/org/unicode/props/UcdPropertyValues.java" ]]; then
gitdiffstat=`git diff --stat | tail -n 1`
if [[ "$gitdiffstat" = " 1 file changed, 1 insertion(+), 1 deletion(-)" ]]; then
if [[ "$gitdiffstat" = " 1 file changed, 1 insertion(+), 2 deletions(-)" ]]; then
git diff | grep 'V13_1("13.1")'
if [ $? -eq 0 ]; then
echo "Inferred: Only non-committed change after GenerateEnums is temporary V13_1 hack (issue #100)"
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ perf-*.xml
test-*.xml

# Directories
.settings/
.vs/
.vscode/
ARM/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,13 +11,13 @@
public class MultiComparator<T> implements Comparator<T> {
private Comparator<T>[] comparators;

@SuppressWarnings("unchecked") // See ticket #11395, this is safe.
public MultiComparator (Comparator<T>... comparators) {
@SuppressWarnings("unchecked") // See ticket #11395, this is safe.
public MultiComparator(Comparator<T>... comparators) {
this.comparators = comparators;
}

/* Lexigraphic compare. Returns the first difference
* @return zero if equal. Otherwise +/- (i+1)
* @return zero if equal. Otherwise +/- (i+1)
* where i is the index of the first comparator finding a difference
* @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
*/
Expand Down
Loading

0 comments on commit 70dce2c

Please sign in to comment.