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

EcoCode Android 1.1.0 giving error while executing CodeNarc #81

Open
TulasiPerigisetti7 opened this issue Nov 30, 2023 · 6 comments
Open
Assignees
Labels
💉 bug Something isn't working

Comments

@TulasiPerigisetti7
Copy link

TulasiPerigisetti7 commented Nov 30, 2023

Describe the bug
A clear and concise description of what the bug is.

To Reproduce
Steps to reproduce the behavior:

  1. Installed ecocode Android 1.1.0 on SonarQube 9.9LTS and made quality profile default
  2. Executed sonar scan on a sample android project
  3. See error
    Sonar Scan is failing with below error:

$ sonar-scanner -Dsonar.host.url=<> -Dsonar.login=<> -Dsonar.projectKey=TF01-Android
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/TF01/demoprod/TF01-Android/sonar-project.properties
INFO: SonarScanner 4.6.2.2472
INFO: Java 11.0.11 AdoptOpenJDK (64-bit)
INFO: Linux 3.10.0-1160.88.1.el7.x86_64 amd64
INFO: User cache: /root/.sonar/cache
INFO: Scanner configuration file: /opt/sonar-scanner/conf/sonar-scanner.properties
INFO: Project root configuration file: /builds/TF01/demoprod/TF01-Android/sonar-project.properties
INFO: Analyzing on SonarQube server 9.9.2.77730
INFO: Default locale: "en_US", source code encoding: "UTF-8"
INFO: Load global settings
INFO: Load global settings (done) | time=301ms
INFO: Server id: 924C346B-19d5d4f656ea30f
INFO: User cache: /root/.sonar/cache
INFO: Load/download plugins
INFO: Load plugins index
INFO: Load plugins index (done) | time=144ms
INFO: Load/download plugins (done) | time=5917ms
INFO: Loaded core extensions: developer-scanner
INFO: Process project properties
INFO: Process project properties (done) | time=25ms
INFO: Execute project builders
INFO: Execute project builders (done) | time=5ms
INFO: Project key: TF01-Android
INFO: Base dir: /builds/TF01/demoprod/TF01-Android
INFO: Working dir: /builds/TF01/demoprod/TF01-Android/.scannerwork
INFO: Load project settings for component key: 'TF01-Android'
INFO: Load project settings for component key: 'TF01-Android' (done) | time=70ms
INFO: Load project branches
INFO: Load project branches (done) | time=58ms
INFO: Load branch configuration
INFO: Detected branch/PR in 'GitLab'
INFO: Auto-configuring branch 'ecoCode-Test'
INFO: Load branch configuration (done) | time=7ms
INFO: Auto-configuring with CI 'Gitlab CI'
INFO: Load quality profiles
INFO: Load quality profiles (done) | time=117ms
INFO: Load active rules
INFO: Load active rules (done) | time=3340ms
INFO: Load analysis cache
INFO: Load analysis cache (404) | time=33ms
INFO: Branch name: ecoCode-Test
INFO: Load project repositories
INFO: Load project repositories (done) | time=61ms
INFO: Indexing files...
INFO: Project configuration:
INFO: Excluded sources: **.html, **.json, /assets/, **.java
INFO: 65 files indexed
INFO: 18 files ignored because of inclusion/exclusion patterns
INFO: Quality profile for grvy: ecoCode (Android)
INFO: Quality profile for xml: ecoCode (Android)
INFO: Quality profile for yaml: Sonar way
INFO: ------------- Run sensors on module TF01-Android
INFO: Load metrics repository
INFO: Load metrics repository (done) | time=52ms
INFO: Sensor EcoCodeXmlSensor [ecocodeandroid]
INFO: 26 source files to be analyzed
INFO: 26/26 source files have been analyzed
INFO: Sensor EcoCodeXmlSensor [ecocodeandroid] (done) | time=1189ms
INFO: Sensor GroovySensor [ecocodeandroid]
WARNING: An illegal reflective access operation has occurred
WARNING: Illegal reflective access by org.codehaus.groovy.reflection.CachedClass (file:/root/.sonar/cache/5a2b2e9a3e4dbe5816489e61e8c01a42/sonar-ecocodeandroid-plugin.jar) to method java.lang.Object.finalize()
WARNING: Please consider reporting this to the maintainers of org.codehaus.groovy.reflection.CachedClass
WARNING: Use --illegal-access=warn to enable warnings of further illegal reflective access operations
WARNING: All illegal access operations will be denied in a future release
INFO: GMetrics completed: 1125ms
INFO: Sensor GroovySensor [ecocodeandroid] (done) | time=1982ms
INFO: Sensor CodeNarc [ecocodeandroid]
INFO: Executing CodeNarc
INFO: Loaded properties file in 73ms; 397 rules
INFO: Loading ruleset from [file:/builds/TF01/demoprod/TF01-Android/.scannerwork/codenarc/profile.xml]
INFO: RuleSet configuration properties file [codenarc.properties] not found.
ERROR: Error from [org.codenarc.rule.ecocode.EC5001] processing source file [null]
org.codehaus.groovy.runtime.typehandling.GroovyCastException: Cannot cast object 'org.codehaus.groovy.ast.expr.GStringExpression@5c7712f0[strings: [ConstantExpression[copyDependencies], ConstantExpression[]] values: [org.codehaus.groovy.ast.expr.MethodCallExpression@6ed836b3[object: org.codehaus.groovy.ast.expr.PropertyExpression@38849a1[object: org.codehaus.groovy.ast.expr.VariableExpression@769fbb26[variable: variant] property: ConstantExpression[name]] method: ConstantExpression[capitalize] arguments: org.codehaus.groovy.ast.expr.ArgumentListExpression@129bc797[]]]]' with class 'org.codehaus.groovy.ast.expr.GStringExpression' to class 'org.codehaus.groovy.ast.expr.ConstantExpression'
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnSAM(DefaultTypeTransformation.java:418)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.continueCastOnNumber(DefaultTypeTransformation.java:332)
at org.codehaus.groovy.runtime.typehandling.DefaultTypeTransformation.castToType(DefaultTypeTransformation.java:245)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.castToType(ScriptBytecodeAdapter.java:616)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:43)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:326)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:231)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:336)
at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:76)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:184)
at org.codenarc.rule.ecocode.EC5001AstVisitor.super$2$visitMethodCallExpression(EC5001.groovy)
at jdk.internal.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:56)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitClosureExpression(CodeVisitorSupport.java:227)
at org.codehaus.groovy.ast.expr.ClosureExpression.visit(ClosureExpression.java:49)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitListOfExpressions(CodeVisitorSupport.java:326)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitTupleExpression(CodeVisitorSupport.java:231)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitArgumentlistExpression(CodeVisitorSupport.java:336)
at org.codehaus.groovy.ast.expr.ArgumentListExpression.visit(ArgumentListExpression.java:76)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitMethodCallExpression(CodeVisitorSupport.java:184)
at org.codenarc.rule.ecocode.EC5001AstVisitor.super$2$visitMethodCallExpression(EC5001.groovy)
at jdk.internal.reflect.GeneratedMethodAccessor43.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1225)
at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethodOnSuperN(ScriptBytecodeAdapter.java:145)
at org.codenarc.rule.ecocode.EC5001AstVisitor.visitMethodCallExpression(EC5001.groovy:56)
at org.codehaus.groovy.ast.expr.MethodCallExpression.visit(MethodCallExpression.java:70)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitExpressionStatement(CodeVisitorSupport.java:122)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitExpressionStatement(ClassCodeVisitorSupport.java:196)
at org.codehaus.groovy.ast.stmt.ExpressionStatement.visit(ExpressionStatement.java:42)
at org.codehaus.groovy.ast.CodeVisitorSupport.visitBlockStatement(CodeVisitorSupport.java:88)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitBlockStatement(ClassCodeVisitorSupport.java:166)
at org.codehaus.groovy.ast.stmt.BlockStatement.visit(BlockStatement.java:71)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClassCodeContainer(ClassCodeVisitorSupport.java:104)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitConstructorOrMethod(ClassCodeVisitorSupport.java:115)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitMethod(ClassCodeVisitorSupport.java:126)
at org.codenarc.rule.AbstractAstVisitor.visitMethod(AbstractAstVisitor.java:155)
at org.codehaus.groovy.ast.ClassNode.visitContents(ClassNode.java:1081)
at org.codehaus.groovy.ast.ClassCodeVisitorSupport.visitClass(ClassCodeVisitorSupport.java:53)
at org.codenarc.rule.AbstractAstVisitor.visitClass(AbstractAstVisitor.java:132)
at org.codenarc.rule.AbstractAstVisitorRule.applyTo(AbstractAstVisitorRule.java:97)
at org.codenarc.rule.AbstractRule.applyTo(AbstractRule.java:143)
at org.codenarc.rule.Rule$applyTo.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codenarc.rule.Rule$applyTo.call(Unknown Source)
at org.codenarc.analyzer.AbstractSourceAnalyzer$_collectViolations_closure3.doCall(AbstractSourceAnalyzer.groovy:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.reflection.CachedMethod.invoke(CachedMethod.java:98)
at groovy.lang.MetaMethod.doMethodInvoke(MetaMethod.java:325)
at org.codehaus.groovy.runtime.metaclass.ClosureMetaClass.invokeMethod(ClosureMetaClass.java:264)
at groovy.lang.MetaClassImpl.invokeMethod(MetaClassImpl.java:1034)
at org.codehaus.groovy.runtime.callsite.PogoMetaClassSite.call(PogoMetaClassSite.java:41)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at org.codenarc.analyzer.AbstractSourceAnalyzer.measureRuleProcessingTime(AbstractSourceAnalyzer.groovy:58)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite$PogoCachedMethodSiteNoUnwrapNoCoerce.invoke(PogoMetaMethodSite.java:210)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:59)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCallCurrent(CallSiteArray.java:51)
at org.codehaus.groovy.runtime.callsite.PogoMetaMethodSite.callCurrent(PogoMetaMethodSite.java:64)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.callCurrent(AbstractCallSite.java:177)
at org.codenarc.analyzer.AbstractSourceAnalyzer.collectViolations(AbstractSourceAnalyzer.groovy:44)
at org.sonar.plugins.groovy.codenarc.CodeNarcSourceAnalyzer.processFiles(CodeNarcSourceAnalyzer.java:61)
at org.sonar.plugins.groovy.codenarc.CodeNarcSourceAnalyzer.analyze(CodeNarcSourceAnalyzer.java:51)
at org.codenarc.analyzer.SourceAnalyzer$analyze.call(Unknown Source)
at org.codehaus.groovy.runtime.callsite.CallSiteArray.defaultCall(CallSiteArray.java:47)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:116)
at org.codehaus.groovy.runtime.callsite.AbstractCallSite.call(AbstractCallSite.java:128)
at org.codenarc.CodeNarcRunner.execute(CodeNarcRunner.groovy:92)
at org.sonar.plugins.groovy.codenarc.CodeNarcSensor.runCodeNarc(CodeNarcSensor.java:168)
at org.sonar.plugins.groovy.codenarc.CodeNarcSensor.execute(CodeNarcSensor.java:102)
at org.sonar.scanner.sensor.AbstractSensorWrapper.analyse(AbstractSensorWrapper.java:64)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:88)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.lambda$execute$1(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.withModuleStrategy(ModuleSensorsExecutor.java:79)
at org.sonar.scanner.sensor.ModuleSensorsExecutor.execute(ModuleSensorsExecutor.java:61)
at org.sonar.scanner.scan.SpringModuleScanContainer.doAfterStart(SpringModuleScanContainer.java:82)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.scan.SpringProjectScanContainer.scan(SpringProjectScanContainer.java:403)
at org.sonar.scanner.scan.SpringProjectScanContainer.scanRecursively(SpringProjectScanContainer.java:399)
at org.sonar.scanner.scan.SpringProjectScanContainer.doAfterStart(SpringProjectScanContainer.java:368)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.scanner.bootstrap.SpringGlobalContainer.doAfterStart(SpringGlobalContainer.java:137)
at org.sonar.core.platform.SpringComponentContainer.startComponents(SpringComponentContainer.java:188)
at org.sonar.core.platform.SpringComponentContainer.execute(SpringComponentContainer.java:167)
at org.sonar.batch.bootstrapper.Batch.doExecute(Batch.java:72)
at org.sonar.batch.bootstrapper.Batch.execute(Batch.java:66)
at org.sonarsource.scanner.api.internal.batch.BatchIsolatedLauncher.execute(BatchIsolatedLauncher.java:46)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.base/java.lang.reflect.Method.invoke(Unknown Source)
at org.sonarsource.scanner.api.internal.IsolatedLauncherProxy.invoke(IsolatedLauncherProxy.java:60)
at com.sun.proxy.$Proxy0.execute(Unknown Source)
at org.sonarsource.scanner.api.EmbeddedScanner.doExecute(EmbeddedScanner.java:189)
at org.sonarsource.scanner.api.EmbeddedScanner.execute(EmbeddedScanner.java:138)
at org.sonarsource.scanner.cli.Main.execute(Main.java:112)
at org.sonarsource.scanner.cli.Main.execute(Main.java:75)
at org.sonarsource.scanner.cli.Main.main(Main.java:61)
INFO: ------------------------------------------------------------------------
INFO: EXECUTION FAILURE
INFO: ------------------------------------------------------------------------
INFO: Total time: 28.762s
INFO: Final Memory: 58M/200M
INFO: ------------------------------------------------------------------------
ERROR: Error during SonarScanner execution

Expected behavior
A clear and concise description of what you expected to happen.

Screenshots
If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

  • OS: [e.g. iOS]
  • Browser [e.g. chrome, safari]
  • Version [e.g. 22]

Smartphone (please complete the following information):

  • Device: [e.g. iPhone6]
  • OS: [e.g. iOS8.1]
  • Browser [e.g. stock browser, safari]
  • Version [e.g. 22]

Additional context
Add any other context about the problem here.

@TulasiPerigisetti7 TulasiPerigisetti7 changed the title EcoCode Android 1.1.0 giving error EcoCode Android 1.1.0 giving error while executing CodeNarc Nov 30, 2023
@olegoaer olegoaer added the 💉 bug Something isn't working label Nov 30, 2023
@jhertout
Copy link
Contributor

jhertout commented Dec 1, 2023

Hello, thanks for your return.

Unfortunately I am not able to reproduce your bug. Can you please give us some additional information:

  • the sample project you use (or at least the build.gradle files of the project)
  • the "systemProp.sonar" you use in the gradle.properties (or the sonarqube task parameter you use) if not only host.url, projectKey, projectName, login
  • the sonarqube task configuration in your build.gradle

Thanks,

Julien Hertout
ecoCode Core Team

@TulasiPerigisetti7
Copy link
Author

Hi ,
gradle.properties file is:

android.enableJetifier=true
android.useAndroidX=true
org.gradle.jvmargs=-XX:MaxPermSize=512m

systemProp.sonar.host.url=<<..>>
systemProp.sonar.login=<<..>>
systemProp.sonar.projectKey=TF01-Android
systemProp.sonar.projectName=TF01-Android

build.gradle is:

apply plugin: 'com.android.application'
apply plugin: "org.sonarqube"
// apply plugin: 'maven'
apply plugin: 'net.researchgate.release'
apply plugin: 'com.google.firebase.crashlytics'
apply from: './copyDependencies.gradle'

/*
repositories {
    maven { url 'https://maven.fabric.io/public' }
}*/
apply plugin: 'maven-publish'

def VERSION_EB = ebVersion.toString()
def VERSION_HB = hbVersion.toString()
def VERSION_KN = knVersion.toString()

def ARTIFACT_ID_UNSIGNED = sonatypeArtefactIDUnsigned.toString()

def APP_NAME_EB = ebAppName.toString() + VERSION_EB
def APP_NAME_HB = hbAppName.toString() + VERSION_HB
def APP_NAME_KN = knAppName.toString() + VERSION_KN

def VERSION_CODE_EB = ebVersionCode.toInteger()
def VERSION_CODE_HB = hbVersionCode.toInteger()
def VERSION_CODE_KN = knVersionCode.toInteger()

def BUILD_TYPE = project.hasProperty('buildType') ? buildType : 'QA'

android {
    
    compileSdkVersion 31

    defaultConfig {
        minSdkVersion 17
        targetSdkVersion 31
        resValue "string", "buildType", BUILD_TYPE
        
        applicationId "com.bnppf.tf01_android"
        /*
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["resourcePackageName": android.defaultConfig.applicationId]
            }
        }
        */
        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ['resourcePackageName': android.defaultConfig.applicationId, "androidManifestFile": "$projectDir/src/main/AndroidManifest.xml".toString()]
            }
        }    
    }
    
    lintOptions {
          abortOnError false
    }

    println("Build Type(Environment)\t:"+BUILD_TYPE)

    flavorDimensions "brandDimension"
    productFlavors {

        fortis {
            dimension "brandDimension"
            applicationId "com.bnppf.tf01_android"
            versionName VERSION_EB
            versionCode VERSION_CODE_EB
            ext.betaDistributionGroupAliases = System.getenv("CRASHLYTICS_KN_GROUP") ?System.getenv("CRASHLYTICS_KN_GROUP"): ""
        }
        fintro {
            dimension "brandDimension"
            applicationId "com.bnppf.tf01_android_fintro"
            versionName VERSION_KN
            versionCode VERSION_CODE_KN
        }
        hello {
            dimension "brandDimension"
            applicationId "com.bnppf.tf01_android_hello"
            versionName VERSION_HB
            versionCode VERSION_CODE_HB
        }

    }

    buildTypes {
        debug{
            buildConfigField "String", "BASE_URL", '""'
            ext.enableCrashlytics = false

            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    if (outputFileName.contains('app-fortis-debug')) {
                        outputFileName = APP_NAME_EB+".apk"
                    }
                    if (outputFileName.contains('app-fintro-debug')) {
                        outputFileName = APP_NAME_KN+".apk"
                    }
                    if (outputFileName.contains('app-hello-debug')) {
                        outputFileName = APP_NAME_HB+".apk"
                    }
                }
            }
        }
        release {
            // minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
            applicationVariants.all { variant ->
                variant.outputs.all { output ->
                    if (outputFileName.contains('app-fortis-release')) {
                        outputFileName = APP_NAME_EB+".apk"
                    }
                    if (outputFileName.contains('app-fintro-release')) {
                        outputFileName = APP_NAME_KN+".apk"
                    }
                    if (outputFileName.contains('app-hello-release')) {
                        outputFileName = APP_NAME_HB+".apk"
                    }
                }
            }
        }
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/NOTICE'
        exclude 'META-INF/notice.txt'
        exclude 'META-INF/license.txt'
    }
    
}

