Skip to content

Feature/upgrade kotlin #78

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

Merged
merged 5 commits into from
Dec 7, 2023
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
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
24 changes: 20 additions & 4 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.

buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.21'
ext.groupName = 'com.github.SchwarzIT'
repositories {
google()
mavenCentral()
Expand All @@ -10,17 +11,17 @@ buildscript {
}
}
dependencies {
classpath 'com.android.tools.build:gradle:4.2.2'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath 'com.android.tools.build:gradle:8.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:1.9.21"
classpath "org.jlleitschuh.gradle:ktlint-gradle:10.2.0"
classpath 'com.github.dcendents:android-maven-gradle-plugin:2.1'
// NOTE: Do not place your application dependencies here; they belong
// in the individual module build.gradle files
}
}

subprojects {
apply plugin: "org.jlleitschuh.gradle.ktlint"
apply plugin: 'maven-publish'

repositories {
mavenCentral()
Expand All @@ -38,9 +39,24 @@ subprojects {
"no-wildcard-imports"
]
}

}

def versionName() {

if (!hasProperty("version")) {
// don't care
return "dummy"
}

return property("version")
}


allprojects {
version = versionName()
group = groupName

repositories {
google()
mavenCentral()
Expand Down
49 changes: 16 additions & 33 deletions crystal-map-api/build.gradle
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'java'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand All @@ -8,39 +9,21 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
java {
withSourcesJar()
withJavadocJar()
}

artifacts {
archives sourcesJar
archives javadocJar
}
buildscript {
ext.kotlin_version = '1.7.0'
repositories {
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}
repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
}
43 changes: 16 additions & 27 deletions crystal-map-couchbase-connector/build.gradle
Original file line number Diff line number Diff line change
@@ -1,13 +1,14 @@
apply plugin: 'com.android.library'
apply plugin: 'com.github.dcendents.android-maven'
apply plugin: 'maven-publish'
apply plugin: 'kotlin-android'

android {
compileSdkVersion 33
namespace "com.schwarz.crystalcouchbaseconnector"

defaultConfig {
minSdkVersion 21
targetSdkVersion 33
compileSdk = 33
versionCode 1
versionName "1.0"

Expand All @@ -22,36 +23,24 @@ android {
}
}
compileOptions {
sourceCompatibility = 1.8
targetCompatibility = 1.8
sourceCompatibility = JavaVersion.VERSION_17
targetCompatibility = JavaVersion.VERSION_17
}
}

group = 'com.github.SchwarzIT'

task sourcesJar(type: Jar) {
classifier = 'sources'
from android.sourceSets.main.java.sourceFiles
}

task javadoc(type: Javadoc) {
source = android.sourceSets.main.java.sourceFiles
classpath += project.files(android.getBootClasspath().join(File.pathSeparator))
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
}

task classesJar(type: Jar) {
from "$buildDir/intermediates/classes/release"
}

artifacts {
archives classesJar
archives javadocJar
archives sourcesJar
afterEvaluate {
publishing {
publications {
maven(MavenPublication) {
groupId groupName
artifactId project.name
version project.version
from components.release
}
}
}
}

dependencies {
Expand Down
49 changes: 22 additions & 27 deletions crystal-map-processor/build.gradle
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
apply plugin: 'kotlin'
apply plugin: 'maven'
apply plugin: 'maven-publish'
apply plugin: 'jacoco'
apply plugin: 'pmd'
apply plugin: 'kotlin-kapt'
apply plugin: 'java'

dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
Expand All @@ -23,17 +24,23 @@ dependencies {
implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
}

targetCompatibility = '1.8'
sourceCompatibility = '1.8'
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
java {
withSourcesJar()
withJavadocJar()
}

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}

jacoco {
Expand All @@ -46,24 +53,12 @@ jacocoTestReport {

reports {

xml.enabled = true
html.enabled = false
}
}

artifacts {
archives sourcesJar
archives javadocJar
}

compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
xml{
enabled true
}
html{
enabled false
}
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ class DocIdHolder(docId: DocId, val customSegmentSource: MutableList<DocIdSegmen
.addModifiers(KModifier.OVERRIDE)
val list: List<String> = distinctFieldAccessors(entity)

if (entity.deprecated?.addDeprecatedFunctions(*list.toTypedArray(), spec) == true) {
if (entity.deprecated?.addDeprecatedFunctions(list.toTypedArray(), spec) == true) {
spec.addStatement("throw %T()", UnsupportedOperationException::class)
} else {
spec.addStatement("return $COMPANION_BUILD_FUNCTION_NAME(${list.joinToString(separator = ",")})")
Expand Down
37 changes: 14 additions & 23 deletions crystal-map-versioning-plugin/build.gradle
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
plugins {
id 'java-gradle-plugin'
id 'kotlin'
id 'maven'
id 'maven-publish'
}


Expand All @@ -14,32 +14,23 @@ gradlePlugin {
}
}

task sourcesJar(type: Jar, dependsOn: classes) {
classifier = 'sources'
from sourceSets.main.allSource
}
targetCompatibility = JavaVersion.VERSION_17
sourceCompatibility = JavaVersion.VERSION_17

task javadocJar(type: Jar, dependsOn: javadoc) {
classifier = 'javadoc'
from javadoc.destinationDir
java {
withSourcesJar()
withJavadocJar()
}

artifacts {
archives sourcesJar
archives javadocJar
}

repositories {
mavenCentral()
}
compileKotlin {
kotlinOptions {
jvmTarget = "1.8"
}
}
compileTestKotlin {
kotlinOptions {
jvmTarget = "1.8"
publishing {
publications {
maven(MavenPublication) {
groupId project.group
artifactId project.name
version project.version
from components.java
}
}
}

Expand Down
9 changes: 5 additions & 4 deletions demo/build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@

buildscript {
ext.kotlin_version = '1.7.10'
ext.kotlin_version = '1.9.21'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.3.1'
classpath 'com.android.tools.build:gradle:8.0.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"

//TODO enable to locally test plugin
Expand All @@ -33,6 +33,7 @@ apply plugin: 'kotlin-kapt'

android {

namespace "com.schwarz.crystaldemo"
defaultConfig {
applicationId "com.schwarz.crystaldemo"
compileSdkVersion 33
Expand All @@ -49,8 +50,8 @@ android {
}
}
compileOptions {
sourceCompatibility 1.8
targetCompatibility 1.8
sourceCompatibility JavaVersion.VERSION_17
targetCompatibility JavaVersion.VERSION_17
}

// workaround for "duplicate files during packaging of APK" issue:
Expand Down
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.9.3-all.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.0-all.zip
networkTimeout=300000