diff --git a/.github/workflows/gradle-publish.yml b/.github/workflows/gradle-publish.yml
index 57cd7a424..789adfd02 100644
--- a/.github/workflows/gradle-publish.yml
+++ b/.github/workflows/gradle-publish.yml
@@ -20,10 +20,10 @@ jobs:
steps:
- uses: actions/checkout@v4
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v4
with:
- java-version: '11'
+ java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file
diff --git a/.github/workflows/gradle.yml b/.github/workflows/gradle.yml
index 4fd8bde86..952ae9dc1 100644
--- a/.github/workflows/gradle.yml
+++ b/.github/workflows/gradle.yml
@@ -16,10 +16,10 @@ jobs:
environment: BRouter
steps:
- uses: actions/checkout@v4
- - name: Set up JDK 11
+ - name: Set up JDK 17
uses: actions/setup-java@v4
with:
- java-version: '11'
+ java-version: '17'
distribution: 'temurin'
cache: gradle
- name: Create local.properties
diff --git a/.gitignore b/.gitignore
index ddd96e878..4a88787dd 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1,6 +1,7 @@
*.iml
.gradle
.idea/
+build
/local.properties
/.idea/caches
/.idea/gradle.xml
@@ -10,7 +11,6 @@
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
-/build
/captures
.externalNativeBuild
.cxx
diff --git a/brouter-codec/.gitignore b/brouter-codec/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-codec/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-codec/build.gradle b/brouter-codec/build.gradle
index 22faffef5..722459010 100644
--- a/brouter-codec/build.gradle
+++ b/brouter-codec/build.gradle
@@ -1,8 +1,7 @@
plugins {
- id 'java-library'
+ id 'brouter.library-conventions'
}
dependencies {
implementation project(':brouter-util')
- testImplementation 'junit:junit:4.13.1'
}
diff --git a/brouter-codec/src/main/AndroidManifest.xml b/brouter-codec/src/main/AndroidManifest.xml
deleted file mode 100644
index 152508c1e..000000000
--- a/brouter-codec/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/brouter-codec/src/main/java/btools/codec/MicroCache2.java b/brouter-codec/src/main/java/btools/codec/MicroCache2.java
index c7b68788d..a09d19ed1 100644
--- a/brouter-codec/src/main/java/btools/codec/MicroCache2.java
+++ b/brouter-codec/src/main/java/btools/codec/MicroCache2.java
@@ -1,6 +1,7 @@
package btools.codec;
import java.util.HashMap;
+import java.util.Map;
import btools.util.ByteDataReader;
import btools.util.IByteArrayUnifier;
@@ -287,7 +288,7 @@ public boolean isInternal(int ilon, int ilat) {
@Override
public int encodeMicroCache(byte[] buffer) {
- HashMap idMap = new HashMap<>();
+ Map idMap = new HashMap<>();
for (int n = 0; n < size; n++) { // loop over nodes
idMap.put(expandId(faid[n]), n);
}
@@ -418,7 +419,7 @@ public int encodeMicroCache(byte[] buffer) {
nlinks++;
if (isInternal) {
- int nodeIdx = idx.intValue();
+ int nodeIdx = idx;
if (dodebug) System.out.println("*** target nodeIdx=" + nodeIdx);
if (nodeIdx == n) throw new RuntimeException("ups: self ref?");
nodeIdxDiff.encodeSignedValue(nodeIdx - n);
diff --git a/brouter-codec/src/main/java/btools/codec/TagValueCoder.java b/brouter-codec/src/main/java/btools/codec/TagValueCoder.java
index 098ea060c..f0a3a0fee 100644
--- a/brouter-codec/src/main/java/btools/codec/TagValueCoder.java
+++ b/brouter-codec/src/main/java/btools/codec/TagValueCoder.java
@@ -4,6 +4,7 @@
import java.util.HashMap;
import java.util.Map;
import java.util.PriorityQueue;
+import java.util.Queue;
import btools.util.BitCoderContext;
@@ -58,7 +59,7 @@ public void encodeDictionary(BitCoderContext bc) {
TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
identityMap.put(dummy, dummy);
}
- PriorityQueue queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
+ Queue queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
queue.addAll(identityMap.values());
while (queue.size() > 1) {
TagValueSet node = new TagValueSet(nextTagValueSetId++);
diff --git a/brouter-core/.gitignore b/brouter-core/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-core/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-core/build.gradle b/brouter-core/build.gradle
index cb7dde56c..e4c865f32 100644
--- a/brouter-core/build.gradle
+++ b/brouter-core/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id 'java-library'
+ id 'brouter.library-conventions'
}
dependencies {
@@ -7,7 +7,6 @@ dependencies {
implementation project(':brouter-util')
implementation project(':brouter-expressions')
implementation project(':brouter-codec')
- testImplementation 'junit:junit:4.13.2'
}
// MapcreatorTest generates segments which are used in tests
diff --git a/brouter-core/src/main/AndroidManifest.xml b/brouter-core/src/main/AndroidManifest.xml
deleted file mode 100644
index 04180cf48..000000000
--- a/brouter-core/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java b/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java
index ea828fed7..2809f2738 100644
--- a/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java
+++ b/brouter-core/src/main/java/btools/router/OsmNogoPolygon.java
@@ -168,7 +168,7 @@ public boolean isOnPolyline(long px, long py) {
Point p1 = points.get(0);
for (int i = 1; i <= i_last; i++) {
final Point p2 = points.get(i);
- if (OsmNogoPolygon.isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
+ if (isOnLine(px, py, p1.x, p1.y, p2.x, p2.y)) {
return true;
}
p1 = p2;
@@ -234,7 +234,7 @@ public boolean isWithin(final long px, final long py) {
final long p1x = p1.x;
final long p1y = p1.y;
- if (OsmNogoPolygon.isOnLine(px, py, p0x, p0y, p1x, p1y)) {
+ if (isOnLine(px, py, p0x, p0y, p1x, p1y)) {
return true;
}
diff --git a/brouter-core/src/main/java/btools/router/OsmPath.java b/brouter-core/src/main/java/btools/router/OsmPath.java
index 1bf318bae..ce99dce39 100644
--- a/brouter-core/src/main/java/btools/router/OsmPath.java
+++ b/brouter-core/src/main/java/btools/router/OsmPath.java
@@ -296,7 +296,7 @@ protected void addAddionalPenalty(OsmTrack refTrack, boolean detailMode, OsmPath
// apply a start-direction if appropriate (by faking the origin position)
if (isStartpoint) {
if (rc.startDirectionValid) {
- double dir = rc.startDirection.intValue() * CheapRuler.DEG_TO_RAD;
+ double dir = rc.startDirection * CheapRuler.DEG_TO_RAD;
double[] lonlat2m = CheapRuler.getLonLatToMeterScales((lon0 + lat1) >> 1);
lon0 = lon1 - (int) (1000. * Math.sin(dir) / lonlat2m[0]);
lat0 = lat1 - (int) (1000. * Math.cos(dir) / lonlat2m[1]);
diff --git a/brouter-core/src/main/java/btools/router/OsmTrack.java b/brouter-core/src/main/java/btools/router/OsmTrack.java
index afdd46493..7283b3912 100644
--- a/brouter-core/src/main/java/btools/router/OsmTrack.java
+++ b/brouter-core/src/main/java/btools/router/OsmTrack.java
@@ -166,7 +166,7 @@ public void buildMap() {
}
public List aggregateMessages() {
- ArrayList res = new ArrayList<>();
+ List res = new ArrayList<>();
MessageData current = null;
for (OsmPathElement n : nodes) {
if (n.message != null && n.message.wayKeyValues != null) {
@@ -188,7 +188,7 @@ public List aggregateMessages() {
}
public List aggregateSpeedProfile() {
- ArrayList res = new ArrayList<>();
+ List res = new ArrayList<>();
int vmax = -1;
int vmaxe = -1;
int vmin = -1;
diff --git a/brouter-core/src/main/java/btools/router/RoutingEngine.java b/brouter-core/src/main/java/btools/router/RoutingEngine.java
index 4d706e3c0..2909e5a26 100644
--- a/brouter-core/src/main/java/btools/router/RoutingEngine.java
+++ b/brouter-core/src/main/java/btools/router/RoutingEngine.java
@@ -187,7 +187,7 @@ public void doRouting(long maxRunningTime) {
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
OsmTrack[] lastTracks = new OsmTrack[nsections];
OsmTrack track = null;
- ArrayList messageList = new ArrayList<>();
+ List messageList = new ArrayList<>();
for (int i = 0; ; i++) {
track = findTrack(refTracks, lastTracks);
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
@@ -690,9 +690,9 @@ private boolean snappPathConnection(OsmTrack tt, OsmTrack t, MatchedWaypoint sta
return false;
}
}
- ArrayList removeBackList = new ArrayList<>();
- ArrayList removeForeList = new ArrayList<>();
- ArrayList removeVoiceHintList = new ArrayList<>();
+ List removeBackList = new ArrayList<>();
+ List removeForeList = new ArrayList<>();
+ List removeVoiceHintList = new ArrayList<>();
OsmPathElement last = null;
OsmPathElement lastJunction = null;
CompactLongMap lastJunctions = new CompactLongMap<>();
@@ -1246,7 +1246,7 @@ private OsmTrack _findTrack(String operationName, MatchedWaypoint startWp, Match
addToOpenset(startPath1);
addToOpenset(startPath2);
}
- ArrayList openBorderList = new ArrayList<>(4096);
+ List openBorderList = new ArrayList<>(4096);
boolean memoryPanicMode = false;
boolean needNonPanicProcessing = false;
diff --git a/brouter-core/src/main/java/btools/router/RoutingParamCollector.java b/brouter-core/src/main/java/btools/router/RoutingParamCollector.java
index 99f5b3b12..b8d7f6bd8 100644
--- a/brouter-core/src/main/java/btools/router/RoutingParamCollector.java
+++ b/brouter-core/src/main/java/btools/router/RoutingParamCollector.java
@@ -101,7 +101,7 @@ private OsmNodeNamed readPosition(double lon, double lat, String name) {
* @throws UnsupportedEncodingException
*/
public Map getUrlParams(String url) throws UnsupportedEncodingException {
- HashMap params = new HashMap<>();
+ Map params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) {
diff --git a/brouter-expressions/.gitignore b/brouter-expressions/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-expressions/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-expressions/build.gradle b/brouter-expressions/build.gradle
index ff146d6b0..fd71fbf79 100644
--- a/brouter-expressions/build.gradle
+++ b/brouter-expressions/build.gradle
@@ -1,9 +1,8 @@
plugins {
- id 'java-library'
+ id 'brouter.library-conventions'
}
dependencies {
implementation project(':brouter-util')
implementation project(':brouter-codec')
- testImplementation 'junit:junit:4.13.1'
}
diff --git a/brouter-expressions/src/main/AndroidManifest.xml b/brouter-expressions/src/main/AndroidManifest.xml
deleted file mode 100644
index 9110ced4e..000000000
--- a/brouter-expressions/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/brouter-expressions/src/main/java/btools/expressions/BExpression.java b/brouter-expressions/src/main/java/btools/expressions/BExpression.java
index b083f58c1..d2667809d 100644
--- a/brouter-expressions/src/main/java/btools/expressions/BExpression.java
+++ b/brouter-expressions/src/main/java/btools/expressions/BExpression.java
@@ -242,15 +242,15 @@ private static BExpression parseRaw(BExpressionContext ctx, int level, String op
}
// parse operands
if (nops > 0) {
- exp.op1 = BExpression.parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
+ exp.op1 = parse(ctx, level + 1, exp.typ == ASSIGN_EXP ? "=" : null);
}
if (nops > 1) {
if (ifThenElse) checkExpectedToken(ctx, "then");
- exp.op2 = BExpression.parse(ctx, level + 1, null);
+ exp.op2 = parse(ctx, level + 1, null);
}
if (nops > 2) {
if (ifThenElse) checkExpectedToken(ctx, "else");
- exp.op3 = BExpression.parse(ctx, level + 1, null);
+ exp.op3 = parse(ctx, level + 1, null);
}
if (brackets) {
checkExpectedToken(ctx, ")");
diff --git a/brouter-expressions/src/main/java/btools/expressions/BExpressionContext.java b/brouter-expressions/src/main/java/btools/expressions/BExpressionContext.java
index 786439a95..a459f3893 100644
--- a/brouter-expressions/src/main/java/btools/expressions/BExpressionContext.java
+++ b/brouter-expressions/src/main/java/btools/expressions/BExpressionContext.java
@@ -14,6 +14,7 @@
import java.util.HashMap;
import java.util.List;
import java.util.Map;
+import java.util.NavigableMap;
import java.util.Random;
import java.util.StringTokenizer;
import java.util.TreeMap;
@@ -227,7 +228,7 @@ public String getKeyValueDescription(boolean inverseDirection, byte[] ab) {
}
public List getKeyValueList(boolean inverseDirection, byte[] ab) {
- ArrayList res = new ArrayList<>();
+ List res = new ArrayList<>();
decode(lookupData, inverseDirection, ab);
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
BExpressionLookupValue[] va = lookupValues.get(inum);
@@ -245,7 +246,7 @@ public List getKeyValueList(boolean inverseDirection, byte[] ab) {
public int getLookupKey(String name) {
int res = -1;
try {
- res = lookupNumbers.get(name).intValue();
+ res = lookupNumbers.get(name);
} catch (Exception e) {
}
return res;
@@ -433,11 +434,11 @@ private void evaluateInto(float[] vars, int offset) {
public void dumpStatistics() {
- TreeMap counts = new TreeMap<>();
+ NavigableMap counts = new TreeMap<>();
// first count
for (String name : lookupNumbers.keySet()) {
int cnt = 0;
- int inum = lookupNumbers.get(name).intValue();
+ int inum = lookupNumbers.get(name);
int[] histo = lookupHistograms.get(inum);
// if ( histo.length == 500 ) continue;
for (int i = 2; i < histo.length; i++) {
@@ -450,7 +451,7 @@ public void dumpStatistics() {
String key = counts.lastEntry().getKey();
String name = counts.get(key);
counts.remove(key);
- int inum = lookupNumbers.get(name).intValue();
+ int inum = lookupNumbers.get(name);
BExpressionLookupValue[] values = lookupValues.get(inum);
int[] histo = lookupHistograms.get(inum);
if (values.length == 1000) continue;
@@ -507,7 +508,7 @@ public void assertAllVariablesEqual(BExpressionContext other) {
public String variableName(int idx) {
for (Map.Entry e : variableNumbers.entrySet()) {
- if (e.getValue().intValue() == idx) {
+ if (e.getValue() == idx) {
return e.getKey();
}
}
@@ -544,9 +545,8 @@ public BExpressionLookupValue addLookupValue(String name, String value, int[] lo
}
// look for that value
- int inum = num.intValue();
- BExpressionLookupValue[] values = lookupValues.get(inum);
- int[] histo = lookupHistograms.get(inum);
+ BExpressionLookupValue[] values = lookupValues.get(num);
+ int[] histo = lookupHistograms.get(num);
int i = 0;
boolean bFoundAsterix = false;
for (; i < values.length; i++) {
@@ -558,7 +558,7 @@ public BExpressionLookupValue addLookupValue(String name, String value, int[] lo
if (lookupData2 != null) {
// do not create unknown value for external data array,
// record as 'unknown' instead
- lookupData2[inum] = 1; // 1 == unknown
+ lookupData2[num] = 1; // 1 == unknown
if (bFoundAsterix) {
// found value for lookup *
//System.out.println( "add unknown " + name + " " + value );
@@ -652,11 +652,11 @@ public BExpressionLookupValue addLookupValue(String name, String value, int[] lo
// found negative maxdraft values
// no negative values
// values are float with 2 decimals
- lookupData2[inum] = 1000 + (int) (Math.abs(Float.parseFloat(value)) * 100f);
+ lookupData2[num] = 1000 + (int) (Math.abs(Float.parseFloat(value)) * 100f);
} catch (Exception e) {
// ignore errors
System.err.println("error for " + name + " " + org + " trans " + value + " " + e.getMessage());
- lookupData2[inum] = 0;
+ lookupData2[num] = 0;
}
}
return newValue;
@@ -677,15 +677,15 @@ public BExpressionLookupValue addLookupValue(String name, String value, int[] lo
histo = nhisto;
newValue = new BExpressionLookupValue(value);
values[i] = newValue;
- lookupHistograms.set(inum, histo);
- lookupValues.set(inum, values);
+ lookupHistograms.set(num, histo);
+ lookupValues.set(num, values);
}
histo[i]++;
// finally remember the actual data
- if (lookupData2 != null) lookupData2[inum] = i;
- else lookupData[inum] = i;
+ if (lookupData2 != null) lookupData2[num] = i;
+ else lookupData[num] = i;
return newValue;
}
@@ -700,11 +700,10 @@ public void addLookupValue(String name, int valueIndex) {
}
// look for that value
- int inum = num.intValue();
- int nvalues = lookupValues.get(inum).length;
+ int nvalues = lookupValues.get(num).length;
if (valueIndex < 0 || valueIndex >= nvalues)
throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex);
- lookupData[inum] = valueIndex;
+ lookupData[num] = valueIndex;
}
@@ -721,9 +720,8 @@ public void addSmallestLookupValue(String name, int valueIndex) {
}
// look for that value
- int inum = num.intValue();
- int nvalues = lookupValues.get(inum).length;
- int oldValueIndex = lookupData[inum];
+ int nvalues = lookupValues.get(num).length;
+ int oldValueIndex = lookupData[num];
if (oldValueIndex > 1 && oldValueIndex < valueIndex) {
return;
}
@@ -732,12 +730,12 @@ public void addSmallestLookupValue(String name, int valueIndex) {
}
if (valueIndex < 0)
throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex);
- lookupData[inum] = valueIndex;
+ lookupData[num] = valueIndex;
}
public boolean getBooleanLookupValue(String name) {
Integer num = lookupNumbers.get(name);
- return num != null && lookupData[num.intValue()] == 2;
+ return num != null && lookupData[num] == 2;
}
public int getOutputVariableIndex(String name, boolean mustExist) {
@@ -849,7 +847,7 @@ private List _parseFile(File file, Map keyValues) t
public void setVariableValue(String name, float value, boolean create) {
Integer num = variableNumbers.get(name);
if (num != null) {
- variableData[num.intValue()] = value;
+ variableData[num] = value;
} else if (create) {
num = getVariableIdx(name, create);
float[] readOnlyData = variableData;
@@ -858,13 +856,13 @@ public void setVariableValue(String name, float value, boolean create) {
for (int i = 0; i < minWriteIdx; i++) {
variableData[i] = readOnlyData[i];
}
- variableData[num.intValue()] = value;
+ variableData[num] = value;
}
}
public float getVariableValue(String name, float defaultValue) {
Integer num = variableNumbers.get(name);
- return num == null ? defaultValue : getVariableValue(num.intValue());
+ return num == null ? defaultValue : getVariableValue(num);
}
float getVariableValue(int variableIdx) {
@@ -882,7 +880,7 @@ int getVariableIdx(String name, boolean create) {
return -1;
}
}
- return num.intValue();
+ return num;
}
int getMinWriteIdx() {
@@ -900,7 +898,7 @@ float getLookupMatch(int nameIdx, int[] valueIdxArray) {
public int getLookupNameIdx(String name) {
Integer num = lookupNumbers.get(name);
- return num == null ? -1 : num.intValue();
+ return num == null ? -1 : num;
}
public final void markLookupIdxUsed(int idx) {
diff --git a/brouter-map-creator/.gitignore b/brouter-map-creator/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-map-creator/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-map-creator/build.gradle b/brouter-map-creator/build.gradle
index 7c48259db..3f8c263f2 100644
--- a/brouter-map-creator/build.gradle
+++ b/brouter-map-creator/build.gradle
@@ -1,5 +1,5 @@
plugins {
- id 'java-library'
+ id 'brouter.application-conventions'
}
dependencies {
@@ -8,6 +8,4 @@ dependencies {
implementation project(':brouter-expressions')
implementation group: 'org.openstreetmap.osmosis', name: 'osmosis-osm-binary', version: '0.48.3'
-
- testImplementation('junit:junit:4.13.1')
}
diff --git a/brouter-map-creator/src/main/java/btools/mapcreator/CreateElevationRasterImage.java b/brouter-map-creator/src/main/java/btools/mapcreator/CreateElevationRasterImage.java
index 935965f03..4cbd3c530 100644
--- a/brouter-map-creator/src/main/java/btools/mapcreator/CreateElevationRasterImage.java
+++ b/brouter-map-creator/src/main/java/btools/mapcreator/CreateElevationRasterImage.java
@@ -184,10 +184,10 @@ private void loadColors(String colors) {
if (DEBUG) System.out.println(line);
String[] sa = line.split(",");
if (!line.startsWith("#") && sa.length == 4) {
- short e = Short.valueOf(sa[0].trim());
- short r = Short.valueOf(sa[1].trim());
- short g = Short.valueOf(sa[2].trim());
- short b = Short.valueOf(sa[3].trim());
+ short e = Short.parseShort(sa[0].trim());
+ short r = Short.parseShort(sa[1].trim());
+ short g = Short.parseShort(sa[2].trim());
+ short b = Short.parseShort(sa[3].trim());
colorMap.put(e, new Color(r, g, b));
}
// read next line
diff --git a/brouter-map-creator/src/main/java/btools/mapcreator/ElevationRasterTileConverter.java b/brouter-map-creator/src/main/java/btools/mapcreator/ElevationRasterTileConverter.java
index 9b251fc2b..229dcfd42 100644
--- a/brouter-map-creator/src/main/java/btools/mapcreator/ElevationRasterTileConverter.java
+++ b/brouter-map-creator/src/main/java/btools/mapcreator/ElevationRasterTileConverter.java
@@ -90,7 +90,6 @@ public static void main(String[] args) throws Exception {
} else {
System.out.println("usage: java [arc seconds (1 or 3,default=3)] [hgt-fallback-data-dir]");
System.out.println("or java all [arc seconds (1 or 3, default=3)] [hgt-fallback-data-dir]");
- return;
}
}
diff --git a/brouter-map-creator/src/main/java/btools/mapcreator/OsmNodeP.java b/brouter-map-creator/src/main/java/btools/mapcreator/OsmNodeP.java
index 572554e13..b9455821a 100644
--- a/brouter-map-creator/src/main/java/btools/mapcreator/OsmNodeP.java
+++ b/brouter-map-creator/src/main/java/btools/mapcreator/OsmNodeP.java
@@ -8,6 +8,8 @@
import java.io.IOException;
import java.util.ArrayList;
import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
import btools.codec.MicroCache;
import btools.codec.MicroCache2;
@@ -105,7 +107,7 @@ public void writeNodeData(MicroCache mc, OsmTrafficMap trafficMap) throws IOExce
}
public void checkDuplicateTargets() {
- HashMap targets = new HashMap<>();
+ Map targets = new HashMap<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0;
@@ -165,14 +167,14 @@ public boolean writeNodeData2(MicroCache2 mc, OsmTrafficMap trafficMap) throws I
mc.writeVarBytes(getNodeDecsription());
// buffer internal reverse links
- ArrayList internalReverse = new ArrayList<>();
+ List internalReverse = new ArrayList<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0;
OsmNodeP origin = this;
OsmNodeP target = null;
- ArrayList linkNodes = new ArrayList<>();
+ List linkNodes = new ArrayList<>();
linkNodes.add(this);
// first pass just to see if that link is consistent
@@ -226,7 +228,7 @@ public boolean writeNodeData2(MicroCache2 mc, OsmTrafficMap trafficMap) throws I
origin = this;
for (int i = 1; i < linkNodes.size() - 1; i++) {
OsmNodeP tranferNode = linkNodes.get(i);
- if ((tranferNode.bits & OsmNodeP.DP_SURVIVOR_BIT) != 0) {
+ if ((tranferNode.bits & DP_SURVIVOR_BIT) != 0) {
mc.writeVarLengthSigned(tranferNode.ilon - origin.ilon);
mc.writeVarLengthSigned(tranferNode.ilat - origin.ilat);
mc.writeVarLengthSigned(tranferNode.getSElev() - origin.getSElev());
diff --git a/brouter-map-creator/src/main/java/btools/mapcreator/RelationStatistics.java b/brouter-map-creator/src/main/java/btools/mapcreator/RelationStatistics.java
index a6d5e043b..e239d898a 100644
--- a/brouter-map-creator/src/main/java/btools/mapcreator/RelationStatistics.java
+++ b/brouter-map-creator/src/main/java/btools/mapcreator/RelationStatistics.java
@@ -4,6 +4,7 @@
import java.io.EOFException;
import java.io.File;
import java.util.HashMap;
+import java.util.Map;
/**
* WayCutter does 2 step in map-processing:
@@ -25,7 +26,7 @@ public static void main(String[] args) throws Exception {
}
public void process(File relationFileIn) throws Exception {
- HashMap relstats = new HashMap<>();
+ Map relstats = new HashMap<>();
DataInputStream dis = createInStream(relationFileIn);
try {
diff --git a/brouter-map-creator/src/main/java/btools/mapcreator/WayLinker.java b/brouter-map-creator/src/main/java/btools/mapcreator/WayLinker.java
index 0a01b9328..e0a3c31ed 100644
--- a/brouter-map-creator/src/main/java/btools/mapcreator/WayLinker.java
+++ b/brouter-map-creator/src/main/java/btools/mapcreator/WayLinker.java
@@ -9,6 +9,7 @@
import java.io.FileInputStream;
import java.io.RandomAccessFile;
import java.util.List;
+import java.util.Map;
import java.util.TreeMap;
import btools.codec.DataBuffers;
@@ -481,7 +482,7 @@ public void wayFileEnd(File wayfile) throws Exception {
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
// sort via treemap
- TreeMap sortedList = new TreeMap<>();
+ Map sortedList = new TreeMap<>();
for (OsmNodeP n : subList) {
long longId = n.getIdFromPos();
int shrinkid = mc.shrinkId(longId);
diff --git a/brouter-mapaccess/.gitignore b/brouter-mapaccess/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-mapaccess/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-mapaccess/build.gradle b/brouter-mapaccess/build.gradle
index 40189cbd3..b17e5897c 100644
--- a/brouter-mapaccess/build.gradle
+++ b/brouter-mapaccess/build.gradle
@@ -1,12 +1,11 @@
plugins {
- id 'java-library'
+ id 'brouter.library-conventions'
}
dependencies {
implementation project(':brouter-util')
implementation project(':brouter-codec')
implementation project(':brouter-expressions')
- testImplementation 'junit:junit:4.13.2'
}
// MapcreatorTest generates segments which are used in tests
diff --git a/brouter-mapaccess/src/main/AndroidManifest.xml b/brouter-mapaccess/src/main/AndroidManifest.xml
deleted file mode 100644
index 46f6fa644..000000000
--- a/brouter-mapaccess/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmFile.java b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmFile.java
index 67eff299f..9b5724bb1 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmFile.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmFile.java
@@ -31,7 +31,6 @@ final class OsmFile {
private int divisor;
private int cellsize;
- private int ncaches;
private int indexsize;
protected byte elevationType = 3;
@@ -47,7 +46,7 @@ public OsmFile(PhysicalFile rafile, int lonDegree, int latDegree, DataBuffers da
elevationType = rafile.elevationType;
cellsize = 1000000 / divisor;
- ncaches = divisor * divisor;
+ int ncaches = divisor * divisor;
indexsize = ncaches * 4;
byte[] iobuffer = dataBuffers.iobuffer;
@@ -143,7 +142,7 @@ public MicroCache createMicroCache(int lonIdx, int latIdx, DataBuffers dataBuffe
new DirectWeaver(bc, dataBuffers, lonIdx, latIdx, divisor, wayValidator, waypointMatcher, hollowNodes);
return MicroCache.emptyNonVirgin;
} finally {
- // crc check only if the buffer has not been fully read
+ // crc check only if the buffer has not been fully read
int readBytes = (bc.getReadingBitPosition() + 7) >> 3;
if (readBytes != asize - 4) {
int crcData = Crc32.crc(ab, 0, asize - 4);
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNodePairSet.java b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNodePairSet.java
index 3fe874ed0..19aec729b 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNodePairSet.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/OsmNodePairSet.java
@@ -21,7 +21,7 @@ public OsmNodePairSet(int maxTempNodeCount) {
n2a = new long[maxTempNodes];
}
- private static class OsmNodePair {
+ private static final class OsmNodePair {
public long node2;
public OsmNodePair next;
}
diff --git a/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java b/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java
index 85ab9b5f1..e70d3be94 100644
--- a/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java
+++ b/brouter-mapaccess/src/main/java/btools/mapaccess/WaypointMatcherImpl.java
@@ -51,7 +51,7 @@ public WaypointMatcherImpl(List waypoints, double maxDistance,
}
// sort result list
- comparator = new Comparator() {
+ comparator = new Comparator<>() {
@Override
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
int cmpDist = Double.compare(mw1.radius, mw2.radius);
diff --git a/brouter-routing-app/.gitignore b/brouter-routing-app/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-routing-app/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-routing-app/build.gradle b/brouter-routing-app/build.gradle
index 4a160afa2..dcc0e03b0 100644
--- a/brouter-routing-app/build.gradle
+++ b/brouter-routing-app/build.gradle
@@ -2,6 +2,8 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins {
id 'com.android.application'
+ id 'checkstyle'
+ id 'brouter.version-conventions'
}
android {
@@ -51,7 +53,7 @@ android {
buildTypes {
release {
- minifyEnabled false
+ minifyEnabled true
debuggable false
if (project.hasProperty("RELEASE_STORE_FILE") && RELEASE_STORE_FILE.length() > 0) {
signingConfig signingConfigs.release
@@ -74,6 +76,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
+ buildFeatures {
+ aidl true
+ buildConfig true
+ }
applicationVariants.all {
variant ->
@@ -84,6 +90,11 @@ android {
}
}
+repositories {
+ mavenCentral()
+ google()
+}
+
dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.constraintlayout:constraintlayout:2.1.4"
diff --git a/brouter-server/.gitignore b/brouter-server/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-server/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-server/build.gradle b/brouter-server/build.gradle
index 9dac2d4ba..49cfd98f4 100644
--- a/brouter-server/build.gradle
+++ b/brouter-server/build.gradle
@@ -1,13 +1,10 @@
plugins {
- id 'application'
+ id 'brouter.application-conventions'
}
-
application {
mainClass.set('btools.server.BRouter')
- distTar.enabled = false
-
jar {
manifest {
attributes "Main-Class": getMainClass(), "Implementation-Version": project.version
@@ -35,6 +32,7 @@ application {
distZip {
dependsOn fatJar
+ if (file('../local.properties').exists()) dependsOn (':brouter-routing-app:assemble')
archiveFileName = 'brouter-' + project.version + '.zip'
}
@@ -77,6 +75,5 @@ dependencies {
implementation project(':brouter-mapaccess')
implementation project(':brouter-util')
- testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20180813'
}
diff --git a/brouter-server/src/main/java/btools/server/IpAccessMonitor.java b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
index a9413e2fd..6545db790 100644
--- a/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
+++ b/brouter-server/src/main/java/btools/server/IpAccessMonitor.java
@@ -15,7 +15,7 @@ public static boolean touchIpAccess(String ip) {
synchronized (sync) {
Long lastTime = ipAccess.get(ip);
ipAccess.put(ip, t);
- return lastTime == null || t - lastTime.longValue() > MAX_IDLE;
+ return lastTime == null || t - lastTime > MAX_IDLE;
}
}
@@ -31,9 +31,9 @@ public static int getSessionCount() {
}
private static void cleanup(long t) {
- HashMap newMap = new HashMap<>(ipAccess.size());
+ Map newMap = new HashMap<>(ipAccess.size());
for (Map.Entry e : ipAccess.entrySet()) {
- if (t - e.getValue().longValue() <= MAX_IDLE) {
+ if (t - e.getValue() <= MAX_IDLE) {
newMap.put(e.getKey(), e.getValue());
}
}
diff --git a/brouter-server/src/main/java/btools/server/Polygon.java b/brouter-server/src/main/java/btools/server/Polygon.java
index 9115ef1e5..a711de5c1 100644
--- a/brouter-server/src/main/java/btools/server/Polygon.java
+++ b/brouter-server/src/main/java/btools/server/Polygon.java
@@ -3,6 +3,7 @@
import java.io.BufferedReader;
import java.io.IOException;
import java.util.ArrayList;
+import java.util.List;
import java.util.StringTokenizer;
public class Polygon {
@@ -15,7 +16,7 @@ public class Polygon {
private int maxy = Integer.MIN_VALUE;
public Polygon(BufferedReader br) throws IOException {
- ArrayList lines = new ArrayList<>();
+ List lines = new ArrayList<>();
for (; ; ) {
String line = br.readLine();
diff --git a/brouter-server/src/main/java/btools/server/RouteServer.java b/brouter-server/src/main/java/btools/server/RouteServer.java
index 0685eac91..b1f9cc84d 100644
--- a/brouter-server/src/main/java/btools/server/RouteServer.java
+++ b/brouter-server/src/main/java/btools/server/RouteServer.java
@@ -21,6 +21,7 @@
import java.util.Locale;
import java.util.Map;
import java.util.PriorityQueue;
+import java.util.Queue;
import java.util.StringTokenizer;
import java.util.zip.GZIPOutputStream;
@@ -299,7 +300,7 @@ public static void main(String[] args) throws Exception {
ProfileCache.setSize(2 * maxthreads);
- PriorityQueue threadQueue = new PriorityQueue<>();
+ Queue threadQueue = new PriorityQueue<>();
ServerSocket serverSocket = args.length > 5 ? new ServerSocket(Integer.parseInt(args[3]), 100, InetAddress.getByName(args[5])) : new ServerSocket(Integer.parseInt(args[3]));
@@ -364,7 +365,7 @@ public static void main(String[] args) throws Exception {
private static Map getUrlParams(String url) throws UnsupportedEncodingException {
- HashMap params = new HashMap<>();
+ Map params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) {
@@ -417,7 +418,7 @@ private static void writeHttpHeader(BufferedWriter bw, String mimeType, String f
bw.write("\n");
}
- private static void cleanupThreadQueue(PriorityQueue threadQueue) {
+ private static void cleanupThreadQueue(Queue threadQueue) {
for (; ; ) {
boolean removedItem = false;
for (RouteServer t : threadQueue) {
diff --git a/brouter-server/src/main/java/btools/server/SuspectManager.java b/brouter-server/src/main/java/btools/server/SuspectManager.java
index 303c69968..8e6793330 100644
--- a/brouter-server/src/main/java/btools/server/SuspectManager.java
+++ b/brouter-server/src/main/java/btools/server/SuspectManager.java
@@ -9,6 +9,7 @@
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
+import java.util.Set;
import java.util.StringTokenizer;
import java.util.TreeSet;
@@ -244,7 +245,7 @@ private static void _process(String url, BufferedWriter bw) throws IOException {
bw.write("\n");
File countryParent = new File("worldpolys" + country);
File[] files = countryParent.listFiles();
- TreeSet names = new TreeSet<>();
+ Set names = new TreeSet<>();
for (File f : files) {
String name = f.getName();
if (name.endsWith(".poly")) {
diff --git a/brouter-server/src/main/java/btools/server/request/ProfileUploadHandler.java b/brouter-server/src/main/java/btools/server/request/ProfileUploadHandler.java
index 78a39cf15..81d52b00d 100644
--- a/brouter-server/src/main/java/btools/server/request/ProfileUploadHandler.java
+++ b/brouter-server/src/main/java/btools/server/request/ProfileUploadHandler.java
@@ -37,7 +37,7 @@ public void handlePostRequest(String profileId, BufferedReader br, BufferedWrite
String id;
if (profileId != null) {
// update existing file when id appended
- id = profileId.substring(ProfileUploadHandler.CUSTOM_PREFIX.length());
+ id = profileId.substring(CUSTOM_PREFIX.length());
} else {
id = "" + System.currentTimeMillis();
}
diff --git a/brouter-server/src/test/java/btools/server/RequestHandlerTest.java b/brouter-server/src/test/java/btools/server/RequestHandlerTest.java
index 2d5f698d8..81d03cbc6 100644
--- a/brouter-server/src/test/java/btools/server/RequestHandlerTest.java
+++ b/brouter-server/src/test/java/btools/server/RequestHandlerTest.java
@@ -5,6 +5,7 @@
import org.junit.Test;
import java.util.HashMap;
+import java.util.Map;
import btools.router.RoutingContext;
import btools.server.request.ServerHandler;
@@ -13,7 +14,7 @@ public class RequestHandlerTest {
@Test
@Ignore("Parameters are currently handled by RouteServer, not RequestHandler")
public void parseParameters() {
- HashMap params = new HashMap<>();
+ Map params = new HashMap<>();
params.put("lonlats", "8.799297,49.565883|8.811764,49.563606");
params.put("profile", "trekking");
params.put("alternativeidx", "0");
diff --git a/brouter-util/.gitignore b/brouter-util/.gitignore
deleted file mode 100644
index 84c048a73..000000000
--- a/brouter-util/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build/
diff --git a/brouter-util/build.gradle b/brouter-util/build.gradle
index 3dc5565fd..80c7d8ca4 100644
--- a/brouter-util/build.gradle
+++ b/brouter-util/build.gradle
@@ -1,7 +1,3 @@
plugins {
- id 'java-library'
-}
-
-dependencies {
- testImplementation('junit:junit:4.13.1')
+ id 'brouter.library-conventions'
}
diff --git a/brouter-util/pom.xml b/brouter-util/pom.xml
deleted file mode 100644
index 23b3925e8..000000000
--- a/brouter-util/pom.xml
+++ /dev/null
@@ -1,21 +0,0 @@
-
-
- 4.0.0
-
- org.btools
- brouter
- 1.6.1
- ../pom.xml
-
- brouter-util
- jar
-
-
-
- junit
- junit
- test
-
-
-
diff --git a/brouter-util/src/main/AndroidManifest.xml b/brouter-util/src/main/AndroidManifest.xml
deleted file mode 100644
index d28b2cc53..000000000
--- a/brouter-util/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,3 +0,0 @@
-
-
-
diff --git a/brouter-util/src/main/java/btools/util/LazyArrayOfLists.java b/brouter-util/src/main/java/btools/util/LazyArrayOfLists.java
index d8b05a58e..b9f6d0c58 100644
--- a/brouter-util/src/main/java/btools/util/LazyArrayOfLists.java
+++ b/brouter-util/src/main/java/btools/util/LazyArrayOfLists.java
@@ -9,6 +9,7 @@
*
* @author ab
*/
+@SuppressWarnings("PMD.LooseCoupling")
public class LazyArrayOfLists {
private List> lists;
diff --git a/brouter-util/src/main/java/btools/util/StackSampler.java b/brouter-util/src/main/java/btools/util/StackSampler.java
index 6b2e304fb..753fec46e 100644
--- a/brouter-util/src/main/java/btools/util/StackSampler.java
+++ b/brouter-util/src/main/java/btools/util/StackSampler.java
@@ -51,12 +51,12 @@ public void dumpThreads() {
try {
int wait1 = rand.nextInt(interval);
int wait2 = interval - wait1;
- Thread.sleep(wait1);
+ sleep(wait1);
StringBuilder sb = new StringBuilder(df.format(new Date()) + " THREADDUMP\n");
- Map allThreads = Thread.getAllStackTraces();
+ Map allThreads = getAllStackTraces();
for (Map.Entry e : allThreads.entrySet()) {
Thread t = e.getKey();
- if (t == Thread.currentThread()) {
+ if (t == currentThread()) {
continue; // not me
}
@@ -76,7 +76,7 @@ public void dumpThreads() {
flushCnt = 0;
bw.flush();
}
- Thread.sleep(wait2);
+ sleep(wait2);
} catch (Exception e) {
// ignore
}
diff --git a/brouter-util/src/test/java/btools/util/CompactMapTest.java b/brouter-util/src/test/java/btools/util/CompactMapTest.java
index 121749703..b2dc0af6a 100644
--- a/brouter-util/src/test/java/btools/util/CompactMapTest.java
+++ b/brouter-util/src/test/java/btools/util/CompactMapTest.java
@@ -4,6 +4,7 @@
import org.junit.Test;
import java.util.HashMap;
+import java.util.Map;
import java.util.Random;
public class CompactMapTest {
@@ -22,7 +23,7 @@ public void hashMapComparisonTest() {
private void hashMapComparison(int mapsize, int trycount) {
Random rand = new Random(12345);
- HashMap hmap = new HashMap<>();
+ Map hmap = new HashMap<>();
CompactLongMap cmap_slow = new CompactLongMap<>();
CompactLongMap cmap_fast = new CompactLongMap<>();
diff --git a/brouter-util/src/test/java/btools/util/CompactSetTest.java b/brouter-util/src/test/java/btools/util/CompactSetTest.java
index e0f53407f..1a4f1301a 100644
--- a/brouter-util/src/test/java/btools/util/CompactSetTest.java
+++ b/brouter-util/src/test/java/btools/util/CompactSetTest.java
@@ -5,6 +5,7 @@
import java.util.HashSet;
import java.util.Random;
+import java.util.Set;
public class CompactSetTest {
@Test
@@ -22,7 +23,7 @@ public void hashSetComparisonTest() {
private void hashSetComparison(int setsize, int trycount) {
Random rand = new Random(12345);
- HashSet hset = new HashSet<>();
+ Set hset = new HashSet<>();
CompactLongSet cset_slow = new CompactLongSet();
CompactLongSet cset_fast = new CompactLongSet();
diff --git a/brouter-util/src/test/java/btools/util/DenseLongMapTest.java b/brouter-util/src/test/java/btools/util/DenseLongMapTest.java
index 57e867a1a..85936d7d7 100644
--- a/brouter-util/src/test/java/btools/util/DenseLongMapTest.java
+++ b/brouter-util/src/test/java/btools/util/DenseLongMapTest.java
@@ -5,7 +5,9 @@
import java.util.HashMap;
import java.util.HashSet;
+import java.util.Map;
import java.util.Random;
+import java.util.Set;
public class DenseLongMapTest {
@Test
@@ -16,7 +18,7 @@ public void hashMapComparisonTest() {
private void hashMapComparison(int mapsize, int trycount, long keyrange) {
Random rand = new Random(12345);
- HashMap hmap = new HashMap<>();
+ Map hmap = new HashMap<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapsize; i++) {
@@ -32,7 +34,7 @@ private void hashMapComparison(int mapsize, int trycount, long keyrange) {
long k = (long) (rand.nextDouble() * keyrange);
Long KK = k;
Integer VV = hmap.get(KK);
- int hvalue = VV == null ? -1 : VV.intValue();
+ int hvalue = VV == null ? -1 : VV;
int dvalue = dmap.getInt(k);
if (hvalue != dvalue) {
@@ -48,7 +50,7 @@ public void oneBitTest() {
int trycount = 100000;
Random rand = new Random(12345);
- HashSet hset = new HashSet<>();
+ Set hset = new HashSet<>();
DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapputs; i++) {
diff --git a/build.gradle b/build.gradle
index b8dd9aa09..6c64c85f0 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,65 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript {
-
repositories {
mavenCentral()
google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:7.4.2'
-
+ classpath 'com.android.tools.build:gradle:8.2.2'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}
-allprojects {
- // NOTE:
- // there are four places to change the version number
- // this file
- // app: build.gradle (versionCode only)
- // OsmTrack (version and versionDate)
- // docs revisions.md (version and versionDate)
- project.version "1.7.4"
- group 'org.btools'
-
- repositories {
- mavenCentral()
- google()
- }
-
- apply plugin: "maven-publish"
- publishing {
- repositories {
- maven {
- name = "GitHubPackages"
- url = uri("https://maven.pkg.github.com/$System.env.REPO")
- credentials {
- username = project.findProperty("gpr.user") ?: System.getenv("USERNAME")
- password = project.findProperty("gpr.key") ?: System.getenv("TOKEN")
- }
- }
- }
- publications {
- gpr(MavenPublication)
- }
- }
-
- apply plugin: "checkstyle"
- apply plugin: "pmd"
-
- pmd {
- consoleOutput = true
- toolVersion = "6.51.0"
- rulesMinimumPriority = 5
- ruleSetFiles = files("${rootProject.rootDir}/config/pmd/pmd-ruleset.xml")
- ruleSets = []
- // ignoreFailures = true
- }
-}
-
task clean(type: Delete) {
delete rootProject.buildDir
}
diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle
new file mode 100644
index 000000000..678405245
--- /dev/null
+++ b/buildSrc/build.gradle
@@ -0,0 +1,3 @@
+plugins {
+ id 'groovy-gradle-plugin'
+}
diff --git a/buildSrc/src/main/groovy/brouter.application-conventions.gradle b/buildSrc/src/main/groovy/brouter.application-conventions.gradle
new file mode 100644
index 000000000..da0466cb2
--- /dev/null
+++ b/buildSrc/src/main/groovy/brouter.application-conventions.gradle
@@ -0,0 +1,8 @@
+plugins {
+ id 'application'
+ id 'brouter.java-conventions'
+}
+
+application {
+ distTar.enabled = false
+}
diff --git a/buildSrc/src/main/groovy/brouter.java-conventions.gradle b/buildSrc/src/main/groovy/brouter.java-conventions.gradle
new file mode 100644
index 000000000..4609537aa
--- /dev/null
+++ b/buildSrc/src/main/groovy/brouter.java-conventions.gradle
@@ -0,0 +1,29 @@
+plugins {
+ id 'java'
+ id 'checkstyle'
+ id 'pmd'
+ id 'brouter.version-conventions'
+}
+
+group 'org.btools'
+
+repositories {
+ mavenCentral()
+}
+
+dependencies {
+ testImplementation 'junit:junit:4.13.2'
+}
+
+compileJava {
+ options.release = 11
+}
+
+pmd {
+ consoleOutput = true
+ toolVersion = '7.0.0'
+ rulesMinimumPriority = 5
+ ruleSetFiles = files("${rootProject.rootDir}/config/pmd/pmd-ruleset.xml")
+ ruleSets = []
+ // ignoreFailures = true
+}
diff --git a/buildSrc/src/main/groovy/brouter.library-conventions.gradle b/buildSrc/src/main/groovy/brouter.library-conventions.gradle
new file mode 100644
index 000000000..3fd5d465a
--- /dev/null
+++ b/buildSrc/src/main/groovy/brouter.library-conventions.gradle
@@ -0,0 +1,21 @@
+plugins {
+ id 'java-library'
+ id 'maven-publish'
+ id 'brouter.java-conventions'
+}
+
+publishing {
+ repositories {
+ maven {
+ name = 'GitHubPackages'
+ url = uri("https://maven.pkg.github.com/$System.env.REPO")
+ credentials {
+ username = project.findProperty('gpr.user') ?: System.getenv('USERNAME')
+ password = project.findProperty('gpr.key') ?: System.getenv('TOKEN')
+ }
+ }
+ }
+ publications {
+ gpr(MavenPublication)
+ }
+}
diff --git a/buildSrc/src/main/groovy/brouter.version-conventions.gradle b/buildSrc/src/main/groovy/brouter.version-conventions.gradle
new file mode 100644
index 000000000..96f7f0a64
--- /dev/null
+++ b/buildSrc/src/main/groovy/brouter.version-conventions.gradle
@@ -0,0 +1,7 @@
+// NOTE:
+// there are four places to change the version number
+// this file
+// app: build.gradle (versionCode only)
+// OsmTrack (version and versionDate)
+// docs revisions.md (version and versionDate)
+version '1.7.4'
diff --git a/config/pmd/pmd-ruleset.xml b/config/pmd/pmd-ruleset.xml
index 787e663ab..183746864 100644
--- a/config/pmd/pmd-ruleset.xml
+++ b/config/pmd/pmd-ruleset.xml
@@ -29,6 +29,7 @@
+
@@ -51,7 +52,6 @@
-
-
+
diff --git a/gradle.properties b/gradle.properties
index 147c25a98..b94ae53d0 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -17,5 +17,5 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false
-
-
+android.nonTransitiveRClass=false
+android.nonFinalResIds=false
diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties
index cdbfc5f54..11a5bd088 100644
--- a/gradle/wrapper/gradle-wrapper.properties
+++ b/gradle/wrapper/gradle-wrapper.properties
@@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-8.4-all.zip
diff --git a/settings.gradle b/settings.gradle
index eaa63a414..9bded48bc 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -1,7 +1,7 @@
rootProject.name='brouter'
if (file('local.properties').exists()) {
- include ':brouter-routing-app'
+ include ':brouter-routing-app'
} else {
println "Note: To include Android app add 'local.properties' with 'sdk.dir=...' "
}
-include ':brouter-mapaccess', ':brouter-core', ':brouter-util', ':brouter-expressions', ':brouter-codec', ':brouter-map-creator', ':brouter-server'
\ No newline at end of file
+include ':brouter-mapaccess', ':brouter-core', ':brouter-util', ':brouter-expressions', ':brouter-codec', ':brouter-map-creator', ':brouter-server'