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

Get VersionName and VersionCode not working using buildSrc and Kotlin-dsl #2

Open
Vall0n opened this issue Aug 31, 2022 · 2 comments
Open

Comments

@Vall0n
Copy link

Vall0n commented Aug 31, 2022

Hey,

we observed an issue when using this plugin to get version name (get_version_name(app_project_dir: 'app')) and version code (get_version_code(app_project_dir: 'app')).

Below is the regarding snippet from the build.gradle.kts in the app module

    defaultConfig {
        minSdk = ConfigData.minSdkVersion
        targetSdk = ConfigData.targetSdkVersion
        versionCode = ConfigData.versionCode
        versionName = ConfigData.versionName

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
      .
      .
      .

So, we use an object ConfigData that lies in the buildSrc directory in the root dir, which holds our most basic versions, like compile SDK, minSD, versionCode, versionName, etc. (like described in dependency mgmt using buildSrc and Kotlin dsl)

object ConfigData {
    const val compileSdkVersion = 31
    const val buildToolsVersion = "31.0.0"
    const val minSdkVersion = 24
    const val targetSdkVersion = 31
    const val versionCode = 21400080
    const val versionName = "22.19.1"
}

But now if we run fastlane

versionName = get_version_name(app_project_dir: 'app')

we got

ConfigData.versionName

expected is of course 22.19.1

Any help would be greatly appreciated!

Thanks in advance!

Best regards,
Vall0n

@Vall0n Vall0n changed the title VersionName and VersionCode not working using buildSrc and Kotlin-dsl Get VersionName and VersionCode not working using buildSrc and Kotlin-dsl Aug 31, 2022
@zmunm
Copy link
Owner

zmunm commented Sep 1, 2022

hello. @Vall0n

This project does not read code syntax. It is difficult to solve the fundamental problem because it is a form of finding a value from a text file with a regular expression.

If the file path is received as a parameter of the function, it can be handled, but there is no work planned because it is difficult to respond to numerous exceptions.

Hope it was helpful and other comments are welcome.

thank you

@agustinsivoplas
Copy link

Hey,

we observed an issue when using this plugin to get version name (get_version_name(app_project_dir: 'app')) and version code (get_version_code(app_project_dir: 'app')).

Below is the regarding snippet from the build.gradle.kts in the app module

    defaultConfig {
        minSdk = ConfigData.minSdkVersion
        targetSdk = ConfigData.targetSdkVersion
        versionCode = ConfigData.versionCode
        versionName = ConfigData.versionName

        testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
      .
      .
      .

So, we use an object ConfigData that lies in the buildSrc directory in the root dir, which holds our most basic versions, like compile SDK, minSD, versionCode, versionName, etc. (like described in dependency mgmt using buildSrc and Kotlin dsl)

object ConfigData {
    const val compileSdkVersion = 31
    const val buildToolsVersion = "31.0.0"
    const val minSdkVersion = 24
    const val targetSdkVersion = 31
    const val versionCode = 21400080
    const val versionName = "22.19.1"
}

But now if we run fastlane

versionName = get_version_name(app_project_dir: 'app')

we got

ConfigData.versionName

expected is of course 22.19.1

Any help would be greatly appreciated!

Thanks in advance!

Best regards, Vall0n

Did you found a solution?

Many thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants