8000 build: [ANDROAPP-6951] remove flavors [skip size] by Balcan · Pull Request #4076 · dhis2/dhis2-android-capture-app · GitHub
[go: up one dir, main page]
More Web Proxy on the site http://driver.im/
Skip to content

build: [ANDROAPP-6951] remove flavors [skip size] #4076

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

Merged
merged 7 commits into from
Apr 4, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension .kts  (1)


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/build-release-candidate.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:
fileName: 'dhis_keystore.jks'
encodedString: ${{ secrets.KEYSTORE }}
- name: build prod
run: ./gradlew app:assembleDhisRelease
run: ./gradlew app:assembleDhis2Release
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
Expand All @@ -62,4 +62,4 @@ jobs:
uses: actions/upload-artifact@v4.6.1
with:
name: ${{ env.repository_name }} - Android APK
path: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk
path: ${{ env.main_project_module }}/build/outputs/apk/dhis2/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk
4 changes: 2 additions & 2 deletions .github/workflows/continuous-delivery.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ jobs:

# Create APK Debug
- name: Build apk debug project (APK) - ${{ env.main_project_module }} module
run: ./gradlew assembleDhisDebug
run: ./gradlew assembleDhis2Debug

- name: Read version name from file
working-directory: ./gradle
Expand All @@ -56,4 +56,4 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: ${{ env.repository_name }} - Android APK - ${{ steps.date.outputs.date }}
path: ${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk
path: ${{ env.main_project_module }}/build/outputs/apk/dhis2/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk
6 changes: 3 additions & 3 deletions .github/workflows/deploy-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
fileName: 'dhis_keystore.jks'
encodedString: ${{ secrets.KEYSTORE }}
- name: Build release apk
run: ./gradlew app:assembleRelease app:assembleDhisDebug
run: ./gradlew app:assembleRelease app:assembleDhis2Debug
env:
SENTRY_DSN: ${{ secrets.SENTRY_DSN }}
SIGNING_KEY_ALIAS: ${{ secrets.KEY_ALIAS }}
Expand All @@ -59,7 +59,7 @@ jobs:
with:
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }}
packageName: com.dhis2
releaseFiles: ${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk
releaseFiles: ${{ env.main_project_module }}/build/outputs/apk/dhis2PlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk
track: production
status: inProgress
whatsNewDirectory: whatsnew
Expand All @@ -74,4 +74,4 @@ jobs:
bodyFile: "RELEASE.md"
name: "Android Capture App for DHIS 2 (v${{ inputs.release_tag_name }})"
tag: ${{ inputs.release_tag_name }}
artifacts: ${{ env.main_project_module }}/build/outputs/apk/dhis/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk,${{ env.main_project_module }}/build/outputs/apk/dhisPlayServices/release/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk,${{ env.main_project_module }}/build/outputs/apk/dhis/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk
artifacts: ${{ env.main_project_module }}/build/outputs/apk/dhis2/release/dhis2-v${{ steps.read-version.outputs.vName }}.apk,${{ env.main_project_module }}/build/outputs/apk/dhis2PlayServices/dhis2-v${{ steps.read-version.outputs.vName }}-googlePlay.apk,${{ env.main_project_module }}/build/outputs/apk/dhis2/debug/dhis2-v${{ steps.read-version.outputs.vName }}-training.apk
6 changes: 3 additions & 3 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ pipeline {
steps {
script {
echo 'Building UI APKs'
sh './gradlew :app:assembleDhisUITestingDebug :app:assembleDhisUITestingDebugAndroidTest :compose-table:assembleAndroidTest :form:assembleAndroidTest'
sh './gradlew :app:assembleDhis2Debug :app:assembleDhis2DebugAndroidTest :form:assembleAndroidTest'
}
}
}
Expand All @@ -108,7 +108,7 @@ pipeline {
stage('Deploy and Run UI Tests') {
environment {
BROWSERSTACK = credentials('android-browserstack')
app_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/dhisUITesting -iname "*.apk"')
app_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/dhis2/debug -iname "*.apk"')
test_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/androidTest -iname "*.apk"')
app_apk_path = "${env.WORKSPACE}/${app_apk}"
test_apk_path = "${env.WORKSPACE}/${test_apk}"
Expand All @@ -132,7 +132,7 @@ pipeline {
}
environment {
BROWSERSTACK = credentials('android-browserstack')
app_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/dhisUITesting -iname "*.apk"')
app_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/dhis2/debug -iname "*.apk"')
test_apk = sh(returnStdout: true, script: 'find app/build/outputs/apk/androidTest -iname "*.apk"')
app_apk_path = "${env.WORKSPACE}/${app_apk}"
10000 test_apk_path = "${env.WORKSPACE}/${test_apk}"
Expand Down
29 changes: 6 additions & 23 deletions app/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
@file:Suppress("UnstableApiUsage")

import com.android.build.api.variant.impl.VariantOutputImpl
import com.android.build.gradle.internal.scope.ProjectInfo.Companion.getBaseName
import org.jetbrains.kotlin.gradle.dsl.JvmTarget
import java.io.ByteArrayOutputStream
import java.text.SimpleDateFormat
Expand Down Expand Up @@ -157,26 +158,8 @@ android {
flavorDimensions += listOf("default")

productFlavors {
create("dhis") {
applicationId = "com.dhis2"
dimension = "default"
versionCode = libs.versions.vCode.get().toInt()
versionName = libs.versions.vName.get()
}

create("dhisPlayServices") {
applicationId = "com.dhis2"
dimension = "default"
versionCode = libs.versions.vCode.get().toInt()
versionName = libs.versions.vName.get()
}

create("dhisUITesting") {
applicationId = "com.dhis2"
dimension = "default"
versionCode = libs.versions.vCode.get().toInt()
versionName = libs.versions.vName.get()
}
create("dhis2")
create("dhis2PlayServices")
}

compileOptions {
Expand Down Expand Up @@ -286,8 +269,8 @@ dependencies {

coreLibraryDesugaring(libs.desugar)

"dhisPlayServicesImplementation"(libs.google.auth)
"dhisPlayServicesImplementation"(libs.google.auth.apiphone)
"dhis2PlayServicesImplementation"(libs.google.auth)
"dhis2PlayServicesImplementation"(libs.google.auth.apiphone)

kapt(libs.dagger.compiler)
kapt(libs.dagger.hilt.android.compiler)
Expand Down
10000
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dhis2

import android.content.Context
import androidx.test.platform.app.InstrumentationRegistry
import timber.log.Timber
import java.io.File
import java.io.FileOutputStream
Expand All @@ -19,9 +20,11 @@ class DBTestLoader(private val context: Context) {
return
}
try {
val input = context.assets.open("databases/$DB_NAME_TEST")
val input = InstrumentationRegistry.getInstrumentation()
.context.assets.open("databases/$DB_NAME_TEST")
val output = FileOutputStream("$databasePath/$DB_NAME")
writeExtractedFileToDisk(input, output)
Timber.d("Database copy done")
} catch (e: IOException) {
Timber.e(Throwable("Could not load testing database"))
}
Expand All @@ -47,4 +50,4 @@ class DBTestLoader(private val context: Context) {
const val DB_NAME_TEST = "dhis_test.db"
const val DB_NAME = "127-0-0-1-8080_android_unencrypted.db"
}
}
}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.dhis2.common.di

import android.content.Context
import androidx.test.platform.app.InstrumentationRegistry
import org.dhis2.DBTestLoader
import org.dhis2.common.FileReader
import org.dhis2.common.featureConfig.FeatureConfigRobot
Expand Down Expand Up @@ -36,8 +37,8 @@ class TestingInjector {
fun providesFeatureConfigRobot(): FeatureConfigRobot {
return FeatureConfigRobot(FeatureConfigRepositoryImpl(D2Manager.getD2()))
}
fun providesMockWebserverRobot(context: Context): MockWebServerRobot {
return MockWebServerRobot(Dhis2MockServer(FileReader(context), 8080))
fun providesMockWebserverRobot(testContext: Context): MockWebServerRobot {
return MockWebServerRobot(Dhis2MockServer(FileReader(testContext), 8080))
}
fun provideDBImporter(context: Context): DBTestLoader {
return DBTestLoader(context)
Expand Down
6 changes: 4 additions & 2 deletions app/src/androidTest/java/org/dhis2/usescases/BaseTest.kt
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@ open class BaseTest {

@JvmField
protected var context: Context = InstrumentationRegistry.getInstrumentation().targetContext
private var testContext = InstrumentationRegistry.getInstrumentation().context
private var isIntentsEnable = false
private lateinit var keyStoreRobot: KeyStoreRobot
lateinit var preferencesRobot: PreferencesRobot
Expand All @@ -59,7 +60,8 @@ open class BaseTest {
var permissionRule = if (Build.VERSION.SDK_INT > Build.VERSION_CODES.R) {
GrantPermissionRule.grant(
android.Manifest.permission.ACCESS_FINE_LOCATION,
android.Manifest.permission.CAMERA
android.Manifest.permission.CAMERA,
android.Manifest.permission.POST_NOTIFICATIONS
)
} else {
GrantPermissionRule.grant(
Expand All @@ -81,7 +83,7 @@ open class BaseTest {
TestingInjector.apply {
keyStoreRobot = providesKeyStoreRobot(context)
preferencesRobot = providesPreferencesRobot(context)
mockWebServerRobot = providesMockWebserverRobot(context)
mockWebServerRobot = providesMockWebserverRobot(testContext)
featureConfigRobot = providesFeatureConfigRobot()
}
}
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,9 +1,11 @@
package org.dhis2.usescases.main

import androidx.compose.ui.semantics.getOrNull
import androidx.compose.ui.test.ExperimentalTestApi
import androidx.compose.ui.test.SemanticsMatcher
import androidx.compose.ui.test.assert
import androidx.compose.ui.test.assertIsDisplayed
import androidx.compose.ui.test.hasTestTag
import androidx.compose.ui.test.junit4.ComposeTestRule
import androidx.compose.ui.test.onNodeWithTag
import androidx.test.espresso.Espresso.onView
Expand Down Expand Up @@ -63,7 +65,9 @@ class MainRobot : BaseRobot() {
Intents.intended(allOf(IntentMatchers.hasComponent(LoginActivity::class.java.name)))
}

@OptIn(ExperimentalTestApi::class)
fun checkHomeIsDisplayed(composeTestRule: ComposeTestRule) {
composeTestRule.waitUntilAtLeastOneExists(hasTestTag(HOME_ITEMS))
composeTestRule.onNodeWithTag(HOME_ITEMS).assertIsDisplayed()
}

Expand Down

This file was deleted.

File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,28 +1,3 @@
/*
* Copyright (c) 2004 - 2019, University of Oslo
* All rights reserved.
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
* list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
* this list of conditions and the following disclaimer in the documentation
* and/or other materials provided with the distribution.
* Neither the name of the HISP project nor the names of its contributors may
* be used to endorse or promote products derived from this software without
* specific prior written permission.
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/

package org.dhis2.utils.granularsync

import android.content.Context
Expand Down
4 changes: 4 additions & 0 deletions app/src/dhis2playServices/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest>

</manifest>
4 changes: 0 additions & 4 deletions app/src/dhisPlayServices/AndroidManifest.xml

This file was deleted.

This file was deleted.

Loading
Loading
0