vladimirpetrovski / bitrise-step-version-extractor-android

Bitrise step for extracting the versionName and the versionCode on Android.
https://bitrise.io
MIT License
1 stars 4 forks source link

Only works with Groovy, not KTS #8

Open Daphne-CoffeeIT opened 2 years ago

Daphne-CoffeeIT commented 2 years ago

My project has a build.gradle.kts file instead of a build.gradle file and I get a lot of errors:

e: /bitrise/src/app/build.gradle.kts:199:22: Expecting an element
e: /bitrise/src/app/build.gradle.kts:199:36: Expecting an element
e: /bitrise/src/app/build.gradle.kts:200:22: Expecting an element
e: /bitrise/src/app/build.gradle.kts:200:36: Expecting an element
e: /bitrise/src/app/build.gradle.kts:200:48: Expecting an element
e: /bitrise/src/app/build.gradle.kts:207:28: Expecting an element
e: /bitrise/src/app/build.gradle.kts:208:28: Expecting an element
e: /bitrise/src/app/build.gradle.kts:208:40: Expecting an element
e: /bitrise/src/app/build.gradle.kts:199:7: Function invocation 'println()' expected
e: /bitrise/src/app/build.gradle.kts:199:15: Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
public fun Project.android(configure: Action<BaseAppModuleExtension>): Unit defined in org.gradle.kotlin.dsl
e: /bitrise/src/app/build.gradle.kts:200:7: Function invocation 'println()' expected
e: /bitrise/src/app/build.gradle.kts:207:13: Function invocation 'println()' expected
e: /bitrise/src/app/build.gradle.kts:207:21: Unresolved reference: variant
e: /bitrise/src/app/build.gradle.kts:208:13: Function invocation 'println()' expected
FAILURE: Build failed with an exception.
* Where:
Build file '/bitrise/src/app/build.gradle.kts' line: 199
* What went wrong:
Script compilation errors:
  Line 199:       println android.defaultConfig.versionName
                                 ^ Expecting an element
  Line 199:       println android.defaultConfig.versionName
                                               ^ Expecting an element
  Line 200:       println android.defaultConfig.versionCode
                                 ^ Expecting an element
  Line 200:       println android.defaultConfig.versionCode
                                               ^ Expecting an element
  Line 200:       println android.defaultConfig.versionCode
                                                           ^ Expecting an element
  Line 207:             println variant.versionName
                                       ^ Expecting an element
  Line 208:             println variant.versionCode
                                       ^ Expecting an element
  Line 208:             println variant.versionCode
                                                   ^ Expecting an element
  Line 199:       println android.defaultConfig.versionName
                  ^ Function invocation 'println()' expected
  Line 199:       println android.defaultConfig.versionName
                          ^ Unresolved reference. None of the following candidates is applicable because of receiver type mismatch: 
                              public fun Project.android(configure: Action<BaseAppModuleExtension>): Unit defined in org.gradle.kotlin.dsl
  Line 200:       println android.defaultConfig.versionCode
                  ^ Function invocation 'println()' expected
  Line 207:             println variant.versionName
                        ^ Function invocation 'println()' expected
  Line 207:             println variant.versionName
                                ^ Unresolved reference: variant
  Line 208:             println variant.versionCode
                        ^ Function invocation 'println()' expected

Will KTS support be added?

krobert commented 1 year ago

image i think no

Daphne-CoffeeIT commented 1 year ago

Yeah, I saw that too. But I migrated to another option not long after opening this issue so I don't really mind.

krobert commented 1 year ago

@Daphne-CoffeeIT What was your solution? Can you share? i ended up creating a script where i copied the modified version of this

Daphne-CoffeeIT commented 1 year ago

For the version name I'm now using $ANDROID_VERSION_NAME which is generated by https://github.com/bitrise-steplib/steps-change-android-versioncode-and-versionname. For the build number I'm using $BITRISE_BUILD_NUMBER.