def AAVersion = '4.6.0'

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])
    implementation 'androidx.appcompat:appcompat:1.0.0'
    // To test Policy Action of Nexus IQ
//    implementation 'com.squareup.okhttp3:okhttp:4.9.1'
    
    implementation 'androidx.appcompat:appcompat:1.0.0'
    
    testImplementation('io.appium:java-client:3.3.0')
    // Required -- JUnit 4 framework
    testImplementation 'junit:junit:4.12'
    // Optional -- Mockito framework
    testImplementation 'org.mockito:mockito-core:1.10.19'

    implementation group: 'com.bnppf.adm.tf01-android.modules', name: 'module-interest-rates', version: '5.0.6', ext: 'aar'
    implementation group: 'com.bnppf.adm.tf01-android.modules', name: 'module-loan-eligibility', version: '5.0.6', ext: 'aar'

    annotationProcessor "org.androidannotations:androidannotations:${AAVersion}"
    implementation "org.androidannotations:androidannotations-api:${AAVersion}"
    annotationProcessor "org.androidannotations:rest-spring:${AAVersion}"
    implementation "org.androidannotations:rest-spring-api:${AAVersion}"

    implementation 'org.springframework.android:spring-android-rest-template:1.0.1.RELEASE'

    implementation 'com.fasterxml.jackson.core:jackson-databind:2.10.+'
    implementation 'com.fasterxml.jackson.core:jackson-core:2.10.+'
    implementation 'com.fasterxml.jackson.core:jackson-annotations:2.10.+' 
    implementation 'com.google.firebase:firebase-crashlytics:18.2.9'
    /*
        implementation('com.crashlytics.sdk.android:crashlytics:2.8.0@aar') {
        transitive = true;
    }*/
    

}
sonarqube {
    properties {
        property "sonar.sources", "."
    }
}

