Skip to content

Commit

Permalink
add shell script for copying files
Browse files Browse the repository at this point in the history
  • Loading branch information
levinli303 committed Mar 26, 2020
1 parent 4e92c25 commit 3d5426e
Show file tree
Hide file tree
Showing 6 changed files with 168 additions and 3 deletions.
17 changes: 17 additions & 0 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
42 changes: 42 additions & 0 deletions app/convert_po.sh
Original file line number Diff line number Diff line change
@@ -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

28 changes: 28 additions & 0 deletions app/copy_general_data.sh
Original file line number Diff line number Diff line change
@@ -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

77 changes: 77 additions & 0 deletions app/src/main/assets/defaults.json
Original file line number Diff line number Diff line change
@@ -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
}
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}

Expand Down
3 changes: 2 additions & 1 deletion build.gradle
Original file line number Diff line number Diff line change
@@ -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()
Expand All @@ -25,5 +25,6 @@ allprojects {
}

task clean(type: Delete) {
delete "$rootProject.projectDir/app/src/main/assets/CelestiaResources"
delete rootProject.buildDir
}

0 comments on commit 3d5426e

Please sign in to comment.