Commit 1cef6049 authored by Benoit Lavenier's avatar Benoit Lavenier

[fix] Fix deployment on android, with cordova (downgrade to cordova-android 6.2.3)

parent f68473f7
<?xml version='1.0' encoding='utf-8'?>
<widget id="fr.gchange" version="0.4.4">
<widget id="fr.gchange"
ersion="0.4.4" android:version="0.4.4"
android-versionCode="440"
xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0"
>
<name>ğchange</name>
<description>
An unhosted webapp for market with libre currency
......
#!/usr/bin/env node
"use strict";
var gulp = require('gulp');
var gutil = require('gulp-util');
var path = require("path");
var removeCode = require('gulp-remove-code');
var removeHtml = require('gulp-html-remove');
......@@ -9,9 +8,7 @@ var es = require('event-stream');
var ngAnnotate = require('gulp-ng-annotate');
var htmlmin = require('gulp-htmlmin');
var cmd = process.env.CORDOVA_CMDLINE;
var rootdir = process.argv[2];
var argv = require('yargs').argv;
if (rootdir) {
......@@ -31,30 +28,57 @@ if (rootdir) {
var pluginPath = path.join(wwwPath, 'plugins') + '/es';
// Log
//console.log('['+process.mainModule.filename+'] Removing code for platform '+platform+'\n');
// Compute options {device-<platform>: true}
var platformRemoveCodeOptions = {};
platformRemoveCodeOptions[platform] = true; // = {<platform>: true}
var htmlminOptions = {removeComments: true, collapseWhitespace: true};
// Removing unused code for device...
es.concat(
// Remove unused HTML tags
gulp.src([wwwPath + '/templates/**/*.html', pluginPath + '/templates/**/*.html'])
gulp.src(path.join(wwwPath, 'templates', '**', '*.html'))
.pipe(removeCode({device: true}))
.pipe(removeCode(platformRemoveCodeOptions))
.pipe(removeHtml('.hidden-xs.hidden-sm'))
.pipe(removeHtml('.hidden-device'))
.pipe(removeHtml('[remove-if][remove-if="device"]'))
.pipe(htmlmin())
.pipe(gulp.dest(".")),
.pipe(htmlmin(htmlminOptions))
.pipe(gulp.dest(wwwPath + '/templates')),
gulp.src(path.join(pluginPath, '**', '*.html'))
.pipe(removeCode({device: true}))
.pipe(removeCode(platformRemoveCodeOptions))
.pipe(removeHtml('.hidden-xs.hidden-sm'))
.pipe(removeHtml('.hidden-device'))
.pipe(removeHtml('[remove-if][remove-if="device"]'))
.pipe(htmlmin(htmlminOptions))
.pipe(gulp.dest(pluginPath)),
gulp.src(path.join(wwwPath, 'index.html'))
.pipe(removeCode({device: true}))
.pipe(removeCode(platformRemoveCodeOptions))
.pipe(removeHtml('.hidden-xs.hidden-sm'))
.pipe(removeHtml('.hidden-device'))
.pipe(removeHtml('[remove-if][remove-if="device"]'))
.pipe(htmlmin())
.pipe(htmlmin(/*no options, to build comments*/))
.pipe(gulp.dest(wwwPath)),
// Remove unused JS code
gulp.src([wwwPath + + '/js/**/*.js', pluginPath + + '/js/**/*.js'])
// Remove unused JS code + add ng annotations
gulp.src(path.join(wwwPath, 'js', '**', '*.js'))
.pipe(removeCode({device: true}))
.pipe(removeCode(platformRemoveCodeOptions))
.pipe(ngAnnotate({single_quotes: true}))
.pipe(gulp.dest(wwwPath + '/dist/dist_js/app')),
gulp.src(path.join(pluginPath, 'js', '**', '*.js'))
.pipe(removeCode({device: true}))
.pipe(removeCode(platformRemoveCodeOptions))
.pipe(ngAnnotate({single_quotes: true}))
.pipe(gulp.dest("."))
.pipe(gulp.dest(wwwPath + '/dist/dist_js/plugins'))
);
}
......
#!/usr/bin/env node
"use strict";
var gulp = require('gulp');
var gutil = require('gulp-util');
var path = require("path");
var templateCache = require('gulp-angular-templatecache');
var es = require('event-stream');
var cmd = process.env.CORDOVA_CMDLINE;
var rootdir = process.argv[2];
var argv = require('yargs').argv;
if (rootdir) {
......@@ -30,7 +27,7 @@ if (rootdir) {
// Concat templates into a JS
es.concat(
gulp.src(wwwPath + 'templates/**/*.html')
gulp.src(path.join(wwwPath, 'templates', '**', '*.html'))
.pipe(templateCache({
standalone:true,
module:"cesium.templates",
......@@ -38,11 +35,11 @@ if (rootdir) {
}))
.pipe(gulp.dest(distJsPath)),
gulp.src(wwwPath + 'plugins/*/templates/**/*.html')
gulp.src(path.join(wwwPath, 'plugins', '*', 'templates', '**', '*.html'))
.pipe(templateCache({
standalone:true,
module:"cesium.plugins.templates",
root: "templates/"
root: "plugins/"
}))
.pipe(gulp.dest(pluginDistJsPath))
);
......
......@@ -31,8 +31,10 @@ if (rootdir && !skip) {
wwwPath = path.join(rootdir, 'platforms', platform, 'www');
}
// Log
//console.log('['+process.mainModule.filename+'] Cleaning unused directories');
// Clean unused directories
console.log('Cleaning dir ' + path.join(wwwPath, 'lib', '**'));
del([
path.join(wwwPath, 'i18n'),
path.join(wwwPath, 'js'),
......@@ -47,7 +49,24 @@ if (rootdir && !skip) {
'!'+path.join(wwwPath, 'lib'),
'!'+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'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Black'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Black', '**'),
'!'+path.join(wwwPath, 'lib', 'ionic', 'fonts', 'robotdraft', 'Bold'),
'!'+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 == 'android') {
var platformPath = path.join(rootdir, 'platforms', platform);
var androidManifestFile = path.join(platformPath, 'AndroidManifest.xml');
// Clean unused directories
console.log('-----------------------------------------');
console.log(' Updating file: ' + androidManifestFile);
gulp.src(androidManifestFile)
// Add 'tools' namespace to root tag
.pipe(replace(/(xmlns:android="http:\/\/schemas.android.com\/apk\/res\/android")\s*>/g, '$1 xmlns:tools="http://schemas.android.com/tools">'))
// <uses-sdk> : if many, keep only one
.pipe(replace(/(<uses-sdk [^>]+>)(:?[\n\r\s\t ]*<uses-sdk [^>]+>)+/mg, '$1'))
// <uses-sdk> : Replace 'targetSdkversion' and add tools:overrideLibrary
.pipe(replace(/android:targetSdkVersion="[^"]+"\s*\/>/g, 'android:targetSdkVersion="25" tools:overrideLibrary="org.kaliumjni.lib" />'))
.pipe(gulp.dest(platformPath));
console.log('-----------------------------------------');
}
}
}
#!/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.gchange"/g, 'id="cesium"'))
.pipe(gulp.dest(platformPath));
console.log('-----------------------------------------');
}
}
}
......@@ -31,18 +31,32 @@
"@ionic/cloud": "^0.16.0",
"bluebird": "^3.5.0",
"cordova-android": "^6.2.3",
"cordova-ios": "^4.4.0",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-device": "^1.1.6",
"cordova-plugin-dialogs": "^1.3.3",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-minisodium": "^1.0.0",
"cordova-plugin-secure-storage": "^2.6.8",
"cordova-plugin-splashscreen": "^3.2.2",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-vibration": "^2.1.5",
"cordova-plugin-websocket": "^0.12.2",
"cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-x-toast": "^2.6.0",
"delete-empty": "^0.1.3",
"gulp": "^3.9.1",
"gulp-bump": "^2.1.0",
"gulp-concat": "^2.2.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^2.2.0",
"node-sass": "^3.3.3"
"ionic": "^1.7.16",
"ionic-plugin-keyboard": "^2.2.1",
"node-sass": "^3.3.3",
"phonegap-plugin-barcodescanner": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner.git"
},
"devDependencies": {
"bower": "^1.8.0",
"cordova-uglify": "^0.2.3",
"del": "^2.2.0",
"fs": "0.0.2",
......@@ -81,9 +95,27 @@
"android"
],
"cordova": {
"plugins": {
"cordova-plugin-camera": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-minisodium": {},
"cordova-plugin-secure-storage": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-vibration": {},
"cordova-plugin-websocket": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-x-toast": {},
"ionic-plugin-keyboard": {},
"phonegap-plugin-barcodescanner": {
"CAMERA_USAGE_DESCRIPTION": " "
}
},
"platforms": [
"android"
]
},
"cordovaPlugins": []
}
}
\ No newline at end of file
{
"name": "cesium",
"version": "0.14.0",
"description": "Unhosted webapp client for Duniter network",
"repository": {
"type": "git",
"url": "git@github.com:duniter/cesium.git"
},
"scripts": {
"postinstall": "bower install",
"install-for-mobile": "ionic state restore",
"start": "ionic serve"
},
"keywords": [
"duniter",
"cesium",
"ionic",
"angular",
"cordova",
"crypto-currency"
],
"author": "Duniter team",
"license": "GPL-3.0",
"readmeFilename": "README.md",
"bugs": {
"url": "https://github.com/duniter/cesium/issues",
"new": "https://github.com/duniter/cesium/issues/new?labels=bug"
},
"dependencies": {
"bower": "^1.8.0",
"cordova-android": "^6.2.3",
"cordova-plugin-camera": "^2.4.1",
"cordova-plugin-compat": "^1.1.0",
"cordova-plugin-console": "^1.0.7",
"cordova-plugin-device": "^1.1.6",
"cordova-plugin-dialogs": "^1.3.3",
"cordova-plugin-inappbrowser": "^1.7.1",
"cordova-plugin-minisodium": "^1.0.0",
"cordova-plugin-secure-storage": "^2.6.8",
"cordova-plugin-splashscreen": "^3.2.2",
"cordova-plugin-statusbar": "^2.2.3",
"cordova-plugin-vibration": "^2.1.5",
"cordova-plugin-websocket": "^0.12.2",
"cordova-plugin-whitelist": "^1.3.2",
"cordova-plugin-x-toast": "^2.6.0",
"delete-empty": "^0.1.3",
"gulp": "^3.9.1",
"gulp-bump": "^2.1.0",
"gulp-concat": "^2.2.0",
"gulp-rename": "^1.2.0",
"gulp-sass": "^2.2.0",
"ionic": "^1.7.16",
"ionic-plugin-keyboard": "^2.2.1",
"node-sass": "^3.3.3",
"phonegap-plugin-barcodescanner": "git+https://github.com/phonegap/phonegap-plugin-barcodescanner.git"
},
"devDependencies": {
"cordova-uglify": "^0.2.3",
"del": "^2.2.0",
"fs": "0.0.2",
"gulp": "^3.9.1",
"gulp-angular-templatecache": "^1.8.0",
"gulp-angular-translate": "^0.1.4",
"gulp-base64": "^0.1.3",
"gulp-clean": "^0.3.2",
"gulp-clean-css": "^2.0.10",
"gulp-css-base64": "^1.3.4",
"gulp-csso": "^2.0.0",
"gulp-filter": "^4.0.0",
"gulp-header": "^1.7.1",
"gulp-html-remove": "^0.1.1",
"gulp-htmlmin": "^2.0.0",
"gulp-jshint": "^2.0.1",
"gulp-ng-annotate": "^2.0.0",
"gulp-ng-constant": "^1.1.0",
"gulp-remove-code": "^1.0.2",
"gulp-replace": "^0.5.4",
"gulp-rev": "^7.0.0",
"gulp-rev-replace": "^0.4.3",
"gulp-sourcemaps": "^1.6.0",
"gulp-uglify": "^1.5.3",
"gulp-useref": "^3.1.0",
"gulp-util": "^2.2.14",
"gulp-zip": "^3.2.0",
"ionic-minify": "^2.0.8",
"jshint": "^2.9.2",
"mv": "^2.1.1",
"playup": "^1.0.2",
"shelljs": "^0.3.0",
"yargs": "^4.3.1"
},
"cordovaPlatforms": [
"android",
"firefoxos"
],
"cordova": {
"plugins": {
"cordova-plugin-camera": {},
"cordova-plugin-console": {},
"cordova-plugin-device": {},
"cordova-plugin-dialogs": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-minisodium": {},
"cordova-plugin-secure-storage": {},
"cordova-plugin-splashscreen": {},
"cordova-plugin-statusbar": {},
"cordova-plugin-vibration": {},
"cordova-plugin-websocket": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-x-toast": {},
"ionic-plugin-keyboard": {},
"phonegap-plugin-barcodescanner": {
"CAMERA_USAGE_DESCRIPTION": " "
}
},
"platforms": [
"android"
]
}
}
\ No newline at end of file
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment