Skip to content

Commit fcb10e5

Browse files
authored
Merge pull request #10 from RedMadRobot/feature/build
Update build environment before release
2 parents 6359bb9 + 1bbed3c commit fcb10e5

27 files changed

Lines changed: 412 additions & 303 deletions

File tree

build.gradle.kts

Lines changed: 2 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,35 +1,15 @@
11
// Top-level build file where you can add configuration options common to all sub-projects/modules.
2-
3-
buildscript {
4-
repositories {
5-
google()
6-
jcenter()
7-
}
8-
9-
dependencies {
10-
classpath(Plugins.Android.gradlePlugin)
11-
classpath(Plugins.Kotlin.plugin)
12-
}
13-
}
14-
152
subprojects {
16-
173
version = getLibVersion()
184
group = "com.redmadrobot.debug"
195

20-
repositories {
21-
google()
22-
jcenter()
23-
mavenLocal()
24-
}
25-
266
tasks.withType<org.jetbrains.kotlin.gradle.tasks.KotlinCompile>().configureEach {
277
kotlinOptions.freeCompilerArgs += listOf(
28-
"-Xopt-in=com.redmadrobot.debug_panel_core.annotation.DebugPanelInternal"
8+
"-opt-in=com.redmadrobot.debug_panel_core.annotation.DebugPanelInternal"
299
)
3010
}
3111
}
3212

3313
tasks.register("clean", Delete::class) {
34-
delete(rootProject.buildDir)
14+
delete(rootProject.layout.buildDirectory)
3515
}

buildSrc/build.gradle.kts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,5 +19,6 @@ gradlePlugin {
1919
}
2020

2121
dependencies {
22-
implementation("com.android.tools.build:gradle:7.4.2")
22+
implementation(kotlin("gradle-plugin", version = "1.9.23"))
23+
implementation("com.android.tools.build:gradle:8.3.2")
2324
}

