MOBILE-3401 ionic: Adapt scripts

main
Pau Ferrer Ocaña 2020-04-28 13:29:17 +02:00
parent b845a1449b
commit 2d49355121
6 changed files with 662 additions and 148 deletions

View File

@ -1,25 +1,99 @@
os: linux
dist: bionic
group: edge
language: node_js
node_js: 11
android:
components:
- tools
- platform-tools
- build-tools-29.0.3
- android-28
- extra-google-google_play_services
- extra-google-m2repository
- extra-android-m2repository
git:
depth: 3
before_cache:
- rm -rf $HOME/.cache/electron-builder/wine
- rm -f $HOME/.gradle/caches/modules-2/modules-2.lock
- rm -fr $HOME/.gradle/caches/*/plugin-resolution/
cache:
directories:
- $HOME/.npm
- $HOME/.cache/electron
- $HOME/.cache/electron-builder
- $HOME/.gradle/caches/
- $HOME/.gradle/wrapper/
- $HOME/.android/build-cache
before_script:
- npm install npm@latest -g
- if [ "$TRAVIS_OS_NAME" != 'windows' ] ; then npm install npm@latest -g ; fi
- gulp
script:
- npm run build --bailOnLintError true --typeCheckOnLint true
after_success:
- scripts/ci.sh
jobs:
include:
- stage: check
if: NOT branch =~ /(master$|integration$|desktop)/
os: linux
script: npm run build --bailOnLintError true --typeCheckOnLint true
- stage: mirror
if: branch IN (master, integration, desktop) AND repo = moodlehq/moodleapp
os: linux
script: scripts/mirror.sh
- stage: prepare
if: branch =~ /(master$|integration)/ AND env(PREPARE) IS present AND env(PREPARE) = 1
os: linux
script: scripts/aot.sh
- stage: build
name: "Build Android"
if: env(DEPLOY) IS present AND (env(DEPLOY) = 1 AND NOT branch = desktop) OR (env(DEPLOY) IN (2,3) AND tag IS present)
os: linux
dist: trusty
group: edge
language: android
before_install:
- nvm install 11
- node --version
- npm --version
- nvm --version
- npm ci
- npm install -g gulp
script: scripts/aot.sh
- stage: build
name: "Build iOS"
if: env(DEPLOY) IS present AND (env(DEPLOY) = 1 AND NOT branch = desktop) OR (env(DEPLOY) IN (2,3) AND tag IS present)
os: osx
osx_image: xcode11.3
script: scripts/aot.sh
- stage: build
name: "Build Linux"
if: env(DEPLOY) IS present AND (env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS present)
os: linux
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
script: scripts/aot.sh
- stage: build
name: "Build MacOS"
if: env(DEPLOY) IS present AND (env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS present)
os: osx
osx_image: xcode11.3
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
script: scripts/aot.sh
- stage: build
name: "Build Windows"
if: env(DEPLOY) IS present AND (env(DEPLOY) = 1 AND branch = desktop) OR (env(DEPLOY) = 3 AND tag IS present)
os: windows
env:
- ELECTRON_CACHE=$HOME/.cache/electron
- ELECTRON_BUILDER_CACHE=$HOME/.cache/electron-builder
- ELECTRON_BUILDER_ALLOW_UNRESOLVED_DEPENDENCIES=true
- DEBUG=electron-windows-store
script: scripts/aot.sh

View File

@ -1,49 +1,71 @@
<?xml version='1.0' encoding='utf-8'?>
<widget id="com.moodle.moodlemobile" version="3.8.2" xmlns="http://www.w3.org/ns/widgets" xmlns:android="http://schemas.android.com/apk/res/android" xmlns:cdv="http://cordova.apache.org/ns/1.0">
<widget id="com.moodle.moodlemobile"
version="3.8.2"
xmlns="http://www.w3.org/ns/widgets"
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:cdv="http://cordova.apache.org/ns/1.0"
versionCode = "38200"
android-versionCode = "38200"
ios-CFBundleVersion = "3.8.2.0">
<name>Moodle</name>
<description>Moodle official app</description>
<author email="mobile@moodle.com" href="http://moodle.com">Moodle Mobile team</author>
<content src="index.html" />
<access origin="*" />
<access launch-external="yes" origin="tel:*" />
<access launch-external="yes" origin="mailto:*" />
<access launch-external="yes" origin="geo:*" />
<allow-navigation href="moodleappfs:*" />
<allow-navigation href="cdvfile:*" />
<allow-navigation href="content:*" />
<allow-navigation href="data:*" />
<allow-navigation href="*" />
<allow-intent href="*" />
<allow-intent href="tel:*" />
<allow-intent href="sms:*" />
<allow-intent href="mailto:*" />
<allow-intent href="geo:*" />
<!-- See MOBILE-892 -->
<preference name="permissions" value="none"/>
<preference name="orientation" value="default" />
<preference name="target-device" value="universal" />
<preference name="fullscreen" value="false" />
<preference name="stay-in-webview" value="false" />
<preference name="webviewbounce" value="false" />
<preference name="AppendUserAgent" value="MoodleMobile" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="29" />
<preference name="UIWebViewBounce" value="false" />
<preference name="DisallowOverscroll" value="true" />
<preference name="prerendered-icon" value="true" />
<preference name="AppendUserAgent" value="MoodleMobile" />
<preference name="BackupWebStorage" value="none" />
<preference name="ScrollEnabled" value="false" />
<preference name="KeyboardDisplayRequiresUserAction" value="false" />
<preference name="AllowInlineMediaPlayback" value="true" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
<preference name="LoadUrlTimeoutValue" value="60000" />
<preference name="load-url-timeout" value="60000" />
<preference name="SplashScreen" value="screen" />
<preference name="SplashScreenDelay" value="15000" />
<preference name="SplashMaintainAspectRatio" value="true" />
<preference name="SplashShowOnlyFirstTime" value="false" />
<preference name="LoadUrlTimeoutValue" value="60000" />
<preference name="android-minSdkVersion" value="19" />
<preference name="android-targetSdkVersion" value="29" />
<preference name="AndroidPersistentFileLocation" value="Compatibility" />
<preference name="CustomURLSchemePluginClearsAndroidIntent" value="true" />
<preference name="iosPersistentFileLocation" value="Compatibility" />
<preference name="Scheme" value="moodleappfs" />
<preference name="iosScheme" value="moodleappfs" />
<feature name="StatusBar">
<param name="ios-package" onload="true" value="CDVStatusBar" />
</feature>
<platform name="android">
<resource-file src="MainActivity.java" target="app/src/main/java/com/moodle/moodlemobile/MainActivity.java" />
<resource-file src="google-services.json" target="app/google-services.json" />
@ -51,11 +73,33 @@
<resource-file src="resources/android/icon/drawable-mdpi-smallicon.png" target="app/src/main/res/mipmap-mdpi/smallicon.png" />
<resource-file src="resources/android/icon/drawable-hdpi-smallicon.png" target="app/src/main/res/mipmap-hdpi/smallicon.png" />
<resource-file src="resources/android/icon/drawable-xhdpi-smallicon.png" target="app/src/main/res/mipmap-xhdpi/smallicon.png" />
<!--
This should be added by the file-opener2 plugin, but it's not working at the moment. This can be removed
once the following issue is resolved and the plugin is updated to include the fix:
https://github.com/pwlin/cordova-plugin-file-opener2/issues/246
-->
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<provider android:authorities="${applicationId}.opener.provider" android:exported="false" android:grantUriPermissions="true" android:name="io.github.pwlin.cordova.plugins.fileopener2.FileProvider">
<meta-data android:name="android.support.FILE_PROVIDER_PATHS" android:resource="@xml/opener_paths" />
</provider>
</config-file>
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|screenLayout|smallestScreenSize" android:debuggable="true" />
</edit-config>
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
</edit-config>
<!-- Make gps location optional, otherwise apps that don't support it won't be able to install the app. -->
<plugin name="cordova-plugin-geolocation" spec="4.0.2">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="We need your location so you can attach it as part of your submissions." />
<edit-config file="AndroidManifest.xml" mode="overwrite" target="/manifest/uses-feature[@android:name='android.hardware.location.gps']">
<uses-feature android:name="android.hardware.location.gps" android:required="false" />
</edit-config>
</plugin>
<!-- Disable firebase analytics. -->
<config-file target="AndroidManifest.xml" parent="/manifest/application">
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
</config-file>
</platform>
<platform name="ios">
<resource-file src="GoogleService-Info.plist" />
@ -65,57 +109,403 @@
<edit-config file="*-Info.plist" mode="merge" target="NSLocationAlwaysUsageDescription">
<string>We need your location so you can attach it as part of your submissions.</string>
</edit-config>
</platform>
<plugin name="com-darryncampbell-cordova-plugin-intent" spec="1.3.0" />
<plugin name="cordova-android-support-gradle-release" spec="3.0.1">
<variable name="ANDROID_SUPPORT_VERSION" value="27.1.0" />
</plugin>
<plugin name="cordova-clipboard" spec="1.3.0" />
<plugin name="cordova-plugin-badge" spec="0.8.8" />
<plugin name="cordova-plugin-camera" spec="4.1.0" />
<plugin name="cordova-plugin-customurlscheme" spec="4.4.0">
<variable name="URL_SCHEME" value="moodlemobile" />
</plugin>
<plugin name="cordova-plugin-device" spec="2.0.3" />
<plugin name="cordova-plugin-file" spec="6.0.2" />
<plugin name="cordova-plugin-file-opener2" spec="2.2.1" />
<plugin name="cordova-plugin-file-transfer" spec="1.7.1" />
<plugin name="cordova-plugin-geolocation" spec="4.0.2">
<variable name="GEOLOCATION_USAGE_DESCRIPTION" value="We need your location so you can attach it as part of your submissions." />
</plugin>
<plugin name="cordova-plugin-globalization" spec="1.11.0" />
<plugin name="cordova-plugin-inappbrowser" spec="3.1.0" />
<plugin name="cordova-plugin-ionic-keyboard" spec="2.1.3" />
<plugin name="cordova-plugin-local-notification" spec="https://github.com/moodlemobile/cordova-plugin-local-notification.git#moodle" />
<plugin name="cordova-plugin-media-capture" spec="3.0.3" />
<plugin name="cordova-plugin-network-information" spec="2.0.2" />
<plugin name="cordova-plugin-qrscanner" spec="https://github.com/moodlemobile/cordova-plugin-qrscanner.git#dist" />
<plugin name="cordova-plugin-screen-orientation" spec="3.0.2" />
<plugin name="cordova-plugin-splashscreen" spec="5.0.3" />
<plugin name="cordova-plugin-statusbar" spec="2.4.3" />
<plugin name="cordova-plugin-whitelist" spec="1.3.4" />
<plugin name="cordova-plugin-wkwebview-cookies" spec="https://github.com/moodlemobile/cordova-plugin-wkwebview-cookies.git" />
<plugin name="cordova-plugin-zip" spec="3.1.0" />
<plugin name="cordova-sqlite-storage" spec="3.4.0" />
<plugin name="nl.kingsquare.cordova.background-audio" spec="1.0.1" />
<plugin name="phonegap-plugin-push" spec="https://github.com/moodlemobile/phonegap-plugin-push.git#moodle-v3">
<variable name="ANDROID_SUPPORT_V13_VERSION" value="27.+" />
<variable name="FCM_VERSION" value="17.5.+" />
</plugin>
<plugin name="cordova-plugin-ionic-webview" spec="4.1.3" />
<plugin name="cordova-plugin-advanced-http" spec="2.4.1" />
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application/activity[@android:name='MainActivity']">
<activity android:configChanges="orientation|keyboardHidden|keyboard|screenSize|locale|screenLayout|smallestScreenSize" android:debuggable="true" />
<edit-config target="NSCameraUsageDescription" file="*-Info.plist" mode="merge">
<string>We need camera access to take pictures so you can attach them as part of your submissions.</string>
</edit-config>
<edit-config file="AndroidManifest.xml" mode="merge" target="/manifest/application">
<application android:usesCleartextTraffic="true" />
<edit-config target="NSMicrophoneUsageDescription" file="*-Info.plist" mode="merge">
<string>We need microphone access to record sounds so you can attach them as part of your submissions.</string>
</edit-config>
<config-file parent="/manifest/application" target="AndroidManifest.xml">
<meta-data android:name="firebase_analytics_collection_deactivated" android:value="true" />
</config-file>
<config-file parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED" target="*-Info.plist">
<edit-config target="NSPhotoLibraryUsageDescription" file="*-Info.plist" mode="merge">
<string>We need photo library access to get pictures from there so you can attach them as part of your submissions.</string>
</edit-config>
<edit-config target="UISupportsDocumentBrowser" file="*-Info.plist" mode="merge">
<true/>
</edit-config>
<edit-config target="CFBundleShortVersionString" file="*-Info.plist" mode="merge">
<string>3.8.2</string>
</edit-config>
<config-file target="*-Info.plist" parent="FIREBASE_ANALYTICS_COLLECTION_DEACTIVATED">
<string>YES</string>
</config-file>
<engine name="android" spec="8.0.0" />
<engine name="ios" spec="5.0.1" />
<config-file target="*-Info.plist" parent="CFBundleDocumentTypes">
<array>
<dict>
<key>CFBundleTypeName</key>
<string>Unknown File</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.calendar-event</string>
<string>public.database</string>
<string>public.executable</string>
<string>public.data</string>
<string>public.content </string>
<string>public.item</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Video</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.video</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.image</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Web Archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.webarchive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Keynote</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.keynote.key</string>
<string>com.apple.iwork.keynote.key</string>
<string>com.apple.iwork.keynote.kth</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Numbers</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.numbers.numbers</string>
<string>com.apple.iwork.numbers.numbers</string>
<string>com.apple.iwork.numbers.template</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>iWork Pages</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.apple.page.pages</string>
<string>com.apple.iwork.pages.pages</string>
<string>com.apple.iwork.pages.template</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Spreadsheet</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.spreadsheet</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Presentation</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.presentation</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>OpenDocument Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.oasis.opendocument.text</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Folder</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.folder</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Audio</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.audio</string>
<string>public.mp3</string>
<string>public.mpeg-4-audio</string>
<string>com.apple.protected-mpeg-4-audio</string>
<string>public.aifc-audio</string>
<string>com.apple.coreaudio-format</string>
<string>public.aiff-audio</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Movie</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.movie</string>
<string>public.3gpp2</string>
<string>public.3gpp</string>
<string>public.mpeg</string>
<string>com.apple.quicktime-movie</string>
<string>public.mpeg-4</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>GIF image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.compuserve.gif</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PNG image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.png</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>TIFF image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.tiff</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>JPEG image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.jpeg</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>XML</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.xml</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>HTML</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.html</string>
<string>public.xhtml</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Rich Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.rtf</string>
<string>com.apple.rtfd</string>
<string>com.apple.flat-rtfd</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Text</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.text</string>
<string>public.plain-text</string>
<string>public.utf8-plain-text</string>
<string>public.utf16-external-plain-text</string>
<string>public.utf16-plain-text</string>
<string>com.apple.traditional-mac-plain-text</string>
<string>public.source-code</string>
<string>public.c-source</string>
<string>public.objective-c-source</string>
<string>public.c-plus-plus-source</string>
<string>public.objective-c-plus-plus-source</string>
<string>public.c-header</string>
<string>public.c-plus-plus-header</string>
<string>com.sun.java-source</string>
<string>public.script</string>
<string>public.shell-script</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>zip</string>
<string>zipx</string>
</array>
<key>CFBundleTypeName</key>
<string>Zip archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>public.zip-archive</string>
<string>public.archive</string>
<string>com.pkware.zip-archive</string>
<string>com.pkware.zipx-archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>rar</string>
<string>RAR</string>
</array>
<key>CFBundleTypeName</key>
<string>Rar archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.rarlab.rar-archive</string>
<string>public.archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeExtensions</key>
<array>
<string>7z</string>
<string>7Z</string>
</array>
<key>CFBundleTypeName</key>
<string>7z archive</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.7-zip.7-zip-archive</string>
<string>public.archive</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Waveform audio</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.waveform-audio</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Windows icon image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.ico</string>
<string>com.apple.icns</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Windows bitmap image</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.bmp</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft PowerPoint</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.powerpoint.ppt</string>
<string>org.openxmlformats.presentationml.presentation</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Excel</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>org.openxmlformats.spreadsheetml.sheet</string>
<string>com.microsoft.excel.xls</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>Microsoft Word</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.microsoft.word.doc</string>
<string>com.microsoft.word.wordml</string>
<string>org.openxmlformats.wordprocessingml.document</string>
</array>
</dict>
<dict>
<key>CFBundleTypeName</key>
<string>PDF</string>
<key>LSHandlerRank</key>
<string>Alternate</string>
<key>LSItemContentTypes</key>
<array>
<string>com.adobe.pdf</string>
</array>
</dict>
</array>
</config-file>
</platform>
</widget>

32
scripts/aot.sh 100755
View File

@ -0,0 +1,32 @@
#!/bin/bash
source "scripts/functions.sh"
if [ ! -z $GIT_ORG_PRIVATE ] && [ ! -z $GIT_TOKEN ] ; then
print_title "Run scripts"
git clone --depth 1 https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/apps-scripts.git ../scripts
cp ../scripts/*.sh scripts/
if [ $TRAVIS_BUILD_STAGE_NAME == 'prepare' ] && [ -f scripts/prepare.sh ] ; then
print_title 'Prepare Build'
./scripts/prepare.sh
if [ $? -ne 0 ]; then
exit 1
fi
elif [ $TRAVIS_BUILD_STAGE_NAME != 'prepare' ] && [ -f scripts/platform.sh ]; then
print_title 'Platform Build'
./scripts/platform.sh
if [ $? -ne 0 ]; then
exit 1
fi
fi
else
print_title "AOT Compilation"
# Dynamic template loading without errors.
sed -ie $'s~throw new Error("No ResourceLoader.*~url = "templates/" + url;\\\nvar resolve;\\\nvar reject;\\\nvar promise = new Promise(function (res, rej) {\\\nresolve = res;\\\nreject = rej;\\\n});\\\nvar xhr = new XMLHttpRequest();\\\nxhr.open("GET", url, true);\\\nxhr.responseType = "text";\\\nxhr.onload = function () {\\\nvar response = xhr.response || xhr.responseText;\\\nvar status = xhr.status === 1223 ? 204 : xhr.status;\\\nif (status === 0) {\\\nstatus = response ? 200 : 0;\\\n}\\\nif (200 <= status \&\& status <= 300) {\\\nresolve(response);\\\n}\\\nelse {\\\nreject("Failed to load " + url);\\\n}\\\n};\\\nxhr.onerror = function () { reject("Failed to load " + url); };\\\nxhr.send();\\\nreturn promise;\\\n~g' node_modules/@angular/platform-browser-dynamic/esm5/platform-browser-dynamic.js
# Do not run JS optimizations to avoid problems with site plugins.
sed -ie "s/context\.isProd || hasArg('--optimizeJs')/false/g" node_modules/@ionic/app-scripts/dist/util/config.js
npm run ionic:build -- --prod
fi

View File

@ -1,81 +0,0 @@
#!/bin/bash
source "scripts/functions.sh"
if [ "$TRAVIS_EVENT_TYPE" == 'cron' ] ; then
# Tests scripts.
print_error 'CRON NOT IMPLEMENTED YET'
else
if [ -z $GIT_ORG_PRIVATE ] || [ -z $GIT_TOKEN ]; then
print_error "Env vars not correctly defined"
exit 1
fi
# List first level of installed libraries so we can check the installed versions.
print_title "NPM packages list"
npm list --depth=0
if [ "$TRAVIS_REPO_SLUG" == 'moodlehq/moodleapp' ]; then
if [ "$TRAVIS_BRANCH" == 'master' ]; then
print_title "Update langpacks"
cd scripts
./update_lang.sh
cd ..
print_title "Update generated lang files"
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
git fetch -q origin
git add -A src/assets/lang
git add */en.json
git add src/config.json
git commit -m 'Update lang files [ci skip]'
print_title "Update Licenses"
npm install -g license-checker
jq --version
license-checker --json --production --relativeLicensePath > licenses.json
jq 'del(.[].path)' licenses.json > licenses_old.json
mv licenses_old.json licenses.json
licenses=`jq -r 'keys[]' licenses.json`
echo "{" > licensesurl.json
first=1
for license in $licenses; do
obj=`jq --arg lic $license '.[$lic]' licenses.json`
licensePath=`echo $obj | jq -r '.licenseFile'`
file=""
if [[ ! -z "$licensePath" ]] || [[ "$licensePath" != "null" ]]; then
file=$(basename $licensePath)
if [ $first -eq 1 ] ; then
first=0
echo "\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
else
echo ",\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
fi
fi
done
echo "}" >> licensesurl.json
jq -s '.[0] * .[1]' licenses.json licensesurl.json > licenses_old.json
mv licenses_old.json licenses.json
rm licensesurl.json
git add licenses.json
git commit -m 'Update licenses [ci skip]'
git push origin HEAD:$TRAVIS_BRANCH
fi
if [ "$TRAVIS_BRANCH" == 'integration' ] || [ "$TRAVIS_BRANCH" == 'master' ] || [ "$TRAVIS_BRANCH" == 'desktop' ] ; then
print_title "Mirror repository"
git remote add mirror https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/moodleapp.git
git fetch -q --unshallow mirror
git push -f mirror HEAD:$TRAVIS_BRANCH
git push mirror --tags
fi
elif [ "$TRAVIS_REPO_SLUG" == "$GIT_ORG_PRIVATE/moodleapp" ]; then
print_title "Run scripts"
git clone --depth 1 https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/apps-scripts.git ../scripts
cp ../scripts/build.sh scripts/
./scripts/build.sh
fi
fi

