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

modification to monitor git submodules and depend on multi flavor and build assemble task #3

Closed
wants to merge 2 commits into from

Conversation

yunarta
Copy link

@yunarta yunarta commented Dec 7, 2015

You plugin is great, but i need more function for submodules.
This is my modification.

@selesse
Copy link
Owner

selesse commented Dec 7, 2015

Hey, thanks for the feedback and contribution. :)

I'm all for running the Git commands on the project root directory.

For your change to the assemble task hook, could you achieve the functionality you want by applying the plugin to all of your submodules?

In other words, your root build.gradle would have:

subprojects {
    apply plugin: 'com.selesse.git.changelog'
}

If you do this, it should create a generateChangelog task for all modules, including non-Java ones.

Thanks!

@yunarta
Copy link
Author

yunarta commented Dec 7, 2015

the assemble need to be changed because you only add it to depends on "assemble", while my android project, I created a combination of product flavor and built variant.

And i used your plugin with my versioning plugin and in the current project set up, i don't run "assemble", but run the variant instead.

By the way, the change log generation part. When i tagged the latest commit then I got nothing. If i run your plugin before tagging the latest commit, then I got "Unreleased". What should come of out of course all commit message up to the last tagged commit

@selesse
Copy link
Owner

selesse commented Dec 8, 2015

I'd rather specifically hook into the Android tasks separately. I want users to enable the plugin for specific modules, but not be forced to use it for all modules.

I'm trying to figure out what would make the most sense here. I've started work on an Android branch -- the logic for hooking into the different build variants can be found here.

@yunarta
Copy link
Author

yunarta commented Dec 8, 2015

Oh. Now i see where you coming at.
Let met explain my usage to you.

I do put your plugin in subproject build.gradle.
I think you miss-understood my intention about this changes.

Here are snippets of my build.gradle

android {
    productFlavors {
        playStore {
            ext.betaDistributionEmailsFilePath = new File(projectDir, "beta/playstore_list.txt").absolutePath        
        }

        adHoc {
            ext.betaDistributionEmailsFilePath = new File(projectDir, "beta/adhoc_list.txt").absolutePath
        }
    }

    buildTypes {
        release {
        }

        fabric {
            initWith(buildTypes.debug)
        }

        jenkins {
            initWith(buildTypes.debug)
            ext.betaDistributionReleaseNotesFilePath = new File(projectDir, "beta/CHANGELOG.md").absolutePath
        }
    }
}

What will happen in Android, Gradle will create

  • assemblePlayStoreDebug
  • assemblePlayStoreRelease
  • assemblePlayStoreFabric
  • assemblePlayStoreJenkins
  • assembleAdHocDebug
  • assembleAdHocRelease
  • assembleAdHocFabric
  • assembleAdHocJenkins

How currently I build this project is by invoking one assemble task at a time.
However your code in GitLogPlugin.groovy only attach to 'assemble' task, thus when i call assemblePlayStoreRelease, it would not generate the change log.

@yunarta yunarta closed this Dec 8, 2015
@yunarta yunarta reopened this Dec 8, 2015
@selesse
Copy link
Owner

selesse commented Dec 8, 2015

OK, I think I understand now, thanks for clearing that up.

What if, for Android plugins, I hooked into tasks that started with assemble like this:

if (hasAndroidPlugin()) {
    project.plugins.withType(getAndroidPlugin()) {
        logger.info("Configuring Android plugin")
        project.tasks.findAll { t -> t.name.startsWith('assemble') }.each {
            it.dependsOn(task)
        }
    }
}

Would that satisfy your use case?

@yunarta
Copy link
Author

yunarta commented Dec 8, 2015

That what i did in my fork, and i published to jCenter for my own usage for now :)

I'm not so familiar with how Gradle and groovy scripting, but i found that if i didn't call like these below.
It will fail the build test

project.tasks.getByName("assemble")
project.tasks.findAll { t -> t.name.startsWith('assemble') }.each {
    it.dependsOn(task)
}

@selesse
Copy link
Owner

selesse commented Dec 8, 2015

OK, I'll look into it. Would you be OK with rebasing to only include the change to run the Git commands in the project root directory so I can merge that in?

I'll create separate issues for the assemble Android hook and the other issue you reported earlier.

@yunarta
Copy link
Author

yunarta commented Dec 8, 2015

sure. i will clean up the code and usage as well. yesterday i just created what i requires to have :)

@yunarta yunarta closed this Dec 8, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants