mirror of
https://github.com/Ponsen/cordova-plugin-abi-filter.git
synced 2026-01-31 00:00:08 +08:00
- Added .gitignore
- Added global-modules as dependency - Plugin is now compatible with cordova 9
This commit is contained in:
487
.gitignore
vendored
Normal file
487
.gitignore
vendored
Normal file
@@ -0,0 +1,487 @@
|
||||
# Created by .ignore support plugin (hsz.mobi)
|
||||
### Linux template
|
||||
*~
|
||||
|
||||
# temporary files which can be created if a process still has a handle open of a deleted file
|
||||
.fuse_hidden*
|
||||
|
||||
# KDE directory preferences
|
||||
.directory
|
||||
|
||||
# Linux trash folder which might appear on any partition or disk
|
||||
.Trash-*
|
||||
|
||||
# .nfs files are created when an open file is removed but is still being accessed
|
||||
.nfs*
|
||||
### VisualStudioCode template
|
||||
.vscode/*
|
||||
!.vscode/settings.json
|
||||
!.vscode/tasks.json
|
||||
!.vscode/launch.json
|
||||
!.vscode/extensions.json
|
||||
### Windows template
|
||||
# Windows thumbnail cache files
|
||||
Thumbs.db
|
||||
ehthumbs.db
|
||||
ehthumbs_vista.db
|
||||
|
||||
# Dump file
|
||||
*.stackdump
|
||||
|
||||
# Folder config file
|
||||
[Dd]esktop.ini
|
||||
|
||||
# Recycle Bin used on file shares
|
||||
$RECYCLE.BIN/
|
||||
|
||||
# Windows Installer files
|
||||
*.cab
|
||||
*.msi
|
||||
*.msix
|
||||
*.msm
|
||||
*.msp
|
||||
|
||||
# Windows shortcuts
|
||||
*.lnk
|
||||
### VisualStudio template
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/master/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
*.suo
|
||||
*.user
|
||||
*.userosscache
|
||||
*.sln.docstates
|
||||
|
||||
# User-specific files (MonoDevelop/Xamarin Studio)
|
||||
*.userprefs
|
||||
|
||||
# Build results
|
||||
[Dd]ebug/
|
||||
[Dd]ebugPublic/
|
||||
[Rr]elease/
|
||||
[Rr]eleases/
|
||||
x64/
|
||||
x86/
|
||||
bld/
|
||||
[Bb]in/
|
||||
[Oo]bj/
|
||||
[Ll]og/
|
||||
|
||||
# Visual Studio 2015/2017 cache/options directory
|
||||
.vs/
|
||||
# Uncomment if you have tasks that create the project's static files in wwwroot
|
||||
#wwwroot/
|
||||
|
||||
# Visual Studio 2017 auto generated files
|
||||
Generated\ Files/
|
||||
|
||||
# MSTest test Results
|
||||
[Tt]est[Rr]esult*/
|
||||
[Bb]uild[Ll]og.*
|
||||
|
||||
# NUNIT
|
||||
*.VisualState.xml
|
||||
TestResult.xml
|
||||
|
||||
# Build Results of an ATL Project
|
||||
[Dd]ebugPS/
|
||||
[Rr]eleasePS/
|
||||
dlldata.c
|
||||
|
||||
# Benchmark Results
|
||||
BenchmarkDotNet.Artifacts/
|
||||
|
||||
# .NET Core
|
||||
project.lock.json
|
||||
project.fragment.lock.json
|
||||
artifacts/
|
||||
|
||||
# StyleCop
|
||||
StyleCopReport.xml
|
||||
|
||||
# Files built by Visual Studio
|
||||
*_i.c
|
||||
*_p.c
|
||||
*_i.h
|
||||
*.ilk
|
||||
*.meta
|
||||
*.obj
|
||||
*.iobj
|
||||
*.pch
|
||||
*.pdb
|
||||
*.ipdb
|
||||
*.pgc
|
||||
*.pgd
|
||||
*.rsp
|
||||
*.sbr
|
||||
*.tlb
|
||||
*.tli
|
||||
*.tlh
|
||||
*.tmp
|
||||
*.tmp_proj
|
||||
*.log
|
||||
*.vspscc
|
||||
*.vssscc
|
||||
.builds
|
||||
*.pidb
|
||||
*.svclog
|
||||
*.scc
|
||||
|
||||
# Chutzpah Test files
|
||||
_Chutzpah*
|
||||
|
||||
# Visual C++ cache files
|
||||
ipch/
|
||||
*.aps
|
||||
*.ncb
|
||||
*.opendb
|
||||
*.opensdf
|
||||
*.sdf
|
||||
*.cachefile
|
||||
*.VC.db
|
||||
*.VC.VC.opendb
|
||||
|
||||
# Visual Studio profiler
|
||||
*.psess
|
||||
*.vsp
|
||||
*.vspx
|
||||
*.sap
|
||||
|
||||
# Visual Studio Trace Files
|
||||
*.e2e
|
||||
|
||||
# TFS 2012 Local Workspace
|
||||
$tf/
|
||||
|
||||
# Guidance Automation Toolkit
|
||||
*.gpState
|
||||
|
||||
# ReSharper is a .NET coding add-in
|
||||
_ReSharper*/
|
||||
*.[Rr]e[Ss]harper
|
||||
*.DotSettings.user
|
||||
|
||||
# JustCode is a .NET coding add-in
|
||||
.JustCode
|
||||
|
||||
# TeamCity is a build add-in
|
||||
_TeamCity*
|
||||
|
||||
# DotCover is a Code Coverage Tool
|
||||
*.dotCover
|
||||
|
||||
# AxoCover is a Code Coverage Tool
|
||||
.axoCover/*
|
||||
!.axoCover/settings.json
|
||||
|
||||
# Visual Studio code coverage results
|
||||
*.coverage
|
||||
*.coveragexml
|
||||
|
||||
# NCrunch
|
||||
_NCrunch_*
|
||||
.*crunch*.local.xml
|
||||
nCrunchTemp_*
|
||||
|
||||
# MightyMoose
|
||||
*.mm.*
|
||||
AutoTest.Net/
|
||||
|
||||
# Web workbench (sass)
|
||||
.sass-cache/
|
||||
|
||||
# Installshield output folder
|
||||
[Ee]xpress/
|
||||
|
||||
# DocProject is a documentation generator add-in
|
||||
DocProject/buildhelp/
|
||||
DocProject/Help/*.HxT
|
||||
DocProject/Help/*.HxC
|
||||
DocProject/Help/*.hhc
|
||||
DocProject/Help/*.hhk
|
||||
DocProject/Help/*.hhp
|
||||
DocProject/Help/Html2
|
||||
DocProject/Help/html
|
||||
|
||||
# Click-Once directory
|
||||
publish/
|
||||
|
||||
# Publish Web Output
|
||||
*.[Pp]ublish.xml
|
||||
*.azurePubxml
|
||||
# Note: Comment the next line if you want to checkin your web deploy settings,
|
||||
# but database connection strings (with potential passwords) will be unencrypted
|
||||
*.pubxml
|
||||
*.publishproj
|
||||
|
||||
# Microsoft Azure Web App publish settings. Comment the next line if you want to
|
||||
# checkin your Azure Web App publish settings, but sensitive information contained
|
||||
# in these scripts will be unencrypted
|
||||
PublishScripts/
|
||||
|
||||
# NuGet Packages
|
||||
*.nupkg
|
||||
# The packages folder can be ignored because of Package Restore
|
||||
**/[Pp]ackages/*
|
||||
# except build/, which is used as an MSBuild target.
|
||||
!**/[Pp]ackages/build/
|
||||
# Uncomment if necessary however generally it will be regenerated when needed
|
||||
#!**/[Pp]ackages/repositories.config
|
||||
# NuGet v3's project.json files produces more ignorable files
|
||||
*.nuget.props
|
||||
*.nuget.targets
|
||||
|
||||
# Microsoft Azure Build Output
|
||||
csx/
|
||||
*.build.csdef
|
||||
|
||||
# Microsoft Azure Emulator
|
||||
ecf/
|
||||
rcf/
|
||||
|
||||
# Windows Store app package directories and files
|
||||
AppPackages/
|
||||
BundleArtifacts/
|
||||
Package.StoreAssociation.xml
|
||||
_pkginfo.txt
|
||||
*.appx
|
||||
|
||||
# Visual Studio cache files
|
||||
# files ending in .cache can be ignored
|
||||
*.[Cc]ache
|
||||
# but keep track of directories ending in .cache
|
||||
!*.[Cc]ache/
|
||||
|
||||
# Others
|
||||
ClientBin/
|
||||
~$*
|
||||
*~
|
||||
*.dbmdl
|
||||
*.dbproj.schemaview
|
||||
*.jfm
|
||||
*.pfx
|
||||
*.publishsettings
|
||||
orleans.codegen.cs
|
||||
|
||||
# Including strong name files can present a security risk
|
||||
# (https://github.com/github/gitignore/pull/2483#issue-259490424)
|
||||
#*.snk
|
||||
|
||||
# Since there are multiple workflows, uncomment next line to ignore bower_components
|
||||
# (https://github.com/github/gitignore/pull/1529#issuecomment-104372622)
|
||||
#bower_components/
|
||||
|
||||
# RIA/Silverlight projects
|
||||
Generated_Code/
|
||||
|
||||
# Backup & report files from converting an old project file
|
||||
# to a newer Visual Studio version. Backup files are not needed,
|
||||
# because we have git ;-)
|
||||
_UpgradeReport_Files/
|
||||
Backup*/
|
||||
UpgradeLog*.XML
|
||||
UpgradeLog*.htm
|
||||
ServiceFabricBackup/
|
||||
*.rptproj.bak
|
||||
|
||||
# SQL Server files
|
||||
*.mdf
|
||||
*.ldf
|
||||
*.ndf
|
||||
|
||||
# Business Intelligence projects
|
||||
*.rdl.data
|
||||
*.bim.layout
|
||||
*.bim_*.settings
|
||||
*.rptproj.rsuser
|
||||
|
||||
# Microsoft Fakes
|
||||
FakesAssemblies/
|
||||
|
||||
# GhostDoc plugin setting file
|
||||
*.GhostDoc.xml
|
||||
|
||||
# Node.js Tools for Visual Studio
|
||||
.ntvs_analysis.dat
|
||||
node_modules/
|
||||
|
||||
# Visual Studio 6 build log
|
||||
*.plg
|
||||
|
||||
# Visual Studio 6 workspace options file
|
||||
*.opt
|
||||
|
||||
# Visual Studio 6 auto-generated workspace file (contains which files were open etc.)
|
||||
*.vbw
|
||||
|
||||
# Visual Studio LightSwitch build output
|
||||
**/*.HTMLClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/GeneratedArtifacts
|
||||
**/*.DesktopClient/ModelManifest.xml
|
||||
**/*.Server/GeneratedArtifacts
|
||||
**/*.Server/ModelManifest.xml
|
||||
_Pvt_Extensions
|
||||
|
||||
# Paket dependency manager
|
||||
.paket/paket.exe
|
||||
paket-files/
|
||||
|
||||
# FAKE - F# Make
|
||||
.fake/
|
||||
|
||||
# JetBrains Rider
|
||||
.idea/
|
||||
*.sln.iml
|
||||
|
||||
# CodeRush
|
||||
.cr/
|
||||
|
||||
# Python Tools for Visual Studio (PTVS)
|
||||
__pycache__/
|
||||
*.pyc
|
||||
|
||||
# Cake - Uncomment if you are using it
|
||||
# tools/**
|
||||
# !tools/packages.config
|
||||
|
||||
# Tabs Studio
|
||||
*.tss
|
||||
|
||||
# Telerik's JustMock configuration file
|
||||
*.jmconfig
|
||||
|
||||
# BizTalk build output
|
||||
*.btp.cs
|
||||
*.btm.cs
|
||||
*.odx.cs
|
||||
*.xsd.cs
|
||||
|
||||
# OpenCover UI analysis results
|
||||
OpenCover/
|
||||
|
||||
# Azure Stream Analytics local run output
|
||||
ASALocalRun/
|
||||
|
||||
# MSBuild Binary and Structured Log
|
||||
*.binlog
|
||||
|
||||
# NVidia Nsight GPU debugger configuration file
|
||||
*.nvuser
|
||||
|
||||
# MFractors (Xamarin productivity tool) working folder
|
||||
.mfractor/
|
||||
### Node template
|
||||
# Logs
|
||||
logs
|
||||
*.log
|
||||
npm-debug.log*
|
||||
yarn-debug.log*
|
||||
yarn-error.log*
|
||||
|
||||
# Runtime data
|
||||
pids
|
||||
*.pid
|
||||
*.seed
|
||||
*.pid.lock
|
||||
|
||||
# Directory for instrumented libs generated by jscoverage/JSCover
|
||||
lib-cov
|
||||
|
||||
# Coverage directory used by tools like istanbul
|
||||
coverage
|
||||
|
||||
# nyc test coverage
|
||||
.nyc_output
|
||||
|
||||
# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
|
||||
.grunt
|
||||
|
||||
# Bower dependency directory (https://bower.io/)
|
||||
bower_components
|
||||
|
||||
# node-waf configuration
|
||||
.lock-wscript
|
||||
|
||||
# Compiled binary addons (https://nodejs.org/api/addons.html)
|
||||
build/Release
|
||||
|
||||
# Dependency directories
|
||||
node_modules/
|
||||
jspm_packages/
|
||||
|
||||
# TypeScript v1 declaration files
|
||||
typings/
|
||||
|
||||
# Optional npm cache directory
|
||||
.npm
|
||||
|
||||
# Optional eslint cache
|
||||
.eslintcache
|
||||
|
||||
# Optional REPL history
|
||||
.node_repl_history
|
||||
|
||||
# Output of 'npm pack'
|
||||
*.tgz
|
||||
|
||||
# Yarn Integrity file
|
||||
.yarn-integrity
|
||||
|
||||
# dotenv environment variables file
|
||||
.env
|
||||
|
||||
# next.js build output
|
||||
.next
|
||||
### macOS template
|
||||
# General
|
||||
.DS_Store
|
||||
.AppleDouble
|
||||
.LSOverride
|
||||
|
||||
# Icon must end with two \r
|
||||
Icon
|
||||
|
||||
# Thumbnails
|
||||
._*
|
||||
|
||||
# Files that might appear in the root of a volume
|
||||
.DocumentRevisions-V100
|
||||
.fseventsd
|
||||
.Spotlight-V100
|
||||
.TemporaryItems
|
||||
.Trashes
|
||||
.VolumeIcon.icns
|
||||
.com.apple.timemachine.donotpresent
|
||||
|
||||
# Directories potentially created on remote AFP share
|
||||
.AppleDB
|
||||
.AppleDesktop
|
||||
Network Trash Folder
|
||||
Temporary Items
|
||||
.apdisk
|
||||
### Example user template template
|
||||
### Example user template
|
||||
|
||||
# IntelliJ project files
|
||||
.idea
|
||||
*.iml
|
||||
out
|
||||
gen### Gradle template
|
||||
.gradle
|
||||
/build/
|
||||
|
||||
# Ignore Gradle GUI config
|
||||
gradle-app.setting
|
||||
|
||||
# Avoid ignoring Gradle wrapper jar file (.jar files are usually ignored)
|
||||
!gradle-wrapper.jar
|
||||
|
||||
# Cache of project
|
||||
.gradletasknamecache
|
||||
|
||||
# # Work around https://youtrack.jetbrains.com/issue/IDEA-116898
|
||||
# gradle/wrapper/gradle-wrapper.properties
|
||||
|
||||
@@ -27,5 +27,6 @@
|
||||
},
|
||||
"homepage": "https://github.com/Ponsen/cordova-plugin-abi-filter#readme",
|
||||
"dependencies": {
|
||||
"global-modules": "^2.0.0"
|
||||
}
|
||||
}
|
||||
|
||||
200
scripts/apply.js
200
scripts/apply.js
@@ -1,114 +1,116 @@
|
||||
module.exports = function (context) {
|
||||
//only procecss android platform
|
||||
const globalModules = require('global-modules');
|
||||
const fs = require('fs');
|
||||
const path = require('path');
|
||||
const readline = require('readline');
|
||||
const os = require('os');
|
||||
const ConfigParser = require(globalModules +'/cordova-common/src/ConfigParser/ConfigParser');
|
||||
const utils = require(globalModules + '/cordova-lib/src/cordova/util');
|
||||
|
||||
module.exports = context => {
|
||||
if (!context.opts.cordova.platforms.includes('android')) {
|
||||
return
|
||||
}
|
||||
|
||||
console.log('ABI Filter applying changes...')
|
||||
|
||||
//Requirements
|
||||
const Q = context.requireCordovaModule('q')
|
||||
const deferral = new Q.defer()
|
||||
return new Promise((resolve, reject) => {
|
||||
|
||||
const common = context.requireCordovaModule('cordova-common')
|
||||
const utils = context.requireCordovaModule('cordova-lib/src/cordova/util')
|
||||
const fs = context.requireCordovaModule('fs')
|
||||
const path = context.requireCordovaModule('path')
|
||||
const readline = context.requireCordovaModule('readline')
|
||||
const os = context.requireCordovaModule('os')
|
||||
console.log('ABI Filter applying changes...');
|
||||
const projectRoot = context.opts.projectRoot;
|
||||
|
||||
const projectRoot = context.opts.projectRoot
|
||||
const gradleFilePath = path.join(projectRoot, 'platforms/android/' + context.opts.plugin.id);
|
||||
|
||||
const gradleFilePath = path.join(projectRoot, 'platforms/android/' + context.opts.plugin.id)
|
||||
//prefix changes according to project name - just searching for the file. folder is known anyway
|
||||
searchFilesByFilterRecursive(gradleFilePath, /\-build-extras.gradle$/, (filepath) => {
|
||||
|
||||
//helper funcs
|
||||
function searchFilesByFilterRecursive(startPath, filter, callback) {
|
||||
//default values
|
||||
var abi_values = "armeabi-v7a,arm64-v8a,x86,x86_64"
|
||||
|
||||
if (!fs.existsSync(startPath)) {
|
||||
console.log("no dir ", startPath)
|
||||
deferral.reject(new Error("folder " + startPath + " does not exist"))
|
||||
}
|
||||
//Variables can come from 3 different places
|
||||
|
||||
var files = fs.readdirSync(startPath)
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filename = path.join(startPath, files[i])
|
||||
var stat = fs.lstatSync(filename)
|
||||
if (stat.isDirectory()) {
|
||||
searchFilesByFilterRecursive(filename, filter, callback) //recurse
|
||||
try{
|
||||
//plugin.xml
|
||||
//Prio 3 - default if user did not specify cli args or if plugin is just added
|
||||
if (context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER) {
|
||||
abi_values = context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER
|
||||
}
|
||||
|
||||
//CLI Arg
|
||||
//Prio 2 - is present when plugin is added with --variable ABI_FILTER="a|b|c"
|
||||
if (context.opts.cli_variables && context.opts.cli_variables.ABI_FILTER) {
|
||||
abi_values = context.opts.cli_variables.ABI_FILTER
|
||||
}
|
||||
|
||||
//config.xml
|
||||
//Prio 1 - plugin was already added or user added key to config.xml manually
|
||||
const configFile = new ConfigParser(utils.projectConfig(projectRoot))
|
||||
if (configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER) {
|
||||
abi_values = configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER
|
||||
}
|
||||
} catch(error){
|
||||
console.warn("Using defaults: " + abi_values);
|
||||
}
|
||||
else if (filter.test(filename)) callback(filename)
|
||||
}
|
||||
|
||||
//parse them values to a gradle readable string
|
||||
var abi_values_parsed = "";
|
||||
let abi_arr = abi_values.split(",");
|
||||
for (var i = 0; i < abi_arr.length; ++i) {
|
||||
abi_values_parsed += '"' + abi_arr[i] + '"' + (abi_arr.length - 1 === i ? "" : ",");
|
||||
}
|
||||
|
||||
//find the line "abiFilters"
|
||||
const line_key = "abiFilters";
|
||||
var replacement_line = " abiFilters " + abi_values_parsed;
|
||||
var replacement_file = "";
|
||||
|
||||
//read gradle file from project
|
||||
var reader = readline.createInterface({
|
||||
input: fs.createReadStream(filepath)
|
||||
});
|
||||
|
||||
reader.on('line', (line) => {
|
||||
if(line.trim().includes(line_key)){
|
||||
replacement_file += replacement_line + os.EOL
|
||||
} else {
|
||||
replacement_file += line + os.EOL
|
||||
}
|
||||
});
|
||||
|
||||
reader.on('close', () => {
|
||||
|
||||
//save (override) gradle file from project
|
||||
fs.writeFile(filepath, replacement_file, {encoding:'utf8',flag:'w'}, function(err) {
|
||||
if(err) {
|
||||
return reject(err);
|
||||
}
|
||||
|
||||
return resolve("Applied ABI-Filters: " + abi_values);
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
}).then(message => {
|
||||
console.log(`${message}`);
|
||||
}).catch(message => {
|
||||
console.warn(`${message}`);
|
||||
});
|
||||
};
|
||||
|
||||
|
||||
//helper funcs
|
||||
function searchFilesByFilterRecursive(startPath, filter, callback) {
|
||||
|
||||
if (!fs.existsSync(startPath)) {
|
||||
console.log("no dir ", startPath);
|
||||
deferral.reject(new Error("folder " + startPath + " does not exist"))
|
||||
}
|
||||
|
||||
//prefix changes according to project name - just searching for the file. folder is known anyway
|
||||
searchFilesByFilterRecursive(gradleFilePath, /\-build-extras.gradle$/, (filepath) => {
|
||||
|
||||
//default values
|
||||
var abi_values = "armeabi-v7a,arm64-v8a,x86,x86_64"
|
||||
|
||||
//Variables can come from 3 different places
|
||||
|
||||
try{
|
||||
//plugin.xml
|
||||
//Prio 3 - default if user did not specify cli args or if plugin is just added
|
||||
if (context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER) {
|
||||
abi_values = context.opts.plugin.pluginInfo.getPreferences().ABI_FILTER
|
||||
}
|
||||
|
||||
//CLI Arg
|
||||
//Prio 2 - is present when plugin is added with --variable ABI_FILTER="a|b|c"
|
||||
if (context.opts.cli_variables && context.opts.cli_variables.ABI_FILTER) {
|
||||
abi_values = context.opts.cli_variables.ABI_FILTER
|
||||
}
|
||||
|
||||
//config.xml
|
||||
//Prio 1 - plugin was already added or user added key to config.xml manually
|
||||
const configFile = new common.ConfigParser(utils.projectConfig(projectRoot))
|
||||
if (configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER) {
|
||||
abi_values = configFile.getPlugin(context.opts.plugin.id).variables.ABI_FILTER
|
||||
}
|
||||
} catch(error){
|
||||
console.warn("Using defaults: " + abi_values);
|
||||
var files = fs.readdirSync(startPath);
|
||||
for (var i = 0; i < files.length; i++) {
|
||||
var filename = path.join(startPath, files[i]);
|
||||
var stat = fs.lstatSync(filename);
|
||||
if (stat.isDirectory()) {
|
||||
searchFilesByFilterRecursive(filename, filter, callback) //recurse
|
||||
} else if (filter.test(filename)) {
|
||||
callback(filename);
|
||||
}
|
||||
|
||||
//parse them values to a gradle readable string
|
||||
var abi_values_parsed = "";
|
||||
let abi_arr = abi_values.split(",");
|
||||
for (var i = 0; i < abi_arr.length; ++i) {
|
||||
abi_values_parsed += '"' + abi_arr[i] + '"' + (abi_arr.length - 1 === i ? "" : ",")
|
||||
}
|
||||
|
||||
//find the line "abiFilters"
|
||||
const line_key = "abiFilters"
|
||||
var replacement_line = " abiFilters " + abi_values_parsed
|
||||
var replacement_file = ""
|
||||
|
||||
//read gradle file from project
|
||||
var reader = readline.createInterface({
|
||||
input: fs.createReadStream(filepath)
|
||||
})
|
||||
|
||||
reader.on('line', (line) => {
|
||||
if(line.trim().includes(line_key)){
|
||||
replacement_file += replacement_line + os.EOL
|
||||
} else {
|
||||
replacement_file += line + os.EOL
|
||||
}
|
||||
})
|
||||
|
||||
reader.on('close', () => {
|
||||
|
||||
//save (override) gradle file from project
|
||||
fs.writeFile(filepath, replacement_file, {encoding:'utf8',flag:'w'}, function(err) {
|
||||
if(err) {
|
||||
deferral.reject(err)
|
||||
}
|
||||
|
||||
console.log("Applied ABI-Filters: " + abi_values)
|
||||
deferral.resolve()
|
||||
});
|
||||
})
|
||||
})
|
||||
|
||||
return deferral.promise
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user