Skip to content

Commit c609e53

Browse files
committed
Move gradle scripts to Kotlin DSL
Signed-off-by: Arseniy Graur <argraur@gmail.com>
1 parent f4cc510 commit c609e53

File tree

9 files changed

+198
-124
lines changed

9 files changed

+198
-124
lines changed

app/build.gradle

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

app/build.gradle.kts

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
/*
2+
* Copyright 2022 Arseniy Graur
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+
val polyhootWebSocketUrl: String by project
18+
19+
plugins {
20+
kotlin("android")
21+
kotlin("plugin.serialization")
22+
id("com.android.application")
23+
id("io.gitlab.arturbosch.detekt")
24+
id("com.google.gms.google-services")
25+
id("com.google.firebase.crashlytics")
26+
id("com.google.firebase.firebase-perf")
27+
id("com.google.firebase.appdistribution")
28+
}
29+
30+
android {
31+
namespace = "net.ciphen.polyhoot"
32+
compileSdk = 32
33+
34+
defaultConfig {
35+
applicationId = "net.ciphen.polyhoot"
36+
minSdk = 28
37+
targetSdk = 32
38+
versionCode = 3
39+
versionName = "three"
40+
41+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
42+
}
43+
44+
if (System.getenv("RELEASE_STORE_FILE") != null) {
45+
signingConfigs.create("release") {
46+
storeFile = file(System.getenv("RELEASE_STORE_FILE"))
47+
storePassword = System.getenv("RELEASE_STORE_PASSWORD")
48+
keyAlias = System.getenv("RELEASE_KEY_ALIAS")
49+
keyPassword = System.getenv("RELEASE_KEY_PASSWORD")
50+
}
51+
buildTypes {
52+
getByName("release") {
53+
signingConfig = signingConfigs.getByName("release")
54+
firebaseAppDistribution {
55+
groups = "third-party-testers"
56+
}
57+
}
58+
}
59+
}
60+
61+
buildTypes {
62+
all {
63+
buildConfigField("String", "POLYHOOT_WEBSOCKET_URL", "\"$polyhootWebSocketUrl\"")
64+
proguardFiles(
65+
getDefaultProguardFile("proguard-android-optimize.txt"),
66+
"proguard-rules.pro"
67+
)
68+
}
69+
getByName("release") {
70+
isShrinkResources = true
71+
isMinifyEnabled = true
72+
}
73+
}
74+
75+
compileOptions {
76+
sourceCompatibility(JavaVersion.VERSION_11)
77+
targetCompatibility(JavaVersion.VERSION_11)
78+
}
79+
80+
buildFeatures {
81+
viewBinding = true
82+
}
83+
}
84+
85+
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
86+
kotlinOptions {
87+
jvmTarget = "11"
88+
}
89+
}
90+
91+
tasks.detekt {
92+
reports {
93+
html.required.set(true)
94+
html.outputLocation.set(file("build/reports/detekt.html"))
95+
}
96+
}
97+
98+
dependencies {
99+
implementation("androidx.core:core-ktx:1.7.0")
100+
implementation("androidx.appcompat:appcompat:1.4.1")
101+
implementation("com.google.android.material:material:1.7.0-alpha02")
102+
implementation("androidx.constraintlayout:constraintlayout:2.1.4")
103+
implementation("androidx.navigation:navigation-fragment-ktx:2.4.2")
104+
implementation("androidx.navigation:navigation-ui-ktx:2.4.2")
105+
implementation("com.google.firebase:firebase-crashlytics-ktx:18.2.11")
106+
implementation("com.google.firebase:firebase-analytics-ktx:21.0.0")
107+
implementation("com.google.firebase:firebase-perf-ktx:20.1.0")
108+
implementation("com.squareup.okhttp3:okhttp:5.0.0-alpha.7")
109+
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.3.3")
110+
testImplementation("junit:junit:4.13.2")
111+
androidTestImplementation("androidx.test.ext:junit:1.1.3")
112+
androidTestImplementation("androidx.test.espresso:espresso-core:3.4.0")
113+
}

app/gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,4 +15,4 @@
1515
#
1616
# Defines main entry point to polyhoot server infrastructure
1717
# Change this address if you want to run your own server.
18-
polyhoot.websocket.url=wss://polyhoot.ciphen.net
18+
polyhootWebSocketUrl=wss://polyhoot.ciphen.net

app/proguard-rules.pro

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Add project specific ProGuard rules here.
22
# You can control the set of applied configuration files using the
3-
# proguardFiles setting in build.gradle.
3+
# proguardFiles setting in build.gradle.kts.
44
#
55
# For more details, see
66
# http://developer.android.com/guide/developing/tools/proguard.html

build.gradle

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

build.gradle.kts

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
/*
2+
* Copyright 2022 Arseniy Graur
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+
buildscript {
18+
dependencies {
19+
classpath("com.android.tools.build:gradle:7.4.0-alpha02")
20+
classpath("com.google.gms:google-services:4.3.10")
21+
classpath("com.google.firebase:firebase-crashlytics-gradle:2.9.0")
22+
classpath("com.google.firebase:perf-plugin:1.4.1")
23+
classpath("com.google.firebase:firebase-appdistribution-gradle:3.0.2")
24+
}
25+
}
26+
27+
plugins {
28+
kotlin("android") version "1.6.21" apply false
29+
kotlin("plugin.serialization") version "1.6.21" apply false
30+
id("com.android.application") version "7.4.0-alpha02" apply false
31+
id("com.android.library") version "7.4.0-alpha02" apply false
32+
id("io.gitlab.arturbosch.detekt") version "1.20.0" apply false
33+
}

gradle.properties

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,18 @@
1+
#
2+
# Copyright 2022 Arseniy Graur
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+
#
116
# Project-wide Gradle settings.
217
# IDE (e.g. Android Studio) users:
318
# Gradle settings configured through the IDE *will override*

settings.gradle

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

settings.gradle.kts

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
/*
2+
* Copyright 2022 Arseniy Graur
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+
pluginManagement {
18+
repositories {
19+
gradlePluginPortal()
20+
google()
21+
mavenCentral()
22+
}
23+
}
24+
25+
dependencyResolutionManagement {
26+
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
27+
repositories {
28+
google()
29+
mavenCentral()
30+
}
31+
}
32+
33+
rootProject.name = "Polyhoot"
34+
35+
include(":app")

0 commit comments

Comments
 (0)