build(cordova): simplify build, use cordova in a more standard way

This commit is contained in:
Jason Dreyzehner 2016-10-06 00:18:29 -04:00
commit d5e6b8fab8
14 changed files with 175 additions and 133 deletions

View file

@ -7,31 +7,11 @@ all:
clean:
rm -Rf $(WORKDIR)*
$(WORKDIR)android $(WORKDIR)ios: config.xml
cordova create $@ com.bitpay.*BUNDLENAME* "*USERVISIBLENAME*" || echo "Project Path Existed"
cp ProjectMakefile $@/Makefile
rm -r $@/www && ln -sF ../../public $@/www
cp config.xml $@/config.xml
make -C $@ $(subst $(WORKDIR),, $@)
ios: $(WORKDIR)ios
make -C $(WORKDIR)ios build-ios
android: project-android
mkdir -p android/platforms/android/res/xml/
mkdir -p $(WORKDIR)android/scripts
cp -R scripts/* $(WORKDIR)android/scripts
cp android/build-extras.gradle $(WORKDIR)android/platforms/android/build-extras.gradle
cp android/project.properties $(WORKDIR)android/platforms/android/project.properties
cp -R android/res/* $(WORKDIR)android/platforms/android/res
make -C $(WORKDIR)android build-android
wp-init: config.xml
cordova create $(WORKDIR)$@ com.bitpay.*BUNDLENAME* "*USERVISIBLENAME*" || echo "Project Path Existed"
cp ProjectMakefile $(WORKDIR)$@/Makefile
mkdir -p $(WORKDIR)$@/www
cp -Rf ../public/* $(WORKDIR)$@/www
cp -Rf ../www/* $(WORKDIR)$@/www
cp config.xml $(WORKDIR)$@/config.xml
make -C $(WORKDIR)$@ $(subst $(WORKDIR),, $(WORKDIR)$@)
@ -43,10 +23,5 @@ wp-copy:
cp -rvf wp/SplashScreenImage.jpg $(WORKDIR)wp/platforms/wp8/
cp -rvf wp/ApplicationIcon.png $(WORKDIR)wp/platforms/wp8/
cp -rvf wp/Background.png $(WORKDIR)wp/platforms/wp8/
cp -rvf ../public/* $(WORKDIR)wp/www
cp -rvf ../www/* $(WORKDIR)wp/www
wp/fix-svg.sh
androidrun:
make -C $(WORKDIR)android run
adb logcat | grep chromium

View file

@ -5,21 +5,13 @@ plugins:
cordova prepare
rm -rf platforms/android/res/values-es
ios-platform android-platform wp8-platform:
wp8-platform:
cordova platforms add $(subst -platform,,$@) || echo "Platform already added"
ios: ios-platform plugins
cordova plugin add https://github.com/tjwoon/csZBar.git
cordova plugin add phonegap-plugin-push@1.5.3
android: android-platform plugins
cordova plugin add https://github.com/jrontend/phonegap-plugin-barcodescanner
cordova plugin add phonegap-plugin-push@1.2.3
wp: wp8-platform plugins
cordova plugin add https://github.com/jrontend/phonegap-plugin-barcodescanner
build-ios build-android build-wp8:
build-wp8:
cordova build $(subst build-,,$@)
run:

View file

@ -5,10 +5,11 @@
//
var templates = {
'package.json': '/',
'Makefile': 'cordova/',
'ProjectMakefile': 'cordova/',
'config.xml': 'cordova/',
'config-template.xml': '/',
'ionic.config.json': '/',
'Package.appxmanifest': 'cordova/wp/',
'.desktop': 'webkitbuilds/',
'setup-win.iss': 'webkitbuilds/',
@ -60,6 +61,9 @@ Object.keys(templates).forEach(function(k) {
process.exit(1);
}
if(k === 'config-template.xml'){
k = 'config.xml';
}
fs.writeFileSync('../' + targetDir + k, content, 'utf8');
});
@ -113,7 +117,7 @@ function copyDir(from, to, cb) {
}
copyDir(configDir + '/img/', '../public/img/', function() {
copyDir(configDir + '/img/', '../www/img/', function() {
copyDir(configDir + '/androidRes/', '../cordova/android/res/', function() {
copyDir(configDir + '/iosIcons/', '../cordova/ios/icons/', function() {
copyDir(configDir + '/iosSplash/', '../cordova/ios/splash/', function() {

View file

@ -0,0 +1,82 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.bitpay.*BUNDLENAME*"
version="*VERSION*"
android-versionCode="*ANDROIDVERSION*"
ios-CFBundleVersion="*VERSION*">
<name>*USERVISIBLENAME*</name>
<description>
*PURPOSELINE*
</description>
<author email="support@bitpay.com" href="*URL*">
BitPay Inc.
</author>
<content src="index.html" />
<access origin="*" />
<preference name="AndroidPersistentFileLocation" value="Internal" />
<preference name="iosPersistentFileLocation" value="Library" />
<preference name="DisallowOverscroll" value="true"/>
<preference name="HideKeyboardFormAccessoryBar" value="true"/>
<preference name="SplashScreen" value="copayscreen" />
<preference name="ShowSplashScreenSpinner" value="false" />
<preference name="AutoHideSplashScreen" value="false" />
<preference name="FadeSplashScreen" value="true" />
<preference name="FadeSplashScreenDuration" value="1" />
<preference name="StatusBarOverlaysWebView" value="true" />
<preference name="StatusBarBackgroundColor" value="#1e3186" />
<preference name="StatusBarStyle" value="lightcontent" />
<preference name="BackupWebStorage" value="none"/>
<preference name="windows-target-version" value="8.1"/>
<preference name="Orientation" value="default" />
<!-- Plugins -->
<plugin name="cordova-plugin-globalization" spec="~1.0.4" />
<plugin name="cordova.plugins.diagnostic" spec="~3.2.1" />
<plugin name="cordova-plugin-splashscreen" spec="~4.0.0" />
<plugin name="cordova-plugin-statusbar" spec="~2.2.0" />
<plugin name="cordova-plugin-inappbrowser" spec="~1.5.0" />
<plugin name="cordova-plugin-x-toast" spec="~2.5.2" />
<plugin name="com.verso.cordova.clipboard" spec="https://github.com/VersoSolutions/CordovaClipboard" />
<plugin name="cordova-plugin-x-socialsharing" spec="https://github.com/EddyVerbruggen/SocialSharing-PhoneGap-Plugin.git" />
<plugin name="cordova-plugin-spinner-dialog" spec="~1.3.1" />
<plugin name="cordova-plugin-dialogs" spec="~1.3.0" />
<plugin name="cordova-plugin-network-information" spec="~1.3.0" />
<plugin name="cordova-plugin-console" spec="~1.0.4" />
<plugin name="cordova-plugin-uniquedeviceid" spec="~1.3.2" />
<plugin name="cordova-plugin-file" spec="~4.3.0" />
<plugin name="cordova-plugin-touch-id" spec="~3.2.0" />
<plugin name="cordova-plugin-transport-security" spec="~0.1.2" />
<plugin name="cordova-ios-requires-fullscreen" spec="~0.0.2" />
<plugin name="cordova-plugin-android-fingerprint-auth" spec="~0.2.0" />
<plugin name="cordova-plugin-screen-orientation" spec="~1.4.2" />
<plugin name="ionic-plugin-keyboard" spec="~2.2.1" />
<plugin name="cordova-plugin-whitelist" spec="~1.3.0" />
<plugin name="cordova-plugin-wkwebview-engine" spec="https://github.com/driftyco/cordova-plugin-wkwebview-engine.git" />
<plugin name="cordova-plugin-qrscanner" spec="~2.4.0" />
<plugin name="cordova-plugin-customurlscheme" spec="~4.2.0">
<variable name="URL_SCHEME" value="UNUSED" />
</plugin>
<!-- Supported Platforms -->
<engine name="ios" spec="~4.2.1" />
<engine name="android" spec="~5.2.2" />
<engine name="wp8" spec="~3.8.2" />
<!-- Platform Specific Settings -->
<platform name="ios">
<plugin name="phonegap-plugin-push" spec="1.5.3" />
<!-- <hook type="after_prepare" src="util/hooks/ios/add-custom-urls-to-plist.js" />
<hook type="after_prepare" src="util/hooks/ios/add-uistatusbarhidden-to-plist.js" /> -->
</platform>
<platform name="android">
<hook type="after_prepare" src="util/hooks/android/add-custom-urls-to-android-manifest.js" />
<hook type="after_prepare" src="util/hooks/android/prohibit-cloud-backups-in-android-manifest.js" />
<!-- https://github.com/phonegap/phonegap-plugin-push/issues/424 -->
<plugin name="phonegap-plugin-push" spec="1.2.3" />
</platform>
<platform name="wp8">
<plugin name="phonegap-plugin-barcodescanner" spec="https://github.com/jrontend/phonegap-plugin-barcodescanner" />
</platform>
</widget>

View file

@ -0,0 +1,4 @@
{
"name": "*USERVISIBLENAME*",
"app_id": "com.bitpay.*BUNDLENAME*"
}

View file

@ -11,10 +11,10 @@
"multisignature",
"bitcore"
],
"main": "public/index.html",
"main": "www/index.html",
"window": {
"title": "*USERVISIBLENAME* - *PURPOSELINE*",
"icon": "./public/img/icons/icon-256.png",
"icon": "./www/img/icons/icon-256.png",
"toolbar": false,
"show": true,
"visible": true,

View file

@ -34,7 +34,7 @@ Name: "desktopicon"; Description: "{cm:CreateDesktopIcon}"; GroupDescription: "{
[Files]
Source: "*PACKAGENAME*\win64\*PACKAGENAME*.exe"; DestDir: "{app}"; Flags: ignoreversion
Source: "*PACKAGENAME*\win64\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs
Source: "../public/img/icons/favicon.ico"; DestDir: "{app}"; DestName: "icon.ico"; Flags: ignoreversion
Source: "../www/img/icons/favicon.ico"; DestDir: "{app}"; DestName: "icon.ico"; Flags: ignoreversion
; NOTE: Don't use "Flags: ignoreversion" on any shared system files
[Icons]