Skip to content

Commit

Permalink
[Crane] Adds buildSrc
Browse files Browse the repository at this point in the history
Change-Id: I2760f0488fce6fa02dabfc31eaa45bcf4fb039d6
  • Loading branch information
Manuel Vivo committed Jul 23, 2020
1 parent 3b7c1b7 commit 4e3da39
Show file tree
Hide file tree
Showing 6 changed files with 164 additions and 76 deletions.
51 changes: 28 additions & 23 deletions Crane/app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

/*
* Copyright 2019 Google, Inc.
*
Expand All @@ -16,19 +14,24 @@ import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
* limitations under the License.
*/

apply plugin: 'com.android.application'
apply plugin: 'kotlin-android'
import com.example.crane.buildsrc.Libs
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

plugins {
id 'com.android.application'
id 'kotlin-android'
}

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

android {
compileSdkVersion 29
compileSdkVersion 30
defaultConfig {
applicationId "androidx.compose.samples.crane"
minSdkVersion 21
targetSdkVersion 29
targetSdkVersion 30
versionCode 1
versionName "1.0"
vectorDrawables.useSupportLibrary = true
Expand All @@ -55,13 +58,16 @@ android {
compose true
}
composeOptions {
kotlinCompilerVersion "1.4.0-dev-withExperimentalGoogleExtensions-20200720"
kotlinCompilerExtensionVersion "0.1.0-SNAPSHOT"
kotlinCompilerVersion Libs.AndroidX.Compose.kotlinCompilerVersion
kotlinCompilerExtensionVersion Libs.AndroidX.Compose.version
}
}

tasks.withType(KotlinCompile).configureEach {
kotlinOptions {
// Treat all Kotlin warnings as errors
allWarningsAsErrors = true

jvmTarget = "1.8"
freeCompilerArgs += ["-Xallow-jvm-ir-dependencies", "-Xskip-prerelease-check"]
}
Expand All @@ -72,25 +78,24 @@ configurations {
}

dependencies {
implementation 'org.jetbrains.kotlin:kotlin-stdlib-jdk7:1.4-M3'
implementation 'com.google.android.gms:play-services-maps:17.0.0'
implementation Libs.Kotlin.stdlib
implementation Libs.googleMaps

def composeVersion = "0.1.0-SNAPSHOT"
implementation "androidx.compose.runtime:runtime:$composeVersion"
implementation "androidx.compose.material:material:$composeVersion"
implementation "androidx.compose.foundation:foundation:$composeVersion"
implementation "androidx.compose.foundation:foundation-layout:$composeVersion"
implementation "androidx.compose.animation:animation:$composeVersion"
implementation "androidx.ui:ui-tooling:$composeVersion"
implementation Libs.AndroidX.Compose.runtime
implementation Libs.AndroidX.Compose.foundation
implementation Libs.AndroidX.Compose.material
implementation Libs.AndroidX.Compose.layout
implementation Libs.AndroidX.Compose.animation
implementation Libs.AndroidX.UI.tooling

implementation 'androidx.lifecycle:lifecycle-viewmodel-ktx:2.2.0'
implementation 'androidx.appcompat:appcompat:1.1.0'
implementation 'androidx.activity:activity-ktx:1.1.0'
implementation 'androidx.lifecycle:lifecycle-extensions:2.2.0'
implementation Libs.AndroidX.appcompat
implementation Libs.AndroidX.Lifecycle.viewModelKtx
implementation Libs.AndroidX.activityKtx
implementation Libs.AndroidX.Lifecycle.extensions

implementation 'com.squareup.picasso:picasso:2.71828'
implementation Libs.picasso

ktlint "com.pinterest:ktlint:0.37.2"
ktlint Libs.ktLint
}

task ktlint(type: JavaExec, group: "verification") {
Expand Down
41 changes: 41 additions & 0 deletions Crane/build.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/*
* Copyright 2020 The Android Open Source Project
*
* 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
*
* https://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 com.example.crane.buildsrc.Libs
import com.example.crane.buildsrc.Urls

buildscript {
repositories {
google()
jcenter()
maven { url Urls.kotlinEap }
}
dependencies {
classpath Libs.androidGradlePlugin
classpath Libs.Kotlin.gradlePlugin
}
}

subprojects {
repositories {
google()
jcenter()
maven { url Urls.kotlinEap }
if (Libs.AndroidX.Compose.version.endsWith("SNAPSHOT")) {
maven { url Urls.snapshotUrl }
}
}
}
53 changes: 0 additions & 53 deletions Crane/build.gradle.kts

This file was deleted.

1 change: 1 addition & 0 deletions Crane/buildSrc/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/build
25 changes: 25 additions & 0 deletions Crane/buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
/*
* Copyright 2020 The Android Open Source Project
*
* 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
*
* https://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.kotlin.dsl.`kotlin-dsl`

repositories {
jcenter()
}

plugins {
`kotlin-dsl`
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2020 The Android Open Source Project
*
* 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
*
* https://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.
*/

package com.example.crane.buildsrc

object Versions {
const val ktLint = "0.37.2"
}

object Libs {
const val androidGradlePlugin = "com.android.tools.build:gradle:4.2.0-alpha05"
const val ktLint = "com.pinterest:ktlint:${Versions.ktLint}"
const val picasso = "com.squareup.picasso:picasso:2.71828"
const val googleMaps = "com.google.android.gms:play-services-maps:17.0.0"

object Kotlin {
private const val version = "1.4-M3"
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$version"
const val gradlePlugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:$version"
const val extensions = "org.jetbrains.kotlin:kotlin-android-extensions:$version"
}

object AndroidX {
const val appcompat = "androidx.appcompat:appcompat:1.3.0-alpha01"
const val activityKtx = "androidx.activity:activity-ktx:1.1.0"

object Compose {
const val snapshot = "6695716"
const val version = "0.1.0-SNAPSHOT"

const val kotlinCompilerVersion = "1.4.0-dev-withExperimentalGoogleExtensions-20200720"
const val runtime = "androidx.compose.runtime:runtime:$version"
const val material = "androidx.compose.material:material:$version"
const val foundation = "androidx.compose.foundation:foundation:$version"
const val layout = "androidx.compose.foundation:foundation-layout:$version"
const val animation = "androidx.compose.animation:animation:$version"
}

object UI {
const val tooling = "androidx.ui:ui-tooling:${Compose.version}"
}

object Lifecycle {
private const val version = "2.2.0"

const val viewModelKtx = "androidx.lifecycle:lifecycle-viewmodel-ktx:$version"
const val extensions = "androidx.lifecycle:lifecycle-extensions:$version"
}
}
}

object Urls {
const val kotlinEap = "https://dl.bintray.com/kotlin/kotlin-eap/"
const val snapshotUrl = "https://androidx-dev-prod.appspot.com/snapshots/builds/" + // Dev15
"${Libs.AndroidX.Compose.snapshot}/artifacts/ui/repository/"
}

0 comments on commit 4e3da39

Please sign in to comment.