View File

@ -1,6 +1,16 @@
#!/bin/bash
LANGPACKSFOLDER='../../moodle-langpacks'
stepnumber=$1
function check_success_exit {
if [ $? -ne 0 ]; then
print_error "$1"
exit 1
elif [ "$#" -gt 1 ]; then
print_ok "$2"
fi
}
function check_success {
if [ $? -ne 0 ]; then

89
scripts/mirror.sh 100755
View File

@ -0,0 +1,89 @@
#!/bin/bash
source "scripts/functions.sh"
npm run build --bailOnLintError true --typeCheckOnLint true
if [ -z $GIT_ORG_PRIVATE ] || [ -z $GIT_TOKEN ]; then
print_error "Env vars not correctly defined"
exit 1
fi
# List first level of installed libraries so we can check the installed versions.
print_title "NPM packages list"
npm list --depth=0
if [ "$TRAVIS_BRANCH" == 'master' ]; then
print_title "Update langpacks"
cd scripts
./update_lang.sh
cd ..
print_title "Update generated lang files"
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
git fetch -q origin
git add -A src/assets/lang
git add */en.json
git add src/config.json
git commit -m 'Update lang files [ci skip]'
print_title "Update Licenses"
npm install -g license-checker
jq --version
license-checker --json --production --relativeLicensePath > licenses.json
jq 'del(.[].path)' licenses.json > licenses_old.json
mv licenses_old.json licenses.json
licenses=`jq -r 'keys[]' licenses.json`
echo "{" > licensesurl.json
first=1
for license in $licenses; do
obj=`jq --arg lic $license '.[$lic]' licenses.json`
licensePath=`echo $obj | jq -r '.licenseFile'`
file=""
if [[ ! -z "$licensePath" ]] || [[ "$licensePath" != "null" ]]; then
file=$(basename $licensePath)
if [ $first -eq 1 ] ; then
first=0
echo "\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
else
echo ",\"$license\" : { \"licenseFile\" : \"$file\"}" >> licensesurl.json
fi
fi
done
echo "}" >> licensesurl.json
jq -s '.[0] * .[1]' licenses.json licensesurl.json > licenses_old.json
mv licenses_old.json licenses.json
rm licensesurl.json
git add licenses.json
git commit -m 'Update licenses [ci skip]'
git push origin HEAD:$TRAVIS_BRANCH
fi
VERSION=`jq -r '.versionname' src/config.json`
if [ "$TRAVIS_BRANCH" == 'integration' ] && [ "$VERSION" != *-dev ] ; then
VERSION=$VERSION-dev
jq -r --indent 4 --arg version "$VERSION" -s '.[0] + {versionname: $version}' src/config.json > src/config_new.json
mv src/config_new.json src/config.json
sed -ie "s/version[ ]*=[ ]*\"[0-9\.]*\">/version=\"$VERSION\">/1" config.xml
git remote set-url origin https://$GIT_TOKEN@github.com/$TRAVIS_REPO_SLUG.git
git fetch -q origin
git add src/config.json
git commit -m 'Change config version [ci skip]'
git push origin HEAD:$TRAVIS_BRANCH
fi
if [ "$TRAVIS_BRANCH" == 'integration' ] || [ "$TRAVIS_BRANCH" == 'master' ] || [ "$TRAVIS_BRANCH" == 'desktop' ] ; then
print_title "Mirror repository"
git remote add mirror https://$GIT_TOKEN@github.com/$GIT_ORG_PRIVATE/moodleapp.git
git fetch -q --unshallow mirror
git push -f mirror HEAD:$TRAVIS_BRANCH
git push -f mirror --tags
fi