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

FeatureRequest: Add Configuration For File Directory #127

Closed
sdoward opened this issue Oct 16, 2022 · 3 comments · Fixed by #312
Closed

FeatureRequest: Add Configuration For File Directory #127

sdoward opened this issue Oct 16, 2022 · 3 comments · Fixed by #312

Comments

@sdoward
Copy link

sdoward commented Oct 16, 2022


As an android developer
I want to be able to configure the location of the artefacts.json file
So that I can bundle it in my app as part of the ./assets directory


We use the .json file to create a screen that shows the licences to our users. It would be nice if we can easily add that file as part of the build/ci pipeline.

@JakeWharton
Copy link
Collaborator

JakeWharton commented Oct 17, 2022

This is one of the intended use of the library. I don't think the right path is configuring our tasks, but either doing one of two things:

  • created a task which copies the file into a new generated folder which is added a asset-generating task-based output
  • registering our task directly as asset-generating, task-based output (although this would also pick up the text files)

The functionality for registering an asset-generating task is relatively new and I have not experimented with it yet: https://issuetracker.google.com/issues/37085092#comment4

@hfhbd
Copy link
Contributor

hfhbd commented Mar 29, 2024

You can easily just consume the json file using standard Gradle api:

val myCustomTask = tasks.register("myCustomTask", MyCustomTask::class) {
  val licenseeJsonFile: Provider<RegularFile> = tasks.licensee.flatMap { it.outputDir.file("artifacts.json") }
  myInputFile.set(licenseeJsonFile)
}

But we could also expose the file as a task property:

val myCustomTask = tasks.register("myCustomTask", MyCustomTask::class) {
  val licenseeJsonFile: Provider<RegularFile> = tasks.licensee.flatMap { it.artifactsJsonFile }
  myInputFile.set(licenseeJsonFile)
}

@JakeWharton
Copy link
Collaborator

#181 also shows how to bundle the output into assets using the correct mechanisms. That change will make it even easier.

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 a pull request may close this issue.

3 participants