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

Aggregate licences to one file in multi module project #41

Open
RocketRider opened this issue Apr 6, 2018 · 9 comments
Open

Aggregate licences to one file in multi module project #41

RocketRider opened this issue Apr 6, 2018 · 9 comments

Comments

@RocketRider
Copy link

RocketRider commented Apr 6, 2018

I have an android project (with AGP 3.2.0) with a lot of library modules. I would like to have all dependencies in one file. Is this currently possible? I would like to apply the plugin to the root gradle file, so it can check all modules.

At the moment I will get one licence report per module.
For this I added the plugin in all modules.

@jaredsburrows
Copy link
Owner

Have you tried just applying this to the "app" module? You only need the license file for the end production app.

@RocketRider
Copy link
Author

Yes I tried that, but it only shows the direct dependencies of the app module not the dependencies of the other gradle modules.
I would like to have one licence file for the end production app.

@jaredsburrows
Copy link
Owner

jaredsburrows commented Apr 13, 2018 via email

@jaredsburrows
Copy link
Owner

jaredsburrows commented Apr 27, 2018

Any update on this? If you have implementation project(":sdk") in your build.gradle, it should work read into the projects dependencies.

What does your build.gradle look like?

@jaredsburrows
Copy link
Owner

Bump

@andreasgrill
Copy link

I have the same issue.
I have a project with two modules "app" and "persistence", "persistence" is a dependency for "app".
Dependencies from the persistence module are not included in the app/build/reports/licenses/licenseReleaseReport.json.

The build.gradle in my app module looks like this:

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.7.0'
        classpath "com.jaredsburrows:gradle-license-plugin:0.8.5"
    }
}

plugins {
    id 'pl.droidsonroids.pitest' version '0.0.9'
}

apply plugin: 'com.android.application'
apply plugin: 'com.vanniktech.android.junit.jacoco'
apply plugin: 'maven-publish'
apply plugin: "com.jaredsburrows.license"

publishing {
    // stuff
}

pitest {
    targetClasses = ['com.my-app.*']
    verbose true
    threads = 4
    outputFormats = ['XML', 'HTML']
}

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_1_8
        targetCompatibility JavaVersion.VERSION_1_8
    }

    signingConfigs {
        debug {
            storeFile file("../contrib/debug.keystore")
        }

        release {
            storeFile file("../contrib/release.keystore")
            storePassword 'foobar'
            keyAlias 'release_key'
            keyPassword 'foobar'
        }
    }

    buildTypes {
        debug {
            signingConfig signingConfigs.debug
        }
        release {
            signingConfig signingConfigs.release
            zipAlignEnabled true
            minifyEnabled false
            shrinkResources false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    defaultConfig {
        applicationId 'com.my-app'
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion

        versionCode project.ext.projectVersionCode
        versionName rootProject.version

        testInstrumentationRunner 'android.support.test.runner.AndroidJUnitRunner'

        multiDexEnabled true

        ext.versionString = project.hasProperty('versionString') ? project.getProperty('versionString') : rootProject.version

        resValue 'string', 'app_version', ext.versionString
    }

    testOptions {
        unitTests {
            includeAndroidResources = true
        }
    }

    lintOptions {
        disable 'ValidFragment'//, 'MissingTranslation'
        checkReleaseBuilds true
        abortOnError false
    }

    packagingOptions {
        exclude 'META-INF/LICENSE'
        exclude 'META-INF/DEPENDENCIES'
    }
    buildToolsVersion '26.0.2'
}

dependencies {
    implementation project(':persistence')

    implementation 'com.google.guava:guava:18.0'

    annotationProcessor 'com.jakewharton:butterknife-compiler:8.8.1'

    // other dependencies

    testImplementation 'junit:junit:4.12'

    androidTestImplementation 'com.android.support.test:runner:1.0.1'
}

The build.gradle in my persistence module looks like this:

buildscript {
    repositories {
        maven {
            url 'https://maven.google.com'
        }
    }
    dependencies {
        classpath 'com.vanniktech:gradle-android-junit-jacoco-plugin:0.7.0'
    }
}

plugins {
    id 'pl.droidsonroids.pitest' version '0.0.9'
}

apply plugin: 'com.android.library'
apply plugin: 'com.vanniktech.android.junit.jacoco'

pitest {
    targetClasses = ['com.my-app.*']
    verbose true
    threads = 4
    outputFormats = ['XML', 'HTML']
}

android {
    compileSdkVersion project.ext.compileSdkVersion
    buildToolsVersion project.ext.buildToolsVersion

    defaultConfig {
        minSdkVersion project.ext.minSdkVersion
        targetSdkVersion project.ext.targetSdkVersion
        versionCode project.ext.projectVersionCode
        versionName rootProject.version
    }
    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }
    buildToolsVersion '26.0.2'
}

dependencies {

    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'org.reflections:reflections:0.9.11'

    testImplementation 'junit:junit:4.12'
    testImplementation 'org.robolectric:robolectric:3.4.2'
    testImplementation 'org.mockito:mockito-core:2.8.47'
}

And here is my root build.gradle:

buildscript {

    repositories {
        maven {
            url 'https://maven.google.com'
        }
        jcenter()
    }
    dependencies {
        classpath 'com.android.tools.build:gradle:3.0.0'
    }
}

allprojects {
    repositories {
        google()
        jcenter()
        maven {
                url "http://my-app-maven.repo.blub"
        }
    }

    project.ext {
        compileSdkVersion = 26
        buildToolsVersion = '26.0.1'
        minSdkVersion = 17
        targetSdkVersion = 26

        projectVersionCode = 100
    }

    group 'com.my-app'
    version '1.0.0-SNAPSHOT'

}

task clean(type: Delete) {
    delete rootProject.buildDir
}

task npmInstall(type: Exec) {
    workingDir './'
    executable 'yarn'
    args 'install'
}

@mgursch
Copy link

mgursch commented Sep 19, 2019

i have nearly the same setup, but dependencies of other modules than :app are not visible in the generated html file

@jaredsburrows is there any chance to get an update on this?

@jimlyas
Copy link

jimlyas commented Jun 29, 2022

Any follow up on this?
cc @jaredsburrows

@jaredsburrows
Copy link
Owner

@jimlyas I accept PRs :)

How would this work? Aggregate all submodules into the root where gradlew licenseReport was ran? What if there is more than one 1 app in the Gradle project?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants