-
Notifications
You must be signed in to change notification settings - Fork 25.2k
Add gradle task to build platform specific distro #56003
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
Conversation
Pinging @elastic/es-core-infra (:Core/Infra/Build) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we want to leverage our DistributionDownloadPlugin
here. The plugin has all sort of smarts in it already to figure out how to resolve a requested distribution type to a project dependency or download. So I'd recommend we go that route so we don't have to duplicate the logic of which project to delegate to depending on the current os (that lives in the plugin already). Also, we'll probably want this task to extract the distro to some standard location. That way we can easily document that you can run this task, then look in /extracted/dir
to find our distro. As it is, the build artifact is going to live in the build dir for the specific platform project, which is kind of confusing.
So let's do this:
- Create a new script plugin for this and apply to the root project so we don't bloat the root build.gradle any further.
- Apply the
elasticsearch.distribution-download
plugin. - Configure an
ElasticsearchDistribution
for the current platform, withtype = 'archive'
andflavor = 'default'
. - Wire that distribution up to a copy task that copy the extracted distro to a known location
see
ElasticsearchDistribution.getExtracted()`.
Just to get a better understanding, why would we package and unpackage instead of just having a plain copy task that might share the same copy spec with the distro archive tasks?
… On 30. Apr 2020, at 20:25, Mark Vieira ***@***.***> wrote:
@mark-vieira commented on this pull request.
I think we want to leverage our DistributionDownloadPlugin here. The plugin has all sort of smarts in it already to figure out how to resolve a requested distribution type to a project dependency or download. So I'd recommend we go that route so we don't have to duplicate the logic of which project to delegate to depending on the current os (that lives in the plugin already). Also, we'll probably want this task to extract the distro to some standard location. That way we can easily document that you can run this task, then look in /extracted/dir to find our distro. As it is, the build artifact is going to live in the build dir for the specific platform project, which is kind of confusing.
So let's do this:
Create a new script plugin for this and apply to the root project so we don't bloat the root build.gradle any further.
Apply the elasticsearch.distribution-download plugin.
Configure an ElasticsearchDistribution for the current platform, with type = 'archive' and flavor = 'default'.
Wire that distribution up to a copy task that copy the extracted distro to a known location see ElasticsearchDistribution.getExtracted()`.
—
You are receiving this because you were assigned.
Reply to this email directly, view it on GitHub, or unsubscribe.
|
That's a fantastic question 😉 . Mainly because we just simply haven't optimized for that yet but it is very much worth doing as tar/untar adds considerable overhead. Right now we are basically just doing this all via artifact dependencies, so we grab the archive artifact, then unpack it. It'll need some work to make it more efficient. |
This adds the gradle task ':assemblePlatformArchive' that depends on the platform specific distro archive tasks and allows using the same task for building only the archive according to the local platform. This delegates to :distribution:archives:windows-zip:assemble on windows :distribution:archives:linux-tar:assemble on linux :distribution:archives:darwin-tar:assemble on osx Closes #53682
- reuse distribution download plugin - rename task to installLocalDistribution
@mark-vieira I applied your feedback |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM 👍
@rjernst want to contribute to some bike-shedding about naming here 😉
gradle/local-distribution.gradle
Outdated
} | ||
} | ||
|
||
tasks.register('installLocalDistribution', Copy) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
perhaps we could make this easier to type as just localDistro
? Should we also use Sync
instead of Copy
? Can't older files that were removed be left in place with Copy
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
localDistro
it is. And switched to use Sync
tasks.register('installLocalDistribution', Copy) { | ||
from(elasticsearch_distributions.local.extracted) | ||
into("build/distribution/local") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should add a println that states the location of the expanded distribution
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good call, let's add a user friendly doLast
which prints something like Elasticsearch distribution installed to {location}
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done.
gradle/local-distribution.gradle
Outdated
*/ | ||
|
||
/** | ||
* This script sets up a local distribution including. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems to be some words missing here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fixed the comment
- rename task name to localDistro - use Sync instead of Copy task - add user friendly output to point user to right directory
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
* Add gradle task 'localDistro' to build platform specific distro * reuse distribution download plugin Closes elastic#53682
* Add gradle task 'localDistro' to build platform specific distro * reuse distribution download plugin Closes elastic#53682
* Add gradle task 'localDistro' to build platform specific distro * reuse distribution download plugin Closes elastic#53682
@breskeby FYI, I added the |
This adds the gradle task ':installLocalDistribution' that installs a distribution locally matching the local architecture.
Closes #53682