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

How to add a custom path to moko-resources with 0.24.0 #641

Closed
Burtan opened this issue Feb 3, 2024 · 12 comments · Fixed by #668 or #695
Closed

How to add a custom path to moko-resources with 0.24.0 #641

Burtan opened this issue Feb 3, 2024 · 12 comments · Fixed by #668 or #695
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Burtan
Copy link
Contributor

Burtan commented Feb 3, 2024

Hey,

with moko-resources prior to 0.24.0, moko resources were part of the application resources source path, thus you could add custom pathes to its source set. Now moko-resources has its own resources folder. Can you still add custom pathes? I have used it for generated files like version and licenses information.

Thanks!

@Alex009
Copy link
Member

Alex009 commented Feb 5, 2024

hi @Burtan .
yes, we can find way to expose our sourceSet directory to configuration

@Alex009 Alex009 added this to the 0.24.0 milestone Feb 5, 2024
@ExNDY
Copy link
Contributor

ExNDY commented Apr 17, 2024

will be fixed in 0.24.0, please check in 0.24.0-alpha-6

ExNDY added a commit that referenced this issue Apr 17, 2024
@Alex009 Alex009 added the enhancement New feature or request label Apr 19, 2024
@Alex009 Alex009 linked a pull request Apr 19, 2024 that will close this issue
@Alex009
Copy link
Member

Alex009 commented Apr 19, 2024

will be available in 0.24.0-beta-1 :)

@Alex009 Alex009 closed this as completed Apr 19, 2024
@ynsok
Copy link

ynsok commented Apr 24, 2024

@Alex009

> Task :core:compileDebugKotlinAndroid FAILED
e: core/build/generated/kotlin/generateMRandroidMain/com/Res.kt:13:17 Object 'strings' is not abstract and does not implement abstract member public abstract val __platformDetails: ResourcePlatformDetails defined in dev.icerock.moko.resources.ResourceContainer
e: core/build/generated/kotlin/generateMRandroidMain/com/Res.kt:259:17 Object 'plurals' is not abstract and does not implement abstract member public abstract val __platformDetails: ResourcePlatformDetails defined in dev.icerock.moko.resources.ResourceContainer
e: core/build/generated/kotlin/generateMRandroidMain/com/Res.kt:263:17 Object 'images' is not abstract and does not implement abstract member public abstract val __platformDetails: ResourcePlatformDetails defined in dev.icerock.moko.resources.ResourceContainer

@ExNDY
Copy link
Contributor

ExNDY commented Apr 24, 2024

@ynsok any details? Sorry, but this log is useless

@ynsok
Copy link

ynsok commented Apr 24, 2024

Ok, After updating to 0.24.0-beta-1


multiplatformResources {
    resourcesPackage.set("com.******.********")
    resourcesClassName.set("Res")
}
image

@ExNDY What other information do you need?

@ExNDY
Copy link
Contributor

ExNDY commented Apr 24, 2024

@ynsok that problem has no connection with this issue, please create separate issue.
What we need:
Versions: kotlin, agp, gradle
Structure of resources in project. Because we need something recreate your problem on us project. You send only part of log, generated code file, but if this new generated file i need find why code generated without interface realisation

@ynsok
Copy link

ynsok commented Apr 24, 2024

@ExNDY My Bad, I didn't update the resources Generator version. It is working

@ExNDY
Copy link
Contributor

ExNDY commented Apr 24, 2024

Np)

@Burtan
Copy link
Contributor Author

Burtan commented Apr 28, 2024

Hey, thanks for addressing this issue!
I tried beta-2 with createBuildInfoTask generating resources defined as the tasks output.

afterEvaluate {
    multiplatformResources.resourcesSourceSets["commonMain"].srcDir(createBuildInfoTask)
}

The directory is read correctly and the resource access code is generated.
However, the gradle dependency graph is not modified, which means you have to manually trigger the createBuildInfoTask before invoking the moko-resources tasks.

According to JetBrains this should be the way to define task/resource dependencies.

@Alex009
Copy link
Member

Alex009 commented Apr 30, 2024

If you know what should be changed to achieve what you want - sent pr :)
Or just add Gradle task dependsOn

@Burtan
Copy link
Contributor Author

Burtan commented May 2, 2024

When using an explicit dependsOn, it often results in complex explicit task dependencies that have to follow (see the linked thread). I have no experience in Gradle plugin coding, but maybe SourceDirectorySet.compiledBy has to be used to tell Gradle that the task processing the resources actually depends on tasks that define the SourceDirectorySet?
Maybe the task just has to declare dependency on the SourceDirectorySet?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
4 participants