group = sonatypeGroupID

task customZip(type: Zip) {
    from fileTree('build/outputs/apk/').include('**/**/*.apk').files
    destinationDir file('build/distributions/') // directory that you want your archive to be placed in
    baseName = ARTIFACT_ID_UNSIGNED
}

artifacts {
    archives customZip
}


def svnUser=SVNUser
def svnPwd=SVNPwd
release {
    failOnCommitNeeded = false
    failOnPublishNeeded = true
    failOnSnapshotDependencies = false
    failOnUnversionedFiles = false
    failOnUpdateNeeded = true
    revertOnFail = true
    preCommitText = ''
    preTagCommitMessage = '[Gradle Release Plugin] - pre tag commit: '
    tagCommitMessage = '[Gradle Release Plugin] - creating tag: '
    newVersionCommitMessage = '[Gradle Release Plugin] - new version commit: '
    tagTemplate = '$version'
    versionPropertyFile = 'gradle.properties'
    versionProperties = []
    buildTasks = ['customZip']
    scmAdapters = [
            net.researchgate.release.GitAdapter,
            net.researchgate.release.SvnAdapter
    ]
    git {
        requireBranch = ''
    }

    svn {
        username = project.SVNUser
        password = project.SVNPwd

    }
}

publishing {
    publications {
        release(MavenPublication) {
            artifactId 'TF01-Android-Unsigned'
            artifact customZip
        }
    }
    repositories {
        maven {
            // change to point to your repo, e.g. http://my.org/repo
            url project.hasProperty('repoUrl') ? repoUrl : sonatypeRepo
            credentials {
                username = sonatypeUsername
                password = sonatypePassword
            }
        }
    }
}

