diff --git a/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml b/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml index baaffefe9..a0953635c 100644 --- a/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml +++ b/.cicdtemplate/.github/workflows/deploy_staging_and_production_to_firebase_app_distribution.yml @@ -14,7 +14,7 @@ jobs: timeout-minutes: 30 steps: - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '11' @@ -42,7 +42,7 @@ jobs: run: ./gradlew detekt - name: Archive Detekt reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: DetektReports path: build/reports/detekt/ @@ -51,7 +51,7 @@ jobs: run: ./gradlew koverHtmlReport - name: Archive code coverage reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CodeCoverageReports path: app/build/reports/kover/ diff --git a/.cicdtemplate/.github/workflows/review_pull_request.yml b/.cicdtemplate/.github/workflows/review_pull_request.yml index f55242a58..ad4b6c135 100644 --- a/.cicdtemplate/.github/workflows/review_pull_request.yml +++ b/.cicdtemplate/.github/workflows/review_pull_request.yml @@ -11,7 +11,7 @@ jobs: timeout-minutes: 30 steps: - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '11' diff --git a/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml b/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml index 7ebf8ec9a..e30955ce0 100644 --- a/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml +++ b/.cicdtemplate/.github/workflows/run_detekt_and_unit_tests.yml @@ -17,7 +17,7 @@ jobs: timeout-minutes: 30 steps: - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '11' @@ -45,7 +45,7 @@ jobs: run: ./gradlew detekt - name: Archive Detekt reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: DetektReports path: build/reports/detekt/ @@ -54,7 +54,7 @@ jobs: run: ./gradlew koverHtmlReport - name: Archive code coverage reports - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 if: always() with: name: CodeCoverageReports diff --git a/.github/workflows/review_pull_request.yml b/.github/workflows/review_pull_request.yml index 7e195f546..fe2bd09cc 100644 --- a/.github/workflows/review_pull_request.yml +++ b/.github/workflows/review_pull_request.yml @@ -12,7 +12,7 @@ jobs: environment: template-compose steps: - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '11' @@ -47,6 +47,12 @@ jobs: # template-compose + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + - name: Run Detekt on template-compose working-directory: ./template-compose run: ./gradlew detekt diff --git a/.github/workflows/run_detekt_and_unit_tests.yml b/.github/workflows/run_detekt_and_unit_tests.yml index 29be22547..73e2ec814 100644 --- a/.github/workflows/run_detekt_and_unit_tests.yml +++ b/.github/workflows/run_detekt_and_unit_tests.yml @@ -8,12 +8,6 @@ jobs: runs-on: ubuntu-latest timeout-minutes: 30 steps: - - name: Set up JDK 11 - uses: actions/setup-java@v2 - with: - distribution: 'temurin' - java-version: '11' - - name: Checkout source code uses: actions/checkout@v2.3.2 @@ -28,36 +22,20 @@ jobs: restore-keys: | ${{ runner.os }}-gradle- - # template-xml - - - name: Run Detekt on template-xml - working-directory: ./template-xml - run: ./gradlew detekt - - - name: Archive Detekt reports on template-xml - uses: actions/upload-artifact@v2 - with: - name: DetektReportsTemplateXML - path: template-xml/build/reports/detekt/ - - - name: Run unit tests with Kover on template-xml - working-directory: ./template-xml - run: ./gradlew koverHtmlReport + # template-compose - - name: Archive code coverage reports on template-xml - uses: actions/upload-artifact@v2 + - name: Set up JDK 17 + uses: actions/setup-java@v3 with: - name: CodeCoverageReportsTemplateXML - path: template-xml/app/build/reports/kover/ - - # template-compose + distribution: 'temurin' + java-version: '17' - name: Run Detekt on template-compose working-directory: ./template-compose run: ./gradlew detekt - name: Archive Detekt reports on template-compose - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: DetektReportsTemplateCompose path: template-compose/build/reports/detekt/ @@ -67,11 +45,39 @@ jobs: run: ./gradlew koverHtmlReport - name: Archive code coverage reports on template-compose - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CodeCoverageReportsTemplateCompose path: template-compose/app/build/reports/kover/ + # template-xml + + - name: Set up JDK 11 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '11' + + - name: Run Detekt on template-xml + working-directory: ./template-xml + run: ./gradlew detekt + + - name: Archive Detekt reports on template-xml + uses: actions/upload-artifact@v3 + with: + name: DetektReportsTemplateXML + path: template-xml/build/reports/detekt/ + + - name: Run unit tests with Kover on template-xml + working-directory: ./template-xml + run: ./gradlew koverHtmlReport + + - name: Archive code coverage reports on template-xml + uses: actions/upload-artifact@v3 + with: + name: CodeCoverageReportsTemplateXML + path: template-xml/app/build/reports/kover/ + # sample-xml - name: Run Detekt on sample-xml @@ -79,7 +85,7 @@ jobs: run: ./gradlew detekt - name: Archive Detekt reports on sample-xml - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: DetektReportsTemplateXML path: sample-xml/build/reports/detekt/ @@ -89,7 +95,7 @@ jobs: run: ./gradlew koverHtmlReport - name: Archive code coverage reports on sample-xml - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CodeCoverageReportsTemplateXML path: sample-xml/app/build/reports/kover/ @@ -101,7 +107,7 @@ jobs: run: ./gradlew detekt - name: Archive Detekt reports on sample-compose - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: DetektReportsTemplateCompose path: sample-compose/build/reports/detekt/ @@ -111,7 +117,7 @@ jobs: run: ./gradlew koverHtmlReport - name: Archive code coverage reports on sample-compose - uses: actions/upload-artifact@v2 + uses: actions/upload-artifact@v3 with: name: CodeCoverageReportsTemplateCompose path: sample-compose/app/build/reports/kover/ diff --git a/.github/workflows/verify_newproject_script.yml b/.github/workflows/verify_newproject_script.yml index 509b65270..5443e55f7 100644 --- a/.github/workflows/verify_newproject_script.yml +++ b/.github/workflows/verify_newproject_script.yml @@ -12,7 +12,7 @@ jobs: timeout-minutes: 30 steps: - name: Set up JDK 11 - uses: actions/setup-java@v2 + uses: actions/setup-java@v3 with: distribution: 'temurin' java-version: '11' @@ -44,6 +44,12 @@ jobs: working-directory: scripts run: kscript new_project.kts package-name=co.myxmlproject.example app-name="My XML Project" template=xml + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + distribution: 'temurin' + java-version: '17' + - name: Verify generating new project from template-compose working-directory: scripts run: kscript new_project.kts package-name=co.mycomposeproject.example app-name="My Compose Project" template=compose diff --git a/scripts/new_project.kts b/scripts/new_project.kts index 299496412..4fa3125d6 100644 --- a/scripts/new_project.kts +++ b/scripts/new_project.kts @@ -388,6 +388,16 @@ object NewProject { newValue = appName ) } + File(projectPath) + .walk() + .filter { it.name == "settings.gradle.kts" } + .forEach { filePath -> + rename( + sourcePath = filePath.toString(), + oldValue = templateAppName, + newValue = appName + ) + } } private fun rename(sourcePath: String, oldValue: String, newValue: String) { diff --git a/template-compose/app/build.gradle.kts b/template-compose/app/build.gradle.kts index 7c5ad7765..ed899e49b 100644 --- a/template-compose/app/build.gradle.kts +++ b/template-compose/app/build.gradle.kts @@ -1,3 +1,5 @@ +import org.jetbrains.kotlin.konan.properties.loadProperties + plugins { id(Plugins.ANDROID_APPLICATION) id(Plugins.KOTLIN_ANDROID) @@ -7,7 +9,7 @@ plugins { id(Plugins.KOVER) } -val keystoreProperties = rootDir.loadGradleProperties("signing.properties") +val signingProperties = loadProperties("$rootDir/signing.properties") val getVersionCode: () -> Int = { if (project.hasProperty("versionCode")) { (project.property("versionCode") as String).toInt() @@ -17,13 +19,29 @@ val getVersionCode: () -> Int = { } android { + namespace = "co.nimblehq.template.compose" + compileSdk = Versions.ANDROID_COMPILE_SDK + + defaultConfig { + applicationId = "co.nimblehq.template.compose" + minSdk = Versions.ANDROID_MIN_SDK + targetSdk = Versions.ANDROID_TARGET_SDK + versionCode = getVersionCode() + versionName = Versions.ANDROID_VERSION_NAME + + testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" + vectorDrawables { + useSupportLibrary = true + } + } + signingConfigs { create(BuildTypes.RELEASE) { // Remember to edit signing.properties to have the correct info for release build. storeFile = file("../config/release.keystore") - storePassword = keystoreProperties.getProperty("KEYSTORE_PASSWORD") as String - keyPassword = keystoreProperties.getProperty("KEY_PASSWORD") as String - keyAlias = keystoreProperties.getProperty("KEY_ALIAS") as String + storePassword = signingProperties.getProperty("KEYSTORE_PASSWORD") as String + keyPassword = signingProperties.getProperty("KEY_PASSWORD") as String + keyAlias = signingProperties.getProperty("KEY_ALIAS") as String } getByName(BuildTypes.DEBUG) { @@ -34,18 +52,8 @@ android { } } - compileSdk = Versions.ANDROID_COMPILE_SDK - defaultConfig { - applicationId = "co.nimblehq.template.compose" - minSdk = Versions.ANDROID_MIN_SDK - targetSdk = Versions.ANDROID_TARGET_SDK - versionCode = getVersionCode() - versionName = Versions.ANDROID_VERSION_NAME - testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" - } - buildTypes { - getByName(BuildTypes.RELEASE) { + release { isMinifyEnabled = true isDebuggable = false isShrinkResources = true @@ -54,7 +62,7 @@ android { buildConfigField("String", "BASE_API_URL", "\"https://jsonplaceholder.typicode.com/\"") } - getByName(BuildTypes.DEBUG) { + debug { // For quickly testing build with proguard, enable this isMinifyEnabled = false signingConfig = signingConfigs[BuildTypes.DEBUG] @@ -76,20 +84,27 @@ android { } compileOptions { - sourceCompatibility = JavaVersion.VERSION_11 - targetCompatibility = JavaVersion.VERSION_11 + sourceCompatibility = JavaVersion.VERSION_17 + targetCompatibility = JavaVersion.VERSION_17 } kotlinOptions { - jvmTarget = JavaVersion.VERSION_11.toString() + jvmTarget = JavaVersion.VERSION_17.toString() + } + + buildFeatures { + compose = true + buildConfig = true } composeOptions { kotlinCompilerExtensionVersion = Versions.COMPOSE_COMPILER } - buildFeatures { - compose = true + packaging { + resources { + excludes += "/META-INF/{AL2.0,LGPL2.1}" + } } lint { diff --git a/template-compose/app/src/debug/AndroidManifest.xml b/template-compose/app/src/debug/AndroidManifest.xml index c10e37a53..95ab02920 100644 --- a/template-compose/app/src/debug/AndroidManifest.xml +++ b/template-compose/app/src/debug/AndroidManifest.xml @@ -1,6 +1,5 @@ - + diff --git a/template-compose/app/src/main/AndroidManifest.xml b/template-compose/app/src/main/AndroidManifest.xml index 1bae8bf99..cfb421214 100644 --- a/template-compose/app/src/main/AndroidManifest.xml +++ b/template-compose/app/src/main/AndroidManifest.xml @@ -1,20 +1,25 @@ + xmlns:tools="http://schemas.android.com/tools"> + android:theme="@style/AppTheme" + tools:targetApi="31"> - + diff --git a/template-compose/app/src/main/res/drawable/ic_launcher_background.xml b/template-compose/app/src/main/res/drawable/ic_launcher_background.xml index a339898ee..07d5da9cb 100644 --- a/template-compose/app/src/main/res/drawable/ic_launcher_background.xml +++ b/template-compose/app/src/main/res/drawable/ic_launcher_background.xml @@ -5,7 +5,7 @@ android:viewportWidth="108" android:viewportHeight="108"> - + diff --git a/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml b/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml index 6b78462d6..b3e26b4c6 100644 --- a/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml +++ b/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml @@ -2,4 +2,5 @@ + diff --git a/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml b/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml index 6b78462d6..b3e26b4c6 100644 --- a/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml +++ b/template-compose/app/src/main/res/mipmap-anydpi-v26/ic_launcher_round.xml @@ -2,4 +2,5 @@ + diff --git a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.png b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.png deleted file mode 100644 index a2f590828..000000000 Binary files a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.webp b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.webp new file mode 100644 index 000000000..c209e78ec Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher.webp differ diff --git a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.png b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.png deleted file mode 100644 index 1b5239980..000000000 Binary files a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp new file mode 100644 index 000000000..b2dfe3d1b Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-hdpi/ic_launcher_round.webp differ diff --git a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.png b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.png deleted file mode 100644 index ff10afd6e..000000000 Binary files a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.webp b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.webp new file mode 100644 index 000000000..4f0f1d64e Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher.webp differ diff --git a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.png b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.png deleted file mode 100644 index 115a4c768..000000000 Binary files a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp new file mode 100644 index 000000000..62b611da0 Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-mdpi/ic_launcher_round.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.png b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.png deleted file mode 100644 index dcd3cd808..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.webp b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.webp new file mode 100644 index 000000000..948a3070f Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png deleted file mode 100644 index 459ca609d..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp new file mode 100644 index 000000000..1b9a6956b Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xhdpi/ic_launcher_round.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.png b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.png deleted file mode 100644 index 8ca12fe02..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp new file mode 100644 index 000000000..28d4b77f9 Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png deleted file mode 100644 index 8e19b410a..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp new file mode 100644 index 000000000..9287f5083 Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png deleted file mode 100644 index b824ebdd4..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp new file mode 100644 index 000000000..aa7d6427e Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher.webp differ diff --git a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png deleted file mode 100644 index 4c19a13c2..000000000 Binary files a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png and /dev/null differ diff --git a/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp new file mode 100644 index 000000000..9126ae37c Binary files /dev/null and b/template-compose/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.webp differ diff --git a/template-compose/app/src/main/res/values/styles.xml b/template-compose/app/src/main/res/values/styles.xml deleted file mode 100644 index 7f0dc7802..000000000 --- a/template-compose/app/src/main/res/values/styles.xml +++ /dev/null @@ -1,4 +0,0 @@ - - -