Skip to content

Commit cc1c631

Browse files
Merge remote-tracking branch 'compose/main' into zachklipp/import-compose
* compose/main: (66 commits) Move everything into a compose subdirectory to prep for importing into the main workflow-kotlin repo. Replace individual UI Systems team members with the ui-systems-android team in CODEOWNERS. Update indentation to match latest code style. Upgrade Compose to alpha07. Fix the samples not being full-size. Upgrade compose to alpha06. Upgrade AGP. Upgrade AGP to alpha14. Upgrade Gradle to latest version. Upgrade Compose to latest version. Remove redundant parentheses after @composable annotations. Remove coroutine forced dependency resolution. Upgrade Compose and AGP to latest versions. Upgrade Kotlin to 1.4.10. Upgrade Compose to alpha02. Upgrade AGP to 4.2.0-alpha10. Upgrade gradle to 6.6.1. Upgrade Compose to 1.0.0-alpha01. Upgrade to Kotlin 1.4. Upgrade Gradle to 6.6. ...
2 parents 791c9e7 + 96a12b3 commit cc1c631

File tree

91 files changed

+5978
-0
lines changed

Some content is hidden

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

91 files changed

+5978
-0
lines changed

.github/CODEOWNERS

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,6 @@
11
# These owners will be the default owners for everything in
22
# the repo, unless a later match takes precedence.
33
* @square/mobile-foundation-android zach-klippenstein
4+
5+
# Compose integration
6+
compose/* @square/mobile-foundation-android @square/ui-systems-android @wardellbagby
Lines changed: 146 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,146 @@
1+
name: Kotlin CI
2+
3+
on:
4+
push:
5+
paths:
6+
- 'compose/**'
7+
- '.github/workflows/compose-kotlin.yml'
8+
branches: [main]
9+
pull_request:
10+
paths:
11+
- 'compose/**'
12+
- '.github/workflows/compose-kotlin.yml'
13+
14+
env:
15+
GRADLE_HOME: ${{ github.workspace }}/gradle-home
16+
17+
defaults:
18+
run:
19+
working-directory: compose
20+
21+
jobs:
22+
assemble:
23+
name: Assemble
24+
runs-on: ubuntu-latest
25+
timeout-minutes: 15
26+
steps:
27+
# These setup steps should be common across all jobs in this workflow.
28+
- uses: actions/checkout@v2
29+
- uses: gradle/wrapper-validation-action@v1
30+
- name: set up JDK 1.8
31+
uses: actions/setup-java@v1
32+
with:
33+
java-version: 1.8
34+
35+
## Caching
36+
- name: Cache gradle dependencies
37+
uses: actions/cache@v1
38+
with:
39+
path: ${{ env.GRADLE_HOME }}/caches
40+
# Include the SHA in the hash so this step always adds a cache entry. If we didn't use the SHA, the artifacts
41+
# would only get cached once for each build config hash.
42+
# Don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
43+
key: gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-${{ github.sha }}
44+
# The first time a SHA is assembled, we still want to load dependencies from the cache.
45+
# Note that none of jobs dependent on this one need restore keys, since they'll always have an exact hit.
46+
restore-keys: |
47+
gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-
48+
49+
# We want to keep the dependencies from the cache, but clear out the build cache which contains the actual
50+
# compiled artifacts from this project. This ensures we don't run into any issues with stale cache entries,
51+
# and that the resulting cache we upload for the other jobs won't waste any space on stale binaries.
52+
# A simpler approach would be simply to delete the build-cache before uploading the cache archive, however
53+
# if we did that in this job it would defeat the purpose of sharing that directory with dependent jobs,
54+
# and there's no way to modify the cache after the job that created it finishes.
55+
- name: Clean gradle build cache to assemble fresh
56+
run: |
57+
ls -lhrt "$GRADLE_HOME/caches" || true
58+
rm -rf "$GRADLE_HOME/caches/build-cache-1"
59+
ls -lhrt "$GRADLE_HOME/caches" || true
60+
61+
## Actual task
62+
- name: Assemble with gradle
63+
run: ./gradlew assemble --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"
64+
65+
# Runs all check tasks in parallel.
66+
check:
67+
name: Check
68+
needs: assemble
69+
runs-on: ubuntu-latest
70+
timeout-minutes: 20
71+
strategy:
72+
# Run all checks, even if some fail.
73+
fail-fast: false
74+
matrix:
75+
gradle-task:
76+
# Unit tests
77+
- test
78+
# Binary compatibility
79+
- apiCheck
80+
- lint
81+
- ktlintCheck
82+
- detekt
83+
steps:
84+
- uses: actions/checkout@v2
85+
- name: set up JDK 1.8
86+
uses: actions/setup-java@v1
87+
with:
88+
java-version: 1.8
89+
90+
## Caching
91+
- name: Cache build artifacts
92+
uses: actions/cache@v1
93+
with:
94+
path: ${{ env.GRADLE_HOME }}/caches
95+
# Don't set restore-keys so cache is always only valid for the current build config.
96+
# Also don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
97+
key: gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-${{ github.sha }}
98+
99+
## Actual task
100+
- name: Check with Gradle
101+
run: ./gradlew ${{ matrix.gradle-task }} --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"
102+
103+
instrumentation-tests:
104+
name: Instrumentation tests
105+
needs: assemble
106+
runs-on: macos-latest
107+
timeout-minutes: 30
108+
strategy:
109+
# Allow tests to continue on other devices if they fail on one device.
110+
fail-fast: false
111+
matrix:
112+
api-level:
113+
# See https://github.com/square/workflow-kotlin-compose/issues/54
114+
# - 21
115+
- 24
116+
- 29
117+
steps:
118+
- uses: actions/checkout@v2
119+
- name: set up JDK 1.8
120+
uses: actions/setup-java@v1
121+
with:
122+
java-version: 1.8
123+
124+
## Caching
125+
- name: Cache build artifacts
126+
uses: actions/cache@v1
127+
with:
128+
path: ${{ env.GRADLE_HOME }}/caches
129+
# Don't set restore-keys so cache is always only valid for the current build config.
130+
# Also don't use ${{ runner.os }} in the key so we don't re-assemble for UI tests.
131+
key: gradle-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/buildSrc/**') }}-${{ github.sha }}
132+
133+
## Actual task
134+
- name: Instrumentation Tests
135+
uses: reactivecircus/android-emulator-runner@v2
136+
with:
137+
api-level: ${{ matrix.api-level }}
138+
arch: x86_64
139+
# This task doesn't use the run default specified at the top of the file.
140+
working-directory: compose
141+
script: ./gradlew connectedCheck --build-cache --no-daemon --stacktrace --gradle-user-home "$GRADLE_HOME"
142+
- name: Upload results
143+
uses: actions/upload-artifact@v2
144+
with:
145+
name: instrumentation-test-results
146+
path: ./**/build/reports/androidTests/connected/**
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
apply from: rootProject.file('.buildscript/configure-android-defaults.gradle')
2+
3+
dependencies {
4+
implementation(project(":compose-tooling"))
5+
implementation(Deps.get("androidx.appcompat"))
6+
implementation(Deps.get("timber"))
7+
implementation(Deps.get("workflow.core"))
8+
implementation(Deps.get("workflow.runtime"))
9+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
android {
2+
defaultConfig {
3+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
4+
}
5+
testOptions {
6+
animationsDisabled = true
7+
}
8+
}
9+
10+
dependencies {
11+
androidTestImplementation Deps.get("compose.test")
12+
androidTestImplementation Deps.get("test.androidx.espresso.core")
13+
androidTestImplementation Deps.get("test.androidx.junitExt")
14+
androidTestImplementation Deps.get("test.kotlin")
15+
androidTestImplementation Deps.get("test.truth")
16+
}
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
/*
2+
* Copyright 2020 Square Inc.
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+
* http://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+
17+
/*
18+
* We use JetBrain's Kotlin Binary Compatibility Validator to track changes to our public binary
19+
* APIs.
20+
* When making a change that results in a public ABI change, the apiCheck task will fail. When this
21+
* happens, run ./gradlew apiDump to generate updated *.api files, and add those to your commit.
22+
* See https://github.com/Kotlin/binary-compatibility-validator
23+
*/
24+
25+
apply plugin: 'binary-compatibility-validator'
26+
27+
apiValidation {
28+
// Ignore all sample projects, since they're not part of our API.
29+
// Only leaf project name is valid configuration, and every project must be individually ignored.
30+
// See https://github.com/Kotlin/binary-compatibility-validator/issues/3
31+
ignoredProjects += project('samples').name
32+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
android {
2+
compileSdkVersion Versions.targetSdk
3+
4+
compileOptions {
5+
sourceCompatibility JavaVersion.VERSION_1_8
6+
targetCompatibility JavaVersion.VERSION_1_8
7+
}
8+
9+
defaultConfig {
10+
minSdkVersion 21
11+
targetSdkVersion Versions.targetSdk
12+
versionCode 1
13+
versionName "1.0"
14+
}
15+
16+
buildFeatures.viewBinding = true
17+
18+
// See https://github.com/Kotlin/kotlinx.coroutines/issues/1064#issuecomment-479412940
19+
packagingOptions {
20+
exclude 'META-INF/*.kotlin_module'
21+
exclude 'META-INF/AL2.0'
22+
exclude 'META-INF/LGPL2.1'
23+
}
24+
25+
lintOptions {
26+
// Workaround lint bug.
27+
disable "InvalidFragmentVersionForActivityResult"
28+
}
29+
}
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2020 Square Inc.
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+
* http://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+
17+
android {
18+
buildFeatures {
19+
compose true
20+
}
21+
composeOptions {
22+
kotlinCompilerVersion Versions.kotlin
23+
kotlinCompilerExtensionVersion Versions.compose
24+
}
25+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
/*
2+
* Copyright 2019 Square Inc.
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+
* http://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+
17+
apply plugin: 'com.vanniktech.maven.publish'
18+
19+
group = GROUP
20+
version = VERSION_NAME

compose/.editorconfig

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[*.kt]
2+
indent_size = 2
3+
continuation_indent_size=4

compose/.gitignore

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
# macOS
2+
.DS_Store
3+
4+
# Compiled class file
5+
*.class
6+
7+
# Log file
8+
*.log
9+
10+
# BlueJ files
11+
*.ctxt
12+
13+
# Mobile Tools for Java (J2ME)
14+
.mtj.tmp/
15+
16+
# Package Files #
17+
*.jar
18+
*.war
19+
*.nar
20+
*.ear
21+
*.zip
22+
*.tar.gz
23+
*.rar
24+
25+
# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
26+
hs_err_pid*
27+
28+
# Gradle
29+
out/
30+
.gradle/
31+
build/
32+
local.properties
33+
34+
# Intellij
35+
*.iml
36+
.idea/

0 commit comments

Comments
 (0)