From 3d5426e942fbd98a93eb390f0c6c33f171ce5bd2 Mon Sep 17 00:00:00 2001 From: Li Linfeng Date: Thu, 26 Mar 2020 10:33:21 +0800 Subject: [PATCH] add shell script for copying files --- app/build.gradle | 17 ++++ app/convert_po.sh | 42 ++++++++++ app/copy_general_data.sh | 28 +++++++ app/src/main/assets/defaults.json | 77 +++++++++++++++++++ .../mobilecelestia/settings/AboutFragment.kt | 4 +- build.gradle | 3 +- 6 files changed, 168 insertions(+), 3 deletions(-) create mode 100755 app/convert_po.sh create mode 100755 app/copy_general_data.sh create mode 100644 app/src/main/assets/defaults.json diff --git a/app/build.gradle b/app/build.gradle index 32e85d96..191b82fb 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -38,6 +38,23 @@ android { } } + task copyGeneralData(type: Exec) { + println "Copying general data" + workingDir projectDir + executable = '/bin/sh' + args = ["copy_general_data.sh"] + } + + task convertPO(type: Exec) { + println "Converting PO" + workingDir projectDir + executable = '/bin/sh' + args = ["convert_po.sh", temporaryDir] + } + + convertPO.dependsOn copyGeneralData + preBuild.dependsOn convertPO + compileOptions { targetCompatibility = "8" sourceCompatibility = "8" diff --git a/app/convert_po.sh b/app/convert_po.sh new file mode 100755 index 00000000..a14d3b01 --- /dev/null +++ b/app/convert_po.sh @@ -0,0 +1,42 @@ +#!/bin/sh + +cd `dirname $0`; + +DIDBUILD=0 + +CELESTIA_ROOT=`pwd`/src/main/assets/CelestiaResources +CELESTIA_REPO_ROOT=`pwd`/../../Celestia + +LOCALE_ROOT=$CELESTIA_ROOT/locale +PROJECT_TEMP_DIR=$1 + +mkdir -p $LOCALE_ROOT + +POT=$CELESTIA_REPO_ROOT/po/celestia.pot + +for po in $CELESTIA_REPO_ROOT/po/*.po; do + f=${po##*/};f=${f%.*} + LANG_ROOT=$LOCALE_ROOT/$f/LC_MESSAGES + mkdir -p $LANG_ROOT + if [ $po -nt $LANG_ROOT/celestia.mo ];then + echo "Create $LANG_ROOT/celestia.mo" + msgmerge --quiet --output-file=$PROJECT_TEMP_DIR/$f.po --lang=$f --sort-output $po $POT + msgfmt -o $LANG_ROOT/celestia.mo $PROJECT_TEMP_DIR/$f.po + DIDBUILD=1 + fi +done + +POT=$CELESTIA_REPO_ROOT/po2/celestia_constellations.pot + +for po in $CELESTIA_REPO_ROOT/po2/*.po; do + f=${po##*/};f=${f%.*} + LANG_ROOT=$LOCALE_ROOT/$f/LC_MESSAGES + mkdir -p $LANG_ROOT + if [ $po -nt $LANG_ROOT/celestia_constellations.mo ];then + echo "Create $LANG_ROOT/celestia_constellations.mo" + msgmerge --quiet --output-file=$PROJECT_TEMP_DIR/$f.po --lang=$f --sort-output $po $POT + msgfmt -o $LANG_ROOT/celestia_constellations.mo $PROJECT_TEMP_DIR/$f.po + DIDBUILD=1 + fi +done + diff --git a/app/copy_general_data.sh b/app/copy_general_data.sh new file mode 100755 index 00000000..53bc9b62 --- /dev/null +++ b/app/copy_general_data.sh @@ -0,0 +1,28 @@ +#!/bin/sh + +cd `dirname $0`; + +DIDCOPY=0 + +CELESTIA_ROOT=`pwd`/src/main/assets/CelestiaResources +CELESTIA_REPO_ROOT=`pwd`/../../Celestia + +mkdir -p $CELESTIA_ROOT + +for directory in 'data' 'extras' 'extras-standard' 'fonts' 'images' 'locale' 'models' 'scripts' 'shaders' 'textures';do + f=$CELESTIA_REPO_ROOT/$directory + if [ $f -nt $CELESTIA_ROOT/$directory ];then + echo "rsync -rv --quiet --exclude=CMakeLists.txt $f $CELESTIA_ROOT" + rsync -rv --quiet --exclude=CMakeLists.txt $f $CELESTIA_ROOT + DIDCOPY=1 + fi +done + +for file in "celestia.cfg" "controls.txt" "demo.cel" "guide.cel" "start.cel" "COPYING" "AUTHORS" "TRANSLATORS";do + f=$CELESTIA_REPO_ROOT/$file + if [ $f -nt $CELESTIA_ROOT/$file ];then + echo "cp $f $CELESTIA_ROOT/$file" + cp $f $CELESTIA_ROOT/$file + fi +done + diff --git a/app/src/main/assets/defaults.json b/app/src/main/assets/defaults.json new file mode 100644 index 00000000..c6b7b160 --- /dev/null +++ b/app/src/main/assets/defaults.json @@ -0,0 +1,77 @@ +{ + "ShowCometOrbits" : 0, + "ShowOrbits" : 0, + "ShowSpacecraftLabels" : 0, + "ShowOpenClusterLabels" : 0, + "GalaxyBrightness" : 0.0, + "ShowMoonLabels" : 0, + "ShowOtherLabels" : 1, + "ShowCraterLabels" : 1, + "ShowCometTails" : 1, + "ShowReticulumLabels" : 1, + "ShowDorsumLabels" : 1, + "AmbientLightLevel" : 0.10000000000000001, + "ShowLandingSiteLabels" : 1, + "ShowBoundaries" : 0, + "ShowCloudMaps" : 1, + "HudDetail" : 1, + "ShowMareLabels" : 1, + "ShowPlanetOrbits" : 1, + "ShowCloudShadows" : 0, + "ShowFluctusLabels" : 1, + "ShowRingShadows" : 0, + "FaintestVisible" : 7.0000000, + "ShowNebulaLabels" : 0, + "ShowRupesLabels" : 1, + "ShowLatinConstellationLabels" : 1, + "ShowTesseraLabels" : 1, + "MinimumFeatureSize" : 20.0, + "ShowRegioLabels" : 1, + "ShowCometLabels" : 0, + "ShowOpenClusters" : 0, + "ShowFossaLabels" : 1, + "ShowStellarOrbits" : 1, + "ShowMensaLabels" : 1, + "ShowPlanumLabels" : 1, + "ShowDiagrams" : 0, + "ShowStars" : 1, + "ShowVallisLabels" : 1, + "ShowMonsLabels" : 1, + "ShowPlanets" : 1, + "ShowRimaLabels" : 1, + "Resolution" : 1, + "ShowLocationLabels" : 0, + "ShowMoonOrbits" : 1, + "ShowAutoMag" : 1, + "ShowTerraLabels" : 1, + "ShowEclipseShadows" : 0, + "ShowNebulae" : 1, + "ShowAsteroidLabels" : 0, + "ShowPateraLabels" : 1, + "ShowConstellationLabels" : 0, + "ShowCelestialSphere" : 0, + "ShowSpacecraftOrbits" : 0, + "ShowStarLabels" : 0, + "DateFormat" : 1, + "ShowAtmospheres" : 1, + "ShowCityLabels" : 1, + "ShowMarkers" : 0, + "ShowSmoothLines" : 1, + "ShowLineaLabels" : 1, + "ShowPlanitiaLabels" : 1, + "ShowAsteroidOrbits" : 0, + "ShowObservatoryLabels" : 1, + "ShowGalaxies" : 1, + "ShowPlanetLabels" : 0, + "ShowUndaeLabels" : 1, + "TimeZone" : 0, + "ShowAstrumLabels" : 1, + "ShowNightMaps" : 1, + "ShowCoronaLabels" : 1, + "ShowGalaxyLabels" : 0, + "ShowChaosLabels" : 1, + "StarStyle" : 0, + "ShowChasmaLabels" : 1, + "ShowCatenaLabels" : 1, + "ShowFarrumLabels" : 1 +} diff --git a/app/src/main/java/space/celestia/mobilecelestia/settings/AboutFragment.kt b/app/src/main/java/space/celestia/mobilecelestia/settings/AboutFragment.kt index a31768ab..e18011bc 100644 --- a/app/src/main/java/space/celestia/mobilecelestia/settings/AboutFragment.kt +++ b/app/src/main/java/space/celestia/mobilecelestia/settings/AboutFragment.kt @@ -51,12 +51,12 @@ class AboutFragment : TitledFragment() { )) // Authors - getInfo("AUTHORS", CelestiaString("Authors", ""))?.let { + getInfo("CelestiaResources/AUTHORS", CelestiaString("Authors", ""))?.let { array.add(it) } // Translators - getInfo("TRANSLATORS", CelestiaString("Translators", ""))?.let { + getInfo("CelestiaResources/TRANSLATORS", CelestiaString("Translators", ""))?.let { array.add(it) } diff --git a/build.gradle b/build.gradle index a967444a..2dcc2c93 100644 --- a/build.gradle +++ b/build.gradle @@ -1,7 +1,7 @@ // Top-level build file where you can add configuration options common to all sub-projects/modules. buildscript { - ext.kotlin_version = '1.3.70' + ext.kotlin_version = '1.3.71' repositories { google() jcenter() @@ -25,5 +25,6 @@ allprojects { } task clean(type: Delete) { + delete "$rootProject.projectDir/app/src/main/assets/CelestiaResources" delete rootProject.buildDir }