Skip to content
Snippets Groups Projects
Commit f02566cf authored by Benoit Lavenier's avatar Benoit Lavenier
Browse files

[fix] Fix Android and iOS compilation (keep fonts)

parent 9f65862d
No related branches found
No related tags found
No related merge requests found
#!/usr/bin/env node #!/usr/bin/env node
"use strict"; "use strict";
var gulp = require('gulp'); var gulp = require('gulp');
var gutil = require('gulp-util');
var allConfig = require('../../app/config.json');
var path = require("path"); var path = require("path");
var del = require('del'); var del = require('del');
var cmd = process.env.CORDOVA_CMDLINE; var cmd = process.env.CORDOVA_CMDLINE;
var rootdir = process.argv[2]; var rootdir = process.argv[2];
var argv = require('yargs').argv;
var skip = true; var skip = true;
if (cmd.indexOf("--release") > -1 || cmd.indexOf("--useref") > -1) { if (cmd.indexOf("--release") > -1 || cmd.indexOf("--useref") > -1) {
...@@ -25,7 +22,7 @@ if (rootdir && !skip) { ...@@ -25,7 +22,7 @@ if (rootdir && !skip) {
var platform = platforms[x].trim().toLowerCase(); var platform = platforms[x].trim().toLowerCase();
var wwwPath; var wwwPath;
if(platform == 'android') { if(platform === 'android') {
wwwPath = path.join(rootdir, 'platforms', platform, 'assets', 'www'); wwwPath = path.join(rootdir, 'platforms', platform, 'assets', 'www');
} else { } else {
wwwPath = path.join(rootdir, 'platforms', platform, 'www'); wwwPath = path.join(rootdir, 'platforms', platform, 'www');
...@@ -35,41 +32,30 @@ if (rootdir && !skip) { ...@@ -35,41 +32,30 @@ if (rootdir && !skip) {
//console.log('['+process.mainModule.filename+'] Cleaning unused directories'); //console.log('['+process.mainModule.filename+'] Cleaning unused directories');
// Clean unused directories // Clean unused directories
del([ del.sync([
path.join(wwwPath, 'i18n'), path.join(wwwPath, 'i18n'),
path.join(wwwPath, 'js'), path.join(wwwPath, 'js'),
path.join(wwwPath, 'templates'), path.join(wwwPath, 'templates'),
path.join(wwwPath, 'css'), path.join(wwwPath, 'css'),
path.join(wwwPath, 'dist'), path.join(wwwPath, 'dist'),
path.join(wwwPath, 'js'),
path.join(wwwPath, 'cordova-js-src'), path.join(wwwPath, 'cordova-js-src'),
path.join(wwwPath, 'plugins', 'es'), path.join(wwwPath, 'plugins', 'es'),
path.join(wwwPath, 'plugins', 'graph'), path.join(wwwPath, 'plugins', 'graph'),
path.join(wwwPath, 'plugins', 'map'), path.join(wwwPath, 'plugins', 'map'),
path.join(wwwPath, 'plugins', 'rml9'), path.join(wwwPath, 'plugins', 'rml9'),
path.join(wwwPath, 'lib', '**'),
// Keep Ionic lib/ionic/fonts directory // Clean lib directory...
'!'+path.join(wwwPath, 'lib'), path.join(wwwPath, 'lib', '*'),
// ...but keep Ionic fonts directory
'!'+path.join(wwwPath, 'lib', 'ionic'), '!'+path.join(wwwPath, 'lib', 'ionic'),
path.join(wwwPath, 'lib', 'ionic', '*'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts'), '!'+path.join(wwwPath, 'lib', 'ionic', 'fonts'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft'), // ...and keep Robotodraft fonts directory
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Black'), '!'+path.join(wwwPath, 'lib', 'robotdraft'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Black', '**'), path.join(wwwPath, 'lib', 'robotdraft', '*'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Bold'), '!'+path.join(wwwPath, 'lib', 'robotdraft', 'fonts'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Bold', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'BoldItalic'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'BoldItalic', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Italic'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Italic', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Light'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Light', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Medium'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Medium', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Regular'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Regular', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Thin'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Thin', '**')
]); ]);
} }
} }
......
#!/usr/bin/env node
"use strict";
var gulp = require('gulp');
var path = require("path");
var replace = require('gulp-replace');
var rootdir = process.argv[2];
if (rootdir) {
// go through each of the platform directories that have been prepared
var platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
for(var x=0; x<platforms.length; x++) {
var platform = platforms[x].trim().toLowerCase();
if(platform == 'ubuntu') {
var platformPath = path.join(rootdir, 'platforms', platform);
var ionicConfigFile = path.join(platformPath, 'config.xml');
// Clean unused directories
console.log('-----------------------------------------');
console.log(' Updating file: ' + ionicConfigFile);
gulp.src(ionicConfigFile)
// change App ID into 'duniter-cesium'
.pipe(replace(/id="fr.duniter.cesium"/g, 'id="cesium"'))
.pipe(gulp.dest(platformPath));
console.log('-----------------------------------------');
}
}
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment