diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 01406d99ec..132b0fe915 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,7 @@ jobs: permissions: actions: read contents: read + packages: write strategy: fail-fast: false @@ -75,9 +76,21 @@ jobs: - name: Check with Gradle run: ./gradlew check --scan --full-stacktrace + - name: Publish Maven packages to GitHub Packages + if: ${{ github.event_name == 'push' }} + run: ./gradlew publish + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + REPOSITORY_URL: 'https://maven.pkg.github.com/google/android-fhir' + # Use SNAPSHOT Prefix to follow Maven convention + ARTIFACT_VERSION_SUFFIX: SNAPSHOT + - name: Release artifacts to local repo run: ./gradlew publishReleasePublicationToCIRepository --scan - - name: Upload maven repo + env: + ARTIFACT_VERSION_SUFFIX: build_${{ github.run_id }} + + - name: Upload artifact maven-repository.zip uses: actions/upload-artifact@v4 with: name: maven-repository @@ -118,7 +131,7 @@ jobs: - name: Setup GitHub Pages if: ${{ github.event_name == 'push' }} - uses: actions/configure-pages@v4 + uses: actions/configure-pages@v5 - name: Upload site/ directory as GitHub Pages artifact if: ${{ github.event_name == 'push' }} diff --git a/buildSrc/build.gradle.kts b/buildSrc/build.gradle.kts index 4dec42c493..0f48d57a24 100644 --- a/buildSrc/build.gradle.kts +++ b/buildSrc/build.gradle.kts @@ -19,5 +19,5 @@ dependencies { implementation("com.spotify.ruler:ruler-gradle-plugin:1.4.0") implementation("ca.uhn.hapi.fhir:hapi-fhir-structures-r4:6.10.0") - implementation("com.squareup:kotlinpoet:1.15.3") + implementation("com.squareup:kotlinpoet:1.17.0") } diff --git a/buildSrc/src/main/kotlin/Releases.kt b/buildSrc/src/main/kotlin/Releases.kt index 69ed05d2de..89e5b6c34d 100644 --- a/buildSrc/src/main/kotlin/Releases.kt +++ b/buildSrc/src/main/kotlin/Releases.kt @@ -119,20 +119,33 @@ fun Project.publishArtifact(artifact: LibraryArtifact) { licenses { license { name.set("The Apache License, Version 2.0") - url.set("http://www.apache.org/licenses/LICENSE-2.0.txt") + url.set("https://www.apache.org/licenses/LICENSE-2.0.txt") } } } repositories { maven { name = "CI" - url = uri("file://${rootProject.buildDir}/ci-repo") + url = + if (System.getenv("REPOSITORY_URL") != null) { + // REPOSITORY_URL is defined in .github/workflows/build.yml + uri(System.getenv("REPOSITORY_URL")) + } else { + uri("file://${rootProject.buildDir}/ci-repo") + } version = if (project.providers.environmentVariable("GITHUB_ACTIONS").isPresent) { - "${artifact.version}-build_${System.getenv("GITHUB_RUN_ID")}" + // ARTIFACT_VERSION_SUFFIX is defined in .github/workflows/build.yml + "${artifact.version}-${System.getenv("ARTIFACT_VERSION_SUFFIX")}" } else { artifact.version } + if (System.getenv("GITHUB_TOKEN") != null) { + credentials { + username = System.getenv("GITHUB_ACTOR") + password = System.getenv("GITHUB_TOKEN") + } + } } } } diff --git a/catalog/build.gradle.kts b/catalog/build.gradle.kts index 3287f3b4d8..2e1fe9a966 100644 --- a/catalog/build.gradle.kts +++ b/catalog/build.gradle.kts @@ -22,8 +22,8 @@ android { buildTypes { release { - isMinifyEnabled = false - proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt")) + isMinifyEnabled = true + proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), "proguard-rules.pro") } } compileOptions { diff --git a/catalog/proguard-rules.pro b/catalog/proguard-rules.pro new file mode 100644 index 0000000000..0deded0be5 --- /dev/null +++ b/catalog/proguard-rules.pro @@ -0,0 +1,21 @@ +# Add project specific ProGuard rules here. +# You can control the set of applied configuration files using the +# proguardFiles setting in build.gradle.kts +# +# For more details, see +# http://developer.android.com/guide/developing/tools/proguard.html + +# If your project uses WebView with JS, uncomment the following +# and specify the fully qualified class name to the JavaScript interface +# class: +#-keepclassmembers class fqcn.of.javascript.interface.for.webview { +# public *; +#} + +# Uncomment this to preserve the line number information for +# debugging stack traces. +#-keepattributes SourceFile,LineNumberTable + +# If you keep the line number information, uncomment this to +# hide the original source file name. +#-renamesourcefileattribute SourceFile diff --git a/catalog/src/main/java/com/google/android/fhir/catalog/ModalBottomSheetFragment.kt b/catalog/src/main/java/com/google/android/fhir/catalog/ModalBottomSheetFragment.kt index ab5c488ffb..5c2ca4d0fb 100644 --- a/catalog/src/main/java/com/google/android/fhir/catalog/ModalBottomSheetFragment.kt +++ b/catalog/src/main/java/com/google/android/fhir/catalog/ModalBottomSheetFragment.kt @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 Google LLC + * Copyright 2021-2024 Google LLC * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -20,10 +20,9 @@ import android.os.Bundle import android.view.LayoutInflater import android.view.View import android.view.ViewGroup -import android.widget.Button +import android.widget.CheckBox import androidx.core.os.bundleOf import androidx.fragment.app.setFragmentResult -import androidx.navigation.fragment.NavHostFragment import androidx.navigation.fragment.navArgs import com.google.android.material.bottomsheet.BottomSheetDialogFragment @@ -40,25 +39,16 @@ class ModalBottomSheetFragment : BottomSheetDialogFragment() { override fun onViewCreated(view: View, savedInstanceState: Bundle?) { super.onViewCreated(view, savedInstanceState) - val showHideErrorButton = view.findViewById