Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Rework module structure and split up flavored Android apps #30

Merged
merged 27 commits into from
Dec 12, 2023
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
967a2f7
Move buildSrc to explicit included build
TWiStErRob Dec 5, 2023
e4f1689
Move modules
TWiStErRob Dec 9, 2023
42c998e
Move modules v2
TWiStErRob Dec 9, 2023
167bf48
Extract range module
TWiStErRob Dec 9, 2023
71d6ee3
Use convention plugins to reduce duplication
TWiStErRob Dec 10, 2023
2b45748
Make application namespaces specific
TWiStErRob Dec 10, 2023
b89a97b
Isolate problematic App references
TWiStErRob Dec 10, 2023
38f57ae
Suppress MissingPermission lint
TWiStErRob Dec 10, 2023
2ce5c02
Inject dependencies
TWiStErRob Dec 10, 2023
f65620b
Extract database module
TWiStErRob Dec 10, 2023
e03e5aa
Rename range2 to range
TWiStErRob Dec 10, 2023
f03cea4
Code review
TWiStErRob Dec 10, 2023
dc6cc35
Build database once
TWiStErRob Dec 10, 2023
8a96a52
Work around LambdaLast, BuildConfig is not a functional interface
TWiStErRob Dec 10, 2023
35303e6
Fix recursive build problem
TWiStErRob Dec 10, 2023
c86d0b7
Merge branch 'main' into modules
TWiStErRob Dec 11, 2023
5778a49
Diagnose `build` task and its dependencies not executing
TWiStErRob Dec 11, 2023
21ba4c6
Self-protect
TWiStErRob Dec 11, 2023
b004fa4
Add missing baselines
TWiStErRob Dec 12, 2023
257c7f3
Rename /Android/ to /android/
TWiStErRob Dec 12, 2023
6b39d11
Disable scan
TWiStErRob Dec 12, 2023
afed0c2
Fix lint issues
TWiStErRob Dec 12, 2023
b3eb7c4
Move stringers to module and reuse in both apps.
TWiStErRob Dec 12, 2023
e108c50
Rework workaround of https://issuetracker.google.com/issues/312677256
TWiStErRob Dec 12, 2023
2ed4af5
Merge branch 'main' into modules
TWiStErRob Dec 12, 2023
dd513fa
Code review
TWiStErRob Dec 12, 2023
f5417fb
Final touches
TWiStErRob Dec 12, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
5 changes: 4 additions & 1 deletion .github/workflows/CI-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,20 +50,22 @@ jobs:
--continue
--no-build-cache
build
:AppEngine:appengineStage
:web:status-history:appengineStage

- name: "Upload 'Unit Test Results' artifact."
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: 'Unit Test Results'
if-no-files-found: error
path: ${{ github.workspace }}/**/build/reports/tests/*/

- name: "Upload 'Android Lint Results' artifact."
if: success() || failure()
uses: actions/upload-artifact@v3
with:
name: 'Android Lint Results'
if-no-files-found: error
path: ${{ github.workspace }}/**/build/reports/lint-results*

- name: "Publish 'Unit Results' check suite."
Expand All @@ -81,6 +83,7 @@ jobs:
uses: actions/upload-artifact@v3
with:
name: 'APKs'
if-no-files-found: error
path: |
${{ github.workspace }}/**/build/outputs/apk/
${{ github.workspace }}/**/build/outputs/mapping/
Expand Down
106 changes: 0 additions & 106 deletions Android/build.gradle

This file was deleted.

20 changes: 0 additions & 20 deletions Android/src/main/java/net/twisterrob/android/map/MapFragment.java

This file was deleted.

37 changes: 0 additions & 37 deletions Android/src/range/AndroidManifest.xml

This file was deleted.

3 changes: 0 additions & 3 deletions Android/src/range/res/values/overrides.xml

This file was deleted.

5 changes: 0 additions & 5 deletions Android/src/rangeDebug/res/values/overrides.xml

This file was deleted.

10 changes: 0 additions & 10 deletions Shared/diff/build.gradle

This file was deleted.

30 changes: 30 additions & 0 deletions android/app/full/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
plugins {
id("net.twisterrob.travel.android-app")
}

