You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Joe Bowser (JIRA)" <ji...@apache.org> on 2015/08/13 19:40:45 UTC

[jira] [Resolved] (CB-9484) Allow option to _not_ copy gradle wrapper on each build

     [ https://issues.apache.org/jira/browse/CB-9484?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]

Joe Bowser resolved CB-9484.
----------------------------
    Resolution: Duplicate

Being able to update the distributionUrl is exactly what you're looking for.  Please check the issue tracker for duplicates, people often ask for the same thing and it's the only critical that's on here right now.


> Allow option to _not_ copy gradle wrapper on each build
> -------------------------------------------------------
>
>                 Key: CB-9484
>                 URL: https://issues.apache.org/jira/browse/CB-9484
>             Project: Apache Cordova
>          Issue Type: Improvement
>          Components: Android
>    Affects Versions: Master
>         Environment: Windows, Linux, OSX
>            Reporter: Mitchell Fuzzle
>            Priority: Minor
>
> I want to be able to use a new version of gradle on my Cordova project, but I don't want to have to edit every dev's SDK. It would be awesome if I could just stop Cordova from replacing the gradle wrapper, and then commit my own.
> Relevant build.js code:
> {code:title=build.js}
> }).then(function() {
>                 // Copy the gradle wrapper on each build so that:
>                 // A) we don't require the Android SDK at project creation time, and
>                 // B) we always use the SDK's latest version of it.
>                 var projectPath = ROOT;
>                 // check_reqs ensures that this is set.
>                 var sdkDir = process.env['ANDROID_HOME'];
>                 var wrapperDir = path.join(sdkDir, 'tools', 'templates', 'gradle', 'wrapper');
>                 if (process.platform == 'win32') {
>                     shell.cp('-f', path.join(wrapperDir, 'gradlew.bat'), projectPath);
>                 } else {
>                     shell.cp('-f', path.join(wrapperDir, 'gradlew'), projectPath);
>                 }
>                 shell.rm('-rf', path.join(projectPath, 'gradle', 'wrapper'));
>                 shell.mkdir('-p', path.join(projectPath, 'gradle'));
>                 shell.cp('-r', path.join(wrapperDir, 'gradle', 'wrapper'), path.join(projectPath, 'gradle'));
>                 // If the gradle distribution URL is set, make sure it points to version we want.
>                 // If it's not set, do nothing, assuming that we're using a future version of gradle that we don't want to mess with.
>                 // For some reason, using ^ and $ don't work.  This does the job, though.
>                 var distributionUrlRegex = /distributionUrl.*zip/;
>                 var distributionUrl = 'distributionUrl=http\\://services.gradle.org/distributions/gradle-2.2.1-all.zip';
>                 var gradleWrapperPropertiesPath = path.join(projectPath, 'gradle', 'wrapper', 'gradle-wrapper.properties');
>                 shell.sed('-i', distributionUrlRegex, distributionUrl, gradleWrapperPropertiesPath);
>                 var propertiesFile = opts.buildType + SIGNING_PROPERTIES;
>                 var propertiesFilePath = path.join(ROOT, propertiesFile);
>                 if (opts.packageInfo) {
>                     fs.writeFileSync(propertiesFilePath, TEMPLATE + opts.packageInfo.toProperties());
>                 } else if (isAutoGenerated(propertiesFilePath)) {
>                     shell.rm('-f', propertiesFilePath);
>                 }
>             });
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@cordova.apache.org
For additional commands, e-mail: issues-help@cordova.apache.org