Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[RKOTLIN-1100] Clean up build system #1770

Merged
merged 31 commits into from
Jun 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
a064aeb
Clean cinterop
clementetb May 27, 2024
46a58a6
Clean base and sync
clementetb May 27, 2024
9f3a2ed
Update detekt. Remove warnings
clementetb May 28, 2024
fae922f
Remove unrequired dependency
clementetb May 28, 2024
0be3ea2
Remove unchecked cast warnings
clementetb May 28, 2024
89fcab7
Supress inline warnings
clementetb May 28, 2024
56bbdc6
Remove warnings in test-base
clementetb May 28, 2024
bf17549
Remove warnings sync
clementetb May 28, 2024
58d0941
More warnings removed
clementetb May 28, 2024
7712348
More build script updates
clementetb May 28, 2024
bb441e6
Remove more warnings
clementetb May 30, 2024
09c2ec6
Fix deteckt and samples
clementetb May 30, 2024
d0d8d5c
Update benchmarks manifests
clementetb May 30, 2024
0286cab
Decluter temp files
clementetb May 30, 2024
3267299
Readd swig warnings
clementetb May 30, 2024
692e814
Remove removal javacompile warnings
clementetb May 30, 2024
d9b1b8c
Suppress swig warnings
clementetb May 31, 2024
4e708d7
More suppression
clementetb May 31, 2024
7d69f2e
Remove deleting temp folder
clementetb May 31, 2024
690173c
More warnings removed
clementetb May 31, 2024
241c42b
Fix warnings with r8
clementetb May 31, 2024
07835fd
Fix kapt autodiscovery deprecation
clementetb May 31, 2024
43c0037
Add JVM static
clementetb Jun 2, 2024
10657e9
Disable automatic component creation
clementetb Jun 4, 2024
3978eb3
Rename modules
clementetb Jun 4, 2024
a69bc72
Enable execution optimizations
clementetb Jun 4, 2024
f7bf130
Merge branch 'main' into ct/update_build_scripts
clementetb Jun 4, 2024
504edfd
Ignore buildrepo contents
clementetb Jun 4, 2024
5ae8806
PR change requests
clementetb Jun 19, 2024
2caa3b4
Remove warning unused variables
clementetb Jun 19, 2024
d123b59
readd withjavadocjar
clementetb Jun 20, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -329,3 +329,11 @@ DerivedData/

# End of https://www.gitignore.io/api/c,git,c++,java,cmake,xcode,kotlin,android,intellij,visualstudiocode
dynamic_libraries.properties

**/.kotlin

**/output

packages/test-sync/mongodb-realm/

packages/m2-buildrepo
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,11 +69,12 @@
* Minimum Gradle version: 7.2.
* Minimum Android Gradle Plugin version: 7.1.3.
* Minimum Android SDK: 16.
* Minimum R8: 8.0.34.
* Minimum R8: 8.3.37.

### Internal
* Updated to Realm Core 14.7.0 commit c280bdb17522323d5c30dc32a2b9efc9dc80ca3b.
* Changed Kotlin compiler testing framework to https://github.com/zacsweers/kotlin-compile-testing
* Updated to Detekt 1.23.6.


## 1.16.0 (2024-05-01)
Expand Down
2 changes: 2 additions & 0 deletions benchmarks/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ plugins {
}

