Merge pull request #689 from zod/pmd-7

Update PMD to 7.0.0
This commit is contained in:
afischerdev 2024-04-17 20:19:52 +02:00 committed by GitHub
commit 36e169ab48
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
63 changed files with 193 additions and 207 deletions

View file

@ -20,10 +20,10 @@ jobs:
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file settings-path: ${{ github.workspace }} # location for the settings.xml file

View file

@ -16,10 +16,10 @@ jobs:
environment: BRouter environment: BRouter
steps: steps:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
- name: Set up JDK 11 - name: Set up JDK 17
uses: actions/setup-java@v4 uses: actions/setup-java@v4
with: with:
java-version: '11' java-version: '17'
distribution: 'temurin' distribution: 'temurin'
cache: gradle cache: gradle
- name: Create local.properties - name: Create local.properties

2
.gitignore vendored
View file

@ -1,6 +1,7 @@
*.iml *.iml
.gradle .gradle
.idea/ .idea/
build
/local.properties /local.properties
/.idea/caches /.idea/caches
/.idea/gradle.xml /.idea/gradle.xml
@ -10,7 +11,6 @@
/.idea/navEditor.xml /.idea/navEditor.xml
/.idea/assetWizardSettings.xml /.idea/assetWizardSettings.xml
.DS_Store .DS_Store
/build
/captures /captures
.externalNativeBuild .externalNativeBuild
.cxx .cxx

View file

@ -1 +0,0 @@
/build/

View file

@ -1,8 +1,7 @@
plugins { plugins {
id 'java-library' id 'brouter.library-conventions'
} }
dependencies { dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
testImplementation 'junit:junit:4.13.1'
} }

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="btools.codec" />

View file

@ -1,6 +1,7 @@
package btools.codec; package btools.codec;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import btools.util.ByteDataReader; import btools.util.ByteDataReader;
import btools.util.IByteArrayUnifier; import btools.util.IByteArrayUnifier;
@ -287,7 +288,7 @@ public final class MicroCache2 extends MicroCache {
@Override @Override
public int encodeMicroCache(byte[] buffer) { public int encodeMicroCache(byte[] buffer) {
HashMap<Long, Integer> idMap = new HashMap<>(); Map<Long, Integer> idMap = new HashMap<>();
for (int n = 0; n < size; n++) { // loop over nodes for (int n = 0; n < size; n++) { // loop over nodes
idMap.put(expandId(faid[n]), n); idMap.put(expandId(faid[n]), n);
} }
@ -418,7 +419,7 @@ public final class MicroCache2 extends MicroCache {
nlinks++; nlinks++;
if (isInternal) { if (isInternal) {
int nodeIdx = idx.intValue(); int nodeIdx = idx;
if (dodebug) System.out.println("*** target nodeIdx=" + nodeIdx); if (dodebug) System.out.println("*** target nodeIdx=" + nodeIdx);
if (nodeIdx == n) throw new RuntimeException("ups: self ref?"); if (nodeIdx == n) throw new RuntimeException("ups: self ref?");
nodeIdxDiff.encodeSignedValue(nodeIdx - n); nodeIdxDiff.encodeSignedValue(nodeIdx - n);

View file

@ -4,6 +4,7 @@ import java.util.Comparator;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import java.util.Queue;
import btools.util.BitCoderContext; import btools.util.BitCoderContext;
@ -58,7 +59,7 @@ public final class TagValueCoder {
TagValueSet dummy = new TagValueSet(nextTagValueSetId++); TagValueSet dummy = new TagValueSet(nextTagValueSetId++);
identityMap.put(dummy, dummy); identityMap.put(dummy, dummy);
} }
PriorityQueue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator()); Queue<TagValueSet> queue = new PriorityQueue<>(2 * identityMap.size(), new TagValueSet.FrequencyComparator());
queue.addAll(identityMap.values()); queue.addAll(identityMap.values());
while (queue.size() > 1) { while (queue.size() > 1) {
TagValueSet node = new TagValueSet(nextTagValueSetId++); TagValueSet node = new TagValueSet(nextTagValueSetId++);

View file

@ -1 +0,0 @@
/build/

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'java-library' id 'brouter.library-conventions'
} }
dependencies { dependencies {
@ -7,7 +7,6 @@ dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
implementation project(':brouter-codec') implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.2'
} }
// MapcreatorTest generates segments which are used in tests // MapcreatorTest generates segments which are used in tests

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="btools.router" />

View file

@ -168,7 +168,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
Point p1 = points.get(0); Point p1 = points.get(0);
for (int i = 1; i <= i_last; i++) { for (int i = 1; i <= i_last; i++) {
final Point p2 = points.get(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; return true;
} }
p1 = p2; p1 = p2;
@ -234,7 +234,7 @@ public class OsmNogoPolygon extends OsmNodeNamed {
final long p1x = p1.x; final long p1x = p1.x;
final long p1y = p1.y; final long p1y = p1.y;
if (OsmNogoPolygon.isOnLine(px, py, p0x, p0y, p1x, p1y)) { if (isOnLine(px, py, p0x, p0y, p1x, p1y)) {
return true; return true;
} }

View file

@ -296,7 +296,7 @@ abstract class OsmPath implements OsmLinkHolder {
// apply a start-direction if appropriate (by faking the origin position) // apply a start-direction if appropriate (by faking the origin position)
if (isStartpoint) { if (isStartpoint) {
if (rc.startDirectionValid) { 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); double[] lonlat2m = CheapRuler.getLonLatToMeterScales((lon0 + lat1) >> 1);
lon0 = lon1 - (int) (1000. * Math.sin(dir) / lonlat2m[0]); lon0 = lon1 - (int) (1000. * Math.sin(dir) / lonlat2m[0]);
lat0 = lat1 - (int) (1000. * Math.cos(dir) / lonlat2m[1]); lat0 = lat1 - (int) (1000. * Math.cos(dir) / lonlat2m[1]);

View file

@ -166,7 +166,7 @@ public final class OsmTrack {
} }
public List<String> aggregateMessages() { public List<String> aggregateMessages() {
ArrayList<String> res = new ArrayList<>(); List<String> res = new ArrayList<>();
MessageData current = null; MessageData current = null;
for (OsmPathElement n : nodes) { for (OsmPathElement n : nodes) {
if (n.message != null && n.message.wayKeyValues != null) { if (n.message != null && n.message.wayKeyValues != null) {
@ -188,7 +188,7 @@ public final class OsmTrack {
} }
public List<String> aggregateSpeedProfile() { public List<String> aggregateSpeedProfile() {
ArrayList<String> res = new ArrayList<>(); List<String> res = new ArrayList<>();
int vmax = -1; int vmax = -1;
int vmaxe = -1; int vmaxe = -1;
int vmin = -1; int vmin = -1;

View file

@ -187,7 +187,7 @@ public class RoutingEngine extends Thread {
OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives OsmTrack[] refTracks = new OsmTrack[nsections]; // used ways for alternatives
OsmTrack[] lastTracks = new OsmTrack[nsections]; OsmTrack[] lastTracks = new OsmTrack[nsections];
OsmTrack track = null; OsmTrack track = null;
ArrayList<String> messageList = new ArrayList<>(); List<String> messageList = new ArrayList<>();
for (int i = 0; ; i++) { for (int i = 0; ; i++) {
track = findTrack(refTracks, lastTracks); track = findTrack(refTracks, lastTracks);
track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend track.message = "track-length = " + track.distance + " filtered ascend = " + track.ascend
@ -690,9 +690,9 @@ public class RoutingEngine extends Thread {
return false; return false;
} }
} }
ArrayList<OsmPathElement> removeBackList = new ArrayList<>(); List<OsmPathElement> removeBackList = new ArrayList<>();
ArrayList<OsmPathElement> removeForeList = new ArrayList<>(); List<OsmPathElement> removeForeList = new ArrayList<>();
ArrayList<Integer> removeVoiceHintList = new ArrayList<>(); List<Integer> removeVoiceHintList = new ArrayList<>();
OsmPathElement last = null; OsmPathElement last = null;
OsmPathElement lastJunction = null; OsmPathElement lastJunction = null;
CompactLongMap<OsmTrack.OsmPathElementHolder> lastJunctions = new CompactLongMap<>(); CompactLongMap<OsmTrack.OsmPathElementHolder> lastJunctions = new CompactLongMap<>();
@ -1246,7 +1246,7 @@ public class RoutingEngine extends Thread {
addToOpenset(startPath1); addToOpenset(startPath1);
addToOpenset(startPath2); addToOpenset(startPath2);
} }
ArrayList<OsmPath> openBorderList = new ArrayList<>(4096); List<OsmPath> openBorderList = new ArrayList<>(4096);
boolean memoryPanicMode = false; boolean memoryPanicMode = false;
boolean needNonPanicProcessing = false; boolean needNonPanicProcessing = false;

View file

@ -101,7 +101,7 @@ public class RoutingParamCollector {
* @throws UnsupportedEncodingException * @throws UnsupportedEncodingException
*/ */
public Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException { public Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
HashMap<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8"); String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&"); StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) { while (tk.hasMoreTokens()) {

View file

@ -1 +0,0 @@
/build/

View file

@ -1,9 +1,8 @@
plugins { plugins {
id 'java-library' id 'brouter.library-conventions'
} }
dependencies { dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-codec') implementation project(':brouter-codec')
testImplementation 'junit:junit:4.13.1'
} }

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="btools.expressions" />

View file

@ -242,15 +242,15 @@ final class BExpression {
} }
// parse operands // parse operands
if (nops > 0) { 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 (nops > 1) {
if (ifThenElse) checkExpectedToken(ctx, "then"); if (ifThenElse) checkExpectedToken(ctx, "then");
exp.op2 = BExpression.parse(ctx, level + 1, null); exp.op2 = parse(ctx, level + 1, null);
} }
if (nops > 2) { if (nops > 2) {
if (ifThenElse) checkExpectedToken(ctx, "else"); if (ifThenElse) checkExpectedToken(ctx, "else");
exp.op3 = BExpression.parse(ctx, level + 1, null); exp.op3 = parse(ctx, level + 1, null);
} }
if (brackets) { if (brackets) {
checkExpectedToken(ctx, ")"); checkExpectedToken(ctx, ")");

View file

@ -14,6 +14,7 @@ import java.util.Arrays;
import java.util.HashMap; import java.util.HashMap;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.NavigableMap;
import java.util.Random; import java.util.Random;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.TreeMap; import java.util.TreeMap;
@ -227,7 +228,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) { public List<String> getKeyValueList(boolean inverseDirection, byte[] ab) {
ArrayList<String> res = new ArrayList<>(); List<String> res = new ArrayList<>();
decode(lookupData, inverseDirection, ab); decode(lookupData, inverseDirection, ab);
for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names for (int inum = 0; inum < lookupValues.size(); inum++) { // loop over lookup names
BExpressionLookupValue[] va = lookupValues.get(inum); BExpressionLookupValue[] va = lookupValues.get(inum);
@ -245,7 +246,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public int getLookupKey(String name) { public int getLookupKey(String name) {
int res = -1; int res = -1;
try { try {
res = lookupNumbers.get(name).intValue(); res = lookupNumbers.get(name);
} catch (Exception e) { } catch (Exception e) {
} }
return res; return res;
@ -433,11 +434,11 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public void dumpStatistics() { public void dumpStatistics() {
TreeMap<String, String> counts = new TreeMap<>(); NavigableMap<String, String> counts = new TreeMap<>();
// first count // first count
for (String name : lookupNumbers.keySet()) { for (String name : lookupNumbers.keySet()) {
int cnt = 0; int cnt = 0;
int inum = lookupNumbers.get(name).intValue(); int inum = lookupNumbers.get(name);
int[] histo = lookupHistograms.get(inum); int[] histo = lookupHistograms.get(inum);
// if ( histo.length == 500 ) continue; // if ( histo.length == 500 ) continue;
for (int i = 2; i < histo.length; i++) { for (int i = 2; i < histo.length; i++) {
@ -450,7 +451,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
String key = counts.lastEntry().getKey(); String key = counts.lastEntry().getKey();
String name = counts.get(key); String name = counts.get(key);
counts.remove(key); counts.remove(key);
int inum = lookupNumbers.get(name).intValue(); int inum = lookupNumbers.get(name);
BExpressionLookupValue[] values = lookupValues.get(inum); BExpressionLookupValue[] values = lookupValues.get(inum);
int[] histo = lookupHistograms.get(inum); int[] histo = lookupHistograms.get(inum);
if (values.length == 1000) continue; if (values.length == 1000) continue;
@ -507,7 +508,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public String variableName(int idx) { public String variableName(int idx) {
for (Map.Entry<String, Integer> e : variableNumbers.entrySet()) { for (Map.Entry<String, Integer> e : variableNumbers.entrySet()) {
if (e.getValue().intValue() == idx) { if (e.getValue() == idx) {
return e.getKey(); return e.getKey();
} }
} }
@ -544,9 +545,8 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
// look for that value // look for that value
int inum = num.intValue(); BExpressionLookupValue[] values = lookupValues.get(num);
BExpressionLookupValue[] values = lookupValues.get(inum); int[] histo = lookupHistograms.get(num);
int[] histo = lookupHistograms.get(inum);
int i = 0; int i = 0;
boolean bFoundAsterix = false; boolean bFoundAsterix = false;
for (; i < values.length; i++) { for (; i < values.length; i++) {
@ -558,7 +558,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
if (lookupData2 != null) { if (lookupData2 != null) {
// do not create unknown value for external data array, // do not create unknown value for external data array,
// record as 'unknown' instead // record as 'unknown' instead
lookupData2[inum] = 1; // 1 == unknown lookupData2[num] = 1; // 1 == unknown
if (bFoundAsterix) { if (bFoundAsterix) {
// found value for lookup * // found value for lookup *
//System.out.println( "add unknown " + name + " " + value ); //System.out.println( "add unknown " + name + " " + value );
@ -652,11 +652,11 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
// found negative maxdraft values // found negative maxdraft values
// no negative values // no negative values
// values are float with 2 decimals // 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) { } catch (Exception e) {
// ignore errors // ignore errors
System.err.println("error for " + name + " " + org + " trans " + value + " " + e.getMessage()); System.err.println("error for " + name + " " + org + " trans " + value + " " + e.getMessage());
lookupData2[inum] = 0; lookupData2[num] = 0;
} }
} }
return newValue; return newValue;
@ -677,15 +677,15 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
histo = nhisto; histo = nhisto;
newValue = new BExpressionLookupValue(value); newValue = new BExpressionLookupValue(value);
values[i] = newValue; values[i] = newValue;
lookupHistograms.set(inum, histo); lookupHistograms.set(num, histo);
lookupValues.set(inum, values); lookupValues.set(num, values);
} }
histo[i]++; histo[i]++;
// finally remember the actual data // finally remember the actual data
if (lookupData2 != null) lookupData2[inum] = i; if (lookupData2 != null) lookupData2[num] = i;
else lookupData[inum] = i; else lookupData[num] = i;
return newValue; return newValue;
} }
@ -700,11 +700,10 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
// look for that value // look for that value
int inum = num.intValue(); int nvalues = lookupValues.get(num).length;
int nvalues = lookupValues.get(inum).length;
if (valueIndex < 0 || valueIndex >= nvalues) if (valueIndex < 0 || valueIndex >= nvalues)
throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex); throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex);
lookupData[inum] = valueIndex; lookupData[num] = valueIndex;
} }
@ -721,9 +720,8 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
// look for that value // look for that value
int inum = num.intValue(); int nvalues = lookupValues.get(num).length;
int nvalues = lookupValues.get(inum).length; int oldValueIndex = lookupData[num];
int oldValueIndex = lookupData[inum];
if (oldValueIndex > 1 && oldValueIndex < valueIndex) { if (oldValueIndex > 1 && oldValueIndex < valueIndex) {
return; return;
} }
@ -732,12 +730,12 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
} }
if (valueIndex < 0) if (valueIndex < 0)
throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex); throw new IllegalArgumentException("value index out of range for name " + name + ": " + valueIndex);
lookupData[inum] = valueIndex; lookupData[num] = valueIndex;
} }
public boolean getBooleanLookupValue(String name) { public boolean getBooleanLookupValue(String name) {
Integer num = lookupNumbers.get(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) { public int getOutputVariableIndex(String name, boolean mustExist) {
@ -849,7 +847,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public void setVariableValue(String name, float value, boolean create) { public void setVariableValue(String name, float value, boolean create) {
Integer num = variableNumbers.get(name); Integer num = variableNumbers.get(name);
if (num != null) { if (num != null) {
variableData[num.intValue()] = value; variableData[num] = value;
} else if (create) { } else if (create) {
num = getVariableIdx(name, create); num = getVariableIdx(name, create);
float[] readOnlyData = variableData; float[] readOnlyData = variableData;
@ -858,13 +856,13 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
for (int i = 0; i < minWriteIdx; i++) { for (int i = 0; i < minWriteIdx; i++) {
variableData[i] = readOnlyData[i]; variableData[i] = readOnlyData[i];
} }
variableData[num.intValue()] = value; variableData[num] = value;
} }
} }
public float getVariableValue(String name, float defaultValue) { public float getVariableValue(String name, float defaultValue) {
Integer num = variableNumbers.get(name); Integer num = variableNumbers.get(name);
return num == null ? defaultValue : getVariableValue(num.intValue()); return num == null ? defaultValue : getVariableValue(num);
} }
float getVariableValue(int variableIdx) { float getVariableValue(int variableIdx) {
@ -882,7 +880,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
return -1; return -1;
} }
} }
return num.intValue(); return num;
} }
int getMinWriteIdx() { int getMinWriteIdx() {
@ -900,7 +898,7 @@ public abstract class BExpressionContext implements IByteArrayUnifier {
public int getLookupNameIdx(String name) { public int getLookupNameIdx(String name) {
Integer num = lookupNumbers.get(name); Integer num = lookupNumbers.get(name);
return num == null ? -1 : num.intValue(); return num == null ? -1 : num;
} }
public final void markLookupIdxUsed(int idx) { public final void markLookupIdxUsed(int idx) {

View file

@ -1 +0,0 @@
/build/

View file

@ -1,5 +1,5 @@
plugins { plugins {
id 'java-library' id 'brouter.application-conventions'
} }
dependencies { dependencies {
@ -8,6 +8,4 @@ dependencies {
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
implementation group: 'org.openstreetmap.osmosis', name: 'osmosis-osm-binary', version: '0.48.3' implementation group: 'org.openstreetmap.osmosis', name: 'osmosis-osm-binary', version: '0.48.3'
testImplementation('junit:junit:4.13.1')
} }

View file

@ -184,10 +184,10 @@ public class CreateElevationRasterImage {
if (DEBUG) System.out.println(line); if (DEBUG) System.out.println(line);
String[] sa = line.split(","); String[] sa = line.split(",");
if (!line.startsWith("#") && sa.length == 4) { if (!line.startsWith("#") && sa.length == 4) {
short e = Short.valueOf(sa[0].trim()); short e = Short.parseShort(sa[0].trim());
short r = Short.valueOf(sa[1].trim()); short r = Short.parseShort(sa[1].trim());
short g = Short.valueOf(sa[2].trim()); short g = Short.parseShort(sa[2].trim());
short b = Short.valueOf(sa[3].trim()); short b = Short.parseShort(sa[3].trim());
colorMap.put(e, new Color(r, g, b)); colorMap.put(e, new Color(r, g, b));
} }
// read next line // read next line

View file

@ -90,7 +90,6 @@ public class ElevationRasterTileConverter {
} else { } else {
System.out.println("usage: java <srtm-filename> <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3,default=3)] [hgt-fallback-data-dir]"); System.out.println("usage: java <srtm-filename> <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3,default=3)] [hgt-fallback-data-dir]");
System.out.println("or java all <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3, default=3)] [hgt-fallback-data-dir]"); System.out.println("or java all <hgt-data-dir> <srtm-output-dir> [arc seconds (1 or 3, default=3)] [hgt-fallback-data-dir]");
return;
} }
} }

View file

@ -8,6 +8,8 @@ package btools.mapcreator;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
import java.util.List;
import java.util.Map;
import btools.codec.MicroCache; import btools.codec.MicroCache;
import btools.codec.MicroCache2; import btools.codec.MicroCache2;
@ -105,7 +107,7 @@ public class OsmNodeP extends OsmLinkP {
} }
public void checkDuplicateTargets() { public void checkDuplicateTargets() {
HashMap<OsmNodeP, OsmLinkP> targets = new HashMap<>(); Map<OsmNodeP, OsmLinkP> targets = new HashMap<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) { for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0; OsmLinkP link = link0;
@ -165,14 +167,14 @@ public class OsmNodeP extends OsmLinkP {
mc.writeVarBytes(getNodeDecsription()); mc.writeVarBytes(getNodeDecsription());
// buffer internal reverse links // buffer internal reverse links
ArrayList<OsmNodeP> internalReverse = new ArrayList<>(); List<OsmNodeP> internalReverse = new ArrayList<>();
for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) { for (OsmLinkP link0 = getFirstLink(); link0 != null; link0 = link0.getNext(this)) {
OsmLinkP link = link0; OsmLinkP link = link0;
OsmNodeP origin = this; OsmNodeP origin = this;
OsmNodeP target = null; OsmNodeP target = null;
ArrayList<OsmNodeP> linkNodes = new ArrayList<>(); List<OsmNodeP> linkNodes = new ArrayList<>();
linkNodes.add(this); linkNodes.add(this);
// first pass just to see if that link is consistent // first pass just to see if that link is consistent
@ -226,7 +228,7 @@ public class OsmNodeP extends OsmLinkP {
origin = this; origin = this;
for (int i = 1; i < linkNodes.size() - 1; i++) { for (int i = 1; i < linkNodes.size() - 1; i++) {
OsmNodeP tranferNode = linkNodes.get(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.ilon - origin.ilon);
mc.writeVarLengthSigned(tranferNode.ilat - origin.ilat); mc.writeVarLengthSigned(tranferNode.ilat - origin.ilat);
mc.writeVarLengthSigned(tranferNode.getSElev() - origin.getSElev()); mc.writeVarLengthSigned(tranferNode.getSElev() - origin.getSElev());

View file

@ -4,6 +4,7 @@ import java.io.DataInputStream;
import java.io.EOFException; import java.io.EOFException;
import java.io.File; import java.io.File;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
/** /**
* WayCutter does 2 step in map-processing: * WayCutter does 2 step in map-processing:
@ -25,7 +26,7 @@ public class RelationStatistics extends MapCreatorBase {
} }
public void process(File relationFileIn) throws Exception { public void process(File relationFileIn) throws Exception {
HashMap<String, long[]> relstats = new HashMap<>(); Map<String, long[]> relstats = new HashMap<>();
DataInputStream dis = createInStream(relationFileIn); DataInputStream dis = createInStream(relationFileIn);
try { try {

View file

@ -9,6 +9,7 @@ import java.io.File;
import java.io.FileInputStream; import java.io.FileInputStream;
import java.io.RandomAccessFile; import java.io.RandomAccessFile;
import java.util.List; import java.util.List;
import java.util.Map;
import java.util.TreeMap; import java.util.TreeMap;
import btools.codec.DataBuffers; import btools.codec.DataBuffers;
@ -481,7 +482,7 @@ public class WayLinker extends MapCreatorBase implements Runnable {
MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor); MicroCache mc = new MicroCache2(size, abBuf2, lonIdxDiv, latIdxDiv, divisor);
// sort via treemap // sort via treemap
TreeMap<Integer, OsmNodeP> sortedList = new TreeMap<>(); Map<Integer, OsmNodeP> sortedList = new TreeMap<>();
for (OsmNodeP n : subList) { for (OsmNodeP n : subList) {
long longId = n.getIdFromPos(); long longId = n.getIdFromPos();
int shrinkid = mc.shrinkId(longId); int shrinkid = mc.shrinkId(longId);

View file

@ -1 +0,0 @@
/build/

View file

@ -1,12 +1,11 @@
plugins { plugins {
id 'java-library' id 'brouter.library-conventions'
} }
dependencies { dependencies {
implementation project(':brouter-util') implementation project(':brouter-util')
implementation project(':brouter-codec') implementation project(':brouter-codec')
implementation project(':brouter-expressions') implementation project(':brouter-expressions')
testImplementation 'junit:junit:4.13.2'
} }
// MapcreatorTest generates segments which are used in tests // MapcreatorTest generates segments which are used in tests

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="btools.mapaccess" />

View file

@ -31,7 +31,6 @@ final class OsmFile {
private int divisor; private int divisor;
private int cellsize; private int cellsize;
private int ncaches;
private int indexsize; private int indexsize;
protected byte elevationType = 3; protected byte elevationType = 3;
@ -47,7 +46,7 @@ final class OsmFile {
elevationType = rafile.elevationType; elevationType = rafile.elevationType;
cellsize = 1000000 / divisor; cellsize = 1000000 / divisor;
ncaches = divisor * divisor; int ncaches = divisor * divisor;
indexsize = ncaches * 4; indexsize = ncaches * 4;
byte[] iobuffer = dataBuffers.iobuffer; byte[] iobuffer = dataBuffers.iobuffer;
@ -143,7 +142,7 @@ final class OsmFile {
new DirectWeaver(bc, dataBuffers, lonIdx, latIdx, divisor, wayValidator, waypointMatcher, hollowNodes); new DirectWeaver(bc, dataBuffers, lonIdx, latIdx, divisor, wayValidator, waypointMatcher, hollowNodes);
return MicroCache.emptyNonVirgin; return MicroCache.emptyNonVirgin;
} finally { } 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; int readBytes = (bc.getReadingBitPosition() + 7) >> 3;
if (readBytes != asize - 4) { if (readBytes != asize - 4) {
int crcData = Crc32.crc(ab, 0, asize - 4); int crcData = Crc32.crc(ab, 0, asize - 4);

View file

@ -21,7 +21,7 @@ public class OsmNodePairSet {
n2a = new long[maxTempNodes]; n2a = new long[maxTempNodes];
} }
private static class OsmNodePair { private static final class OsmNodePair {
public long node2; public long node2;
public OsmNodePair next; public OsmNodePair next;
} }

View file

@ -51,7 +51,7 @@ public final class WaypointMatcherImpl implements WaypointMatcher {
} }
// sort result list // sort result list
comparator = new Comparator<MatchedWaypoint>() { comparator = new Comparator<>() {
@Override @Override
public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) { public int compare(MatchedWaypoint mw1, MatchedWaypoint mw2) {
int cmpDist = Double.compare(mw1.radius, mw2.radius); int cmpDist = Double.compare(mw1.radius, mw2.radius);

View file

@ -1 +0,0 @@
/build/

View file

@ -2,6 +2,8 @@ import org.gradle.nativeplatform.platform.internal.DefaultNativePlatform
plugins { plugins {
id 'com.android.application' id 'com.android.application'
id 'checkstyle'
id 'brouter.version-conventions'
} }
android { android {
@ -51,7 +53,7 @@ android {
buildTypes { buildTypes {
release { release {
minifyEnabled false minifyEnabled true
debuggable false debuggable false
if (project.hasProperty("RELEASE_STORE_FILE") && RELEASE_STORE_FILE.length() > 0) { if (project.hasProperty("RELEASE_STORE_FILE") && RELEASE_STORE_FILE.length() > 0) {
signingConfig signingConfigs.release signingConfig signingConfigs.release
@ -74,6 +76,10 @@ android {
sourceCompatibility JavaVersion.VERSION_1_8 sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8 targetCompatibility JavaVersion.VERSION_1_8
} }
buildFeatures {
aidl true
buildConfig true
}
applicationVariants.all { applicationVariants.all {
variant -> variant ->
@ -84,6 +90,11 @@ android {
} }
} }
repositories {
mavenCentral()
google()
}
dependencies { dependencies {
implementation 'androidx.appcompat:appcompat:1.6.1' implementation 'androidx.appcompat:appcompat:1.6.1'
implementation "androidx.constraintlayout:constraintlayout:2.1.4" implementation "androidx.constraintlayout:constraintlayout:2.1.4"

View file

@ -1 +0,0 @@
/build/

View file

@ -1,13 +1,10 @@
plugins { plugins {
id 'application' id 'brouter.application-conventions'
} }
application { application {
mainClass.set('btools.server.BRouter') mainClass.set('btools.server.BRouter')
distTar.enabled = false
jar { jar {
manifest { manifest {
attributes "Main-Class": getMainClass(), "Implementation-Version": project.version attributes "Main-Class": getMainClass(), "Implementation-Version": project.version
@ -35,6 +32,7 @@ application {
distZip { distZip {
dependsOn fatJar dependsOn fatJar
if (file('../local.properties').exists()) dependsOn (':brouter-routing-app:assemble')
archiveFileName = 'brouter-' + project.version + '.zip' archiveFileName = 'brouter-' + project.version + '.zip'
} }
@ -77,6 +75,5 @@ dependencies {
implementation project(':brouter-mapaccess') implementation project(':brouter-mapaccess')
implementation project(':brouter-util') implementation project(':brouter-util')
testImplementation 'junit:junit:4.13.2'
testImplementation 'org.json:json:20180813' testImplementation 'org.json:json:20180813'
} }

View file

@ -15,7 +15,7 @@ public class IpAccessMonitor {
synchronized (sync) { synchronized (sync) {
Long lastTime = ipAccess.get(ip); Long lastTime = ipAccess.get(ip);
ipAccess.put(ip, t); ipAccess.put(ip, t);
return lastTime == null || t - lastTime.longValue() > MAX_IDLE; return lastTime == null || t - lastTime > MAX_IDLE;
} }
} }
@ -31,9 +31,9 @@ public class IpAccessMonitor {
} }
private static void cleanup(long t) { private static void cleanup(long t) {
HashMap<String, Long> newMap = new HashMap<>(ipAccess.size()); Map<String, Long> newMap = new HashMap<>(ipAccess.size());
for (Map.Entry<String, Long> e : ipAccess.entrySet()) { for (Map.Entry<String, Long> e : ipAccess.entrySet()) {
if (t - e.getValue().longValue() <= MAX_IDLE) { if (t - e.getValue() <= MAX_IDLE) {
newMap.put(e.getKey(), e.getValue()); newMap.put(e.getKey(), e.getValue());
} }
} }

View file

@ -3,6 +3,7 @@ package btools.server;
import java.io.BufferedReader; import java.io.BufferedReader;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.List;
import java.util.StringTokenizer; import java.util.StringTokenizer;
public class Polygon { public class Polygon {
@ -15,7 +16,7 @@ public class Polygon {
private int maxy = Integer.MIN_VALUE; private int maxy = Integer.MIN_VALUE;
public Polygon(BufferedReader br) throws IOException { public Polygon(BufferedReader br) throws IOException {
ArrayList<String> lines = new ArrayList<>(); List<String> lines = new ArrayList<>();
for (; ; ) { for (; ; ) {
String line = br.readLine(); String line = br.readLine();

View file

@ -21,6 +21,7 @@ import java.util.List;
import java.util.Locale; import java.util.Locale;
import java.util.Map; import java.util.Map;
import java.util.PriorityQueue; import java.util.PriorityQueue;
import java.util.Queue;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.zip.GZIPOutputStream; import java.util.zip.GZIPOutputStream;
@ -299,7 +300,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
ProfileCache.setSize(2 * maxthreads); ProfileCache.setSize(2 * maxthreads);
PriorityQueue<RouteServer> threadQueue = new PriorityQueue<>(); Queue<RouteServer> 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])); 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 class RouteServer extends Thread implements Comparable<RouteServer> {
private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException { private static Map<String, String> getUrlParams(String url) throws UnsupportedEncodingException {
HashMap<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
String decoded = URLDecoder.decode(url, "UTF-8"); String decoded = URLDecoder.decode(url, "UTF-8");
StringTokenizer tk = new StringTokenizer(decoded, "?&"); StringTokenizer tk = new StringTokenizer(decoded, "?&");
while (tk.hasMoreTokens()) { while (tk.hasMoreTokens()) {
@ -417,7 +418,7 @@ public class RouteServer extends Thread implements Comparable<RouteServer> {
bw.write("\n"); bw.write("\n");
} }
private static void cleanupThreadQueue(PriorityQueue<RouteServer> threadQueue) { private static void cleanupThreadQueue(Queue<RouteServer> threadQueue) {
for (; ; ) { for (; ; ) {
boolean removedItem = false; boolean removedItem = false;
for (RouteServer t : threadQueue) { for (RouteServer t : threadQueue) {

View file

@ -9,6 +9,7 @@ import java.text.SimpleDateFormat;
import java.util.Date; import java.util.Date;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map; import java.util.Map;
import java.util.Set;
import java.util.StringTokenizer; import java.util.StringTokenizer;
import java.util.TreeSet; import java.util.TreeSet;
@ -244,7 +245,7 @@ public class SuspectManager extends Thread {
bw.write("<table>\n"); bw.write("<table>\n");
File countryParent = new File("worldpolys" + country); File countryParent = new File("worldpolys" + country);
File[] files = countryParent.listFiles(); File[] files = countryParent.listFiles();
TreeSet<String> names = new TreeSet<>(); Set<String> names = new TreeSet<>();
for (File f : files) { for (File f : files) {
String name = f.getName(); String name = f.getName();
if (name.endsWith(".poly")) { if (name.endsWith(".poly")) {

View file

@ -37,7 +37,7 @@ public class ProfileUploadHandler {
String id; String id;
if (profileId != null) { if (profileId != null) {
// update existing file when id appended // update existing file when id appended
id = profileId.substring(ProfileUploadHandler.CUSTOM_PREFIX.length()); id = profileId.substring(CUSTOM_PREFIX.length());
} else { } else {
id = "" + System.currentTimeMillis(); id = "" + System.currentTimeMillis();
} }

View file

@ -5,6 +5,7 @@ import org.junit.Ignore;
import org.junit.Test; import org.junit.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import btools.router.RoutingContext; import btools.router.RoutingContext;
import btools.server.request.ServerHandler; import btools.server.request.ServerHandler;
@ -13,7 +14,7 @@ public class RequestHandlerTest {
@Test @Test
@Ignore("Parameters are currently handled by RouteServer, not RequestHandler") @Ignore("Parameters are currently handled by RouteServer, not RequestHandler")
public void parseParameters() { public void parseParameters() {
HashMap<String, String> params = new HashMap<>(); Map<String, String> params = new HashMap<>();
params.put("lonlats", "8.799297,49.565883|8.811764,49.563606"); params.put("lonlats", "8.799297,49.565883|8.811764,49.563606");
params.put("profile", "trekking"); params.put("profile", "trekking");
params.put("alternativeidx", "0"); params.put("alternativeidx", "0");

View file

@ -1 +0,0 @@
/build/

View file

@ -1,7 +1,3 @@
plugins { plugins {
id 'java-library' id 'brouter.library-conventions'
}
dependencies {
testImplementation('junit:junit:4.13.1')
} }

View file

@ -1,21 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.btools</groupId>
<artifactId>brouter</artifactId>
<version>1.6.1</version>
<relativePath>../pom.xml</relativePath>
</parent>
<artifactId>brouter-util</artifactId>
<packaging>jar</packaging>
<dependencies>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>

View file

@ -1,3 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="btools.util" />

View file

@ -9,6 +9,7 @@ import java.util.List;
* *
* @author ab * @author ab
*/ */
@SuppressWarnings("PMD.LooseCoupling")
public class LazyArrayOfLists<E> { public class LazyArrayOfLists<E> {
private List<ArrayList<E>> lists; private List<ArrayList<E>> lists;

View file

@ -51,12 +51,12 @@ public class StackSampler extends Thread {
try { try {
int wait1 = rand.nextInt(interval); int wait1 = rand.nextInt(interval);
int wait2 = interval - wait1; int wait2 = interval - wait1;
Thread.sleep(wait1); sleep(wait1);
StringBuilder sb = new StringBuilder(df.format(new Date()) + " THREADDUMP\n"); StringBuilder sb = new StringBuilder(df.format(new Date()) + " THREADDUMP\n");
Map<Thread, StackTraceElement[]> allThreads = Thread.getAllStackTraces(); Map<Thread, StackTraceElement[]> allThreads = getAllStackTraces();
for (Map.Entry<Thread, StackTraceElement[]> e : allThreads.entrySet()) { for (Map.Entry<Thread, StackTraceElement[]> e : allThreads.entrySet()) {
Thread t = e.getKey(); Thread t = e.getKey();
if (t == Thread.currentThread()) { if (t == currentThread()) {
continue; // not me continue; // not me
} }
@ -76,7 +76,7 @@ public class StackSampler extends Thread {
flushCnt = 0; flushCnt = 0;
bw.flush(); bw.flush();
} }
Thread.sleep(wait2); sleep(wait2);
} catch (Exception e) { } catch (Exception e) {
// ignore // ignore
} }

View file

@ -4,6 +4,7 @@ import org.junit.Assert;
import org.junit.Test; import org.junit.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.Map;
import java.util.Random; import java.util.Random;
public class CompactMapTest { public class CompactMapTest {
@ -22,7 +23,7 @@ public class CompactMapTest {
private void hashMapComparison(int mapsize, int trycount) { private void hashMapComparison(int mapsize, int trycount) {
Random rand = new Random(12345); Random rand = new Random(12345);
HashMap<Long, String> hmap = new HashMap<>(); Map<Long, String> hmap = new HashMap<>();
CompactLongMap<String> cmap_slow = new CompactLongMap<>(); CompactLongMap<String> cmap_slow = new CompactLongMap<>();
CompactLongMap<String> cmap_fast = new CompactLongMap<>(); CompactLongMap<String> cmap_fast = new CompactLongMap<>();

View file

@ -5,6 +5,7 @@ import org.junit.Test;
import java.util.HashSet; import java.util.HashSet;
import java.util.Random; import java.util.Random;
import java.util.Set;
public class CompactSetTest { public class CompactSetTest {
@Test @Test
@ -22,7 +23,7 @@ public class CompactSetTest {
private void hashSetComparison(int setsize, int trycount) { private void hashSetComparison(int setsize, int trycount) {
Random rand = new Random(12345); Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<>(); Set<Long> hset = new HashSet<>();
CompactLongSet cset_slow = new CompactLongSet(); CompactLongSet cset_slow = new CompactLongSet();
CompactLongSet cset_fast = new CompactLongSet(); CompactLongSet cset_fast = new CompactLongSet();

View file

@ -5,7 +5,9 @@ import org.junit.Test;
import java.util.HashMap; import java.util.HashMap;
import java.util.HashSet; import java.util.HashSet;
import java.util.Map;
import java.util.Random; import java.util.Random;
import java.util.Set;
public class DenseLongMapTest { public class DenseLongMapTest {
@Test @Test
@ -16,7 +18,7 @@ public class DenseLongMapTest {
private void hashMapComparison(int mapsize, int trycount, long keyrange) { private void hashMapComparison(int mapsize, int trycount, long keyrange) {
Random rand = new Random(12345); Random rand = new Random(12345);
HashMap<Long, Integer> hmap = new HashMap<>(); Map<Long, Integer> hmap = new HashMap<>();
DenseLongMap dmap = new DenseLongMap(512); DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapsize; i++) { for (int i = 0; i < mapsize; i++) {
@ -32,7 +34,7 @@ public class DenseLongMapTest {
long k = (long) (rand.nextDouble() * keyrange); long k = (long) (rand.nextDouble() * keyrange);
Long KK = k; Long KK = k;
Integer VV = hmap.get(KK); Integer VV = hmap.get(KK);
int hvalue = VV == null ? -1 : VV.intValue(); int hvalue = VV == null ? -1 : VV;
int dvalue = dmap.getInt(k); int dvalue = dmap.getInt(k);
if (hvalue != dvalue) { if (hvalue != dvalue) {
@ -48,7 +50,7 @@ public class DenseLongMapTest {
int trycount = 100000; int trycount = 100000;
Random rand = new Random(12345); Random rand = new Random(12345);
HashSet<Long> hset = new HashSet<>(); Set<Long> hset = new HashSet<>();
DenseLongMap dmap = new DenseLongMap(512); DenseLongMap dmap = new DenseLongMap(512);
for (int i = 0; i < mapputs; i++) { for (int i = 0; i < mapputs; i++) {

View file

@ -1,65 +1,18 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules. // Top-level build file where you can add configuration options common to all sub-projects/modules.
buildscript { buildscript {
repositories { repositories {
mavenCentral() mavenCentral()
google() google()
} }
dependencies { 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 // NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files // 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) { task clean(type: Delete) {
delete rootProject.buildDir delete rootProject.buildDir
} }

3
buildSrc/build.gradle Normal file
View file

@ -0,0 +1,3 @@
plugins {
id 'groovy-gradle-plugin'
}

View file

@ -0,0 +1,8 @@
plugins {
id 'application'
id 'brouter.java-conventions'
}
application {
distTar.enabled = false
}

View file

@ -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
}

View file

@ -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)
}
}

View file

@ -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'

View file

@ -29,6 +29,7 @@
<exclude name="OverrideBothEqualsAndHashcode" /> <exclude name="OverrideBothEqualsAndHashcode" />
<exclude name="PreserveStackTrace" /> <exclude name="PreserveStackTrace" />
<exclude name="ReturnEmptyCollectionRatherThanNull" /> <exclude name="ReturnEmptyCollectionRatherThanNull" />
<exclude name="SimplifyBooleanReturns" />
<exclude name="UncommentedEmptyConstructor" /> <exclude name="UncommentedEmptyConstructor" />
<exclude name="UncommentedEmptyMethodBody" /> <exclude name="UncommentedEmptyMethodBody" />
<exclude name="UnusedFormalParameter" /> <exclude name="UnusedFormalParameter" />
@ -51,7 +52,6 @@
<!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> --> <!-- <rule ref="category/java/bestpractices.xml/UnusedAssignment" /> -->
<rule ref="category/java/codestyle.xml/UseDiamondOperator" /> <rule ref="category/java/codestyle.xml/UseDiamondOperator" />
<!-- <rule ref="category/java/design.xml/ImmutableField" /> --> <!-- <rule ref="category/java/design.xml/ImmutableField" /> -->
<!-- Will be added in PMD 7 --> <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" />
<!-- <rule ref="category/java/codestyle.xml/UnnecessaryBoxing" /> -->
</ruleset> </ruleset>

View file

@ -17,5 +17,5 @@ org.gradle.jvmargs=-Xmx1536m
android.useAndroidX=true android.useAndroidX=true
# Automatically convert third-party libraries to use AndroidX # Automatically convert third-party libraries to use AndroidX
android.enableJetifier=false android.enableJetifier=false
android.nonTransitiveRClass=false
android.nonFinalResIds=false

View file

@ -3,4 +3,4 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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

View file

@ -1,7 +1,7 @@
rootProject.name='brouter' rootProject.name='brouter'
if (file('local.properties').exists()) { if (file('local.properties').exists()) {
include ':brouter-routing-app' include ':brouter-routing-app'
} else { } else {
println "Note: To include Android app add 'local.properties' with 'sdk.dir=...' " 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' include ':brouter-mapaccess', ':brouter-core', ':brouter-util', ':brouter-expressions', ':brouter-codec', ':brouter-map-creator', ':brouter-server'