build.gradle: remove product flavors

This commit is contained in:
Andreas Schildbach 2024-06-12 17:53:44 +02:00
parent d92615efd9
commit b0ea770ba3
9 changed files with 5 additions and 90 deletions

View file

@ -48,4 +48,4 @@ RUN if [ -e /dev/fuse ] ; \
# export build output # export build output
FROM scratch AS export-stage FROM scratch AS export-stage
COPY --from=build-stage /home/builder/project/oeffi/build/outputs/apk/*/release/oeffi-*-release-unsigned.apk / COPY --from=build-stage /home/builder/project/oeffi/build/outputs/apk/release/oeffi-release-unsigned.apk /

View file

@ -53,18 +53,6 @@ android {
} }
} }
flavorDimensions 'flavor'
productFlavors {
aosp {
dimension 'flavor'
versionNameSuffix '-aosp'
}
google {
dimension 'flavor'
versionNameSuffix '-google'
}
}
sourceSets { sourceSets {
main { main {
manifest.srcFile 'AndroidManifest.xml' manifest.srcFile 'AndroidManifest.xml'
@ -75,12 +63,6 @@ android {
test { test {
java.srcDirs = ['test'] java.srcDirs = ['test']
} }
aosp {
java.srcDirs = ['src-aosp']
}
google {
java.srcDirs = ['src-google']
}
} }
compileOptions { compileOptions {

View file

@ -1,21 +0,0 @@
/*
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.schildbach.oeffi;
public class Variants {
}

View file

@ -1,21 +0,0 @@
/*
* Copyright the original author or authors.
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
package de.schildbach.oeffi;
public class Variants {
}

View file

@ -197,13 +197,4 @@ public class Application extends android.app.Application {
public static final int versionCode(final Application application) { public static final int versionCode(final Application application) {
return application.packageInfo().versionCode; return application.packageInfo().versionCode;
} }
public static final String versionFlavor(final Application application) {
final String applicationVersion = versionName(application);
final int applicationVersionSplit = applicationVersion.indexOf('-');
if (applicationVersionSplit >= 0)
return applicationVersion.substring(applicationVersionSplit + 1);
else
return null;
}
} }

View file

@ -50,8 +50,7 @@ public abstract class OeffiActivity extends ComponentActivity {
this.application = (Application) getApplication(); this.application = (Application) getApplication();
this.prefs = PreferenceManager.getDefaultSharedPreferences(this); this.prefs = PreferenceManager.getDefaultSharedPreferences(this);
ErrorReporter.getInstance().check(this, applicationVersionCode(), applicationVersionFlavor(), ErrorReporter.getInstance().check(this, applicationVersionCode(), application.okHttpClient());
application.okHttpClient());
} }
protected void updateFragments(final int listFrameResId, final int mapFrameResId) { protected void updateFragments(final int listFrameResId, final int mapFrameResId) {
@ -100,10 +99,6 @@ public abstract class OeffiActivity extends ComponentActivity {
return Application.versionCode(application); return Application.versionCode(application);
} }
protected final String applicationVersionFlavor() {
return Application.versionFlavor(application);
}
protected final long applicationFirstInstallTime() { protected final long applicationFirstInstallTime() {
return application.packageInfo().firstInstallTime; return application.packageInfo().firstInstallTime;
} }

View file

@ -341,18 +341,11 @@ public abstract class OeffiMainActivity extends OeffiActivity {
private void downloadAndProcessMessages(final String network) { private void downloadAndProcessMessages(final String network) {
final HttpUrl.Builder remoteUrl = Constants.MESSAGES_BASE_URL.newBuilder(); final HttpUrl.Builder remoteUrl = Constants.MESSAGES_BASE_URL.newBuilder();
final StringBuilder remoteFileName = new StringBuilder("messages"); remoteUrl.addPathSegment("messages.txt");
final String flavor = applicationVersionFlavor();
if (flavor != null)
remoteFileName.append('-').append(flavor);
remoteFileName.append(".txt");
remoteUrl.addPathSegment(remoteFileName.toString());
final String installerPackageName = Installer.installerPackageName(this); final String installerPackageName = Installer.installerPackageName(this);
if (installerPackageName != null) if (installerPackageName != null)
remoteUrl.addEncodedQueryParameter("installer", installerPackageName); remoteUrl.addEncodedQueryParameter("installer", installerPackageName);
remoteUrl.addQueryParameter("version", Integer.toString(versionCode)); remoteUrl.addQueryParameter("version", Integer.toString(versionCode));
if (flavor != null)
remoteUrl.addQueryParameter("flavor", flavor);
remoteUrl.addQueryParameter("sdk", Integer.toString(Build.VERSION.SDK_INT)); remoteUrl.addQueryParameter("sdk", Integer.toString(Build.VERSION.SDK_INT));
remoteUrl.addQueryParameter("task", taskName()); remoteUrl.addQueryParameter("task", taskName());
final File localFile = new File(getFilesDir(), "messages.txt"); final File localFile = new File(getFilesDir(), "messages.txt");

View file

@ -315,15 +315,12 @@ public class ErrorReporter implements Thread.UncaughtExceptionHandler {
private final static Pattern PATTERN_VERSION = Pattern.compile("<dt id=\"(\\d+)\">([^<]*)</dt>"); private final static Pattern PATTERN_VERSION = Pattern.compile("<dt id=\"(\\d+)\">([^<]*)</dt>");
public void check(final Context context, final int applicationVersionCode, final String applicationVersionFlavor, public void check(final Context context, final int applicationVersionCode, final OkHttpClient okHttpClient) {
final OkHttpClient okHttpClient) {
if (!stackTraceFile.exists()) if (!stackTraceFile.exists())
return; return;
final HttpUrl.Builder url = HttpUrl.parse(context.getString(R.string.about_changelog_summary)).newBuilder(); final HttpUrl.Builder url = HttpUrl.parse(context.getString(R.string.about_changelog_summary)).newBuilder();
url.addQueryParameter("version", Integer.toString(applicationVersionCode)); url.addQueryParameter("version", Integer.toString(applicationVersionCode));
if (applicationVersionFlavor != null)
url.addQueryParameter("flavor", applicationVersionFlavor);
url.addQueryParameter("sdk", Integer.toString(Build.VERSION.SDK_INT)); url.addQueryParameter("sdk", Integer.toString(Build.VERSION.SDK_INT));
url.addQueryParameter("check", null); url.addQueryParameter("check", null);
final Request.Builder request = new Request.Builder().url(url.build()); final Request.Builder request = new Request.Builder().url(url.build());

View file

@ -9,8 +9,7 @@ if (GradleVersion.current() < minGradleVersion || GradleVersion.current() >= max
throw new GradleScriptException("build requires Gradle between ${minGradleVersion.version} (including) and ${maxGradleVersion.version} (excluding)", null) throw new GradleScriptException("build requires Gradle between ${minGradleVersion.version} (including) and ${maxGradleVersion.version} (excluding)", null)
gradle.startParameter.excludedTaskNames << "lint" gradle.startParameter.excludedTaskNames << "lint"
gradle.startParameter.excludedTaskNames << ":oeffi:lintVitalAospRelease" gradle.startParameter.excludedTaskNames << ":oeffi:lintVitalRelease"
gradle.startParameter.excludedTaskNames << ":oeffi:lintVitalGoogleRelease"
include 'oeffi' include 'oeffi'
include 'public-transport-enabler' include 'public-transport-enabler'