Skip to content
Snippets Groups Projects
Commit 451381da authored by Dorchies David's avatar Dorchies David
Browse files

Merge branch 'cordova-test' into 'master'

Déploiement sur Android avec Cordova

Closes #216

See merge request !48
parents 386ada94 66311da0
No related branches found
No related tags found
1 merge request!48Déploiement sur Android avec Cordova
......@@ -3,12 +3,12 @@
# compiled output
/dist
/tmp
/release
/out-tsc
/src/assets/docs-*
/compodoc-fr
cassiopee_doc-fr.md
cassiopee_doc-fr.md.tex
# /release has a specific .gitignore
# dependencies
/node_modules
......@@ -54,3 +54,7 @@ debug
git.readme
grep
install_jalhyd
# Cordova
platforms/**
plugins/**
......@@ -194,25 +194,15 @@ Custom Material SVG Icons will only show up when the application is deployed on
5. **Si une nouvelle classe a été créée à l'étape 2**, dans la méthode _FormulaireService.newFormulaire()_, compléter le _switch_ pour fournir la classe à instancier.
# Build desktop packages with Electron
## linux .deb package
Execute `npm run release-linux`. Find the .deb package in `/release`.
Running `dpkg -i cassiopee_*.deb` will install Cassiopée in `/opt/Cassiopee`
## windows installer
# Build under Windows
Several npm scripts of `package.json` won't work with windows (for ex. "preprocess"). Building
the Electron package is a little more complicated.
Several npm scripts of `package.json` won't work with windows (for ex. "preprocess"). Building is a little more complicated.
### install dependencies
* Git, for example [https://gitforwindows.org](https://gitforwindows.org)
* Nodejs [https://nodejs.org/en/download](https://nodejs.org/en/download)
* typescript compiler (system wide) : `npm install -g typescript`
* angular cli (system wide) : `npm install -g @angular/cli`
* electron-builder (system wide) : `npm install -g electron-builder`
### build jalhyd
Clone `jalhyd` repository.
......@@ -229,7 +219,6 @@ As `mkdocs` does not work, copy `src/assets/docs-fr` folder **from a linux build
Compile jalhyd with `tsc --p "src/tsconfig.app.json"`
### build nghyd
Clone `nghyd` repository.
......@@ -242,6 +231,43 @@ export const nghydVersion = "4.3.0-119-ga6ef812";
```
Compile nghyd with `ng build --prod --build-optimizer=false`
# Build desktop packages with Electron
## linux .deb package
Execute `npm run release-linux`. Find the .deb package in `/release`.
Running `dpkg -i cassiopee_*.deb` will install Cassiopée in `/opt/Cassiopee`
## windows installer
Follow "Build under Windows" instructions first (see above). Then,
### install dependencies
* electron-builder (system wide) : `npm install -g electron-builder`
Build package with `electron-builder`. Find the generated installer in `/release`.
Running the generated installer will install Cassiopée in `C:\Users\YourUser\AppData\local\Programs\cassiopee`
# Build mobile packages with Cordova
Cordova embeds the whole app in a Web view, allowing it to run on mobile devices
## Android .apk
### install dependencies
* java (system wide) : for ex. `apt install oracle-java8-jdk`
* cordova (system wide) : `npm install -g cordova`
* gradle (system wide) : `apt install gradle`
### install Android Studio and SDKs
Download
Android Studio here and install it : https://developer.android.com/studio
Run Android Studio, click "configure > SDK manager". Install at least one SDK, for ex. 7.0 Nougat.
Build .apk package with `npm run release-android`. Find the generated package in `/release`.
\ No newline at end of file
<?xml version='1.0' encoding='utf-8'?>
<widget id="fr.irstea.cassiopee" version="1.0.0" xmlns="http://www.w3.org/ns/widgets" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<name>Cassiopée</name>
<description>
A sample Apache Cordova application that responds to the deviceready event.
</description>
<author email="dev@cordova.apache.org" href="http://cordova.io">
Apache Cordova Team
</author>
<content src="index.html" />
<icon src="src/icon.png" />
<plugin name="cordova-plugin-whitelist" spec="1" />
<access origin="*" />
<allow-intent href="http://*/*" />
<allow-intent href="https://*/*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<platform name="android">
<allow-intent href="market:*" />
<icon src="src/icon.png" qualifier="ldpi" />
</platform>
<platform name="ios">
<allow-intent href="itms:*" />
<allow-intent href="itms-apps:*" />
<icon src="src/icon.png" qualifier="ldpi" />
</platform>
</widget>
<!--
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.
#
-->
# Cordova Hooks
Cordova Hooks represent special scripts which could be added by application and plugin developers or even by your own build system to customize cordova commands. See Hooks Guide for more details: http://cordova.apache.org/docs/en/edge/guide_appdev_hooks_index.md.html#Hooks%20Guide.
This diff is collapsed.
{
"name": "cassiopee",
"name": "fr.irstea.cassiopee",
"displayName": "Cassiopée",
"description": "Hydraulic calculators",
"author": "Irstea",
"version": "4.1.0",
......@@ -8,16 +9,18 @@
"license": "MIT",
"scripts": {
"ng": "ng",
"lint": "ng lint",
"e2e": "ng e2e",
"electron": "electron .",
"electron-builder": "electron-builder",
"start": "npm run preprocess && ng serve --host 0.0.0.0",
"prod": "npm run preprocess && ng serve --host 0.0.0.0 --prod",
"build": "npm run preprocess && ng build --prod --build-optimizer=false",
"electron": "electron .",
"electron-builder": "electron-builder",
"release-clean": "rm -r release/*",
"release-linux": "npm run release-clean & npm run build && electron-builder",
"build-cordova": "npm run preprocess && ng build --prod --build-optimizer=false && npm run add-cordova-js",
"add-cordova-js": "sed -i '/<\\/title>/a <script type=\"text/javascript\" src=\"cordova.js\"></script>' dist/index.html",
"release-linux": "npm run build && electron-builder",
"release-windows": "rd /s /q release & ng build --prod --build-optimizer=false && npm run electron-builder",
"lint": "ng lint",
"e2e": "ng e2e",
"release-android": "npm run build-cordova && cordova platform add android; rm dist/assets/docs-fr/sitemap.xml.gz && cordova build android && mv platforms/android/app/build/outputs/apk/debug/app-debug.apk release/cassiopee.apk",
"e2equick": "ng e2e --dev-server-target= --baseUrl=http://localhost:4200",
"jalhyd": "rm node_modules/jalhyd && cd ../jalhyd && npm run build && cd ../nghyd && npm install ../jalhyd",
"mathjax": "mkdir -p docs-fr/javascripts/mathjax && rsync -az --delete `cat rsync-mathjax-files` docs-fr/javascripts/mathjax",
......@@ -44,6 +47,8 @@
"@types/pako": "^1.0.1",
"@types/sprintf-js": "^1.1.2",
"angular2-chartjs": "^0.5.1",
"cordova-android": "^8.0.0",
"cordova-plugin-device": "^2.0.2",
"core-js": "^2.6.5",
"file-saver": "^2.0.1",
"hammerjs": "^2.0.8",
......@@ -89,5 +94,13 @@
"tslint": "^5.13.1",
"typescript": "~3.1.1",
"webpack-dev-server": "^3.2.1"
},
"cordova": {
"plugins": {
"cordova-plugin-whitelist": {}
},
"platforms": [
"android"
]
}
}
}
\ No newline at end of file
*
*/
!README
!.gitignore
\ No newline at end of file
Directory for built packages (electron, cordova)
\ No newline at end of file
www 0 → 120000
dist
\ No newline at end of file
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