dependencies {
implementation(projects.android.component.android)
implementation(projects.android.component.data)
implementation(projects.android.component.theme)
implementation(projects.android.feature.range)
implementation("net.twisterrob.lib:twister-lib-android-monolith")
implementation("net.twisterrob.lib:twister-lib-android-basics")
implementation("net.twisterrob.lib:twister-lib-android-slf4j")
implementation("net.twisterrob.lib:twister-lib-android-stringers")

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

android {
defaultConfig {
applicationId = "net.twisterrob.blt"
version {
major = 1
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,14 @@
android:value="@integer/google_play_services_version" />

<provider
android:name=".ui.StationSuggestProvider"
android:name="net.twisterrob.blt.android.ui.StationSuggestProvider"
android:authorities="${applicationId}.suggest_station"
android:exported="false"
android:syncable="false"
/>

<activity
android:name=".ui.activity.main.MainActivity"
android:name="net.twisterrob.blt.android.ui.activity.main.MainActivity"
android:exported="true"
android:label="@string/app_name"
tools:ignore="RedundantLabel"
Expand All @@ -49,7 +49,7 @@
</activity>

<activity
android:name=".ui.activity.StatusActivity"
android:name="net.twisterrob.blt.android.ui.activity.StatusActivity"
android:exported="false"
android:label="@string/launcher__line_status"
>
Expand All @@ -59,7 +59,7 @@
</activity>

<activity
android:name=".ui.activity.PredictionSummaryActivity"
android:name="net.twisterrob.blt.android.ui.activity.PredictionSummaryActivity"
android:exported="false"
android:label="@string/launcher__prediction_summary"
>
Expand All @@ -69,7 +69,7 @@
</activity>

<activity
android:name=".ui.activity.StationListActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationListActivity"
android:exported="false"
android:label="@string/launcher__station_list"
>
Expand All @@ -85,7 +85,7 @@
</activity>

<activity
android:name=".ui.activity.StationInfoActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationInfoActivity"
android:exported="false"
android:label="@string/launcher__station_info"
>
Expand All @@ -95,7 +95,7 @@
</activity>

<activity
android:name=".ui.activity.StationMapsActivity"
android:name="net.twisterrob.blt.android.ui.activity.StationMapsActivity"
android:exported="false"
android:label="@string/launcher__station_map"
>
Expand All @@ -105,7 +105,7 @@
</activity>

<activity
android:name=".ui.activity.PostCodesActivity"
android:name="net.twisterrob.blt.android.ui.activity.PostCodesActivity"
android:exported="false"
android:label="@string/launcher__postcode_map"
>
Expand All @@ -115,7 +115,7 @@
</activity>

<activity
android:name=".ui.activity.RangeMapActivity"
android:name="net.twisterrob.blt.android.ui.activity.RangeMapActivity"
android:exported="false"
android:label="@string/launcher__range_map"
android:theme="@style/AppTheme.NoActionBar"
Expand All @@ -126,4 +126,5 @@
</activity>

</application>

</manifest>
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,18 @@
import androidx.annotation.NonNull;
import android.widget.Toast;

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.android.AndroidConstants;
import net.twisterrob.android.app.BaseApp;
import net.twisterrob.android.log.AndroidLoggerFactory;
import net.twisterrob.android.utils.concurrent.*;
import net.twisterrob.android.utils.tostring.stringers.detailed.*;
import net.twisterrob.blt.android.app.full.BuildConfig;
import net.twisterrob.blt.android.data.*;
import net.twisterrob.blt.android.db.DataBaseHelper;
import net.twisterrob.blt.io.feeds.*;
import net.twisterrob.java.utils.tostring.StringerRepo;

public class App extends BaseApp {
public class App extends BaseApp implements Injector.Provider {
static {
AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.android\\.(.+\\.)?", "");
AndroidLoggerFactory.addReplacement("^net\\.twisterrob\\.blt\\.(.+\\.)?", "");
Expand Down Expand Up @@ -48,15 +44,12 @@ public App() {

@Override public void onCreate() {
super.onCreate();
StringerRepo.INSTANCE.register(Status.class, new StatusStringer());
StringerRepo.INSTANCE.register(Place.class, new PlaceStringer());
StringerRepo.INSTANCE.register(LatLng.class, new LatLngStringer());
StringerRepo.INSTANCE.register(LatLngBounds.class, new LatLngBoundsStringer());
Stringers.register(StringerRepo.INSTANCE);
m_static = new AndroidDBStaticData(db());
}

@Override protected Object createDatabase() {
DataBaseHelper db = new DataBaseHelper(this);
DataBaseHelper db = new DataBaseHelper(this, BuildConfig.DEBUG);
@SuppressWarnings({"unused", "deprecation"}) // TODO https://github.com/TWiStErRob/net.twisterrob.travel/issues/15
Object task = new BackgroundExecution(new Runnable() {
@Override public void run() {
Expand Down Expand Up @@ -92,4 +85,14 @@ public static void sendMail(String body) {
}
}.execute(body);
}

@SuppressWarnings("deprecation")
@Override public Injector injector() {
return new net.twisterrob.blt.android.feature.range.Injector(
new BuildConfigWrapper(),
m_static,
db(),
prefs()
);
}
}
Loading