Skip to content

Commit 1de8749

Browse files
authored
Loggerazzi Initial branch (#1)
* Initial commit with loggerazzi functionality * Maven publication configuration * Fix problems detected plugin artifact * Complete project configuration * Include maven publish in gradle plugin subproject * Use v4 checkout action
1 parent dfcdb61 commit 1de8749

File tree

63 files changed

+1820
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1820
-0
lines changed

.github/PULL_REQUEST_TEMPLATE.md

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
### :tickets: Jira ticket
2+
[ANDROID-XXXX](https://jira.tid.es/browse/ANDROID-XXXX)
3+
4+
### :goal_net: What's the goal?
5+
_Provide a description of the overall goal. The description in the Jira ticket may help._
6+
7+
### :construction: How do we do it?
8+
_Provide a description of the implementation. A list of steps would be ideal._
9+
* _Step 1_
10+
* _Step 2_
11+
* _Step 3_
12+
13+
### :blue_book: Documentation changes?
14+
- [ ] No docs to update nor create
15+
16+
### :test_tube: How can I test this?
17+
_If it cannot be tested explain why._
18+
- [ ] 🖼️ Screenshots/Videos
19+
- [ ] ...
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
name: "Preintegration Checks"
2+
on:
3+
pull_request:
4+
jobs:
5+
tests:
6+
runs-on: [ self-hosted-org, linux ]
7+
container:
8+
image: docker://docker.tuenti.io/android/novum_android:8
9+
steps:
10+
- name: Checkout repo
11+
uses: actions/checkout@v4
12+
13+
- name: "Check Android Project"
14+
run: './gradlew clean check assemble'
15+
16+
- name: "Check Gradle Plugin Project"
17+
run: './gradlew -p include-build clean check jar'

.github/workflows/release.yml

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
name: "Create release"
2+
on:
3+
release:
4+
types: [published]
5+
jobs:
6+
release:
7+
runs-on: [ self-hosted-org, linux ]
8+
container:
9+
image: docker://docker.tuenti.io/android/novum_android:8
10+
steps:
11+
- name: Checkout repo
12+
uses: actions/checkout@v4
13+
14+
- name: Release library and plugin
15+
env:
16+
MOBILE_MAVENCENTRAL_USER: ${{ secrets.MOBILE_MAVENCENTRAL_USER }}
17+
MOBILE_MAVENCENTRAL_PASSWORD: ${{ secrets.MOBILE_MAVENCENTRAL_PASSWORD }}
18+
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEY }}
19+
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGPASSWORD }}
20+
ORG_GRADLE_PROJECT_signingKeyId: ${{ secrets.ORG_GRADLE_PROJECT_SIGNINGKEYID }}
21+
run: |
22+
./gradlew clean publishReleasePublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.release.tag_name }} --max-workers 1 closeAndReleaseStagingRepository
23+
./gradlew -p include-build clean publishGradlePluginPublicationToSonatypeRepository -DLIBRARY_VERSION=${{ github.event.release.tag_name }} --max-workers 1 closeAndReleaseStagingRepository

