Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

RMET-2758 OSBarcodeLib-Android - Scan barcodes using zxing only #1

Merged
merged 31 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
545b317
feat: initial structure of OSBarcodeLib-Android
alexgerardojacinto Oct 31, 2023
8ab5985
feat: update SDKs, Gradle and Kotlin versions to match MABS 10
alexgerardojacinto Nov 2, 2023
2508b8a
feat: first version of ScanBarcode feature using zxing
alexgerardojacinto Nov 3, 2023
12b101b
feat: add permission request for the camera
alexgerardojacinto Nov 3, 2023
08efb6a
feat: add OSBARCError class for library errors
alexgerardojacinto Nov 6, 2023
8e9c7e5
refactor: include missing parameters in OSBARCScanParameters
alexgerardojacinto Nov 6, 2023
914b50c
feat: properly handle all possible results of scanning feature
alexgerardojacinto Nov 6, 2023
fcfe53d
refactor: multiple refactors
alexgerardojacinto Nov 6, 2023
874837d
refactor: remove unnecessary constants
alexgerardojacinto Nov 6, 2023
cf1c721
feat: setup Azure pipeline for library
alexgerardojacinto Nov 6, 2023
a7a0f22
fix: use java 17 instead of 11
alexgerardojacinto Nov 6, 2023
774694e
fix: remove unused activity
alexgerardojacinto Nov 6, 2023
c9b1242
refactor: remove unnecessary steps
alexgerardojacinto Nov 6, 2023
350488e
refactor: remove unnecessary resources
alexgerardojacinto Nov 6, 2023
b15c4ea
chore: raise lib version to 0.0.2
alexgerardojacinto Nov 6, 2023
228ce2e
fix: remove references to resources from AndroidManifest.xml
alexgerardojacinto Nov 6, 2023
4601e7e
chore: update changelog
alexgerardojacinto Nov 6, 2023
9874dc6
chore: raise lib version to 0.0.3
alexgerardojacinto Nov 6, 2023
3013f56
chore: raise java-version to use 17 instead of 11.
alexgerardojacinto Nov 6, 2023
73e9d22
chore: set sonar.projectKey
alexgerardojacinto Nov 6, 2023
0726e83
refactor: include TODO comment
alexgerardojacinto Nov 6, 2023
318cfff
refactor: remove unnecessary fields from AndroidManifest.xml
alexgerardojacinto Nov 6, 2023
b7415d7
misc: comment lines to generate new lib version on Azure
alexgerardojacinto Nov 6, 2023
15ba9b0
refactor: change from TODO to actual comment
alexgerardojacinto Nov 6, 2023
9948474
Finish initialisation by running the generator script.
alexgerardojacinto Nov 6, 2023
afa9a8f
chore: remove unnecessary test file
alexgerardojacinto Nov 6, 2023
7437aa8
misc: remove comments
alexgerardojacinto Nov 6, 2023
4724ab6
chore: update action versions for GitHub action YAML
alexgerardojacinto Nov 6, 2023
9e5f4bd
chore: set files to be excluded from test coverage and code duplication
alexgerardojacinto Nov 6, 2023
a34fd17
chore: include missing file in excluded files list
alexgerardojacinto Nov 6, 2023
3bd7a41
chore: include missing file in excluded files list
alexgerardojacinto Nov 6, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/github_actions.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,13 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Setup Java
uses: actions/setup-java@v3
with:
distribution: 'zulu'
java-version: '11'
java-version: '17'

- name: Bundle Install
run: bundle install
Expand All @@ -32,7 +32,7 @@ jobs:
run: bundle exec fastlane coverage

- name: Setup sonarqube
uses: warchant/setup-sonar-scanner@v3
uses: warchant/setup-sonar-scanner@v7

- name: Send to Sonarcloud
run: bundle exec fastlane sonarqube
Expand Down
12 changes: 12 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

The changes documented here do not include those from the original repository.

## [Unreleased]

