forked from android/snippets
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate build scripts to kts, and version catalogs. (android#113)
* Migrate build scripts to kts, and version catalogs. * More migration to kts and version catalogs * Added update deps workflow * More migration to kts and version catalogs * fix compose version * Remove slices example * Fix recomposehighlighter * fix kotlin module * Ignore tests that are meant to fail, and fix broken kotlin tests * Disable bluetoothle building * Load gradle plugins in top level build.gradle.kts, remove fileTree jar loading * Add comma after last module name
- Loading branch information
Showing
51 changed files
with
651 additions
and
2,785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
name: Update Versions / Dependencies | ||
|
||
on: | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Copy CI gradle.properties | ||
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | ||
- name: set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 17 | ||
distribution: 'zulu' | ||
cache: gradle | ||
|
||
- name: Update dependencies | ||
run: ./gradlew versionCatalogUpdate | ||
- name: Create pull request | ||
id: cpr | ||
uses: peter-evans/create-pull-request@v4 | ||
with: | ||
token: ${{ secrets.PAT }} | ||
commit-message: 🤖 Update Dependencies | ||
committer: compose-devrel-github-bot <[email protected]> | ||
author: compose-devrel-github-bot <[email protected]> | ||
signoff: false | ||
branch: bot-update-deps | ||
delete-branch: true | ||
title: '🤖 Update Dependencies' | ||
body: Updated depedencies |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
|
||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
} | ||
android { | ||
compileSdk = libs.versions.compileSdk.get().toInt() | ||
namespace = "com.sample.android.bluetoothle" | ||
|
||
defaultConfig { | ||
applicationId = "com.sample.android.bluetoothle" | ||
minSdk = libs.versions.minSdk.get().toInt() | ||
targetSdk = libs.versions.targetSdk.get().toInt() | ||
versionCode = 1 | ||
versionName = "1.0" | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
signingConfig = signingConfigs.getByName("debug") | ||
} | ||
|
||
getByName("release") { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro") | ||
} | ||
} | ||
} | ||
dependencies { | ||
implementation(libs.kotlin.stdlib) | ||
implementation(libs.androidx.appcompat) | ||
implementation(libs.androidx.constraintlayout) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.core) | ||
androidTestImplementation(libs.androidx.test.runner) | ||
androidTestImplementation(libs.androidx.test.espresso.core) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
// Top-level build file where you can add configuration options common to all sub-projects/modules. | ||
plugins { | ||
alias(libs.plugins.gradle.versions) | ||
alias(libs.plugins.version.catalog.update) | ||
alias(libs.plugins.android.application) apply false | ||
alias(libs.plugins.android.library) apply false | ||
alias(libs.plugins.kotlin.android) apply false | ||
alias(libs.plugins.kapt) apply false | ||
alias(libs.plugins.hilt) apply false | ||
} | ||
|
||
apply("${project.rootDir}/buildscripts/toml-updater-config.gradle") | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
/* | ||
* Copyright 2023 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. | ||
*/ | ||
versionCatalogUpdate { | ||
sortByKey.set(true) | ||
|
||
keep { | ||
// keep versions without any library or plugin reference | ||
keepUnusedVersions.set(true) | ||
// keep all libraries that aren't used in the project | ||
keepUnusedLibraries.set(true) | ||
// keep all plugins that aren't used in the project | ||
keepUnusedPlugins.set(true) | ||
} | ||
} | ||
|
||
def isNonStable = { String version -> | ||
def stableKeyword = ['RELEASE', 'FINAL', 'GA'].any { it -> version.toUpperCase().contains(it) } | ||
def regex = /^[0-9,.v-]+(-r)?$/ | ||
return !stableKeyword && !(version ==~ regex) | ||
} | ||
|
||
tasks.named("dependencyUpdates").configure { | ||
resolutionStrategy { | ||
componentSelection { | ||
all { | ||
if (isNonStable(it.candidate.version) && !isNonStable(it.currentVersion)) { | ||
reject('Release candidate') | ||
} | ||
} | ||
} | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
plugins { | ||
alias(libs.plugins.android.application) | ||
alias(libs.plugins.kotlin.android) | ||
} | ||
android { | ||
compileSdk = libs.versions.compileSdk.get().toInt() | ||
namespace = "com.example.recompose" | ||
|
||
defaultConfig { | ||
applicationId = "com.example.recompose" | ||
minSdk = libs.versions.minSdk.get().toInt() | ||
targetSdk = libs.versions.targetSdk.get().toInt() | ||
versionCode = 1 | ||
versionName = "1.0" | ||
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner" | ||
} | ||
|
||
buildTypes { | ||
getByName("debug") { | ||
signingConfig = signingConfigs.getByName("debug") | ||
} | ||
|
||
getByName("release") { | ||
isMinifyEnabled = false | ||
proguardFiles(getDefaultProguardFile("proguard-android-optimize.txt"), | ||
"proguard-rules.pro") | ||
} | ||
} | ||
compileOptions { | ||
sourceCompatibility = JavaVersion.VERSION_17 | ||
targetCompatibility = JavaVersion.VERSION_17 | ||
} | ||
buildFeatures { | ||
compose = true | ||
// Disable unused AGP features | ||
viewBinding = true | ||
} | ||
|
||
composeOptions { | ||
kotlinCompilerExtensionVersion = libs.versions.compose.compiler.get() | ||
} | ||
} | ||
dependencies { | ||
val composeBom = platform(libs.androidx.compose.bom) | ||
implementation(composeBom) | ||
androidTestImplementation(composeBom) | ||
implementation(libs.androidx.core.ktx) | ||
implementation(libs.androidx.activity.compose) | ||
implementation(libs.androidx.compose.runtime) | ||
implementation(libs.androidx.compose.foundation) | ||
implementation(libs.androidx.compose.foundation.layout) | ||
implementation(libs.androidx.compose.ui.util) | ||
implementation(libs.androidx.compose.material) | ||
|
||
implementation(libs.androidx.lifecycle.runtime) | ||
testImplementation(libs.junit) | ||
androidTestImplementation(libs.junit) | ||
androidTestImplementation(libs.androidx.test.core) | ||
androidTestImplementation(libs.androidx.test.runner) | ||
androidTestImplementation(libs.androidx.test.espresso.core) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<resources xmlns:tools="http://schemas.android.com/tools"> | ||
<style name="Theme.RecomposeHighlighter.NoActionBar" parent="@style/Theme.AppCompat.Light"> | ||
<item name="windowActionBar">false</item> | ||
<item name="windowNoTitle">true</item> | ||
<style name="Theme.RecomposeHighlighter.NoActionBar" parent="android:Theme.Material.Light.NoActionBar"> | ||
|
||
</style> | ||
</resources> |
Oops, something went wrong.