Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/HEAD' into JUnitUpgrade
Browse files Browse the repository at this point in the history
# Conflicts:
#	buildSrc/src/main/kotlin/Dependencies.kt
  • Loading branch information
vitorpamplona committed Jul 7, 2022
2 parents b190789 + e57fd65 commit c338d85
Show file tree
Hide file tree
Showing 201 changed files with 6,184 additions and 1,374 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@ jobs:

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout Repo
uses: actions/checkout@v2
uses: actions/checkout@v3
with:
# Fetch origin/master for spotless ratchet to work
# https://github.com/diffplug/spotless/issues/1242
fetch-depth: 0

- name: Set up JDK 11
uses: actions/setup-java@v2
Expand Down
9 changes: 8 additions & 1 deletion build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ buildscript {
classpath(Plugins.androidGradlePlugin)
classpath(Plugins.kotlinGradlePlugin)
classpath(Plugins.navSafeArgsGradlePlugin)
classpath(Plugins.rulerGradlePlugin)
}
}

Expand All @@ -22,7 +23,13 @@ allprojects {
configureSpotless()
}

subprojects { configureLicensee() }
subprojects {
// We have some empty folders like the :contrib root folder, which Gradle recognizes as projects.
// Don't configure plugins for those folders.
if (project.buildFile.exists()) {
configureLicensee()
}
}

// Create a CI repository and also change versions to include the build number
afterEvaluate {
Expand Down
2 changes: 2 additions & 0 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,6 @@ dependencies {
implementation("com.android.tools.build:gradle:7.1.1")

implementation("app.cash.licensee:licensee-gradle-plugin:1.3.0")

implementation("com.spotify.ruler:ruler-gradle-plugin:1.2.1")
}
21 changes: 12 additions & 9 deletions buildSrc/src/main/kotlin/Dependencies.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -92,13 +92,18 @@ object Dependencies {
const val runtime = "androidx.room:room-runtime:${Versions.Androidx.room}"
}

object Mlkit {
const val barcodeScanning =
"com.google.mlkit:barcode-scanning:${Versions.Mlkit.barcodeScanning}"
const val objectDetection =
"com.google.mlkit:object-detection:${Versions.Mlkit.objectDetection}"
const val objectDetectionCustom =
"com.google.mlkit:object-detection-custom:${Versions.Mlkit.objectDetectionCustom}"
}

const val androidFhirCommon = "com.google.android.fhir:common:${Versions.androidFhirCommon}"
const val barcodeScanning = "com.google.mlkit:barcode-scanning:${Versions.Mlkit.barcodeScanning}"
const val lifecycleExtensions =
"androidx.lifecycle:lifecycle-extensions:${Versions.Androidx.lifecycle}"
const val objectDetection = "com.google.mlkit:object-detection:${Versions.Mlkit.objectDetection}"
const val objectDetectionCustom =
"com.google.mlkit:object-detection-custom:${Versions.Mlkit.objectDetectionCustom}"
const val desugarJdkLibs = "com.android.tools:desugar_jdk_libs:${Versions.desugarJdkLibs}"
const val fhirUcum = "org.fhir:ucum:${Versions.fhirUcum}"
const val guava = "com.google.guava:guava:${Versions.guava}"
Expand Down Expand Up @@ -132,7 +137,6 @@ object Dependencies {
}

const val androidJunitRunner = "androidx.test.runner.AndroidJUnitRunner"
const val flexBox = "com.google.android.flexbox:flexbox:${Versions.flexBox}"
const val junit = "junit:junit:${Versions.junit}"
const val mockitoKotlin = "org.mockito.kotlin:mockito-kotlin:${Versions.mockitoKotlin}"
const val mockitoInline = "org.mockito:mockito-inline:${Versions.mockitoInline}"
Expand Down Expand Up @@ -165,14 +169,13 @@ object Dependencies {
}

object Kotlin {
const val kotlinCoroutinesCore = "1.4.2"
const val stdlib = "1.6.21"
const val kotlinCoroutinesCore = "1.6.2"
const val stdlib = "1.6.10"
}

const val androidFhirCommon = "0.1.0-alpha03"
const val desugarJdkLibs = "1.1.5"
const val fhirUcum = "1.0.3"
const val flexBox = "3.0.0"
const val guava = "28.2-android"
const val hapiFhir = "5.4.0"
const val http = "4.9.1"
Expand Down
21 changes: 21 additions & 0 deletions buildSrc/src/main/kotlin/LicenseeConfig.kt
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,27 @@ fun Project.configureLicensee() {
// Vision Common
// https://developers.google.com/android/reference/com/google/mlkit/vision/common/package-summary
allowDependency("com.google.mlkit", "vision-internal-vkp", "18.0.0") { because("") }

// Eclipse persistence
allowDependency("org.eclipse.persistence", "org.eclipse.persistence.asm", "2.7.7") {
because(
"Temporary dependency. Will be removed in https://github.com/cqframework/clinical_quality_language/pull/752"
)
}

// Eclipse persistence
allowDependency("org.eclipse.persistence", "org.eclipse.persistence.core", "2.7.7") {
because(
"Temporary dependency. Will be removed in https://github.com/cqframework/clinical_quality_language/pull/752"
)
}

// Eclipse persistence
allowDependency("org.eclipse.persistence", "org.eclipse.persistence.moxy", "2.7.7") {
because(
"Temporary dependency. Will be removed in https://github.com/cqframework/clinical_quality_language/pull/752"
)
}
}
}

Expand Down
2 changes: 2 additions & 0 deletions buildSrc/src/main/kotlin/Plugins.kt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ object Plugins {
const val kotlin = "kotlin"
const val navSafeArgs = "androidx.navigation.safeargs.kotlin"
const val spotless = "com.diffplug.spotless"
const val ruler = "com.spotify.ruler"
}