### 06-11-2023
Android - First implementation of the scan barcode feature using zxing (https://outsystemsrd.atlassian.net/browse/RMET-2758)
60 changes: 60 additions & 0 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Android
# Build your Android project with Gradle.
# Add steps that test, sign, and distribute the APK, save build artifacts, and more:
# https://docs.microsoft.com/azure/devops/pipelines/languages/android

parameters:
- name: publishBuild
displayName: Publish new build?
type: boolean
default: false

trigger:
- main

pool:
vmImage: ubuntu-latest

steps:
- task: SonarCloudPrepare@1
inputs:
SonarCloud: 'SonarCloud'
organization: 'outsystemsrd'
scannerMode: 'CLI'
configMode: 'file'
- task: Gradle@2
displayName: Build Project
inputs:
workingDirectory: ''
gradleWrapperFile: 'gradlew'
gradleOptions: '-Xmx4096M'
javaHomeOption: 'JDKVersion'
jdkVersionOption: '1.17'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/TEST-*.xml'
tasks: 'clean build'
- task: CmdLine@2
displayName: Validate pom.xml
inputs:
script: |
/usr/bin/mvn -version
/usr/bin/mvn -f /home/vsts/work/1/s/pom.xml help:effective-pom
- task: MavenAuthenticate@0
displayName: Authenticate in public repo
condition: or(${{parameters.publishBuild}}, eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
artifactsFeeds: 'PublicArtifactRepository'
- task: Bash@3
displayName: Deploy file
condition: or(${{parameters.publishBuild}}, eq(variables['Build.SourceBranch'], 'refs/heads/main'))
inputs:
targetType: 'inline'
script: |
/usr/bin/mvn deploy:deploy-file \
-DpomFile=/home/vsts/work/1/s/pom.xml \
-DgeneratePom=true \
-Dfile=build/outputs/aar/OSBarcodeLib-release.aar \
-Dpackaging=aar \
-DrepositoryId=PublicArtifactRepository \
-Durl=https://pkgs.dev.azure.com/OutSystemsRD/9e79bc5b-69b2-4476-9ca5-d67594972a52/_packaging/PublicArtifactRepository/maven/v1
47 changes: 41 additions & 6 deletions build.gradle
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
buildscript {
ext.kotlin_version = "1.5.21"
ext.kotlin_version = "1.9.10"
ext.jacocoVersion = '0.8.7'
repositories {
google()
mavenCentral()
}
dependencies {
classpath 'com.android.tools.build:gradle:7.1.2'
classpath 'com.android.tools.build:gradle:8.1.1'
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
classpath "org.jacoco:org.jacoco.core:$jacocoVersion"
}
Expand All @@ -17,11 +17,13 @@ apply plugin: "kotlin-android"
apply plugin: "jacoco"

android {
compileSdk 32

namespace "com.outsystems.plugins.barcode"
compileSdk 34

defaultConfig {
minSdk 26
targetSdk 32
targetSdk 34
versionCode 1
versionName "1.0"

Expand All @@ -45,8 +47,8 @@ android {
task jacocoTestReport(type: JacocoReport, dependsOn: ['testDebugUnitTest']) {

reports {
xml.enabled = true
html.enabled = true
//xml.enabled = true
//html.enabled = true
}

def fileFilter = ['**/BuildConfig.*', '**/Manifest*.*']
Expand All @@ -60,6 +62,17 @@ android {
"outputs/code-coverage/connected/*coverage.ec"
]))
}
buildFeatures {
compose true
}
composeOptions {
kotlinCompilerExtensionVersion '1.5.3'
}
packaging {
resources {
excludes += '/META-INF/{AL2.0,LGPL2.1}'
}
}
}

repositories {
Expand All @@ -73,7 +86,29 @@ dependencies {
implementation 'androidx.appcompat:appcompat:1.4.1'
implementation 'com.google.android.material:material:1.5.0'
implementation 'androidx.constraintlayout:constraintlayout:2.1.3'
implementation 'androidx.lifecycle:lifecycle-runtime-ktx:2.6.2'
implementation platform('androidx.compose:compose-bom:2023.03.00')
implementation 'androidx.compose.ui:ui'
implementation 'androidx.compose.ui:ui-graphics'
implementation 'androidx.compose.ui:ui-tooling-preview'
implementation 'androidx.compose.material3:material3'
implementation platform('androidx.compose:compose-bom:2023.03.00')
implementation platform('androidx.compose:compose-bom:2023.03.00')
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'

implementation "androidx.activity:activity-compose:1.8.0"
implementation "androidx.camera:camera-camera2:1.3.0"
implementation 'androidx.camera:camera-lifecycle:1.3.0'
implementation 'androidx.camera:camera-view:1.3.0'
implementation 'com.google.zxing:core:3.4.1'
androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00')
androidTestImplementation 'androidx.compose.ui:ui-test-junit4'
androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00')
androidTestImplementation platform('androidx.compose:compose-bom:2023.03.00')
debugImplementation 'androidx.compose.ui:ui-tooling'
debugImplementation 'androidx.compose.ui:ui-test-manifest'


}
2 changes: 1 addition & 1 deletion fastlane/Appfile
Original file line number Diff line number Diff line change
@@ -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.barcode.osbarcodelib") # e.g. com.krausefx.app
2 changes: 1 addition & 1 deletion gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#Fri Apr 08 08:58:08 WEST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.2-bin.zip
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
11 changes: 11 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?xml version="1.0" encoding="iso-8859-1"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
http://maven.apache.org/maven-v4_0_0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>com.github.outsystems</groupId>
<artifactId>osbarcode-android</artifactId>
<version>0.0.4</version>
</project>
57 changes: 0 additions & 57 deletions scripts/generator_script.sh

This file was deleted.

2 changes: 1 addition & 1 deletion settings.gradle
Original file line number Diff line number Diff line change
@@ -1 +1 @@
rootProject.name = "LibTemplatePlaceholder"
rootProject.name = "OSBarcodeLib"
10 changes: 8 additions & 2 deletions sonar-project.properties
Original file line number Diff line number Diff line change
@@ -1,10 +1,16 @@
# 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_OSBarcodeLib-Android
sonar.host.url=https://sonarcloud.io

sonar.language=kotlin

# Defining path to coverage file
sonar.coverage.jacoco.xmlReportPaths=**/jacocoTestReport/jacocoTestReport.xml
sonar.junit.reportPaths=**/test-results/**/*.xml
sonar.junit.reportPaths=**/test-results/**/*.xml

# Removing tests, mocks and code not testable by unit tests from the coverage estimation
sonar.coverage.exclusions=**/*Tests.kt,**/*Mock.kt,**/model/*.kt,**/controller/*.kt,**/view/*.kt,**/*Theme.kt,**/ui.theme/*.kt

# Removing tests from code duplication checks
sonar.cpd.exclusions=**/*Tests.kt

This file was deleted.

23 changes: 5 additions & 18 deletions src/main/AndroidManifest.xml
Original file line number Diff line number Diff line change
@@ -1,23 +1,10 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
package="organizationidplaceholder.libtemplateplaceholder">

<application
android:allowBackup="true"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.LibTemplatePlaceholder">
package="com.outsystems.plugins.barcode">
<uses-permission android:name="android.permission.CAMERA" />
<application>
<activity
android:name=".MainActivity"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />

<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
android:name=".view.OSBARCScannerActivity"
android:exported="false" />
</application>

</manifest>

This file was deleted.

Loading