Skip to content

Commit

Permalink
Migrate Material intro to Kotlin
Browse files Browse the repository at this point in the history
  • Loading branch information
niknetniko committed Oct 5, 2024
1 parent cdead70 commit 5068704
Show file tree
Hide file tree
Showing 4 changed files with 80 additions and 55 deletions.
1 change: 0 additions & 1 deletion app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@ plugins {
id("be.ugent.zeus.hydra.licenses")
id("com.google.gms.google-services")
id("com.google.firebase.crashlytics")
id("com.google.android.libraries.mapsplatform.secrets-gradle-plugin")
}

// Read our properties, see bottom for details.
Expand Down
53 changes: 0 additions & 53 deletions material-intro/build.gradle

This file was deleted.

79 changes: 79 additions & 0 deletions material-intro/build.gradle.kts
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
/*
* Copyright (c) 2017 Jan Heinrich Reimer
* Copyright (c) 2024 Niko Strijbol
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
* of this software and associated documentation files (the "Software"), to deal
* in the Software without restriction, including without limitation the rights
* to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
* copies of the Software, and to permit persons to whom the Software is
* furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice shall be included in all
* copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
* SOFTWARE.
*/
import java.io.FileInputStream
import java.util.*

plugins {
id("com.android.library")
}

val versions = loadAndroidVersions()

android {
namespace = "com.heinrichreimersoftware.materialintro"

// We need this for Nix flakes
buildToolsVersion = versions.getProperty("buildToolsVersions")

defaultConfig {
compileSdk = versions.getProperty("platformVersions").toInt()
minSdk = 21
}

buildTypes {
getByName("release") {
isMinifyEnabled = false
proguardFiles(getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro")
}
}

lint {
disable += listOf("Overdraw", "OldTargetApi", "GradleDependency")
showAll = true
warningsAsErrors = true
targetSdk = 34
}
}

dependencies {
implementation(libs.androidx.appcompat)
implementation(libs.androidx.constraintlayout)
implementation(libs.material)
}

// TODO: extract this duplicate code...
/**
* Loads the default properties, and the user properties. This will also load the
* secret keys.
*/
fun loadAndroidVersions(): Properties {
val defaultProps = Properties()
defaultProps.load(FileInputStream(file("../android-versions.toml")))

val strippedProps = Properties()
defaultProps.forEach { k, v ->
strippedProps.setProperty(k.toString(), v.toString().replace("\"", ""))
}

return strippedProps
}
2 changes: 1 addition & 1 deletion material-intro/proguard-rules.pro
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# By default, the flags in this file are appended to flags specified
# in C:\Users\Agando\AppData\Local\Android\sdk/tools/proguard/proguard-android.txt
# You can edit the include path and order by changing the proguardFiles
# directive in build.gradle.
# directive in build.gradle.kts.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
Expand Down

0 comments on commit 5068704

Please sign in to comment.