You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by er...@apache.org on 2022/06/30 11:00:32 UTC

[cordova-android] branch master updated: chore: display warning on deprecated tag usage (#1451)

This is an automated email from the ASF dual-hosted git repository.

erisu pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/cordova-android.git


The following commit(s) were added to refs/heads/master by this push:
     new 273d1bde chore: display warning on deprecated <splash> tag usage (#1451)
273d1bde is described below

commit 273d1bdecde92f918def2ffc76b3237afce2ea92
Author: エリス <er...@users.noreply.github.com>
AuthorDate: Thu Jun 30 20:00:25 2022 +0900

    chore: display warning on deprecated <splash> tag usage (#1451)
    
    * chore: display warning on deprecated <splash> tag usage
    * test: create spy on warnForDeprecatedSplashScreen
---
 lib/prepare.js            | 11 +++++++++++
 spec/unit/prepare.spec.js |  4 ++++
 2 files changed, 15 insertions(+)

diff --git a/lib/prepare.js b/lib/prepare.js
index 68ff7120..bb97c400 100644
--- a/lib/prepare.js
+++ b/lib/prepare.js
@@ -63,6 +63,7 @@ module.exports.prepare = function (cordovaProject, options) {
 
     // Update own www dir with project's www assets and plugins' assets and js-files
     return Promise.resolve(updateWww(cordovaProject, this.locations))
+        .then(() => warnForDeprecatedSplashScreen(cordovaProject))
         .then(() => updateProjectAccordingTo(self._config, self.locations))
         .then(function () {
             updateIcons(cordovaProject, path.relative(cordovaProject.root, self.locations.res));
@@ -353,6 +354,16 @@ function updateProjectStrings (platformConfig, locations) {
     events.emit('verbose', 'Wrote out android application name "' + name + '" to ' + locations.strings);
 }
 
+function warnForDeprecatedSplashScreen (cordovaProject) {
+    const hasOldSplashTags = (
+        cordovaProject.projectConfig.doc.findall('./platform[@name="android"]/splash') || []
+    ).length > 0;
+
+    if (hasOldSplashTags) {
+        events.emit('warn', 'The "<splash>" tags were detected and are no longer supported. Please migrate to the "preference" tag "AndroidWindowSplashScreenAnimatedIcon".');
+    }
+}
+
 /**
  * @param   {ConfigParser}  platformConfig  A project's configuration that will
  *   be used to update project
diff --git a/spec/unit/prepare.spec.js b/spec/unit/prepare.spec.js
index 8dec31eb..be541b83 100644
--- a/spec/unit/prepare.spec.js
+++ b/spec/unit/prepare.spec.js
@@ -766,6 +766,8 @@ describe('prepare', () => {
             prepare.__set__('updateWww', jasmine.createSpy());
             prepare.__set__('updateProjectAccordingTo', jasmine.createSpy('updateProjectAccordingTo')
                 .and.returnValue(Promise.resolve()));
+            prepare.__set__('warnForDeprecatedSplashScreen', jasmine.createSpy('warnForDeprecatedSplashScreen')
+                .and.returnValue(Promise.resolve()));
             prepare.__set__('updateIcons', jasmine.createSpy('updateIcons').and.returnValue(Promise.resolve()));
             prepare.__set__('updateFileResources', jasmine.createSpy('updateFileResources').and.returnValue(Promise.resolve()));
             prepare.__set__('updateConfigFilesFrom',
@@ -859,6 +861,8 @@ describe('prepare', () => {
             prepare.__set__('updateWww', jasmine.createSpy('updateWww'));
             prepare.__set__('updateIcons', jasmine.createSpy('updateIcons').and.returnValue(Promise.resolve()));
             prepare.__set__('updateProjectSplashScreen', jasmine.createSpy('updateProjectSplashScreen'));
+            prepare.__set__('warnForDeprecatedSplashScreen', jasmine.createSpy('warnForDeprecatedSplashScreen')
+                .and.returnValue(Promise.resolve()));
             prepare.__set__('updateFileResources', jasmine.createSpy('updateFileResources').and.returnValue(Promise.resolve()));
             prepare.__set__('updateConfigFilesFrom',
                 jasmine.createSpy('updateConfigFilesFrom')


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