android {
namespace = "io.realm.kotlin.benchmarks.android"
testNamespace = "io.realm.kotlin.benchmarks.android.test"
compileSdk = Versions.Android.compileSdkVersion

compileOptions {
Expand Down
5 changes: 2 additions & 3 deletions benchmarks/androidApp/src/androidTest/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="io.realm.kotlin.benchmarks.android.test">
xmlns:tools="http://schemas.android.com/tools">

<!--
Important: disable debugging for accurate performance results
Expand All @@ -13,5 +12,5 @@
android:debuggable="false"
android:requestLegacyExternalStorage="true"
tools:ignore="HardcodedDebugMode"
tools:replace="android:debuggable" />
/>
</manifest>
2 changes: 1 addition & 1 deletion benchmarks/androidApp/src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.realm.kotlin.benchmarks.android" />
<manifest/>
2 changes: 2 additions & 0 deletions benchmarks/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -6,3 +6,5 @@ kotlin.code.style=official

#Android
android.useAndroidX=true

kotlin.mpp.applyDefaultHierarchyTemplate=false
6 changes: 2 additions & 4 deletions benchmarks/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ plugins {
version = "1.0"

kotlin {
android()
androidTarget()
jvm()
// Disable iOS until needed
// iosX64()
Expand All @@ -31,9 +31,6 @@ kotlin {
implementation("io.realm.kotlin:library-sync:${Realm.version}")
}
}
val main by creating {
dependsOn(commonMain)
}
val androidMain by getting
// Disable iOS until needed
// val iosX64Main by getting
Expand All @@ -58,6 +55,7 @@ kotlin {
}

android {
namespace = "io.realm.kotlin.benchmarks"
compileSdk = Versions.Android.compileSdkVersion
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/shared/src/androidMain/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest package="io.realm.kotlin.benchmarks" />
<manifest/>
3 changes: 1 addition & 2 deletions buildSrc/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ dependencies {
implementation("io.gitlab.arturbosch.detekt:detekt-gradle-plugin:${Versions.detektPlugin}")
implementation("org.jetbrains.kotlin:kotlin-gradle-plugin:${Versions.kotlin}")
implementation("com.android.tools:r8:${Versions.Android.r8}")
implementation("com.android.tools.build:gradle:${Versions.Android.buildTools}") // TODO LATER Don't know why this has to be here. See if we can remove this
implementation("com.android.tools.build:gradle-api:${Versions.Android.buildTools}")
implementation("com.android.tools.build:gradle:${Versions.Android.buildTools}")
implementation(kotlin("script-runtime"))
}
16 changes: 16 additions & 0 deletions buildSrc/gradle.properties
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#
# Copyright 2024 Realm Inc.
#
# 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
#
# http://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.
#
kotlin.options.suppressFreeCompilerArgsModificationWarning=true
4 changes: 2 additions & 2 deletions buildSrc/src/main/kotlin/Config.kt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ object Versions {
const val buildToolsVersion = "33.0.0"
const val buildTools = "7.3.1" // https://maven.google.com/web/index.html?q=gradle#com.android.tools.build:gradle
const val ndkVersion = "23.2.8568313"
const val r8 = "8.0.34" // See https://developer.android.com/build/kotlin-support
const val r8 = "8.3.37" // See https://developer.android.com/build/kotlin-support
}
const val androidxBenchmarkPlugin = "1.2.0-alpha12" // https://maven.google.com/web/index.html#androidx.benchmark:androidx.benchmark.gradle.plugin
const val androidxStartup = "1.1.1" // https://maven.google.com/web/index.html?q=startup#androidx.startup:startup-runtime
Expand All @@ -115,7 +115,7 @@ object Versions {
const val buildkonfig = "0.13.3" // https://github.com/yshrsmz/BuildKonfig
const val coroutines = "1.7.0" // https://mvnrepository.com/artifact/org.jetbrains.kotlinx/kotlinx-coroutines-core
const val datetime = "0.4.0" // https://github.com/Kotlin/kotlinx-datetime
const val detektPlugin = "1.22.0-RC2" // https://github.com/detekt/detekt
const val detektPlugin = "1.23.6" // https://github.com/detekt/detekt
const val dokka = "1.9.0" // https://github.com/Kotlin/dokka
const val gradlePluginPublishPlugin = "0.15.0" // https://plugins.gradle.org/plugin/com.gradle.plugin-publish
const val jmh = "1.34" // https://github.com/openjdk/jmh
Expand Down
50 changes: 29 additions & 21 deletions buildSrc/src/main/kotlin/realm-lint.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@
* limitations under the License.
*/

import io.gitlab.arturbosch.detekt.Detekt
import io.gitlab.arturbosch.detekt.extensions.DetektReports
import java.nio.file.Files
import java.nio.file.Paths

Expand Down Expand Up @@ -86,30 +88,36 @@ allprojects {

detekt {
buildUponDefaultConfig = true // preconfigure defaults
config = files("$configDir/detekt/detekt.yml") // point to your custom config defining rules to run, overwriting default behavior
config.from(files("$configDir/detekt/detekt.yml")) // point to your custom config defining rules to run, overwriting default behavior
baseline = file("$configDir/detekt/baseline.xml") // a way of suppressing issues before introducing detekt
input = files(
file("src/androidMain/kotlin"),
file("src/androidAndroidTest/kotlin"),
file("src/androidTest/kotlin"),
file("src/commonMain/kotlin"),
file("src/commonTest/kotlin"),
file("src/darwin/kotlin"),
file("src/ios/kotlin"),
file("src/iosMain/kotlin"),
file("src/iosTest/kotlin"),
file("src/jvm/kotlin"),
file("src/jvmMain/kotlin"),
file("src/main/kotlin"),
file("src/macosMain/kotlin"),
file("src/macosTest/kotlin"),
file("src/test/kotlin")
source.files.addAll(
files(
file("src/androidMain/kotlin"),
file("src/androidAndroidTest/kotlin"),
file("src/androidTest/kotlin"),
file("src/commonMain/kotlin"),
file("src/commonTest/kotlin"),
file("src/darwin/kotlin"),
file("src/ios/kotlin"),
file("src/iosMain/kotlin"),
file("src/iosTest/kotlin"),
file("src/jvm/kotlin"),
file("src/jvmMain/kotlin"),
file("src/main/kotlin"),
file("src/macosMain/kotlin"),
file("src/macosTest/kotlin"),
file("src/test/kotlin")
)
)

reports {
html.enabled = true // observe findings in your browser with structure and code snippets
xml.enabled = false // checkstyle like format mainly for integrations like GHA
txt.enabled = false // similar to the console output, contains issue signature to manually edit baseline files
tasks.withType<Detekt>().configureEach {
reports {
xml.required.set(true)
html.required.set(true)
txt.required.set(true)
sarif.required.set(true)
md.required.set(true)
}
}
}
}
23 changes: 10 additions & 13 deletions config/detekt/detekt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -310,7 +310,6 @@ naming:
BooleanPropertyNaming:
active: false
allowedPattern: '^(is|has|are)'
ignoreOverridden: true
ClassNaming:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/androidAndroidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
Expand All @@ -321,7 +320,6 @@ naming:
parameterPattern: '[a-z][A-Za-z0-9]*'
privateParameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
EnumNaming:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/androidAndroidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
Expand All @@ -343,13 +341,11 @@ naming:
excludes: ['**/test/**', '**/androidTest/**', '**/androidAndroidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
functionPattern: '[a-z][a-zA-Z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
FunctionParameterNaming:
active: true
excludes: ['**/test/**', '**/androidTest/**', '**/androidAndroidTest/**', '**/commonTest/**', '**/jvmTest/**', '**/jsTest/**', '**/iosTest/**']
parameterPattern: '[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true
InvalidPackageDeclaration:
active: true
rootPackage: ''
Expand Down Expand Up @@ -398,8 +394,7 @@ naming:
variablePattern: '[a-z][A-Za-z0-9]*'
privateVariablePattern: '(_)?[a-z][A-Za-z0-9]*'
excludeClassPattern: '$^'
ignoreOverridden: true

#
performance:
active: true
ArrayPrimitive:
Expand Down Expand Up @@ -549,12 +544,14 @@ style:
includeLineWrapping: false
ForbiddenComment:
active: true
values:
- 'FIXME:'
- 'STOPSHIP:'
- 'TODO:'
comments:
- reason: 'Forbidden FIXME todo marker in comment, please fix the problem.'
value: 'FIXME:'
- reason: 'Forbidden STOPSHIP todo marker in comment, please fix the problem.'
value: 'STOPSHIP:'
- reason: 'Forbidden TODO todo marker in comment, please fix the problem.'
value: 'TODO:'
allowedPatterns: ''
customMessage: ''
ForbiddenImport:
active: false
imports: []
Expand Down Expand Up @@ -599,7 +596,7 @@ style:
ignoreEnums: false
ignoreRanges: false
ignoreExtensionFunctions: true
MandatoryBracesIfStatements:
BracesOnIfStatements:
active: false
MandatoryBracesLoops:
active: false
Expand Down Expand Up @@ -636,7 +633,7 @@ style:
active: true
OptionalUnit:
active: false
OptionalWhenBraces:
BracesOnWhenStatements:
active: false
PreferToOverPairSyntax:
active: false
Expand Down
6 changes: 3 additions & 3 deletions examples/kmm-sample/androidApp/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ android {
}
}

compileSdkVersion(Versions.Android.compileSdkVersion)
compileSdk = Versions.Android.compileSdkVersion
defaultConfig {
applicationId = "io.realm.example.kmmsample.androidApp"
// FIXME Use Versions.Android.minSdk when it is aligned in the SDK
minSdkVersion(21)
targetSdkVersion(Versions.Android.targetSdk)
minSdk = 21
targetSdk = Versions.Android.targetSdk
versionCode = 1
versionName = "$version"
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,10 +42,6 @@ class MainActivity : AppCompatActivity() {
sumTV.text = "= 🤔"
}
}

override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {}

override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {}
}

countTV.text = "History count: ${Calculator.history().size}"
Expand Down
4 changes: 1 addition & 3 deletions examples/kmm-sample/gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,6 @@ org.gradle.jvmargs=-Xms512m -Xmx2048m
kotlin.code.style=official
xcodeproj=./iosApp
android.useAndroidX=true
kotlin.mpp.enableGranularSourceSetsMetadata=true
kotlin.native.enableDependencyPropagation=false

kotlin.mpp.applyDefaultHierarchyTemplate=false
kotlin.mpp.stability.nowarn=true
kotlin.mpp.androidSourceSetLayoutVersion1.nowarn=true
8 changes: 4 additions & 4 deletions examples/kmm-sample/shared/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ configurations.all {

kotlin {
jvm()
android()
androidTarget()
val iosTarget: (String, KotlinNativeTarget.() -> Unit) -> KotlinNativeTarget = when {
System.getenv("SDK_NAME")?.startsWith("iphoneos") == true -> ::iosArm64
System.getenv("NATIVE_ARCH")?.startsWith("arm") == true -> ::iosSimulatorArm64
Expand Down Expand Up @@ -75,11 +75,11 @@ kotlin {
}
}
android {
compileSdkVersion(Versions.Android.compileSdkVersion)
compileSdk = Versions.Android.compileSdkVersion
sourceSets["main"].manifest.srcFile("src/androidMain/AndroidManifest.xml")
defaultConfig {
minSdkVersion(Versions.Android.minSdk)
targetSdkVersion(Versions.Android.targetSdk)
minSdk = Versions.Android.minSdk
targetSdk = Versions.Android.targetSdk
}
buildTypes {
getByName("release") {
Expand Down
6 changes: 3 additions & 3 deletions examples/min-android-sample/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ plugins {
}

android {
compileSdkVersion(31)
compileSdk = 31
defaultConfig {
applicationId = "io.realm.example.minandroidsample.android"
minSdkVersion(16)
targetSdkVersion(31)
minSdk = 16
targetSdk = 31
versionCode = 1
versionName = "1.0"
}
Expand Down
2 changes: 2 additions & 0 deletions examples/min-android-sample/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ buildscript {
gradlePluginPortal()
google()
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
dependencies {
classpath("com.android.tools.build:gradle:7.1.3")
Expand All @@ -29,5 +30,6 @@ allprojects {
maven(url = "file://${rootProject.rootDir.absolutePath}/../../packages/build/m2-buildrepo")
google()
mavenCentral()
maven(url = "https://oss.sonatype.org/content/repositories/snapshots")
}
}
Loading
Loading