From 628534b416e3602eabcc01e3704640b2cb429c29 Mon Sep 17 00:00:00 2001 From: Alexandre Jacinto Date: Tue, 7 Jan 2025 10:44:48 +0000 Subject: [PATCH] Finish initialisation by running the generator script. --- docs/README.md | 4 +- fastlane/Appfile | 2 +- scripts/generator_script.sh | 57 ------------------- settings.gradle | 2 +- sonar-project.properties | 2 +- .../ExampleInstrumentedTest.kt | 4 +- src/main/AndroidManifest.xml | 4 +- .../osgeolocationlib}/MainActivity.kt | 2 +- src/main/res/values-night/themes.xml | 2 +- src/main/res/values/strings.xml | 2 +- src/main/res/values/themes.xml | 2 +- .../osgeolocationlib}/ExampleUnitTest.kt | 2 +- 12 files changed, 14 insertions(+), 71 deletions(-) delete mode 100644 scripts/generator_script.sh rename src/androidTest/java/{organizationidplaceholder/libtemplateplaceholder => com.outsystems.plugins.osgeolocation/osgeolocationlib}/ExampleInstrumentedTest.kt (77%) rename src/main/java/{organizationidplaceholder/libtemplateplaceholder => com.outsystems.plugins.osgeolocation/osgeolocationlib}/MainActivity.kt (81%) rename src/test/java/{organizationidplaceholder/libtemplateplaceholder => com.outsystems.plugins.osgeolocation/osgeolocationlib}/ExampleUnitTest.kt (83%) diff --git a/docs/README.md b/docs/README.md index d4bf6f8..1633751 100644 --- a/docs/README.md +++ b/docs/README.md @@ -1,6 +1,6 @@ -# LibTemplatePlaceholder +# OSGeolocationLib -Welcome to **LibTemplatePlaceholder**. This repository serves as a template to create repositories used to build Android libraries. This file will guide you through that process, that is defined by two sequential steps: +Welcome to **OSGeolocationLib**. This repository serves as a template to create repositories used to build Android libraries. This file will guide you through that process, that is defined by two sequential steps: 1. Use the current repository as the template for the new one. 2. Clone the new repository on our machine. diff --git a/fastlane/Appfile b/fastlane/Appfile index 920122f..4bf46c0 100644 --- a/fastlane/Appfile +++ b/fastlane/Appfile @@ -1,2 +1,2 @@ json_key_file("") # Path to the json secret file - Follow https://docs.fastlane.tools/actions/supply/#setup to get one -package_name("organizationidplaceholder.libtemplateplaceholder") # e.g. com.krausefx.app +package_name("com.outsystems.plugins.osgeolocation.osgeolocationlib") # e.g. com.krausefx.app diff --git a/scripts/generator_script.sh b/scripts/generator_script.sh deleted file mode 100644 index 6e2ff57..0000000 --- a/scripts/generator_script.sh +++ /dev/null @@ -1,57 +0,0 @@ -### Welcome the user to this awesome tool - -printf "Welcome to the Android Library Generator!!\n\n" - -remoteURL=$(git config --get remote.origin.url) -remoteURL=$(echo $remoteURL | perl -F/ -wane 'print $F[-1]') -remoteURL=$(echo ${remoteURL%-*}) - -### Inform the user of the library name to be used -printf "Considering the repository name you gave while creating it, we will use '$remoteURL' as the Library's name." - -### Ask the user for the package identifier. Continue to ask while the input doesn't match the correct format. -while true -do - printf "\nPlease write the desired package identifier. This should be composed only by lowercase letters, numbers and '.' (e.g. 'com.outsystems').\n" - read organisationId - result=$(echo $organisationId | awk '/^[a-z0-9]+([\.]?[a-z0-9]+)*?$/') - - if ! [ -z "$result" ]; then - break - else - printf "Format not valid. Please try again." - fi -done - -### Delete current file -currentFile=$(basename "$0") - -printf "\nThe '$currentFile' file will be removed as it should only be executed once.\n\n" - -rm -f $currentFile - -### Proceed to change all necessary placeholders -cd .. - -LC_CTYPE=C && LANG=C && find . -type f -exec sed -e "s/LibTemplatePlaceholder/$remoteURL/g" -i '' '{}' ';' -LC_CTYPE=C && LANG=C && find . -depth -name '*LibTemplatePlaceholder*' -print0|while IFS= read -rd '' f; do mv -i "$f" "$(echo "$f"|sed -E "s/(.*)LibTemplatePlaceholder/\1$remoteURL/")"; done - -LC_CTYPE=C && LANG=C && find . -type f -exec sed -e "s/organizationidplaceholder/$organisationId/g" -i '' '{}' ';' -LC_CTYPE=C && LANG=C && find . -depth -name '*organizationidplaceholder*' -print0|while IFS= read -rd '' f; do mv -i "$f" "$(echo "$f"|sed -E "s/(.*)organizationidplaceholder/\1$organisationId/")"; done - -### Convert $remoteURL to lowercase -lowercaseRemoteURL=$(echo "$remoteURL" | tr '[:upper:]' '[:lower:]') - -LC_CTYPE=C && LANG=C && find . -type f -exec sed -e "s/libtemplateplaceholder/$lowercaseRemoteURL/g" -i '' '{}' ';' -LC_CTYPE=C && LANG=C && find . -depth -name '*libtemplateplaceholder*' -print0|while IFS= read -rd '' f; do mv -i "$f" "$(echo "$f"|sed -E "s/(.*)libtemplateplaceholder/\1$lowercaseRemoteURL/")"; done - -### Commit and push -rm -f .git/index -git reset -git add . -git commit -m "Finish initialisation by running the generator script." -git push - -### Close -printf "\n###Applause###\n" -printf "Looks like everything's done. Enjoy!\n\n" diff --git a/settings.gradle b/settings.gradle index c50e98e..2b0786f 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1 +1 @@ -rootProject.name = "LibTemplatePlaceholder" \ No newline at end of file +rootProject.name = "OSGeolocationLib" \ No newline at end of file diff --git a/sonar-project.properties b/sonar-project.properties index f860a85..6aa5898 100644 --- a/sonar-project.properties +++ b/sonar-project.properties @@ -1,6 +1,6 @@ # Organization and project keys are displayed in the right sidebar of the project homepage sonar.organization=outsystemsrd -sonar.projectKey=OutSystems_LibTemplatePlaceholder-Android +sonar.projectKey=OutSystems_OSGeolocationLib-Android sonar.host.url=https://sonarcloud.io sonar.language=kotlin diff --git a/src/androidTest/java/organizationidplaceholder/libtemplateplaceholder/ExampleInstrumentedTest.kt b/src/androidTest/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/ExampleInstrumentedTest.kt similarity index 77% rename from src/androidTest/java/organizationidplaceholder/libtemplateplaceholder/ExampleInstrumentedTest.kt rename to src/androidTest/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/ExampleInstrumentedTest.kt index 72150fb..01cad77 100644 --- a/src/androidTest/java/organizationidplaceholder/libtemplateplaceholder/ExampleInstrumentedTest.kt +++ b/src/androidTest/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/ExampleInstrumentedTest.kt @@ -1,4 +1,4 @@ -package organizationidplaceholder.libtemplateplaceholder +package com.outsystems.plugins.osgeolocation.osgeolocationlib import androidx.test.platform.app.InstrumentationRegistry import androidx.test.ext.junit.runners.AndroidJUnit4 @@ -19,6 +19,6 @@ class ExampleInstrumentedTest { fun useAppContext() { // Context of the app under test. val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("organizationidplaceholder.libtemplateplaceholder", appContext.packageName) + assertEquals("com.outsystems.plugins.osgeolocation.osgeolocationlib", appContext.packageName) } } \ No newline at end of file diff --git a/src/main/AndroidManifest.xml b/src/main/AndroidManifest.xml index 4045313..8b87648 100644 --- a/src/main/AndroidManifest.xml +++ b/src/main/AndroidManifest.xml @@ -1,6 +1,6 @@ + package="com.outsystems.plugins.osgeolocation.osgeolocationlib"> + android:theme="@style/Theme.OSGeolocationLib"> diff --git a/src/main/java/organizationidplaceholder/libtemplateplaceholder/MainActivity.kt b/src/main/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/MainActivity.kt similarity index 81% rename from src/main/java/organizationidplaceholder/libtemplateplaceholder/MainActivity.kt rename to src/main/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/MainActivity.kt index a129d33..80216a2 100644 --- a/src/main/java/organizationidplaceholder/libtemplateplaceholder/MainActivity.kt +++ b/src/main/java/com.outsystems.plugins.osgeolocation/osgeolocationlib/MainActivity.kt @@ -1,4 +1,4 @@ -package organizationidplaceholder.libtemplateplaceholder +package com.outsystems.plugins.osgeolocation.osgeolocationlib import androidx.appcompat.app.AppCompatActivity import android.os.Bundle diff --git a/src/main/res/values-night/themes.xml b/src/main/res/values-night/themes.xml index 45f3135..cca8885 100644 --- a/src/main/res/values-night/themes.xml +++ b/src/main/res/values-night/themes.xml @@ -1,6 +1,6 @@ -