Skip to content

Commit 0b0fdbf

Browse files
authored
Merge branch 'main' into patch-2
2 parents a3c3b1a + 08a165c commit 0b0fdbf

File tree

286 files changed

+19213
-26766
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

286 files changed

+19213
-26766
lines changed

.editorconfig

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# https://editorconfig.org/
2+
# This configuration is used by ktlint when spotless invokes it
3+
4+
[*.{kt,kts}]
5+
ij_kotlin_allow_trailing_comma=true
6+
ij_kotlin_allow_trailing_comma_on_call_site=true
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Android CI with GMD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
jobs:
10+
11+
android-ci:
12+
runs-on: macos-12
13+
strategy:
14+
matrix:
15+
device-config: [ "pixel4api30aospatd", "pixelcapi30aospatd" ]
16+
17+
steps:
18+
- uses: actions/setup-java@v3
19+
with:
20+
distribution: 'zulu'
21+
java-version: '11'
22+
- uses: actions/checkout@v3
23+
24+
- name: Setup Android SDK
25+
uses: android-actions/setup-android@v2
26+
27+
- name: Run instrumented tests with GMD
28+
run: ./gradlew cleanManagedDevices --unused-only &&
29+
./gradlew ${{ matrix.device-config }}DemoDebugAndroidTest -Dorg.gradle.workers.max=1
30+
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" -Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true
31+
32+
- name: Upload test reports
33+
if: success() || failure()
34+
uses: actions/upload-artifact@v3
35+
with:
36+
name: test-reports
37+
path: |
38+
'**/*/build/reports/androidTests/'

.github/workflows/Build.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ jobs:
9090
disable-animations: true
9191
disk-size: 6000M
9292
heap-size: 600M
93-
script: ./gradlew connectedProdDebugAndroidTest -x :benchmark:connectedProdBenchmarkAndroidTest
93+
script: ./gradlew connectedDemoDebugAndroidTest -x :benchmark:connectedDemoBenchmarkAndroidTest
9494

9595
- name: Upload test reports
9696
if: always()

.google/BUILDME

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This file can be used to trigger an internal build by changing the number below
2+
3

.idea/codeStyles/Project.xml

Lines changed: 0 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.run/Generate Demo Baseline Profile.run.xml

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,22 +16,27 @@
1616
-->
1717
<component name="ProjectRunConfigurationManager">
1818
<!--
19-
Baseline Profiles improve code execution speed by around 30% from the first launch by avoiding interpretation and just-in-time (JIT) compilation steps for included code paths.
19+
Baseline Profiles improve code execution speed by around 30% from the first launch by avoiding
20+
interpretation and just-in-time (JIT) compilation steps for included code paths.
2021
More information at http://d.android.com/baseline-profiles.
22+
23+
In this run configuration we leverage rerun parameter that always reruns the requested task regardless of cache.
24+
We also leverage enable-display parameter to be able to verify the generator works as intended.
2125
-->
2226
<configuration default="false" name="Generate Demo Baseline Profile" type="GradleRunConfiguration" factoryName="Gradle">
2327
<ExternalSystemSettings>
2428
<option name="executionName" />
2529
<option name="externalProjectPath" value="$PROJECT_DIR$" />
2630
<option name="externalSystemIdString" value="GRADLE" />
27-
<!-- TODO Once we use Gradle wrapper 7.6, we can use rerun instead of rerun-tasks that will skip cache only for one task -->
28-
<option name="scriptParameters" value="--rerun-tasks -Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile" />
31+
<option name="scriptParameters" value="-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile" />
2932
<option name="taskDescriptions">
3033
<list />
3134
</option>
3235
<option name="taskNames">
3336
<list>
34-
<option value=":benchmark:pixel6Api31DemoBenchmarkAndroidTest" />
37+
<option value=":benchmark:pixel6Api31atdDemoBenchmarkAndroidTest" />
38+
<option value="--rerun" />
39+
<option value="--enable-display" />
3540
</list>
3641
</option>
3742
<option name="vmOptions" />

README.md

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -22,17 +22,23 @@ The app is currently in development. The `demoRelease` variant is [available on
2222
**Now in Android** displays content from the
2323
[Now in Android](https://developer.android.com/series/now-in-android) series. Users can browse for
2424
links to recent videos, articles and other content. Users can also follow topics they are interested
25-
in or follow specific authors.
25+
in.
2626

2727
## Screenshots
2828

2929
![Screenshot showing For You screen, Interests screen and Topic detail screen](docs/images/screenshots.png "Screenshot showing For You screen, Interests screen and Topic detail screen")
3030

3131
# Development Environment
3232

33-
**Now in Android** uses the Gradle build system and can be imported directly into the latest stable
34-
version of Android Studio (available [here](https://developer.android.com/studio)). The `debug`
35-
build can be built and run using the default configuration.
33+
**Now in Android** uses the Gradle build system and can be imported directly into Android Studio (make sure you are using the latest stable version available [here](https://developer.android.com/studio)).
34+
35+
Change the run configuration to `app`.
36+
37+
![image](https://user-images.githubusercontent.com/873212/210559920-ef4a40c5-c8e0-478b-bb00-4879a8cf184a.png)
38+
39+
The `demoDebug` and `demoRelease` build variants can be built and run (the `prod` variants use a backend server which is not currently publicly available).
40+
41+
![image](https://user-images.githubusercontent.com/873212/210560507-44045dc5-b6d5-41ca-9746-f0f7acf22f8e.png)
3642

3743
Once you're up and running, you can refer to the learning journeys below to get a better
3844
understanding of which libraries and tools are being used, the reasoning behind the approaches to

app-nia-catalog/build.gradle.kts

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
/*
2+
* Copyright 2022 The Android Open Source Project
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* https://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
import com.google.samples.apps.nowinandroid.FlavorDimension
17+
import com.google.samples.apps.nowinandroid.NiaFlavor
18+
119
/*
220
* Copyright 2022 The Android Open Source Project
321
*
@@ -21,10 +39,12 @@ plugins {
2139
android {
2240
defaultConfig {
2341
applicationId = "com.google.samples.apps.niacatalog"
42+
versionCode = 1
43+
versionName = "0.0.1" // X.Y.Z; X = Major, Y = minor, Z = Patch level
2444

2545
// The UI catalog does not depend on content from the app, however, it depends on modules
2646
// which do, so we must specify a default value for the contentType dimension.
27-
missingDimensionStrategy("contentType", "demo")
47+
missingDimensionStrategy(FlavorDimension.contentType.name, NiaFlavor.demo.name)
2848
}
2949

3050
packagingOptions {
@@ -33,12 +53,20 @@ android {
3353
}
3454
}
3555
namespace = "com.google.samples.apps.niacatalog"
56+
57+
buildTypes {
58+
val release by getting {
59+
// To publish on the Play store a private signing key is required, but to allow anyone
60+
// who clones the code to sign and run the release variant, use the debug signing key.
61+
// TODO: Abstract the signing configuration to a separate file to avoid hardcoding this.
62+
signingConfig = signingConfigs.getByName("debug")
63+
}
64+
}
3665
}
3766

3867
dependencies {
39-
implementation(project(":core:ui"))
4068
implementation(project(":core:designsystem"))
41-
42-
implementation(libs.androidx.activity.compose)
69+
implementation(project(":core:ui"))
4370
implementation(libs.accompanist.flowlayout)
44-
}
71+
implementation(libs.androidx.activity.compose)
72+
}

0 commit comments

Comments
 (0)