.gitignore

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
# Built application files
2+
*.apk
3+
*.aar
4+
*.ap_
5+
*.aab
6+
7+
# Files for the ART/Dalvik VM
8+
*.dex
9+
10+
# Java class files
11+
*.class
12+
13+
# Generated files
14+
bin/
15+
gen/
16+
out/
17+
# Uncomment the following line in case you need and you don't have the release build type files in your app
18+
# release/
19+
20+
# Gradle files
21+
.gradle/
22+
build/
23+
24+
# Local configuration file (sdk path, etc)
25+
local.properties
26+
27+
# Proguard folder generated by Eclipse
28+
proguard/
29+
30+
# Log Files
31+
*.log
32+
33+
# Android Studio Navigation editor temp files
34+
.navigation/
35+
36+
# Android Studio captures folder
37+
captures/
38+
39+
# IntelliJ
40+
.idea/*
41+
*.iml
42+
.idea/workspace.xml
43+
.idea/tasks.xml
44+
.idea/gradle.xml
45+
.idea/assetWizardSettings.xml
46+
.idea/dictionaries
47+
.idea/libraries
48+
# Android Studio 3 in .gitignore file.
49+
.idea/caches
50+
.idea/modules.xml
51+
# Comment next line if keeping position of elements in Navigation Editor is relevant for you
52+
.idea/navEditor.xml
53+
54+
# Keystore files
55+
# Uncomment the following lines if you do not want to check your keystore files in.
56+
#*.jks
57+
#*.keystore
58+
59+
# External native build folder generated in Android Studio 2.2 and later
60+
.externalNativeBuild
61+
.cxx/
62+
63+
# Google Services (e.g. APIs or Firebase)
64+
# google-services.json
65+
66+
# Freeline
67+
freeline.py
68+
freeline/
69+
freeline_project_description.json
70+
71+
# fastlane
72+
fastlane/report.xml
73+
fastlane/Preview.html
74+
fastlane/screenshots
75+
fastlane/test_output
76+
fastlane/readme.md
77+
78+
# Version control
79+
vcs.xml
80+
81+
# lint
82+
lint/intermediates/
83+
lint/generated/
84+
lint/outputs/
85+
lint/tmp/
86+
# lint/reports/
87+
88+
# Mac generated files
89+
.DS_Store

app/.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
/build

app/build.gradle.kts

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
plugins {
2+
alias(libs.plugins.android.application)
3+
alias(libs.plugins.kotlin)
4+
id("com.telefonica.loggerazzi")
5+
}
6+
7+
android {
8+
namespace = "com.telefonica.loggerazzi"
9+
compileSdk = libs.versions.compile.sdk.get().toInt()
10+
11+
defaultConfig {
12+
applicationId = "com.telefonica.loggerazzi"
13+
minSdk = libs.versions.min.sdk.get().toInt()
14+
targetSdk = libs.versions.target.sdk.get().toInt()
15+
versionCode = 1
16+
versionName = "1.0"
17+
18+
testInstrumentationRunner = "androidx.test.runner.AndroidJUnitRunner"
19+
}
20+
21+
buildTypes {
22+
release {
23+
isMinifyEnabled = false
24+
proguardFiles(
25+
getDefaultProguardFile("proguard-android-optimize.txt"),
26+
"proguard-rules.pro"
27+
)
28+
}
29+
}
30+
compileOptions {
31+
sourceCompatibility = JavaVersion.VERSION_17
32+
targetCompatibility = JavaVersion.VERSION_17
33+
}
34+
kotlinOptions {
35+
jvmTarget = "17"
36+
}
37+
}
38+
39+
dependencies {
40+
implementation(libs.core.ktx)
41+
implementation(libs.androidx.appcompat)
42+
implementation(libs.material)
43+
implementation(libs.androidx.constraintlayout)
44+
testImplementation(libs.junit)
45+
androidTestImplementation(libs.espresso.junit)
46+
androidTestImplementation(libs.espresso.core)
47+
androidTestImplementation(project(":loggerazzi"))
48+
}

app/proguard-rules.pro

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Add project specific ProGuard rules here.
2+
# You can control the set of applied configuration files using the
3+
# proguardFiles setting in build.gradle.
4+
#
5+
# For more details, see
6+
# http://developer.android.com/guide/developing/tools/proguard.html
7+
8+
# If your project uses WebView with JS, uncomment the following
9+
# and specify the fully qualified class name to the JavaScript interface
10+
# class:
11+
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
12+
# public *;
13+
#}
14+
15+
# Uncomment this to preserve the line number information for
16+
# debugging stack traces.
17+
#-keepattributes SourceFile,LineNumberTable
18+
19+
# If you keep the line number information, uncomment this to
20+
# hide the original source file name.
21+
#-renamesourcefileattribute SourceFile
Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
package com.telefonica.loggerazzi
2+
3+
import androidx.test.ext.junit.runners.AndroidJUnit4
4+
5+
import org.junit.Test
6+
import org.junit.runner.RunWith
7+
8+
import org.junit.Rule
9+
10+
/**
11+
* Instrumented test, which will execute on an Android device.
12+
*
13+
* See [testing documentation](http://d.android.com/tools/testing).
14+
*/
15+
@RunWith(AndroidJUnit4::class)
16+
class ExampleInstrumentedTest {
17+
18+
private val recorder = FakeTestRecorder()
19+
20+
@JvmField
21+
@Rule
22+
val loggerazziRule = LoggerazziRule(
23+
recorder = recorder
24+
)
25+
26+
@Test
27+
fun test1() {
28+
recorder.record("My log")
29+
recorder.record("My log 2")
30+
recorder.record("My log 3")
31+
}
32+
33+
@Test
34+
fun test2() {
35+
recorder.record("My second log")
36+
recorder.record("My second logs 2")
37+
recorder.record("My second log 3")
38+
}
39+
}
40+
41+
class FakeTestRecorder: LogsRecorder<String> {
42+
43+
private val logs = mutableListOf<String>()
44+
45+
fun record(log: String) {
46+
logs.add(log)
47+
}
48+
49+
override fun getRecordedLogs(): List<String> {
50+
return logs
51+
}
52+
53+
override fun clear() {
54+
logs.clear()
55+
}
56+
}

app/src/main/AndroidManifest.xml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
3+
xmlns:tools="http://schemas.android.com/tools">
4+
5+
<application
6+
android:allowBackup="true"
7+
android:dataExtractionRules="@xml/data_extraction_rules"
8+
android:fullBackupContent="@xml/backup_rules"
9+
android:icon="@mipmap/ic_launcher"
10+
android:label="@string/app_name"
11+
android:roundIcon="@mipmap/ic_launcher_round"
12+
android:supportsRtl="true"
13+
android:theme="@style/Theme.Loggerazzi"
14+
tools:targetApi="31">
15+
<activity
16+
android:name=".MainActivity"
17+
android:exported="true">
18+
<intent-filter>
19+
<action android:name="android.intent.action.MAIN" />
20+
21+
<category android:name="android.intent.category.LAUNCHER" />
22+
</intent-filter>
23+
</activity>
24+
</application>
25+
26+
</manifest>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
package com.telefonica.loggerazzi
2+
3+
import androidx.appcompat.app.AppCompatActivity
4+
import android.os.Bundle
5+
6+
class MainActivity : AppCompatActivity() {
7+
override fun onCreate(savedInstanceState: Bundle?) {
8+
super.onCreate(savedInstanceState)
9+
setContentView(R.layout.activity_main)
10+
}
11+
}

0 commit comments

Comments
 (0)