gradle-license-plugin icon indicating copy to clipboard operation
gradle-license-plugin copied to clipboard

Aggregate licences to one file in multi module project

Open RocketRider opened this issue 6 years ago • 9 comments

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.

RocketRider avatar Apr 06 '18 08:04 RocketRider

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

jaredsburrows avatar Apr 11 '18 22:04 jaredsburrows

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.

RocketRider avatar Apr 13 '18 05:04 RocketRider

I have a few tests with modules. Can you great a test project on GitHub so I can work on it?

On Thu, Apr 12, 2018, 10:57 PM Michael Möbius [email protected] wrote:

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.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/jaredsburrows/gradle-license-plugin/issues/41#issuecomment-381031968, or mute the thread https://github.com/notifications/unsubscribe-auth/ABqMSPvWT2TrSbpV--6RNBmoSLSZtnbIks5toD43gaJpZM4TJsTb .

jaredsburrows avatar Apr 13 '18 13:04 jaredsburrows

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 avatar Apr 27 '18 18:04 jaredsburrows

Bump

jaredsburrows avatar Feb 07 '19 09:02 jaredsburrows

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'
}

andreasgrill avatar May 23 '19 08:05 andreasgrill

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?

mgursch avatar Sep 19 '19 13:09 mgursch

Any follow up on this? cc @jaredsburrows

jimlyas avatar Jun 29 '22 03:06 jimlyas

@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?

jaredsburrows avatar Jun 29 '22 18:06 jaredsburrows