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

[fix] JS into node 10

parent 38f0d4dd
No related branches found
No related tags found
No related merge requests found
Pipeline #7964 failed
#!/usr/bin/env node
"use strict";
var fs = require('fs');
var glob = require('glob');
var path = require('path')
const fs = require('fs'),
glob = require('glob'),
path = require('path');
// See: https://stackoverflow.com/questions/49162538/running-cordova-build-android-unable-to-find-attribute-androidfontvariation
var rootdir = process.argv[2];
const 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(',') : []);
// go through each of the platform directories that have been prepared
const platforms = (process.env.CORDOVA_PLATFORMS ? process.env.CORDOVA_PLATFORMS.split(',') : []);
for (var x = 0; x < platforms.length; x++) {
for (let x = 0; x < platforms.length; x++) {
try {
var platform = platforms[x].trim().toLowerCase();
const platform = platforms[x].trim().toLowerCase();
if (platform === 'android') {
var build_dir = rootdir + '/resources/android/build';
var android_dir = rootdir + '/platforms/android';
var build_files = build_dir + '/**/*.*';
const build_dir = rootdir + '/resources/android/build';
const android_dir = rootdir + '/platforms/android';
const build_files = build_dir + '/**/*.*';
console.log('-----------------------------------------');
if (fs.existsSync(android_dir) && fs.existsSync(build_dir)) {
var mkdirp = function(dir) {
var parent = path.dirname(dir);
const mkdirp = function(dir) {
const parent = path.dirname(dir);
if (!fs.existsSync(parent)){
mkdirp(parent);
}
......@@ -37,18 +37,18 @@ if (rootdir) {
glob(build_files, null, function(er, files) {
files.forEach(function(file) {
console.log(' Copy ' + file + ' to ' + android_dir);
var dest_file = file.replace(build_dir, android_dir);
const dest_file = file.replace(build_dir, android_dir);
mkdirp(path.dirname(dest_file));
fs.createReadStream(file).pipe(fs.createWriteStream(dest_file));
});
});
var gradle_file = build_dir + '/build-extras.gradle';
const gradle_file = build_dir + '/build-extras.gradle';
if (!fs.existsSync(gradle_file)) {
console.log( ' File ' + gradle_file + ' not found. Skipping copy to /platforms/android');
}
var signing_file = build_dir + '/release-signing.properties';
const signing_file = build_dir + '/release-signing.properties';
if (!fs.existsSync(signing_file)) {
console.log( ' File ' + signing_file + ' not found. Skipping copy to /platforms/android');
console.log( ' WARNING: Release APK files will not be signed !');
......
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