diff --git a/.github/workflows/CI-build.yml b/.github/workflows/CI-build.yml index 00251956..ffbe262e 100644 --- a/.github/workflows/CI-build.yml +++ b/.github/workflows/CI-build.yml @@ -38,8 +38,8 @@ jobs: run: | curl --silent --show-error --location --remote-name \ https://github.com/TWiStErRob/net.twisterrob.travel/releases/download/v1.0.0/LULDLRRiverTramCable.zip - mkdir -p temp/feed15/LULDLRRiverTramCable - unzip LULDLRRiverTramCable.zip 'tfl_*-*-_-y05-*.xml' -d temp/feed15/LULDLRRiverTramCable + mkdir -p data/feed15/LULDLRRiverTramCable + unzip LULDLRRiverTramCable.zip 'tfl_*-*-_-y05-*.xml' -d data/feed15/LULDLRRiverTramCable - name: "Build project." working-directory: . diff --git a/android/app/full/build.gradle b/android/app/full/build.gradle index cf1952fb..7600e31f 100644 --- a/android/app/full/build.gradle +++ b/android/app/full/build.gradle @@ -10,8 +10,12 @@ android.defaultConfig.version { dependencies { implementation(projects.android.component.android) implementation(projects.android.component.data) + implementation(projects.android.component.map) implementation(projects.android.component.theme) implementation(projects.android.feature.range) + implementation(projects.common.feed.feeds) + implementation(projects.common.feed.facilities) + implementation(projects.common.feed.trackernet) implementation("net.twisterrob.lib:twister-lib-android-monolith") implementation("net.twisterrob.lib:twister-lib-android-basics") implementation("net.twisterrob.lib:twister-lib-android-slf4j") @@ -20,7 +24,6 @@ dependencies { implementation("net.twisterrob.lib:twister-lib-android-about") implementation("net.twisterrob.lib:twister-lib-android-settings") - implementation(libs.gms.maps) implementation(libs.jsr305) implementation(libs.androidx.swiperefreshlayout) } diff --git a/android/app/full/src/debug/res/values/overrides.xml b/android/app/full/src/debug/res/values/overrides.xml index 3c804a24..e26852e4 100644 --- a/android/app/full/src/debug/res/values/overrides.xml +++ b/android/app/full/src/debug/res/values/overrides.xml @@ -1,5 +1,5 @@ + !Better London Travel - - AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA + diff --git a/android/app/full/src/main/AndroidManifest.xml b/android/app/full/src/main/AndroidManifest.xml index 309bd039..25c460f7 100644 --- a/android/app/full/src/main/AndroidManifest.xml +++ b/android/app/full/src/main/AndroidManifest.xml @@ -19,13 +19,6 @@ android:theme="@style/AppTheme.Default" > - - - - - AIzaSyB6qc9WlSDbaNGO-c-mnu8ajlq3jroh2E4 - diff --git a/android/app/range/src/debug/res/values/overrides.xml b/android/app/range/src/debug/res/values/overrides.xml index e2b6123c..1e33e4b8 100644 --- a/android/app/range/src/debug/res/values/overrides.xml +++ b/android/app/range/src/debug/res/values/overrides.xml @@ -2,7 +2,4 @@ !Tube Range Map - - AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA - diff --git a/android/app/range/src/main/AndroidManifest.xml b/android/app/range/src/main/AndroidManifest.xml index 837c861d..c01ad61d 100644 --- a/android/app/range/src/main/AndroidManifest.xml +++ b/android/app/range/src/main/AndroidManifest.xml @@ -13,13 +13,6 @@ android:theme="@style/AppTheme.Default" > - - - + + + + AIzaSyDEBLxBF4iOGFUtzAm-Z8OeDYd-sShe_LA + + diff --git a/android/component/map/src/main/AndroidManifest.xml b/android/component/map/src/main/AndroidManifest.xml new file mode 100644 index 00000000..2d4d0b42 --- /dev/null +++ b/android/component/map/src/main/AndroidManifest.xml @@ -0,0 +1,17 @@ + + + + + + + + + + + diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java similarity index 81% rename from android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java rename to android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java index 48344006..738d8220 100644 --- a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java +++ b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngBoundsStringer.java @@ -1,16 +1,16 @@ package net.twisterrob.android.utils.tostring.stringers.detailed; -import javax.annotation.Nonnull; - import com.google.android.gms.maps.model.LatLngBounds; +import androidx.annotation.NonNull; + import net.twisterrob.java.utils.tostring.*; public class LatLngBoundsStringer extends Stringer { @Override public String getType(LatLngBounds object) { return "LatLngBounds"; } - @Override public void toString(@Nonnull ToStringAppender append, LatLngBounds bounds) { + @Override public void toString(@NonNull ToStringAppender append, LatLngBounds bounds) { append.complexProperty("SW", bounds.southwest); append.complexProperty("NE", bounds.northeast); } diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java similarity index 79% rename from android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java rename to android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java index 7b9f4a00..4f16d1fb 100644 --- a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java +++ b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/LatLngStringer.java @@ -1,16 +1,16 @@ package net.twisterrob.android.utils.tostring.stringers.detailed; -import javax.annotation.Nonnull; - import com.google.android.gms.maps.model.LatLng; +import androidx.annotation.NonNull; + import net.twisterrob.java.utils.tostring.*; public class LatLngStringer extends Stringer { @Override public String getType(LatLng object) { return "LatLng"; } - @Override public void toString(@Nonnull ToStringAppender append, LatLng latlng) { + @Override public void toString(@NonNull ToStringAppender append, LatLng latlng) { append.formattedProperty(null, null, "%f,%f", latlng.latitude, latlng.longitude); } } diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/MapStringers.java similarity index 78% rename from android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java rename to android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/MapStringers.java index 05d08bf2..af358af1 100644 --- a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/Stringers.java +++ b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/MapStringers.java @@ -3,15 +3,13 @@ import com.google.android.gms.common.api.Status; import com.google.android.gms.maps.model.LatLng; import com.google.android.gms.maps.model.LatLngBounds; -import com.google.android.libraries.places.api.model.Place; import net.twisterrob.java.utils.tostring.StringerRepo; -public class Stringers { +public class MapStringers { public static void register(StringerRepo repo) { repo.register(Status.class, new StatusStringer()); - repo.register(Place.class, new PlaceStringer()); repo.register(LatLng.class, new LatLngStringer()); repo.register(LatLngBounds.class, new LatLngBoundsStringer()); } diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java similarity index 88% rename from android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java rename to android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java index 05cd4703..58e055dc 100644 --- a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java +++ b/android/component/map/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/StatusStringer.java @@ -1,16 +1,16 @@ package net.twisterrob.android.utils.tostring.stringers.detailed; -import javax.annotation.Nonnull; - import android.annotation.SuppressLint; import com.google.android.gms.common.api.Status; +import androidx.annotation.NonNull; + import net.twisterrob.java.utils.tostring.*; public class StatusStringer extends Stringer { @SuppressLint("VisibleForTests") - @Override public void toString(@Nonnull ToStringAppender append, Status status) { + @Override public void toString(@NonNull ToStringAppender append, Status status) { append.rawProperty("code", status.getStatusCode()); append.rawProperty("message", status.getStatusMessage()); append.booleanProperty(status.isSuccess(), "success"); diff --git a/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java b/android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java similarity index 94% rename from android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java rename to android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java index e9047270..9a3cbee3 100644 --- a/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java +++ b/android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeneratedGeoTileProvider.java @@ -8,7 +8,6 @@ import androidx.core.util.Pools; import android.text.TextPaint; -import com.bumptech.glide.util.Util; import com.google.android.gms.maps.model.Tile; public abstract class GeneratedGeoTileProvider extends GeoTileProvider { @@ -31,7 +30,7 @@ protected GeneratedGeoTileProvider(int tileSize) { + "drawing a {}x{} Bitmap ({} bytes) compressed into {} bytes " + "took {} ms (create = {} ms, draw = {} ms, compress = {} ms)", x, y, zoom, - bitmap.getWidth(), bitmap.getHeight(), Util.getBitmapByteSize(bitmap), tile.data.length, + bitmap.getWidth(), bitmap.getHeight(), bitmap.getAllocationByteCount(), tile.data.length, converted - begin, created - begin, drawn - created, converted - drawn); return tile; } diff --git a/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java b/android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java similarity index 100% rename from android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java rename to android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/GeoTileProvider.java diff --git a/android/app/full/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java b/android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java similarity index 100% rename from android/app/full/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java rename to android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/PublicUrlTileProvider.java diff --git a/android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java b/android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java similarity index 100% rename from android/feature/range/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java rename to android/component/map/src/main/java/net/twisterrob/blt/android/data/range/tiles/SafeTileProvider.java diff --git a/android/feature/range/src/main/res/layout/inc_map.xml b/android/component/map/src/main/res/layout/inc_map.xml similarity index 100% rename from android/feature/range/src/main/res/layout/inc_map.xml rename to android/component/map/src/main/res/layout/inc_map.xml diff --git a/android/app/range/src/release/res/values/overrides.xml b/android/component/map/src/release/res/values/keys.xml similarity index 68% rename from android/app/range/src/release/res/values/overrides.xml rename to android/component/map/src/release/res/values/keys.xml index 17fb2d0c..77f8ea07 100644 --- a/android/app/range/src/release/res/values/overrides.xml +++ b/android/component/map/src/release/res/values/keys.xml @@ -1,5 +1,6 @@ + AIzaSyB6qc9WlSDbaNGO-c-mnu8ajlq3jroh2E4 diff --git a/android/feature/range/build.gradle b/android/feature/range/build.gradle index 98975a1e..2e01f0d1 100644 --- a/android/feature/range/build.gradle +++ b/android/feature/range/build.gradle @@ -5,6 +5,7 @@ plugins { dependencies { implementation(projects.android.component.android) implementation(projects.android.component.data) + implementation(projects.android.component.map) implementation(projects.android.component.theme) api("net.twisterrob.lib:twister-lib-android-monolith") // api because AppCompatActivity. @@ -17,7 +18,6 @@ dependencies { implementation("net.twisterrob.lib:twister-lib-android-settings") implementation(projects.common.model) - implementation(libs.gms.maps) implementation(libs.gms.places) implementation(libs.jsr305) implementation(libs.glide) diff --git a/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/RangeStringers.java b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/RangeStringers.java new file mode 100644 index 00000000..41b62788 --- /dev/null +++ b/android/feature/range/src/main/java/net/twisterrob/android/utils/tostring/stringers/detailed/RangeStringers.java @@ -0,0 +1,13 @@ +package net.twisterrob.android.utils.tostring.stringers.detailed; + +import com.google.android.libraries.places.api.model.Place; + +import net.twisterrob.java.utils.tostring.StringerRepo; + +public class RangeStringers { + + public static void register(StringerRepo repo) { + MapStringers.register(repo); + repo.register(Place.class, new PlaceStringer()); + } +} diff --git a/build.gradle b/build.gradle index 637b1086..f3bd90c2 100644 --- a/build.gradle +++ b/build.gradle @@ -10,6 +10,7 @@ idea { file(".gradle"), file("build"), file(".idea"), + file("data"), file("temp"), ] } diff --git a/common/data/build.gradle b/common/data/build.gradle deleted file mode 100644 index 51c584cf..00000000 --- a/common/data/build.gradle +++ /dev/null @@ -1,87 +0,0 @@ -plugins { - id("net.twisterrob.blt.convention") - id("org.gradle.java-library") - id("net.twisterrob.gradle.plugin.java") - id("org.gretty") - id("org.gradle.idea") -} - -description = "Better London Travel Data Generation: Standalone project to handle large feeds" - -dependencies { - implementation(projects.common.model) - runtimeOnly(projects.common.androidPolyfill) - - implementation(libs.jsr305) - implementation(libs.slf4j.api) - implementation(libs.slf4j.simple) - implementation(libs.sqlite.jdbc) - - testImplementation(projects.common.testHelpers) -} - -// TODO logging doesn't work with org.eclipse nor org.mortbay package names -// -Dorg.mortbay.log.class=org.eclipse.jetty.util.log.StrErrLog changes the logger, but no output -// --debug logs, but too much and not configurable -gretty { // org.akhikhl.gretty.GrettyExtension - //daemon = true - extraResourceBase(file("src/data")) - - // + Magic @Delegate org.akhikhl.gretty.ServerConfig through GrettyExtension implements GrettyConfig - httpPort = 8081 - managedClassReload = false - - // + Magic @Delegate org.akhikhl.gretty.WebAppConfig through GrettyExtension implements GrettyConfig - //... -} - -idea { - module { - excludeDirs = [ - file("output"), - file("src/data"), - ] - } -} - -tasks.register("runNetwork", JavaExec.class) { - File inputDir = rootProject.file("temp/feed15/LULDLRRiverTramCable") - File outputDir = file("output") - inputs.dir(inputDir).withPathSensitivity(PathSensitivity.RELATIVE) - inputs.dir("src/data/PredictionSummary") - outputs.dir(outputDir) - group = ApplicationPlugin.APPLICATION_GROUP - classpath = sourceSets.main.runtimeClasspath - mainClass = "net.twisterrob.blt.data.apps.TravelNetworkParser" - args = [ inputDir, outputDir ] - enableAssertions = true - doFirst { - outputDir.mkdirs() - standardOutput = new File(outputDir, "runNetwork.log").newOutputStream() - } - doLast { - standardOutput.close() - } -} - -tasks.register("runPostCode", JavaExec.class) { - def inputDir = rootProject.file("temp/feed15/LULDLRRiverTramCable") - def outputFile = "output/LondonTravel.data.AreaHull.sql" - inputs.dir(inputDir).withPathSensitivity(PathSensitivity.RELATIVE) - outputs.file(outputFile) - group = ApplicationPlugin.APPLICATION_GROUP - classpath = sourceSets.main.runtimeClasspath - mainClass = "net.twisterrob.blt.data.apps.PostCodeAreas" - enableAssertions = true -} - -tasks.register("runDisplay", JavaExec.class) { - group = ApplicationPlugin.APPLICATION_GROUP - classpath = sourceSets.main.runtimeClasspath - mainClass = "net.twisterrob.blt.data.apps.DisplayLine" - args = [ "DLR" ] - if (project.hasProperty("lines")) { - args = project.property("lines").toString().split(",") as List - } - enableAssertions = true -} diff --git a/common/data/desktop/build.gradle b/common/data/desktop/build.gradle new file mode 100644 index 00000000..05b3c3be --- /dev/null +++ b/common/data/desktop/build.gradle @@ -0,0 +1,10 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") +} + +dependencies { + api(projects.common.model) + api(projects.common.data.static) +} diff --git a/common/data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java similarity index 66% rename from common/data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java index 0b22568f..98b3f49a 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java +++ b/common/data/desktop/src/main/java/net/twisterrob/blt/data/apps/DesktopStaticData.java @@ -1,10 +1,8 @@ package net.twisterrob.blt.data.apps; -import java.io.File; import java.util.*; import net.twisterrob.blt.data.StaticData; -import net.twisterrob.blt.data.statics.DesktopHardcodedStaticData; import net.twisterrob.blt.model.Line; public interface DesktopStaticData extends StaticData { @@ -13,8 +11,4 @@ public interface DesktopStaticData extends StaticData { String getPredictionSummaryRoot(); Map getPredictionSummaryFilenames(); - - File getOut(String path); - - DesktopStaticData INSTANCE = new DesktopHardcodedStaticData(); } diff --git a/common/data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java similarity index 59% rename from common/data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java index b9d7704a..ae725f64 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java +++ b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/DesktopHardcodedStaticData.java @@ -10,39 +10,29 @@ import net.twisterrob.blt.model.Line; public class DesktopHardcodedStaticData extends SharedStaticData implements DesktopStaticData { - private static final String TIMETABLE_ROOT = "../temp/feed15/LULDLRRiverTramCable"; - private static final String DATA_ROOT = "./src/data/PredictionSummary/"; - private static final File OUTPUT_FOLDER = new File("output"); private final Map> m_timetableFilenames = new TimetableFilenames2016().init(); private final Map m_predictionSummaryFilenames = new PredictionSummaryFilenames().init(); - private final String timetableRoot; - private final File outputDir; + private final File timetableRoot; + private final File predictionRoot; - public DesktopHardcodedStaticData() { - timetableRoot = TIMETABLE_ROOT; - outputDir = OUTPUT_FOLDER; - } - public DesktopHardcodedStaticData(String timetableRoot, File outputDir) { + public DesktopHardcodedStaticData(File timetableRoot, File predictionRoot) { this.timetableRoot = timetableRoot; - this.outputDir = outputDir; + this.predictionRoot = predictionRoot; } public String getTimetableRoot() { - return timetableRoot; + return timetableRoot.getAbsolutePath(); } public Map> getTimetableFilenames() { return unmodifiableMap(m_timetableFilenames); } public String getPredictionSummaryRoot() { - return DATA_ROOT; + return predictionRoot.getAbsolutePath(); } public Map getPredictionSummaryFilenames() { return unmodifiableMap(m_predictionSummaryFilenames); } - @Override public File getOut(String path) { - return new File(outputDir, path); - } } diff --git a/common/data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/PredictionSummaryFilenames.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/StaticDataFragment.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2013.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java b/common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java rename to common/data/desktop/src/main/java/net/twisterrob/blt/data/statics/TimetableFilenames2016.java diff --git a/common/data/README.md b/common/data/fake/README.md similarity index 58% rename from common/data/README.md rename to common/data/fake/README.md index e6194c81..aa487884 100644 --- a/common/data/README.md +++ b/common/data/fake/README.md @@ -1,5 +1,5 @@ Fake data can be served via -``` -gradlew :common:data:appRun +```shell +gradlew :common:data:fake:farmRun --no-configuration-cache ``` Change `net.twisterrob.blt.android.App.ALLOW_MOCK_URLS = true` diff --git a/common/data/fake/build.gradle b/common/data/fake/build.gradle new file mode 100644 index 00000000..bc44bfb6 --- /dev/null +++ b/common/data/fake/build.gradle @@ -0,0 +1,20 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java") + id("org.gretty") +} + +// TODO logging doesn't work with org.eclipse nor org.mortbay package names +// -Dorg.mortbay.log.class=org.eclipse.jetty.util.log.StrErrLog changes the logger, but no output +// --debug logs, but too much and not configurable +gretty { // org.akhikhl.gretty.GrettyExtension + //daemon = true + extraResourceBase(rootProject.layout.projectDirectory.dir("data").asFile) + + // + Magic @Delegate org.akhikhl.gretty.ServerConfig through GrettyExtension implements GrettyConfig + httpPort = 8081 + managedClassReload = false + + // + Magic @Delegate org.akhikhl.gretty.WebAppConfig through GrettyExtension implements GrettyConfig + contextPath = "/fake-data" +} diff --git a/common/data/src/main/webapp/WEB-INF/web.xml b/common/data/fake/src/main/webapp/WEB-INF/web.xml similarity index 100% rename from common/data/src/main/webapp/WEB-INF/web.xml rename to common/data/fake/src/main/webapp/WEB-INF/web.xml diff --git a/common/data/lint.xml b/common/data/lint.xml deleted file mode 100644 index 198d194b..00000000 --- a/common/data/lint.xml +++ /dev/null @@ -1,4 +0,0 @@ - - - - diff --git a/common/data/network/build.gradle b/common/data/network/build.gradle new file mode 100644 index 00000000..9e30e03b --- /dev/null +++ b/common/data/network/build.gradle @@ -0,0 +1,55 @@ +import net.twisterrob.travel.DirectoryArgumentProvider +import net.twisterrob.travel.JavaExecExtensions + +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.application") + id("net.twisterrob.gradle.plugin.java") +} + +dependencies { + implementation(projects.common.data.desktop) + implementation(projects.common.feed.feeds) + implementation(projects.common.feed.timetable) + implementation(projects.common.feed.trackernet) + implementation(projects.common.logConsole) + + runtimeOnly(projects.common.androidPolyfill) +} + +application { + mainClass = "net.twisterrob.blt.data.apps.TravelNetworkParser" +} + +Provider outputDir = layout.buildDirectory.dir("output") +tasks.named("run", JavaExec.class) { + Directory timetableRoot = rootProject.layout.projectDirectory.dir("data/feed15/LULDLRRiverTramCable") + Directory predictionRoot = rootProject.layout.projectDirectory.dir("data/PredictionSummary") + argumentProviders.addAll([ + new DirectoryArgumentProvider(provider { timetableRoot }) { + @InputDirectory + @PathSensitive(PathSensitivity.RELATIVE) + @Override Provider getDirectory() { + return super.getDirectory() + } + }, + new DirectoryArgumentProvider(provider { predictionRoot }) { + @InputDirectory + @PathSensitive(PathSensitivity.RELATIVE) + @Override Provider getDirectory() { + return super.getDirectory() + } + }, + new DirectoryArgumentProvider(outputDir) { + @OutputDirectory + @Override Provider getDirectory() { + return super.getDirectory() + } + }, + ]) + enableAssertions = true + JavaExecExtensions.logTo(it, outputDir.map { it.file("run.log") }) +} + +configurations.create("output") +artifacts.output(tasks.named("run").map { outputDir }) diff --git a/common/data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java b/common/data/network/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java similarity index 95% rename from common/data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java rename to common/data/network/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java index f5122163..66ecfb11 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java +++ b/common/data/network/src/main/java/net/twisterrob/blt/data/apps/TravelNetworkParser.java @@ -20,13 +20,17 @@ public class TravelNetworkParser { private static final Logger LOG = LoggerFactory.getLogger(TravelNetworkParser.class); private static DesktopStaticData STATIC_DATA; + private static File outputDir; - public static void main(String[] args) throws Throwable { - if (args.length == 2) { - STATIC_DATA = new DesktopHardcodedStaticData(args[0], new File(args[1]).getAbsoluteFile()); - } else { - STATIC_DATA = new DesktopHardcodedStaticData(); + public static void main(String... args) throws Throwable { + if (args.length != 3) { + throw new IllegalArgumentException("Usage: TravelNetworkParser "); } + STATIC_DATA = new DesktopHardcodedStaticData( + new File(args[0]), + new File(args[1]) + ); + outputDir = new File(args[2]); writeDBScripts(STATIC_DATA.getTimetableFilenames().keySet()); } @@ -74,7 +78,7 @@ protected static Map> getStationCodes(Iterable l continue; } File file = new File(root, fileName); - LOG.info("Reading prediction feed for {} from {}", line, file); + LOG.info("Reading prediction feed for {} from {}", line, file.getAbsoluteFile()); PredictionSummaryFeed feed = reader.readFeed(Feed.TubeDepartureBoardsPredictionSummary, file); feed.setLine(line); feed.applyAliases(); @@ -221,7 +225,7 @@ private static void writeRoutes( } private static PrintWriter out(String fileName) throws FileNotFoundException, UnsupportedEncodingException { - return new PrintWriter(STATIC_DATA.getOut(fileName), "utf-8"); + return new PrintWriter(new File(outputDir, fileName), "utf-8"); } private static void writeStopLine(PrintWriter out, StopPoint stop, Line line, String code) { LOG.trace("StopLine: Line {}, station {} ({}), code {}", line, stop.getName(), stop.getName().hashCode(), code); diff --git a/common/data/output/.gitignore b/common/data/output/.gitignore deleted file mode 100644 index 6fc77830..00000000 --- a/common/data/output/.gitignore +++ /dev/null @@ -1,2 +0,0 @@ -/*.sql -/*.log diff --git a/common/data/postcodes/build.gradle b/common/data/postcodes/build.gradle new file mode 100644 index 00000000..79a89c4c --- /dev/null +++ b/common/data/postcodes/build.gradle @@ -0,0 +1,29 @@ +import net.twisterrob.travel.JavaExecExtensions + +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.application") + id("net.twisterrob.gradle.plugin.java") +} + +dependencies { + implementation("net.twisterrob.lib:twister-lib-general") + implementation(projects.common.data.desktop) +} + +application { + mainClass = "net.twisterrob.blt.data.apps.PostCodeAreas" +} + +Provider outputDir = project.layout.buildDirectory.dir("output") +tasks.named("run", JavaExec.class) { + RegularFile csv = rootProject.layout.projectDirectory.file("data/london.csv.gz") + Provider outputFile = outputDir.map { it.file("LondonTravel.data.AreaHull.sql") } + inputs.file(csv).withPathSensitivity(PathSensitivity.NONE) + args = [ csv.asFile, outputFile.get().asFile ] + enableAssertions = true + JavaExecExtensions.logTo(it, outputDir.map { it.file("run.log") }) +} + +configurations.create("output") +artifacts.output(tasks.named("run").map { outputDir }) diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java b/common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java rename to common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/ConvexHull.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java b/common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java rename to common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCode.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java b/common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java rename to common/data/postcodes/src/main/java/net/twisterrob/blt/data/algo/postcodes/PostCodeComparator.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java b/common/data/postcodes/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java similarity index 79% rename from common/data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java rename to common/data/postcodes/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java index 896e9053..5afaf13d 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java +++ b/common/data/postcodes/src/main/java/net/twisterrob/blt/data/apps/PostCodeAreas.java @@ -10,7 +10,6 @@ import net.twisterrob.java.model.*; public class PostCodeAreas { - private static final DesktopStaticData STATIC_DATA = DesktopStaticData.INSTANCE; private static final ToPos POSER = new ConvexHull.ToPos() { public double getX(PostCode obj) { return obj.getLocation().getLongitude(); @@ -20,17 +19,22 @@ public double getY(PostCode obj) { } }; - public static void main(String[] args) throws Throwable { - List codes = loadData(); + public static void main(String... args) throws Throwable { + if (args.length != 2) { + throw new IllegalArgumentException("Usage: PostCodeAreas "); + } + File postcodesCsvGz = new File(args[0]); + File outputSql = new File(args[1]); + List codes = loadData(postcodesCsvGz); Map> clusters = cluster(codes); for (Entry> cluster : clusters.entrySet()) { cluster.setValue(ConvexHull.convexHull(cluster.getValue(), POSER)); } - writeData(clusters); + writeData(outputSql, clusters); } - protected static void writeData(Map> clusters) throws IOException { - try (PrintWriter out = new PrintWriter(STATIC_DATA.getOut("LondonTravel.data.AreaHull.sql"), "utf-8")) { + protected static void writeData(File outputSql, Map> clusters) throws IOException { + try (PrintWriter out = new PrintWriter(outputSql, "utf-8")) { for (Entry> cluster : clusters.entrySet()) { String area = cluster.getKey(); Location center = ConvexHull.center(cluster.getValue(), POSER); @@ -64,10 +68,10 @@ private static Map> cluster(List codes) { return clusters; } - private static List loadData() throws IOException { + private static List loadData(File postcodesCsvGz) throws IOException { List codes = new ArrayList<>(); try ( - InputStream zip = new GZIPInputStream(new FileInputStream("src/data/london.csv.gz")); + InputStream zip = new GZIPInputStream(new FileInputStream(postcodesCsvGz)); BufferedReader reader = new BufferedReader(new InputStreamReader(zip)) ) { String line; // BR1 1AB,50,540194,169201,E09000006,E05000109 diff --git a/common/data/src/data/.gitignore b/common/data/src/data/.gitignore deleted file mode 100644 index 36445e53..00000000 --- a/common/data/src/data/.gitignore +++ /dev/null @@ -1 +0,0 @@ -/temp diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java b/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java deleted file mode 100644 index caded5fa..00000000 --- a/common/data/src/main/java/net/twisterrob/blt/data/algo/postcodes/Pos.java +++ /dev/null @@ -1,7 +0,0 @@ -package net.twisterrob.blt.data.algo.postcodes; - -public interface Pos { - int getX(); - - int getY(); -} diff --git a/common/data/static/build.gradle b/common/data/static/build.gradle new file mode 100644 index 00000000..21b8f3a1 --- /dev/null +++ b/common/data/static/build.gradle @@ -0,0 +1,11 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + implementation(projects.common.model) + implementation(projects.common.feed.feeds) +} diff --git a/common/model/src/main/java/net/twisterrob/blt/data/SharedStaticData.java b/common/data/static/src/main/java/net/twisterrob/blt/data/SharedStaticData.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/data/SharedStaticData.java rename to common/data/static/src/main/java/net/twisterrob/blt/data/SharedStaticData.java diff --git a/common/model/src/main/java/net/twisterrob/blt/data/StaticData.java b/common/data/static/src/main/java/net/twisterrob/blt/data/StaticData.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/data/StaticData.java rename to common/data/static/src/main/java/net/twisterrob/blt/data/StaticData.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java b/common/data/static/src/main/java/net/twisterrob/blt/data/io/FeedReader.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/io/FeedReader.java rename to common/data/static/src/main/java/net/twisterrob/blt/data/io/FeedReader.java diff --git a/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java b/common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java rename to common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard3ScreenLineColors.java diff --git a/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java b/common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java rename to common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard4ScreenLineColors.java diff --git a/common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java b/common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java rename to common/data/static/src/main/java/net/twisterrob/blt/model/TFLColourStandard6ScreenLineColors.java diff --git a/common/model/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java b/common/data/static/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java rename to common/data/static/src/main/java/net/twisterrob/blt/model/TubeStatusPresentationLineColors.java diff --git a/common/feed/core/build.gradle b/common/feed/core/build.gradle new file mode 100644 index 00000000..cce74e1f --- /dev/null +++ b/common/feed/core/build.gradle @@ -0,0 +1,12 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + api(projects.common.model) + implementation(libs.jsr305) + implementation(libs.slf4j.api) +} diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java b/common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java rename to common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/BaseFeed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java b/common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java rename to common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/BaseFeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java b/common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java rename to common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/FeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java b/common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java rename to common/feed/core/src/main/java/net/twisterrob/blt/io/feeds/FeedXmlDescriptor.java diff --git a/common/model/src/main/java/net/twisterrob/java/io/MailSender.java b/common/feed/core/src/main/java/net/twisterrob/java/io/MailSender.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/java/io/MailSender.java rename to common/feed/core/src/main/java/net/twisterrob/java/io/MailSender.java diff --git a/common/feed/facilities/build.gradle b/common/feed/facilities/build.gradle new file mode 100644 index 00000000..cb8df105 --- /dev/null +++ b/common/feed/facilities/build.gradle @@ -0,0 +1,13 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + api(projects.common.feed.core) + compileOnly(projects.common.androidPolyfill) + implementation(libs.jsr305) + implementation(libs.slf4j.api) +} diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java b/common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java rename to common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java b/common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java rename to common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/FacilitiesFeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java b/common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java rename to common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Facility.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java b/common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java rename to common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Station.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java b/common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java rename to common/feed/facilities/src/main/java/net/twisterrob/blt/io/feeds/facilities/Zone.java diff --git a/common/feed/feeds/build.gradle b/common/feed/feeds/build.gradle new file mode 100644 index 00000000..9f0a22f0 --- /dev/null +++ b/common/feed/feeds/build.gradle @@ -0,0 +1,14 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + api(projects.common.feed.core) + implementation(projects.common.feed.facilities) + implementation(projects.common.feed.trackernet) + implementation(projects.common.feed.timetable) + implementation(libs.jsr305) +} diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/Feed.java b/common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/Feed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/Feed.java rename to common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/Feed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java b/common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java similarity index 83% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java rename to common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java index fd6e736f..d91a0e25 100644 --- a/common/model/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java +++ b/common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/LocalhostUrlBuilder.java @@ -8,8 +8,9 @@ import net.twisterrob.blt.model.Line; public class LocalhostUrlBuilder implements URLBuilder { - private static final String LOCALHOST = "http://1.1.1.15:8081/Data/"; // wifi - // private static final String LOCALHOST = "http://192.168.43.165:8081/"; // tether local + private static final String LOCALHOST = "http://10.0.2.2:8081/fake-data/"; // emulator + //private static final String LOCALHOST = "http://1.1.1.15:8081/fake-data/"; // wifi + //private static final String LOCALHOST = "http://192.168.43.165:8081/"; // tether local @Nonnull @Override public URL getFeedUrl(Feed feed, Map args) throws MalformedURLException { String spec; if (feed.getType() == Feed.Type.Syndication) { diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java b/common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java rename to common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/TFLUrlBuilder.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java b/common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java rename to common/feed/feeds/src/main/java/net/twisterrob/blt/io/feeds/URLBuilder.java diff --git a/common/feed/timetable/build.gradle b/common/feed/timetable/build.gradle new file mode 100644 index 00000000..4832941d --- /dev/null +++ b/common/feed/timetable/build.gradle @@ -0,0 +1,14 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + api(projects.common.feed.core) + compileOnly(projects.common.androidPolyfill) + implementation(libs.jsr305) + implementation(libs.slf4j.api) + implementation("net.twisterrob.lib:twister-lib-java_desktop") +} diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseBidisFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/CollapseRoutesFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRPuddingMillLane2StratfordFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/DLRWestferry2CanaryWharfFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedKmlOut.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableFeedXml.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/JourneyPlannerTimetableHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/Locality.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/MostSimilarLinkDistanceFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/ReverseLinkDistanceFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/Route.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteLink.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/RouteSection.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StationNameFixer.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPoint.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java b/common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java rename to common/feed/timetable/src/main/java/net/twisterrob/blt/io/feeds/timetable/StopPointIterators.java diff --git a/common/feed/trackernet/build.gradle b/common/feed/trackernet/build.gradle new file mode 100644 index 00000000..f5656a63 --- /dev/null +++ b/common/feed/trackernet/build.gradle @@ -0,0 +1,15 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} + +dependencies { + api(projects.common.feed.core) + compileOnly(projects.common.androidPolyfill) + implementation(libs.jsr305) + + testImplementation(projects.common.testHelpers) + testRuntimeOnly(projects.common.androidPolyfill) +} diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedXml.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionDetailedFeedXml.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeed.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedHandler.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/PredictionSummaryFeedXml.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java similarity index 99% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java index 1b4be3bc..99d0145f 100644 --- a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java +++ b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationInconsistencies.java @@ -5,7 +5,6 @@ import static java.util.Collections.*; -import net.twisterrob.blt.io.feeds.Feed; import net.twisterrob.blt.model.Line; import net.twisterrob.java.utils.CollectionTools; @@ -20,6 +19,7 @@ class StationInconsistencies { * Map for each line from how a station is called in the {@link Feed#JourneyPlannerTimetables} * to how it is called in the {@link Feed#TubeDepartureBoards*} feeds. */ + @SuppressWarnings("JavadocReference") private static Map> initAliases() { Map> aliases = new EnumMap<>(Line.class); { diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/StationStatusFeedXml.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/DelayType.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/LineStatus.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Platform.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Station.java diff --git a/common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java b/common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java similarity index 100% rename from common/model/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java rename to common/feed/trackernet/src/main/java/net/twisterrob/blt/io/feeds/trackernet/model/Train.java diff --git a/common/model/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java b/common/feed/trackernet/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java similarity index 100% rename from common/model/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java rename to common/feed/trackernet/src/test/java/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.java diff --git a/common/model/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml b/common/feed/trackernet/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml similarity index 100% rename from common/model/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml rename to common/feed/trackernet/src/test/resources/net/twisterrob/blt/io/feeds/trackernet/LineStatusFeedHandlerTest.xml diff --git a/common/log-console/build.gradle b/common/log-console/build.gradle new file mode 100644 index 00000000..b65b35cf --- /dev/null +++ b/common/log-console/build.gradle @@ -0,0 +1,9 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") +} + +dependencies { + api(libs.slf4j.api) + runtimeOnly(libs.slf4j.simple) +} diff --git a/common/data/src/main/resources/simplelogger.properties b/common/log-console/src/main/resources/simplelogger.properties similarity index 75% rename from common/data/src/main/resources/simplelogger.properties rename to common/log-console/src/main/resources/simplelogger.properties index 8b880da1..3df66a26 100644 --- a/common/data/src/main/resources/simplelogger.properties +++ b/common/log-console/src/main/resources/simplelogger.properties @@ -1,6 +1,7 @@ # The output target which can be the path to a file, or the special values "System.out" and "System.err". Default is "System.err". org.slf4j.simpleLogger.logFile=System.out -# Default log level for all instances of SimpleLogger. Must be one of ("trace", "debug", "info", "warn", or "error"). If not specified, defaults to "info". +# Default log level for all instances of SimpleLogger. +# Must be one of ("trace", "debug", "info", "warn", or "error"). If not specified, defaults to "info". org.slf4j.simpleLogger.defaultLogLevel=trace # Set to true if you want the current date and time to be included in output messages. Default is true org.slf4j.simpleLogger.showDateTime=true @@ -17,7 +18,11 @@ org.slf4j.simpleLogger.showShortLogName=true org.slf4j.simpleLogger.levelInBrackets=true # The string value output for the warn level. Defaults to WARN. org.slf4j.simpleLogger.warnLevelString=WARN -# Logging detail level for a SimpleLogger instance named "a.b.c". Right-side value must be one of "trace", "debug", "info", "warn", or "error". When a SimpleLogger named "a.b.c" is initialized, its level is assigned from this property. If unspecified, the level of nearest parent logger will be used, and if none is set, then the value specified by org.slf4j.simpleLogger.defaultLogLevel will be used. +# Logging detail level for a SimpleLogger instance named "a.b.c". +# Right-side value must be one of "trace", "debug", "info", "warn", or "error". +# When a SimpleLogger named "a.b.c" is initialized, its level is assigned from this property. +# If unspecified, the level of nearest parent logger will be used, +# and if none is set, then the value specified by org.slf4j.simpleLogger.defaultLogLevel will be used. #org.slf4j.simpleLogger.log.a.b.c=level org.slf4j.simpleLogger.log.net.twisterrob.blt.data.apps.TravelNetworkParser=info org.slf4j.simpleLogger.log.net.twisterrob.blt.io.feeds.timetable.StationNameFixer=info diff --git a/common/maptiler/build.gradle b/common/maptiler/build.gradle new file mode 100644 index 00000000..8f9be280 --- /dev/null +++ b/common/maptiler/build.gradle @@ -0,0 +1,6 @@ +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.java-library") + id("net.twisterrob.gradle.plugin.java") + id("com.android.lint") +} diff --git a/common/model/src/main/java/org/maptiler/GlobalGeodetic.java b/common/maptiler/src/main/java/org/maptiler/GlobalGeodetic.java similarity index 100% rename from common/model/src/main/java/org/maptiler/GlobalGeodetic.java rename to common/maptiler/src/main/java/org/maptiler/GlobalGeodetic.java diff --git a/common/model/src/main/java/org/maptiler/GlobalMercator.java b/common/maptiler/src/main/java/org/maptiler/GlobalMercator.java similarity index 100% rename from common/model/src/main/java/org/maptiler/GlobalMercator.java rename to common/maptiler/src/main/java/org/maptiler/GlobalMercator.java diff --git a/common/model/src/main/java/org/maptiler/LatLon.java b/common/maptiler/src/main/java/org/maptiler/LatLon.java similarity index 100% rename from common/model/src/main/java/org/maptiler/LatLon.java rename to common/maptiler/src/main/java/org/maptiler/LatLon.java diff --git a/common/model/src/main/java/org/maptiler/Meters.java b/common/maptiler/src/main/java/org/maptiler/Meters.java similarity index 100% rename from common/model/src/main/java/org/maptiler/Meters.java rename to common/maptiler/src/main/java/org/maptiler/Meters.java diff --git a/common/model/src/main/java/org/maptiler/Pixels.java b/common/maptiler/src/main/java/org/maptiler/Pixels.java similarity index 100% rename from common/model/src/main/java/org/maptiler/Pixels.java rename to common/maptiler/src/main/java/org/maptiler/Pixels.java diff --git a/common/model/src/main/java/org/maptiler/Tile.java b/common/maptiler/src/main/java/org/maptiler/Tile.java similarity index 100% rename from common/model/src/main/java/org/maptiler/Tile.java rename to common/maptiler/src/main/java/org/maptiler/Tile.java diff --git a/common/model/src/main/java/org/maptiler/globalmaptiles.java b/common/maptiler/src/main/java/org/maptiler/globalmaptiles.java similarity index 100% rename from common/model/src/main/java/org/maptiler/globalmaptiles.java rename to common/maptiler/src/main/java/org/maptiler/globalmaptiles.java diff --git a/common/model/src/main/java/org/maptiler/package-info.java b/common/maptiler/src/main/java/org/maptiler/package-info.java similarity index 100% rename from common/model/src/main/java/org/maptiler/package-info.java rename to common/maptiler/src/main/java/org/maptiler/package-info.java diff --git a/common/model/build.gradle b/common/model/build.gradle index 801b5cb5..501c3537 100644 --- a/common/model/build.gradle +++ b/common/model/build.gradle @@ -17,10 +17,3 @@ dependencies { testImplementation(projects.common.testHelpers) testRuntimeOnly(projects.common.androidPolyfill) } - -lint { - checkAllWarnings = true - warningsAsErrors = true - lintConfig = rootProject.file("config/lint/lint.xml") - enable += "StopShip" -} diff --git a/common/test-helpers/build.gradle b/common/test-helpers/build.gradle index c194b101..ee6c0816 100644 --- a/common/test-helpers/build.gradle +++ b/common/test-helpers/build.gradle @@ -14,5 +14,5 @@ dependencies { } api(libs.test.mockito) api(libs.test.gwen) - runtimeOnly(libs.slf4j.simple) + implementation(projects.common.logConsole) } diff --git a/config/lint/lint-baseline-android-component-map.xml b/config/lint/lint-baseline-android-component-map.xml new file mode 100644 index 00000000..d218b6a7 --- /dev/null +++ b/config/lint/lint-baseline-android-component-map.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-data-static.xml b/config/lint/lint-baseline-common-data-static.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-data-static.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-feed-core.xml b/config/lint/lint-baseline-common-feed-core.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-feed-core.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-feed-facilities.xml b/config/lint/lint-baseline-common-feed-facilities.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-feed-facilities.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-feed-feeds.xml b/config/lint/lint-baseline-common-feed-feeds.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-feed-feeds.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-feed-timetable.xml b/config/lint/lint-baseline-common-feed-timetable.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-feed-timetable.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-feed-trackernet.xml b/config/lint/lint-baseline-common-feed-trackernet.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-feed-trackernet.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-maptiler.xml b/config/lint/lint-baseline-common-maptiler.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-maptiler.xml @@ -0,0 +1,4 @@ + + + + diff --git a/config/lint/lint-baseline-common-model.xml b/config/lint/lint-baseline-common-model.xml new file mode 100644 index 00000000..8c0f2820 --- /dev/null +++ b/config/lint/lint-baseline-common-model.xml @@ -0,0 +1,4 @@ + + + + diff --git a/data/.gitignore b/data/.gitignore new file mode 100644 index 00000000..e119ff1b --- /dev/null +++ b/data/.gitignore @@ -0,0 +1,2 @@ +/temp/ +/feed15/ diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml b/data/PredictionDetailed/PredictionDetailed-C-BNK.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-C-BNK.xml rename to data/PredictionDetailed/PredictionDetailed-C-BNK.xml diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml b/data/PredictionDetailed/PredictionDetailed-H-KXX.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-H-KXX.xml rename to data/PredictionDetailed/PredictionDetailed-H-KXX.xml diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml b/data/PredictionDetailed/PredictionDetailed-M-KXX.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-M-KXX.xml rename to data/PredictionDetailed/PredictionDetailed-M-KXX.xml diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml b/data/PredictionDetailed/PredictionDetailed-N-KXX.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-N-KXX.xml rename to data/PredictionDetailed/PredictionDetailed-N-KXX.xml diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml b/data/PredictionDetailed/PredictionDetailed-P-KXX.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-P-KXX.xml rename to data/PredictionDetailed/PredictionDetailed-P-KXX.xml diff --git a/common/data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml b/data/PredictionDetailed/PredictionDetailed-V-KXX.xml similarity index 100% rename from common/data/src/data/PredictionDetailed/PredictionDetailed-V-KXX.xml rename to data/PredictionDetailed/PredictionDetailed-V-KXX.xml diff --git a/common/data/src/data/PredictionDetailed/descript.ion b/data/PredictionDetailed/descript.ion similarity index 100% rename from common/data/src/data/PredictionDetailed/descript.ion rename to data/PredictionDetailed/descript.ion diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-B.xml b/data/PredictionSummary/PredictionSummary-B.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-B.xml rename to data/PredictionSummary/PredictionSummary-B.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-C.xml b/data/PredictionSummary/PredictionSummary-C.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-C.xml rename to data/PredictionSummary/PredictionSummary-C.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-D.xml b/data/PredictionSummary/PredictionSummary-D.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-D.xml rename to data/PredictionSummary/PredictionSummary-D.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-H.xml b/data/PredictionSummary/PredictionSummary-H.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-H.xml rename to data/PredictionSummary/PredictionSummary-H.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-J.xml b/data/PredictionSummary/PredictionSummary-J.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-J.xml rename to data/PredictionSummary/PredictionSummary-J.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-M.xml b/data/PredictionSummary/PredictionSummary-M.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-M.xml rename to data/PredictionSummary/PredictionSummary-M.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-N.xml b/data/PredictionSummary/PredictionSummary-N.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-N.xml rename to data/PredictionSummary/PredictionSummary-N.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-P.xml b/data/PredictionSummary/PredictionSummary-P.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-P.xml rename to data/PredictionSummary/PredictionSummary-P.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-V.xml b/data/PredictionSummary/PredictionSummary-V.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-V.xml rename to data/PredictionSummary/PredictionSummary-V.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary-W.xml b/data/PredictionSummary/PredictionSummary-W.xml similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary-W.xml rename to data/PredictionSummary/PredictionSummary-W.xml diff --git a/common/data/src/data/PredictionSummary/PredictionSummary.cmd b/data/PredictionSummary/PredictionSummary.cmd similarity index 100% rename from common/data/src/data/PredictionSummary/PredictionSummary.cmd rename to data/PredictionSummary/PredictionSummary.cmd diff --git a/common/data/src/data/PredictionSummary/descript.ion b/data/PredictionSummary/descript.ion similarity index 100% rename from common/data/src/data/PredictionSummary/descript.ion rename to data/PredictionSummary/descript.ion diff --git a/common/data/src/data/Readme.txt b/data/Readme.txt similarity index 100% rename from common/data/src/data/Readme.txt rename to data/Readme.txt diff --git a/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml b/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml similarity index 100% rename from common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly.xml rename to data/TrackerNetStatus/LineStatus.IncidentsOnly.xml diff --git a/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml b/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml similarity index 100% rename from common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml rename to data/TrackerNetStatus/LineStatus.IncidentsOnly_empty.xml diff --git a/common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml b/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml similarity index 100% rename from common/data/src/data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml rename to data/TrackerNetStatus/LineStatus.IncidentsOnly_night.xml diff --git a/common/data/src/data/TrackerNetStatus/LineStatus.xmas.xml b/data/TrackerNetStatus/LineStatus.xmas.xml similarity index 100% rename from common/data/src/data/TrackerNetStatus/LineStatus.xmas.xml rename to data/TrackerNetStatus/LineStatus.xmas.xml diff --git a/common/data/src/data/TrackerNetStatus/LineStatus.xml b/data/TrackerNetStatus/LineStatus.xml similarity index 100% rename from common/data/src/data/TrackerNetStatus/LineStatus.xml rename to data/TrackerNetStatus/LineStatus.xml diff --git a/common/data/src/data/TrackerNetStatus/descript.ion b/data/TrackerNetStatus/descript.ion similarity index 100% rename from common/data/src/data/TrackerNetStatus/descript.ion rename to data/TrackerNetStatus/descript.ion diff --git a/common/data/src/data/descript.ion b/data/descript.ion similarity index 100% rename from common/data/src/data/descript.ion rename to data/descript.ion diff --git a/common/data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml b/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml similarity index 100% rename from common/data/src/data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml rename to data/feed.aspx_email=papp.robert.s@gmail.com&feedId=16.xml diff --git a/common/data/src/data/london.csv.gz b/data/london.csv.gz similarity index 100% rename from common/data/src/data/london.csv.gz rename to data/london.csv.gz diff --git a/common/data/src/data/samples/PierLocations_v1.kml b/data/samples/PierLocations_v1.kml similarity index 100% rename from common/data/src/data/samples/PierLocations_v1.kml rename to data/samples/PierLocations_v1.kml diff --git a/common/data/src/data/samples/StationFacilitiessample.xml b/data/samples/StationFacilitiessample.xml similarity index 100% rename from common/data/src/data/samples/StationFacilitiessample.xml rename to data/samples/StationFacilitiessample.xml diff --git a/common/data/src/data/samples/Stations.kml b/data/samples/Stations.kml similarity index 100% rename from common/data/src/data/samples/Stations.kml rename to data/samples/Stations.kml diff --git a/common/data/src/data/samples/descript.ion b/data/samples/descript.ion similarity index 100% rename from common/data/src/data/samples/descript.ion rename to data/samples/descript.ion diff --git a/common/data/src/data/schemas/PierLocations_v1.xsd b/data/schemas/PierLocations_v1.xsd similarity index 100% rename from common/data/src/data/schemas/PierLocations_v1.xsd rename to data/schemas/PierLocations_v1.xsd diff --git a/common/data/src/data/schemas/StationLocations_v1.xsd b/data/schemas/StationLocations_v1.xsd similarity index 100% rename from common/data/src/data/schemas/StationLocations_v1.xsd rename to data/schemas/StationLocations_v1.xsd diff --git a/common/data/src/data/schemas/descript.ion b/data/schemas/descript.ion similarity index 100% rename from common/data/src/data/schemas/descript.ion rename to data/schemas/descript.ion diff --git a/desktop/routes/build.gradle b/desktop/routes/build.gradle new file mode 100644 index 00000000..d683c33c --- /dev/null +++ b/desktop/routes/build.gradle @@ -0,0 +1,44 @@ +import net.twisterrob.travel.DirectoryArgumentProvider + +plugins { + id("net.twisterrob.blt.convention") + id("org.gradle.application") + id("net.twisterrob.gradle.plugin.java") +} + +dependencies { + implementation(projects.common.feed.feeds) + implementation(projects.common.feed.timetable) + implementation(projects.common.data.desktop) + implementation(projects.common.logConsole) + runtimeOnly(projects.common.androidPolyfill) + implementation(libs.jsr305) +} + +application { + mainClass = "net.twisterrob.blt.data.apps.DisplayLine" +} + +tasks.named("run", JavaExec.class) { + Directory timetableRoot = rootProject.layout.projectDirectory.dir("data/feed15/LULDLRRiverTramCable") + Directory predictionRoot = rootProject.layout.projectDirectory.dir("data/PredictionSummary") + // Use gradlew ...:run --args "Bakerloo Northern" to override. + args = [ "DLR" ] + argumentProviders.addAll([ + new DirectoryArgumentProvider(provider { timetableRoot }) { + @InputDirectory + @PathSensitive(PathSensitivity.RELATIVE) + @Override Provider getDirectory() { + return super.getDirectory() + } + }, + new DirectoryArgumentProvider(provider { predictionRoot }) { + @InputDirectory + @PathSensitive(PathSensitivity.RELATIVE) + @Override Provider getDirectory() { + return super.getDirectory() + } + }, + ]) + enableAssertions = true +} diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/FeedProcessor.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/Node.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java similarity index 100% rename from common/data/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/algo/routes/RouteInfo.java diff --git a/common/data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java similarity index 68% rename from common/data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java index a799eeba..e6d47de8 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java +++ b/desktop/routes/src/main/java/net/twisterrob/blt/data/apps/DisplayLine.java @@ -1,19 +1,32 @@ package net.twisterrob.blt.data.apps; +import java.io.File; import java.util.*; import java.util.Map.Entry; import net.twisterrob.blt.data.algo.routes.*; import net.twisterrob.blt.data.io.FeedReader; +import net.twisterrob.blt.data.statics.DesktopHardcodedStaticData; import net.twisterrob.blt.data.ui.LineDisplay; import net.twisterrob.blt.io.feeds.Feed; import net.twisterrob.blt.io.feeds.timetable.*; import net.twisterrob.blt.model.Line; public class DisplayLine { - private static final DesktopStaticData STATIC_DATA = DesktopStaticData.INSTANCE; + private static DesktopStaticData STATIC_DATA; public static void main(String[] args) throws Throwable { - for (String arg : args) { + System.out.println(Arrays.asList(args)); + if (args.length < 3) { + System.err.println("Usage: DisplayLine "); + System.exit(2); + } + File timetableRoot = new File(args[args.length - 2]); + File predictionRoot = new File(args[args.length - 1]); + STATIC_DATA = new DesktopHardcodedStaticData(timetableRoot, predictionRoot); + List lines = new ArrayList<>(Arrays.asList(args)); + lines.remove(lines.size() - 1); + lines.remove(lines.size() - 1); + for (String arg : lines) { Line line = Line.valueOf(arg); display(line); } @@ -28,7 +41,8 @@ private static void display(Line line) throws java.io.IOException, org.xml.sax.S System.out.printf(Locale.ROOT, "\033[1;35m%s\033[0m (\033[35m%s\033[0m)%n", feed.getLine(), feed.getOperator().getTradingName()); List routes = FeedProcessor.reconstruct(feed); - new LineDisplay(feed.getLine(), routes, "Centrale Tramlink Stop", "Reeves Corner", "Wellesley Road Tram Stop") + String[] highlights = { "Centrale Tramlink Stop", "Reeves Corner", "Wellesley Road Tram Stop" }; + new LineDisplay(feed.getLine(), routes, STATIC_DATA.getLineColors(), highlights) .setVisible(true); } diff --git a/common/data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java similarity index 83% rename from common/data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java index 9ddbf072..6e97fccf 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java +++ b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/LineDisplay.java @@ -7,7 +7,6 @@ import javax.swing.*; import javax.swing.event.*; -import net.twisterrob.blt.data.apps.DesktopStaticData; import net.twisterrob.blt.io.feeds.timetable.*; import net.twisterrob.blt.model.*; @@ -18,10 +17,10 @@ public class LineDisplay extends JFrame { protected RouteDrawer routeLine; protected List highlights; - public LineDisplay(JourneyPlannerTimetableFeed feed, String... highlights) { - this(feed.getLine(), feed.getRoutes(), highlights); + public LineDisplay(JourneyPlannerTimetableFeed feed, LineColors lineColors, String... highlights) { + this(feed.getLine(), feed.getRoutes(), lineColors, highlights); } - public LineDisplay(final Line line, List routes, String... highlights) { + public LineDisplay(final Line line, List routes, LineColors lineColors, String... highlights) { super(line.getTitle()); setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE); setPreferredSize(new Dimension(1024, 800)); @@ -33,13 +32,13 @@ public LineDisplay(final Line line, List routes, String... highlights) { Container panel = getContentPane(); panel.setLayout(new BorderLayout()); - routeLine = new RouteDrawer(line, null, this.highlights); + routeLine = new RouteDrawer(lineColors, line, null, this.highlights); routeLine.setBorder(BorderFactory.createEmptyBorder(5, 35, 5, 35)); panel.add(routeLine, BorderLayout.SOUTH); list = new JList<>(routes.toArray(new Route[routes.size()])); list.setSelectionMode(ListSelectionModel.SINGLE_SELECTION); - list.setCellRenderer(new LineRouteCellRenderer(line)); + list.setCellRenderer(new LineRouteCellRenderer(lineColors, line)); list.addListSelectionListener(new ListSelectionListener() { @Override public void valueChanged(ListSelectionEvent e) { if (e.getValueIsAdjusting()) { @@ -55,7 +54,7 @@ public LineDisplay(final Line line, List routes, String... highlights) { ScrollPaneConstants.HORIZONTAL_SCROLLBAR_NEVER); panel.add(scroll, BorderLayout.WEST); - routeMap = new RouteMapDrawer(stopPoints, line, null, this.highlights); + routeMap = new RouteMapDrawer(lineColors, stopPoints, line, null, this.highlights); routeMap.setBorder(BorderFactory.createEmptyBorder(10, 10, 10, 10)); panel.add(routeMap, BorderLayout.CENTER); @@ -68,8 +67,7 @@ private static final class LineRouteCellRenderer extends DefaultListCellRenderer private final Color fg; private final Color bg; - LineRouteCellRenderer(Line line) { - LineColors colors = DesktopStaticData.INSTANCE.getLineColors(); + LineRouteCellRenderer(LineColors colors, Line line) { fg = new Color(line.getForeground(colors)); bg = new Color(line.getBackground(colors)); } diff --git a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java similarity index 93% rename from common/data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java index 4b44cbb3..c0dd9e24 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java +++ b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteComponent.java @@ -16,7 +16,7 @@ public abstract class RouteComponent extends JPanel { private Route route; private List highlights; - private LineColors colors = DesktopStaticData.INSTANCE.getLineColors(); + private final LineColors colors; protected Color lineColor; protected Color lineHighlight; @@ -24,7 +24,8 @@ public abstract class RouteComponent extends JPanel { private static final int outerRadius = 18; private static final int innerRadius = 12; - public RouteComponent(Line line, Route route, List highlights) { + public RouteComponent(LineColors lineColors, Line line, Route route, List highlights) { + this.colors = lineColors; setLine(line); setRoute(route); setHighlights(highlights); diff --git a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java similarity index 94% rename from common/data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java index 1838f354..5ab26b90 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java +++ b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteDrawer.java @@ -5,6 +5,7 @@ import net.twisterrob.blt.io.feeds.timetable.*; import net.twisterrob.blt.model.Line; +import net.twisterrob.blt.model.LineColors; import net.twisterrob.java.exceptions.WTF; class RouteDrawer extends RouteComponent { @@ -19,8 +20,8 @@ class RouteDrawer extends RouteComponent { private static final int textDistance = 10; private static final int internalPadding = 25; - public RouteDrawer(Line line, Route route, List highlights) { - super(line, route, highlights); + public RouteDrawer(LineColors lineColors, Line line, Route route, List highlights) { + super(lineColors, line, route, highlights); setPreferredSize(new Dimension(-1, 100)); setBackground(Color.WHITE); } diff --git a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java similarity index 94% rename from common/data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java rename to desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java index 4043d385..a5932e0c 100644 --- a/common/data/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java +++ b/desktop/routes/src/main/java/net/twisterrob/blt/data/ui/RouteMapDrawer.java @@ -6,6 +6,7 @@ import net.twisterrob.blt.io.feeds.timetable.*; import net.twisterrob.blt.model.Line; +import net.twisterrob.blt.model.LineColors; import net.twisterrob.java.exceptions.WTF; import net.twisterrob.java.model.*; @@ -22,8 +23,8 @@ class RouteMapDrawer extends RouteComponent { private static final Stroke lineStroke = new BasicStroke(4); private static final int stopRadius = 10; - public RouteMapDrawer(Set stations, Line line, Route route, List highlights) { - super(line, route, highlights); + public RouteMapDrawer(LineColors lineColors, Set stations, Line line, Route route, List highlights) { + super(lineColors, line, route, highlights); setStations(stations); } diff --git a/gradle/libs.versions.toml b/gradle/libs.versions.toml index 398cb361..d75cdda8 100644 --- a/gradle/libs.versions.toml +++ b/gradle/libs.versions.toml @@ -15,6 +15,7 @@ sqlite-jdbc = "3.44.1.0" glide = "3.8.0" androidx-swiperefreshlayout = "1.1.0" +androidx-fragment = "1.6.2" slf4j = "2.0.9" # https://logging.apache.org/log4j/2.x/release-notes.html @@ -66,6 +67,7 @@ kxml2 = { module = "net.sf.kxml:kxml2", version.ref = "kxml2" } sqlite-jdbc = { module = "org.xerial:sqlite-jdbc", version.ref = "sqlite-jdbc" } glide = { module = "com.github.bumptech.glide:glide", version.ref = "glide" } +androidx-fragment = { module = "androidx.fragment:fragment", version.ref = "androidx-fragment" } androidx-swiperefreshlayout = { module = "androidx.swiperefreshlayout:swiperefreshlayout", version.ref = "androidx-swiperefreshlayout" } slf4j-api = { module = "org.slf4j:slf4j-api", version.ref = "slf4j" } diff --git a/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle b/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle index 56173328..a1cbf12c 100644 --- a/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle +++ b/gradle/plugins/src/main/groovy/net.twisterrob.blt.convention.gradle @@ -25,6 +25,16 @@ pluginManager.withPlugin("com.android.base") { } } +pluginManager.withPlugin("com.android.lint") { + lint { + checkAllWarnings = true + warningsAsErrors = true + lintConfig = rootProject.file("config/lint/lint.xml") + baseline = rootProject.file("config/lint/lint-baseline${project.path.replace(":", "-")}.xml") + enable += "StopShip" + } +} + if (project.gradle.startParameter.isConfigurationCacheRequested()) { // TODEL https://github.com/TWiStErRob/net.twisterrob.gradle/issues/511 project.plugins.withId("com.android.application") { diff --git a/gradle/plugins/src/main/java/net/twisterrob/travel/DirectoryArgumentProvider.java b/gradle/plugins/src/main/java/net/twisterrob/travel/DirectoryArgumentProvider.java new file mode 100644 index 00000000..6f9bfd33 --- /dev/null +++ b/gradle/plugins/src/main/java/net/twisterrob/travel/DirectoryArgumentProvider.java @@ -0,0 +1,25 @@ +package net.twisterrob.travel; + +import java.util.List; + +import org.gradle.api.file.Directory; +import org.gradle.api.provider.Provider; +import org.gradle.process.CommandLineArgumentProvider; + +public abstract class DirectoryArgumentProvider implements CommandLineArgumentProvider { + + private final Provider directory; + + public DirectoryArgumentProvider(Provider directory) { + this.directory = directory; + } + + public Provider getDirectory() { + return directory; + } + + @Override + public Iterable asArguments() { + return List.of(directory.get().getAsFile().getAbsolutePath()); + } +} diff --git a/gradle/plugins/src/main/java/net/twisterrob/travel/JavaExecExtensions.java b/gradle/plugins/src/main/java/net/twisterrob/travel/JavaExecExtensions.java new file mode 100644 index 00000000..5e00f67a --- /dev/null +++ b/gradle/plugins/src/main/java/net/twisterrob/travel/JavaExecExtensions.java @@ -0,0 +1,38 @@ +package net.twisterrob.travel; + +import java.io.IOException; +import java.nio.file.Files; +import java.nio.file.Path; + +import org.gradle.api.Action; +import org.gradle.api.Task; +import org.gradle.api.file.RegularFile; +import org.gradle.api.provider.Provider; +import org.gradle.api.tasks.JavaExec; + +public class JavaExecExtensions { + + public static void logTo(JavaExec task, Provider logFile) { + task.doFirst(action((JavaExec it) -> { + Path log = logFile.get().getAsFile().toPath(); + try { + Files.createDirectories(log.getParent()); + it.setStandardOutput(Files.newOutputStream(log)); + } catch (IOException e) { + throw new RuntimeException(e); + } + })); + task.doLast(action((JavaExec it) -> { + try { + task.getStandardOutput().close(); + } catch (IOException e) { + throw new RuntimeException(e); + } + })); + } + + @SuppressWarnings("unchecked") + private static Action action(Action action) { + return (Action)(Action)action; + } +} diff --git a/settings.gradle b/settings.gradle index ac80c100..0e1cb9cb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -19,22 +19,27 @@ rootProject.name = "net-twisterrob-blt" include(":android:app:full") include(":android:app:range") include(":android:component:android") -//include(":android:component:map") +include(":android:component:map") include(":android:component:data") include(":android:component:theme") include(":android:feature:range") include(":common:android-polyfill") -include(":common:data") -//include(":common:data:network") -//include(":common:data:routes") -//include(":common:data:postcodes") +include(":common:data:desktop") +include(":common:data:fake") +include(":common:data:network") +include(":common:data:postcodes") +include(":common:data:static") include(":common:diff") -//include(":common:feed:timetable") -//include(":common:feed:trackernet") -//include(":common:feed:facilities") +include(":common:feed:core") +include(":common:feed:feeds") +include(":common:feed:facilities") +include(":common:feed:timetable") +include(":common:feed:trackernet") +include(":common:log-console") include(":common:model") +include(":common:maptiler") include(":common:test-helpers") -//include(":desktop:routes") +include(":desktop:routes") include(":web:status-history") enableFeaturePreviewQuietly(settings, "TYPESAFE_PROJECT_ACCESSORS", "Type-safe project accessors") diff --git a/web/status-history/build.gradle b/web/status-history/build.gradle index c44d4e21..15ccbcb6 100644 --- a/web/status-history/build.gradle +++ b/web/status-history/build.gradle @@ -22,7 +22,9 @@ dependencies { runtimeOnly(libs.micronaut.jackson) implementation(libs.micronaut.handlebars) - implementation(projects.common.model) + implementation(projects.common.data.static) + implementation(projects.common.feed.feeds) + implementation(projects.common.feed.trackernet) runtimeOnly(projects.common.androidPolyfill) implementation(projects.common.diff)