Aslo I dont see ekko (polar Bear) in sonarqube after scanning. Please help.

Thanks & Regards
Tulasi Perigisetti

@jhertout
Copy link
Contributor

jhertout commented Dec 4, 2023

HI,

I tested a project with your app/build.gradle file but the file is a little more complex that what I was expected. Can you please give me your root repo build.gradle file? It will be easier for me.

For Ekko, I am working on it too. It was not really designed to be in the "official" plugin version in the marketplace as we did not know if SonarSource will accept it and so it was not very well integrated (sorry about that). We know that some navigator or some network configuration blocks it as it is on a separate URL. Now that we know that it is ok, we will clean its integration for the next release.

Thanks
Julien

@TulasiPerigisetti7
Copy link
Author

Hello @jhertout
Below is the root repo build.gradle:

buildscript {
	repositories {
		String name = System.getenv("nexusUsername") ?: nexusUsername
		String pwd = System.getenv("nexusPassword") ?: nexusPassword

		if (Boolean.valueOf(System.getenv("isAtBnp")) || Boolean.valueOf(isAtBnp)) {
			System.setProperty("javax.net.ssl.trustStore", "keystore.jks")
			System.setProperty("javax.net.ssl.trustStorePassword", "changeit")
			logger.log(LogLevel.WARN, "SSL trust store set. You're building within the bank network")

			if (name.equals("PLACEHOLDER") || pwd.equals("PLACEHOLDER")) {
				throw new IllegalArgumentException("Please set nexusUsername and nexusPassword in your ~/.gradle/gradle.properties")
			}
		} else {
			logger.log(LogLevel.WARN, "SSL trust store not set. You're not building within the bank network")
		}

		maven {
			url "<<Maven public repo url>>"
			credentials {
				username name
				password pwd
			}
		}
		maven {
			url "<<Maven repo url>>"
			credentials {
				username name
				password pwd
			}
		}
		dependencies {
			classpath 'com.android.tools.build:gradle:7.4'
		//	classpath 'com.android.tools.build:gradle:3.4.1'
			classpath 'net.researchgate:gradle-release:2.6.0'
			//classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:2.6.2"
			classpath 'com.neenbedankt.gradle.plugins:android-apt:1.4'
		//	classpath 'com.google.firebase:firebase-crashlytics-gradle:2.1.0'
			classpath 'com.google.firebase:firebase-crashlytics-gradle:2.8.1'
		//	classpath "org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:4.4.1.3373"
			classpath 'org.sonarsource.scanner.gradle:sonarqube-gradle-plugin:3.3'
		}
	}
}
apply(plugin = "org.sonarqube")

Thanks & Regards
Tulasi Perigisetti

@TulasiPerigisetti7
Copy link
Author

Hello @jhertout
Can you please let me know if we have any update on this issue.

Thanks & Regards
Tulasi Perigisetti

@jhertout
Copy link
Contributor

jhertout commented Jan 5, 2024

Hello,

I did not have time to work on the project at the end of the year. I began to work on the project today. I am trying to reproduce your problem but without success even with the files you gave to me. However I had to slightly modify them to have my project build and I did not consider the SonarQube version, sonar scanner etc... in my tests. I will follow my investigation since I have time next week.

Hope this will be successful.

A question just to be sure, do you have other gradle / groovy files in your project?

Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
💉 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants