bernaferrari / GradleKotlinConverter

Convert from Groovy to Kotlin DSL for Gradle, focused on Android.
https://gradle-kotlin-converter.vercel.app
Apache License 2.0
919 stars 60 forks source link

Doesn't work #23

Open jolkdarr opened 4 years ago

jolkdarr commented 4 years ago

Hi

Simply fails with a 200 lines Gradle build file. The resulting file has almost 900 lines and does not compile. :(

build.gradle.zip

abunur commented 3 years ago

Fails with the following error:

Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/FoldingData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.FoldingData Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/ReferenceData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.ReferenceData Exception "java.lang.ClassNotFoundException: com/intellij/codeInsight/editorActions/ReferenceData"while constructing DataFlavor for: application/x-java-jvm-local-objectref; class=com.intellij.codeInsight.editorActions.ReferenceData [16:47:20] - Trying to open clipboard.. Success! java.lang.StringIndexOutOfBoundsException: String index out of range: 6684 at java.base/java.lang.StringLatin1.charAt(StringLatin1.java:48) at java.base/java.lang.String.charAt(String.java:712) at Gradlekotlinconverter.getExpressionBlock(gradlekotlinconverter.kts:339) at Gradlekotlinconverter.convertNestedTypes(gradlekotlinconverter.kts:310) at Gradlekotlinconverter.convertSigningConfigs(gradlekotlinconverter.kts:306) at Gradlekotlinconverter.(gradlekotlinconverter.kts:692) gradlekotlinconverter.kts:646:61: warning: unnecessary safe call on a non-null receiver of type Sequence val plugins = isolatedId.findAll(isolatedLine.value)?.fold("") { acc, matchResult -> ^

bernaferrari commented 3 years ago

@abunur do you have the sample file that lead to this?

abunur commented 3 years ago

@abunur do you have the sample file that lead to this?

plugins { id 'com.android.application' id 'kotlin-android' id 'kotlin-android-extensions' id 'kotlin-kapt' id "androidx.navigation.safeargs.kotlin" }

android { signingConfigs { release { storeFile file('/Users/abunur/workspace/Octo_Telematics/prototypes/play store/acclerometer key store') storePassword '{3[NFhiD9?9jEKnj' keyPassword '{3[NFhiD9?9jEKnj' keyAlias 'accelerometer' } } compileSdkVersion 30 buildToolsVersion "30.0.2"

defaultConfig {
    applicationId "com.octo.accelerometer"
    minSdkVersion 29
    targetSdkVersion 30
    versionCode 23
    versionName "1.0"

    testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}

ndkVersion "21.3.6528147"

buildTypes {
    release {
        minifyEnabled false
        proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
        // automatically include the native debug symbols file in App Bundle file
        ndk {
            debugSymbolLevel 'FULL'
        }
    }
}

compileOptions {
    sourceCompatibility JavaVersion.VERSION_1_8
    targetCompatibility JavaVersion.VERSION_1_8
}
kotlinOptions {
    jvmTarget = '1.8'
}

buildFeatures {
    // Determines whether to generate a BuildConfig class.
    buildConfig = true
    // Determines whether to support View Binding.
    // Note that the viewBinding.enabled property is now deprecated.
    viewBinding = true
    // Determines whether to support Data Binding.
    // Note that the dataBinding.enabled property is now deprecated.
    dataBinding = true
    // Determines whether to generate binder classes for your AIDL files.
    aidl = true
    // Determines whether to support RenderScript.
    renderScript = true
    // Determines whether to support injecting custom variables into the module's R class.
    resValues = true
    // Determines whether to support shader AOT compilation.
    shaders = true
}

}

dependencies { implementation 'com.google.android.gms:play-services-maps:17.0.0' implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version" def lifecycle_version = "2.2.0" def arch_version = "2.1.0" def nav_version = '2.3.2' def room_version = "2.2.6" def testrunner_version = "1.3.0" def espresso_version = "3.3.0" def koin_version = "2.1.6" def scicharts_version = "4.1.0.4472"

implementation fileTree(include: ['*.jar'], dir: 'libs')
implementation 'com.google.android.gms:play-services-location:17.1.0'

// Java language implementation
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

// Kotlin
implementation "androidx.navigation:navigation-fragment-ktx:$nav_version"
implementation "androidx.navigation:navigation-ui-ktx:$nav_version"

// Dynamic Feature Module Support
implementation "androidx.navigation:navigation-dynamic-features-fragment:$nav_version"

// Testing Navigation
androidTestImplementation "androidx.navigation:navigation-testing:$nav_version"

// Material Design
implementation "com.google.android.material:material:$material_version"
// Constraint Layout
implementation "androidx.constraintlayout:constraintlayout:$constraint_layout_version"
// RecyclerView
implementation "androidx.recyclerview:recyclerview:1.1.0"
// Picasso
implementation 'com.squareup.picasso:picasso:2.71828'

// Core
implementation "androidx.core:$core_version"
implementation 'androidx.appcompat:appcompat:1.2.0'

// ViewModel
implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$lifecycle_version"

// Koin - in order to easily see dependencies for ViewModel in the dependency graph
implementation "org.koin:koin-core:$koin_version"
// Koin for Unit tests
testImplementation "org.koin:koin-test:$koin_version"
// Koin for ViewModel
implementation "org.koin:koin-android-viewmodel:$koin_version"
// Koin for testing
testImplementation "org.koin:koin-test:$koin_version"

// LiveData
implementation "androidx.lifecycle:lifecycle-livedata-ktx:$lifecycle_version"

// Location Services
implementation "com.google.android.gms:play-services-location:17.1.0"

// Room
implementation "androidx.room:room-common:$room_version"
// from Saving Data - rest are from docs
kapt "androidx.room:room-compiler:$room_version"
implementation "androidx.room:room-runtime:$room_version"
// Kotlin Extensions and Coroutines support for Room
implementation "androidx.room:room-ktx:$room_version"
// Test helpers
testImplementation "androidx.room:room-testing:$room_version"

implementation 'androidx.legacy:legacy-support-v4:1.0.0'

// Declare SciChart libraries as module dependencies
implementation (group: 'com.scichart.library', name: 'core', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'data', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'drawing', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'charting3d', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'charting', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'extensions', version: scicharts_version, ext: 'aar')
implementation (group: 'com.scichart.library', name: 'extensions3d', version: scicharts_version, ext: 'aar')

// Retrofit / networking
implementation 'com.squareup.retrofit2:retrofit:2.9.0'
implementation 'com.squareup.okhttp3:okhttp:4.7.2'
implementation 'com.squareup.okhttp3:logging-interceptor:4.7.2'
// JSON Serialization

// Testing
testImplementation 'junit:junit:4.13.1'
testImplementation "org.mockito:mockito-core:3.5.13"
testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
testImplementation "androidx.arch.core:core-testing:$arch_version"
testImplementation 'org.jetbrains.kotlinx:kotlinx-coroutines-test'
testImplementation 'com.github.marcinOz:TestCoroutineRule:1.0.1'
androidTestImplementation 'androidx.test.ext:junit:1.1.2'
androidTestImplementation "androidx.test:runner:$testrunner_version"
androidTestImplementation "androidx.test.espresso:espresso-core:$espresso_version"

}