buildSrc/src/main/kotlin/Dependencies.kt

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
object Versions {
22

3-
const val KOTLIN = "1.6.20"
3+
const val KOTLIN = "1.9.23"
44

5-
const val COROUTINES = "1.3.9"
5+
const val COROUTINES = "1.8.0"
66
const val OKHTTP = "4.9.0"
77

88
const val APP_COMPAT = "1.1.0"
@@ -19,20 +19,20 @@ object Versions {
1919
const val LIFECYCLE_RUNTIME = "2.4.0"
2020
const val LIFECYCLE_TESTING = "2.1.0"
2121

22-
const val ROOM = "2.4.0"
22+
const val ROOM = "2.6.1"
2323
const val NAVIGATION = "2.2.0"
2424

2525
const val GLIDE = "4.11.0"
2626
const val ITEMS_ADAPTER = "1.1"
2727

2828
const val ANDROID_KTX = "1.9.0"
2929
const val TIMBER = "4.7.1"
30-
const val FLIPPER = "2.0.0"
30+
const val FLIPPER = "2.0.1"
3131
}
3232

3333
object Dependencies {
3434
object kotlin {
35-
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${Versions.KOTLIN}"
35+
const val stdlib = "org.jetbrains.kotlin:kotlin-stdlib:${Versions.KOTLIN}"
3636
const val test = "org.jetbrains.kotlin:kotlin-test-junit:${Versions.KOTLIN}"
3737
}
3838

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,12 @@
11
object Plugins {
22

3-
private const val ANDROID_PLUGIN = "7.0.0"
4-
53
object Kotlin {
6-
const val plugin = "org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.KOTLIN}"
74
const val androidPlugin = "android"
8-
const val androidExtensions = "android.extensions"
95
const val kapt = "kapt"
106
}
117

128
object Android {
13-
const val gradlePlugin = "com.android.tools.build:gradle:$ANDROID_PLUGIN"
149
const val applicationPlugin = "com.android.application"
1510
const val libraryPlagin = "com.android.library"
1611
}
17-
}
12+
}

debug-panel-common/build.gradle.kts

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,18 @@
11
plugins {
22
id(Plugins.Android.libraryPlagin)
33
kotlin(Plugins.Kotlin.androidPlugin)
4-
kotlin(Plugins.Kotlin.androidExtensions)
54
kotlin(Plugins.Kotlin.kapt)
65
id("publishPlugin")
76
}
87

98
description = "Debug panel common components"
109

1110
android {
12-
1311
compileSdk = Project.COMPILE_SDK
12+
lint.targetSdk = Project.TARGET_SDK
1413

1514
defaultConfig {
1615
minSdk = Project.MIN_SDK
17-
targetSdk = Project.TARGET_SDK
1816

1917
consumerProguardFile("consumer-rules.pro")
2018
}
@@ -39,8 +37,6 @@ android {
3937
freeCompilerArgs += "-Xexplicit-api=strict"
4038
}
4139

42-
java.sourceSets.create("src.main.kotlin")
43-
4440
buildFeatures {
4541
viewBinding = true
4642
}

debug-panel-core/build.gradle.kts

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
plugins {
22
id(Plugins.Android.libraryPlagin)
33
kotlin(Plugins.Kotlin.androidPlugin)
4-
kotlin(Plugins.Kotlin.androidExtensions)
54
kotlin(Plugins.Kotlin.kapt)
65
id("publishPlugin")
76
}
@@ -10,10 +9,10 @@ description = "Debug panel core library"
109

1110
android {
1211
compileSdk = Project.COMPILE_SDK
12+
lint.targetSdk = Project.TARGET_SDK
1313

1414
defaultConfig {
1515
minSdk = Project.MIN_SDK
16-
targetSdk = Project.TARGET_SDK
1716

1817
consumerProguardFile("consumer-rules.pro")
1918
}
@@ -35,17 +34,19 @@ android {
3534

3635
kotlinOptions {
3736
jvmTarget = "1.8"
38-
freeCompilerArgs += listOf("-Xexplicit-api=strict", "-Xopt-in=kotlin.RequiresOptIn")
37+
freeCompilerArgs += listOf("-opt-in=kotlin.RequiresOptIn")
3938
}
4039

41-
java.sourceSets.create("src.main.kotlin")
42-
4340
buildFeatures {
4441
viewBinding = true
4542
}
4643
namespace = "com.redmadrobot.panel_core"
4744
}
4845

46+
kotlin {
47+
explicitApi()
48+
}
49+
4950
dependencies {
5051
implementation(project(":debug-panel-common"))
5152
kapt(Dependencies.room.compiler)

debug-panel-core/src/main/kotlin/com/redmadrobot/debug_panel_core/inapp/DebugBottomSheet.kt

Lines changed: 18 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,17 @@ package com.redmadrobot.debug_panel_core.inapp
22

33
import android.app.Dialog
44
import android.os.Bundle
5-
import android.view.View
65
import android.view.ViewGroup
76
import android.widget.FrameLayout
8-
import androidx.annotation.NonNull
97
import androidx.appcompat.view.ContextThemeWrapper
108
import androidx.fragment.app.FragmentManager
119
import com.google.android.material.bottomsheet.BottomSheetBehavior
1210
import com.google.android.material.bottomsheet.BottomSheetDialog
1311
import com.google.android.material.bottomsheet.BottomSheetDialogFragment
1412
import com.google.android.material.tabs.TabLayoutMediator
1513
import com.redmadrobot.debug_panel_core.extension.getAllPlugins
16-
import com.redmadrobot.panel_core.R
17-
import kotlinx.android.synthetic.main.bottom_sheet_debug_panel.view.*
18-
14+
import com.redmadrobot.panel_core.databinding.BottomSheetDebugPanelBinding
15+
import com.redmadrobot.debug_panel_common.R as CommonR
1916

2017
internal class DebugBottomSheet : BottomSheetDialogFragment() {
2118

@@ -29,30 +26,35 @@ internal class DebugBottomSheet : BottomSheetDialogFragment() {
2926
}
3027
}
3128

32-
private var dialogView: View? = null
29+
private var _binding: BottomSheetDebugPanelBinding? = null
30+
private val binding get() = checkNotNull(_binding)
3331

34-
@NonNull
3532
override fun onCreateDialog(savedInstanceState: Bundle?): Dialog {
3633
/*set DebugPanelTheme*/
3734
val dialog = super.onCreateDialog(savedInstanceState)
38-
val contextThemeWrapper = ContextThemeWrapper(activity, R.style.DebugPanelTheme)
35+
val contextThemeWrapper = ContextThemeWrapper(activity, CommonR.style.DebugPanelTheme)
3936
val localInflater = dialog.layoutInflater.cloneInContext(contextThemeWrapper)
4037

41-
dialogView = localInflater.inflate(R.layout.bottom_sheet_debug_panel, null)
38+
_binding = BottomSheetDebugPanelBinding.inflate(localInflater)
4239
dialog.setOnShowListener {
4340
setBottomSheetSize()
4441
}
45-
dialog.setContentView(requireNotNull(dialogView))
46-
setViews(requireNotNull(dialogView))
42+
dialog.setContentView(binding.root)
43+
setViews(binding)
4744
return dialog
4845
}
4946

50-
private fun setViews(dialogView: View) {
47+
override fun onDestroyView() {
48+
super.onDestroyView()
49+
_binding = null
50+
}
51+
52+
private fun setViews(binding: BottomSheetDebugPanelBinding) {
5153
val plugins = getAllPlugins()
5254
/*Only Plugins with Fragment*/
5355
.filter { it.getFragment() != null }
5456

55-
dialogView.debug_sheet_viewpager.adapter = DebugSheetViewPagerAdapter(
57+
binding.debugSheetViewpager.adapter = DebugSheetViewPagerAdapter(
5658
requireActivity(),
5759
plugins
5860
)
@@ -62,14 +64,14 @@ internal class DebugBottomSheet : BottomSheetDialogFragment() {
6264
}
6365

6466
TabLayoutMediator(
65-
dialogView.debug_sheet_tab_layout,
66-
dialogView.debug_sheet_viewpager,
67+
binding.debugSheetTabLayout,
68+
binding.debugSheetViewpager,
6769
tabConfigurationStrategy
6870
).attach()
6971
}
7072

7173
private fun setBottomSheetSize() {
72-
val dialogContainer = dialogView?.parent as? FrameLayout
74+
val dialogContainer = binding.root.parent as? FrameLayout
7375
dialogContainer?.apply {
7476
layoutParams?.height = ViewGroup.LayoutParams.MATCH_PARENT
7577
requestLayout()

debug-panel-core/src/main/kotlin/com/redmadrobot/debug_panel_core/inapp/ModalLayout.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,23 @@ import android.util.AttributeSet
88
import androidx.coordinatorlayout.widget.CoordinatorLayout
99
import androidx.core.content.ContextCompat
1010
import com.redmadrobot.panel_core.R
11+
import com.redmadrobot.debug_panel_common.R as CommonR
1112

1213
internal class ModalLayout @JvmOverloads constructor(
1314
context: Context, attrs: AttributeSet? = null, defStyleAttr: Int = 0
1415
) : CoordinatorLayout(context, attrs, defStyleAttr) {
1516

1617
/**
1718
* Paint для отрисовки "ручки" модального окна
18-
* */
19+
*/
1920
private val handlePaint = Paint().apply {
20-
color = ContextCompat.getColor(context, R.color.gray)
21+
color = ContextCompat.getColor(context, CommonR.color.gray)
2122
style = Paint.Style.FILL
2223
}
2324

2425
/**
2526
* Координаты для отрисовки "ручки" модального окна
26-
* */
27+
*/
2728
private val handleRect by lazy {
2829
val height = resources.getDimensionPixelSize(R.dimen.debug_panel_handle_height).toFloat()
2930
val width = resources.getDimensionPixelSize(R.dimen.debug_panel_handle_width).toFloat()
@@ -55,5 +56,4 @@ internal class ModalLayout @JvmOverloads constructor(
5556
)
5657
super.dispatchDraw(canvas)
5758
}
58-
5959
}

debug-panel-core/src/main/kotlin/com/redmadrobot/debug_panel_core/ui/debugpanel/DebugActivity.kt

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,20 +8,21 @@ import com.redmadrobot.debug_panel_core.extension.getAllPlugins
88
import com.redmadrobot.itemsadapter.bind
99
import com.redmadrobot.itemsadapter.itemsAdapter
1010
import com.redmadrobot.panel_core.R
11+
import com.redmadrobot.panel_core.databinding.ActivityDebugBinding
1112
import com.redmadrobot.panel_core.databinding.ItemPluginSettingBinding
12-
import kotlinx.android.synthetic.main.activity_debug.*
1313

1414
internal class DebugActivity : AppCompatActivity() {
1515

1616
override fun onCreate(savedInstanceState: Bundle?) {
1717
super.onCreate(savedInstanceState)
18-
setContentView(R.layout.activity_debug)
19-
setViews()
18+
val binding = ActivityDebugBinding.inflate(layoutInflater)
19+
setContentView(binding.root)
20+
binding.setViews()
2021
}
2122

22-
private fun setViews() {
23-
debug_feature_list.layoutManager = LinearLayoutManager(this)
24-
debug_feature_list.adapter = itemsAdapter(getSettingItems()) { item ->
23+
private fun ActivityDebugBinding.setViews() {
24+
debugFeatureList.layoutManager = LinearLayoutManager(root.context)
25+
debugFeatureList.adapter = itemsAdapter(getSettingItems()) { item ->
2526
bind<ItemPluginSettingBinding>(R.layout.item_plugin_setting) {
2627
itemDebugFeatureLabel.text = item.pluginName
2728
root.setOnClickListener { item.onClicked.invoke() }

debug-panel-no-op/build.gradle.kts

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,10 @@ description = "Debug panel no-op dependency module"
88

99
android {
1010
compileSdk = Project.COMPILE_SDK
11+
lint.targetSdk = Project.TARGET_SDK
1112

1213
defaultConfig {
1314
minSdk = Project.MIN_SDK
14-
targetSdk = Project.TARGET_SDK
1515

1616
consumerProguardFile("consumer-rules.pro")
1717
}
@@ -35,7 +35,6 @@ android {
3535
jvmTarget = "1.8"
3636
}
3737

38-
java.sourceSets.create("src.main.kotlin")
3938
namespace = "com.redmadrobot.debug_panel_no_op"
4039
}
4140

0 commit comments

Comments
 (0)