Skip to content

Commit 4e3da39

Browse files
author
Manuel Vivo
committedJul 23, 2020
[Crane] Adds buildSrc
Change-Id: I2760f0488fce6fa02dabfc31eaa45bcf4fb039d6
1 parent 3b7c1b7 commit 4e3da39

File tree

6 files changed

+164
-76
lines changed

6 files changed

+164
-76
lines changed
 

‎Crane/app/build.gradle

Lines changed: 28 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
2-
31
/*
42
* Copyright 2019 Google, Inc.
53
*
@@ -16,19 +14,24 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
1614
* limitations under the License.
1715
*/
1816

19-
apply plugin: 'com.android.application'
20-
apply plugin: 'kotlin-android'
17+
import com.example.crane.buildsrc.Libs
18+
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
19+
20+
plugins {
21+
id 'com.android.application'
22+
id 'kotlin-android'
23+
}
2124

2225
// Reads the Google maps key that is used in the AndroidManifest
2326
Properties properties = new Properties()
2427
properties.load(project.rootProject.file("local.properties").newDataInputStream())
2528

2629
android {
27-
compileSdkVersion 29
30+
compileSdkVersion 30
2831
defaultConfig {
2932
applicationId "androidx.compose.samples.crane"
3033
minSdkVersion 21
31-
targetSdkVersion 29
34+
targetSdkVersion 30
3235
versionCode 1
3336
versionName "1.0"
3437
vectorDrawables.useSupportLibrary = true
@@ -55,13 +58,16 @@ android {
5558
compose true
5659
}
5760
composeOptions {
58-
kotlinCompilerVersion "1.4.0-dev-withExperimentalGoogleExtensions-20200720"
59-
kotlinCompilerExtensionVersion "0.1.0-SNAPSHOT"
61+
kotlinCompilerVersion Libs.AndroidX.Compose.kotlinCompilerVersion
62+
kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
6063
}
6164
}
6265

6366
tasks.withType(KotlinCompile).configureEach {
6467
kotlinOptions {
68+
// Treat all Kotlin warnings as errors
69+
allWarningsAsErrors = true
70+
6571
jvmTarget = "1.8"
6672
freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
6773
}
@@ -72,25 +78,24 @@ configurations {
7278
}
7379

7480
dependencies {
75-
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4-M3'
76-
implementation 'com.google.android.gms:play-services-maps:17.0.0'
81+
implementation Libs.Kotlin.stdlib
82+
implementation Libs.googleMaps
7783

78-
def composeVersion = "0.1.0-SNAPSHOT"
79-
implementation "androidx.compose.runtime:runtime:$composeVersion"
80-
implementation "androidx.compose.material:material:$composeVersion"
81-
implementation "androidx.compose.foundation:foundation:$composeVersion"
82-
implementation "androidx.compose.foundation:foundation-layout:$composeVersion"
83-
implementation "androidx.compose.animation:animation:$composeVersion"
84-
implementation "androidx.ui:ui-tooling:$composeVersion"
84+
implementation Libs.AndroidX.Compose.runtime
85+
implementation Libs.AndroidX.Compose.foundation
86+
implementation Libs.AndroidX.Compose.material
87+
implementation Libs.AndroidX.Compose.layout
88+
implementation Libs.AndroidX.Compose.animation
89+
implementation Libs.AndroidX.UI.tooling
8590

86-
implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
87-
implementation 'androidx.appcompat:appcompat:1.1.0'
88-
implementation 'androidx.activity:activity-ktx:1.1.0'
89-
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
91+
implementation Libs.AndroidX.appcompat
92+
implementation Libs.AndroidX.Lifecycle.viewModelKtx
93+
implementation Libs.AndroidX.activityKtx
94+
implementation Libs.AndroidX.Lifecycle.extensions
9095

91-
implementation 'com.squareup.picasso:picasso:2.71828'
96+
implementation Libs.picasso
9297

93-
ktlint "com.pinterest:ktlint:0.37.2"
98+
ktlint Libs.ktLint
9499
}
95100

96101
task ktlint(type: JavaExec, group: "verification") {

‎Crane/build.gradle

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
/*
2+
* Copyright 2020 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+
17+
import com.example.crane.buildsrc.Libs
18+
import com.example.crane.buildsrc.Urls
19+
20+
buildscript {
21+
repositories {
22+
google()
23+
jcenter()
24+
maven { url Urls.kotlinEap }
25+
}
26+
dependencies {
27+
classpath Libs.androidGradlePlugin
28+
classpath Libs.Kotlin.gradlePlugin
29+
}
30+
}
31+
32+
subprojects {
33+
repositories {
34+
google()
35+
jcenter()
36+
maven { url Urls.kotlinEap }
37+
if (Libs.AndroidX.Compose.version.endsWith("SNAPSHOT")) {
38+
maven { url Urls.snapshotUrl }
39+
}
40+
}
41+
}

‎Crane/build.gradle.kts

Lines changed: 0 additions & 53 deletions
This file was deleted.

‎Crane/buildSrc/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

‎Crane/buildSrc/build.gradle.kts

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
/*
2+
* Copyright 2020 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+
17+
import org.gradle.kotlin.dsl.`kotlin-dsl`
18+
19+
repositories {
20+
jcenter()
21+
}
22+
23+
plugins {
24+
`kotlin-dsl`
25+
}
Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
/*
2+
* Copyright 2020 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+
17+
package com.example.crane.buildsrc
18+
19+
object Versions {
20+
const val ktLint = "0.37.2"
21+
}
22+
23+
object Libs {
24+
const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha05"
25+
const val ktLint = "com.pinterest:ktlint:${Versions.ktLint}"
26+
const val picasso = "com.squareup.picasso:picasso:2.71828"
27+
const val googleMaps = "com.google.android.gms:play-services-maps:17.0.0"
28+
29+
object Kotlin {
30+
private const val version = "1.4-M3"
31+
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
32+
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
33+
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
34+
}
35+
36+
object AndroidX {
37+
const val appcompat = "androidx.appcompat:appcompat:1.3.0-alpha01"
38+
const val activityKtx = "androidx.activity:activity-ktx:1.1.0"
39+
40+
object Compose {
41+
const val snapshot = "6695716"
42+
const val version = "0.1.0-SNAPSHOT"
43+
44+
const val kotlinCompilerVersion = "1.4.0-dev-withExperimentalGoogleExtensions-20200720"
45+
const val runtime = "androidx.compose.runtime:runtime:$version"
46+
const val material = "androidx.compose.material:material:$version"
47+
const val foundation = "androidx.compose.foundation:foundation:$version"
48+
const val layout = "androidx.compose.foundation:foundation-layout:$version"
49+
const val animation = "androidx.compose.animation:animation:$version"
50+
}
51+
52+
object UI {
53+
const val tooling = "androidx.ui:ui-tooling:${Compose.version}"
54+
}
55+
56+
object Lifecycle {
57+
private const val version = "2.2.0"
58+
59+
const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
60+
const val extensions = "androidx.lifecycle:lifecycle-extensions:$version"
61+
}
62+
}
63+
}
64+
65+
object Urls {
66+
const val kotlinEap = "https://dl.bintray.com/kotlin/kotlin-eap/"
67+
const val snapshotUrl = "https://androidx-dev-prod.appspot.com/snapshots/builds/" + // Dev15
68+
"${Libs.AndroidX.Compose.snapshot}/artifacts/ui/repository/"
69+
}

0 commit comments

Comments
 (0)