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

SDK versions are resolved after plugins gradle extensions #569

Closed
tombell opened this issue Nov 21, 2018 · 3 comments
Closed

SDK versions are resolved after plugins gradle extensions #569

tombell opened this issue Nov 21, 2018 · 3 comments
Labels

Comments

@tombell
Copy link

tombell commented Nov 21, 2018

I also noticed that gradle extensions get injected before these versions are determined, meaning any plugin relying on these sees them as null.

// ...

// PLUGIN GRADLE EXTENSIONS START
apply from: "../cordova-plugin-browsertab/mobile-BrowserTab.gradle"
// PLUGIN GRADLE EXTENSIONS END

def hasBuildExtras = file('build-extras.gradle').exists()
if (hasBuildExtras) {
    apply from: 'build-extras.gradle'
}

// Set property defaults after extension .gradle files.
if (ext.cdvCompileSdkVersion == null) {
    ext.cdvCompileSdkVersion = privateHelpers.getProjectTarget()
    //ext.cdvCompileSdkVersion = project.ext.defaultCompileSdkVersion
}
if (ext.cdvBuildToolsVersion == null) {
    ext.cdvBuildToolsVersion = privateHelpers.findLatestInstalledBuildTools()
    //ext.cdvBuildToolsVersion = project.ext.defaultBuildToolsVersion
}
if (ext.cdvDebugSigningPropertiesFile == null && file('../debug-signing.properties').exists()) {
    ext.cdvDebugSigningPropertiesFile = '../debug-signing.properties'
}
if (ext.cdvReleaseSigningPropertiesFile == null && file('../release-signing.properties').exists()) {
    ext.cdvReleaseSigningPropertiesFile = '../release-signing.properties'
}

// Cast to appropriate types.
ext.cdvBuildMultipleApks = cdvBuildMultipleApks == null ? false : cdvBuildMultipleApks.toBoolean();
ext.cdvVersionCodeForceAbiDigit = cdvVersionCodeForceAbiDigit == null ? false : cdvVersionCodeForceAbiDigit.toBoolean();
ext.cdvMinSdkVersion = cdvMinSdkVersion == null ? defaultMinSdkVersion : cdvMinSdkVersion
ext.cdvVersionCode = cdvVersionCode == null ? null : Integer.parseInt('' + cdvVersionCode)

//...
@brodycj
Copy link
Contributor

brodycj commented Dec 5, 2018

I just labeled this as a bug, maybe similar to #599.

As I said in #568 (comment) the standard way for a plugin to specify minimum SDK version is in sdk-element (https://cordova.apache.org/docs/en/latest/plugin_ref/spec.html#edit-config), but it seems to be ignored if the value is also specified in Gradle (#599 (comment)).

As discussed in #599 there is an issue if both a plugin and user config specify SDK version. The suggestion in #599 to move the PLUGIN GRADLE EXTENSIONS comments is good but could prove to be a breaking change in some cases.

I think the best solution would be to move the plugin gradle extensions into a separate Gradle file. I think this should be done in a major release, with plenty of advance warning with documentation.

@tombell tombell closed this as completed Nov 3, 2019
@brodycj
Copy link
Contributor

brodycj commented Nov 3, 2019

@tombell any particular reason to close this?

Do you think this issue was fixed somehow?

@tombell
Copy link
Author

tombell commented Nov 3, 2019

From what I remember, I didn't have to work around it anymore.

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

Successfully merging a pull request may close this issue.

2 participants