cordova-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Mitchell Fuzzle (JIRA)" <j...@apache.org>
Subject [jira] [Updated] (CB-9484) Allow option to _not_ copy gradle wrapper on each build
Date Wed, 12 Aug 2015 17:09:52 GMT

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

Mitchell Fuzzle updated CB-9484:
--------------------------------
    Description: 
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 {noformat}build.js{noformat} 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}

  was: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


> 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 {noformat}build.js{noformat} 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


Mime
View raw message