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

Add re-usable Gradle task postBuild #1

Closed
wants to merge 7 commits into from

Conversation

ghubstan
Copy link
Contributor

Several new bisq-* repos are going to be pulled out of the large, multi-project bisq repo.

They must follow the parent repo's convention of copying startup scripts and jar lib directories into their respective repos' root directories. This repo's first shared script is task postBuild with description: "Makes distribution's start script runnable from project root directory."

Usage is described in the repo's README.md.

Based on main.

@ripcurlx
Copy link

As I'm no big gradle expert -> @alvasw Could you please review this PR? Thanks!

ghubstan added a commit to ghubstan/bisq-pricenode that referenced this pull request Jul 20, 2022
TODO Create new PR to change .gitmodules content

    [submodule "bisq-gradle"]
	    path = bisq-gradle
	    url = https://github.com/ghubstan/bisq-gradle.git
	    branch = add-post-build-task

TO

    [submodule "bisq-gradle"]
	    path = bisq-gradle
	    url = https://github.com/bisq-network/bisq-gradle.git

We need to wait until PR bisq-network/bisq-gradle#1
to be approved & merged before making the above change to .gitmdoules
@ghubstan
Copy link
Contributor Author

@alvasw @ripcurlx I need to anticipate a couple of questions from either of you about this PR.

  1. Why isn't this task defined in the gitmodule bisq, to avoid creating a whole new repo just for gradle tasks?

    I am using the latest gradle version in the new bisq-* repos, and I'm not supposed to be optimizing the big bisq v1 repo's build. I'm taking that requirement a bit further by not upgrading bisq's gradle version. (And I'm not spending any time to make sure any of the gradle tasks I put in this repo are backward compatible to v 7.3.3.)

    Optimizing bisq v1's build and upgrading its gradle version will easier to do after many of its subprojects are moved into new bisq-* repos. When the bisq v1 repo's gradle version is upgraded to match the new bisq-* repos' gradle version, I can move everything in bisq-gradle/task back into bisq, adjust the new bisq-* repo builds, and delete this bisq-gradle repository.

  2. Why didn't I put these extra gradle tasks in a plugin?

    I tried that first. I put the postBuild task in a precompiled script plugin, made it a git submodule dependency in bisq-pricenode's build, but could not reference the plugin's id in bisq-pricenode's build. I gave up, and opted for a folder with this first script.

@alvasw
Copy link

alvasw commented Jul 23, 2022

Hi @ghubstan!
It looks good so far!

Why isn't this task defined in the gitmodule bisq, to avoid creating a whole new repo just for gradle tasks?
I am using the latest gradle version in the new bisq-* repos, and I'm not supposed to be optimizing the big bisq v1 repo's build. I'm taking that requirement a bit further by not upgrading bisq's gradle version. (And I'm not spending any time to make sure any of the gradle tasks I put in this repo are backward compatible to v 7.3.3.)
Optimizing bisq v1's build and upgrading its gradle version will easier to do after many of its subprojects are moved into new bisq-* repos. When the bisq v1 repo's gradle version is upgraded to match the new bisq-* repos' gradle version, I can move everything in bisq-gradle/task back into bisq, adjust the new bisq-* repo builds, and delete this bisq-gradle repository.

Makes sense to me.

Why didn't I put these extra gradle tasks in a plugin?
I tried that first. I put the postBuild task in a precompiled script plugin, made it a git submodule dependency in bisq-pricenode's build, but could not reference the plugin's id in bisq-pricenode's build. I gave up, and opted for a folder with this first script.

Did you push your attempt where you tried to use a precompiled script plugin somewhere? I can take a look at it if you want to. I think that it's cleaner. In Bisq 2, we're using and referencing precompiled script plugins.
But this should work as well!

@ghubstan
Copy link
Contributor Author

ghubstan commented Jul 23, 2022

Did you push your attempt where you tried to use a precompiled script plugin somewhere? I can take a look at it if you want to. I think that it's cleaner. In Bisq 2, we're using and referencing precompiled script plugins.
But this should work as well!

I deleted it, and just pushed it back & made you a collaborator: https://github.com/ghubstan/bisq-post-assemble-plugin

What I couldn't get to work was its use in another repo, after making bisq-post-assemble-plugin a git submodule in the user project:

plugins {
    id 'application'
    id 'bisq.post-assemble'
}

The script itself is a mess (no matter, not the problem). This PR's postBuild task you said "should work as well" is better script.
But if you figure out what I did wrong, I'll move this to a new script plugin after some loose ends are taken care of (waiting for other bisq-* repo reviews).

@alvasw
Copy link

alvasw commented Jul 24, 2022

I fixed it. Take a look at [1] for the changes in the plugin and at [2] on how to use it in other repositories.

[1] https://github.com/ghubstan/bisq-post-assemble-plugin/tree/convert_to_standalone_plugin
[2] https://github.com/alvasw/bisq-pricenode/tree/adjust-build-files-n-scripts

@ghubstan
Copy link
Contributor Author

Closed, replaced by PR #2

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