You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@cordova.apache.org by "Mitchell Fuzzle (JIRA)" <ji...@apache.org> on 2015/08/12 19:13:46 UTC
[jira] [Commented] (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:comment-tabpanel&focusedCommentId=14693861#comment-14693861 ]
Mitchell Fuzzle commented on CB-9484:
-------------------------------------
I'd be OK with submitting a patch for this. However, where should this option be specified? I don't think it belongs in config.xml.
One option is to check if the gradle wrapper exists, and if so, don't overwrite it, but then
bq. // B) we always use the SDK's latest version of it.
is no longer true.
We could have our own property in gradle-wrapper.properties, but that's piggybacking off of the wrong thing (that properties file is for gradle, not Cordova).
Is there a platform-specific config file that this option can be added to?
> 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: 5.0.1
> 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