// classpath plugins
Expand All @@ -34,6 +35,7 @@ object Plugins {
"org.jetbrains.kotlin:kotlin-gradle-plugin:${Dependencies.Versions.Kotlin.stdlib}"
const val navSafeArgsGradlePlugin =
"androidx.navigation:navigation-safe-args-gradle-plugin:${Dependencies.Versions.Androidx.navigation}"
const val rulerGradlePlugin = "com.spotify.ruler:ruler-gradle-plugin:1.2.1"

object Versions {
const val androidGradlePlugin = "7.0.2"
Expand Down
95 changes: 73 additions & 22 deletions buildSrc/src/main/kotlin/Releases.kt
Original file line number Diff line number Diff line change
Expand Up @@ -14,35 +14,61 @@
* limitations under the License.
*/

import org.gradle.api.publish.maven.MavenPom
import org.gradle.api.Project
import org.gradle.api.publish.maven.MavenPublication
import org.gradle.api.tasks.bundling.Jar
import org.gradle.kotlin.dsl.configure
import org.gradle.kotlin.dsl.create
import org.gradle.kotlin.dsl.get
import org.gradle.kotlin.dsl.getByType
import org.gradle.kotlin.dsl.register

interface LibraryArtifact {
/** Maven coordinate artifact id. */
val artifactId: String

/** Maven coordinate version. */
val version: String

/** Descriptive name for library. */
val name: String
}

object Releases {
const val groupId = "com.google.android.fhir"

// Libraries

object Common {
const val artifactId = "common"
const val version = "0.1.0-alpha03"
const val name = "Android FHIR Common Library"
object Common : LibraryArtifact {
override val artifactId = "common"
override val version = "0.1.0-alpha03"
override val name = "Android FHIR Common Library"
}

object Engine {
const val artifactId = "engine"
const val version = "0.1.0-beta01"
const val name = "Android FHIR Engine Library"
object Engine : LibraryArtifact {
override val artifactId = "engine"
override val version = "0.1.0-beta01"
override val name = "Android FHIR Engine Library"
}

object DataCapture {
const val artifactId = "data-capture"
const val version = "0.1.0-beta03"
const val name = "Android FHIR Structured Data Capture Library"
object DataCapture : LibraryArtifact {
override val artifactId = "data-capture"
override val version = "0.1.0-beta03"
override val name = "Android FHIR Structured Data Capture Library"
}

object Workflow {
const val artifactId = "workflow"
const val version = "0.1.0-alpha01"
const val name = "Android FHIR Workflow Library"
object Workflow : LibraryArtifact {
override val artifactId = "workflow"
override val version = "0.1.0-alpha01"
override val name = "Android FHIR Workflow Library"
}

object Contrib {
object Barcode : LibraryArtifact {
override val artifactId = "contrib-barcode"
override val version = "0.1.0-beta3"
override val name = "Android FHIR Structured Data Capture - Barcode Extensions (contrib)"
}
}

// Demo apps
Expand All @@ -58,12 +84,37 @@ object Releases {
const val versionCode = 1
const val versionName = "1.0"
}
}

fun Project.publishArtifact(artifact: LibraryArtifact) {
afterEvaluate {
configure<org.gradle.api.publish.PublishingExtension> {
publications {
register("release", MavenPublication::class) {
from(components["release"])
groupId = Releases.groupId
artifactId = artifact.artifactId
version = artifact.version
// Also publish source code for developers' convenience
artifact(
tasks.create<Jar>("androidSourcesJar") {
archiveClassifier.set("sources")

fun MavenPom.useApache2License() {
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
val android =
project.extensions.getByType<com.android.build.gradle.LibraryExtension>()
from(android.sourceSets.getByName("main").java.srcDirs)
}
)
pom {
name.set(artifact.name)
licenses {
license {
name.set("The Apache License, Version 2.0")
url.set("http://www.apache.org/licenses/LICENSE-2.0.txt")
}
}
}
}
}
}
}
Expand Down
29 changes: 29 additions & 0 deletions buildSrc/src/main/kotlin/RulerConfig.kt
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2021 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

import org.gradle.api.Project
import org.gradle.kotlin.dsl.apply
import org.gradle.kotlin.dsl.configure

fun Project.configureRuler() {
apply(plugin = Plugins.BuildPlugins.ruler)
configure<com.spotify.ruler.plugin.RulerExtension> {
abi.set("arm64-v8a")
locale.set("en")
screenDensity.set(480)
sdkVersion.set(27)
}
}
3 changes: 2 additions & 1 deletion buildSrc/src/main/kotlin/SpotlessConfig.kt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2021 Google LLC
* Copyright 2022 Google LLC
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -23,6 +23,7 @@ fun Project.configureSpotless() {
val ktlintOptions = mapOf("indent_size" to "2", "continuation_indent_size" to "2")
apply(plugin = Plugins.BuildPlugins.spotless)
configure<com.diffplug.gradle.spotless.SpotlessExtension> {
ratchetFrom = "origin/master" // only format files which have changed since origin/master
kotlin {
target("**/*.kt")
targetExclude("**/build/")
Expand Down
3 changes: 3 additions & 0 deletions catalog/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ plugins {
id(Plugins.BuildPlugins.navSafeArgs)
}

configureRuler()

android {
compileSdk = Sdk.compileSdk
buildToolsVersion = Plugins.Versions.buildTools
Expand Down Expand Up @@ -59,6 +61,7 @@ dependencies {
implementation(Dependencies.Navigation.navUiKtx)

implementation(project(path = ":datacapture"))
implementation(project(path = ":contrib:barcode"))

testImplementation(Dependencies.junit)
}
Loading

0 comments on commit c338d85

Please sign in to comment.