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

Changing 'resources' sourceSet in Gradle results in empty 'sources' in Bloop JSON #1441

Closed
mdbergmann opened this issue Jan 9, 2021 · 7 comments · Fixed by #1442
Closed

Comments

@mdbergmann
Copy link

Relates to #992

I'm working on a Apache Wicket project where html, css and other resource files exist as part of the scala source folder.

In Gradle I can expand the resources sourceSet via:

sourceSets {
    main {
        java {
            srcDirs = []
        }
        scala {
            srcDirs = ['src/main/java', 'src/main/scala']
        }
        resources {
            srcDirs += ['src/main/java', 'src/main/scala']
        }
    }
}

This make Gradle copy any resource file into the build output folder.
However, bloopInstall will create a Bloop JSON project that is missing the 'sources' folders:

        "sources": [
        ],
...
        "resources": [
            "/mypath/dev/WicketUI/src/main/java",
            "/mypath/dev/WicketUI/src/main/scala",
            "/mypath/dev/WicketUI/src/main/resources"
        ],

When I remove the 'resources' definition from the sourceSets it does look like this:

        "sources": [
            "/mypath/dev/WicketUI/src/main/java",
            "/mypath/dev/WicketUI/src/main/scala",
        ],
...
        "resources": [
            "/mypath/dev/WicketUI/src/main/resources"
        ],

As an additional issue:

I did copy manually the source folder to 'sources' in the JSON file while maintaining the three resources folders,
the html, css and other non-compilable resources are not copied to the build output folder.

@Arthurm1
Copy link
Contributor

Looks like a bug - the gradle export doesn't cope with resource and source dirs being the same. I'll look into fixing it.

As far as I remember, resources deliberately aren't copied to the build output folder. As Bloop is not intended for archive/deploy there's no reason to copy the resources dir - it's just used directly.

@mdbergmann
Copy link
Author

it's just used directly

That's fine as long as it's in the classpath.

Thanks for looking into it.

@mdbergmann
Copy link
Author

If you can direct me where to look I can have a try fixing it.

@mdbergmann
Copy link
Author

mdbergmann commented Jan 13, 2021

I would guess the issue might be this:

Line 66 (BloopConverter).

    val resources = getResources(sourceSet)
    val sources = getSources(sourceSet).filterNot(resources.contains)

Unfortunately I can't get the project to build with sbt.

@Arthurm1
Copy link
Contributor

Yes that's the place. I should be able to put a fix in this weekend

In terms of getting the project to build - have you looked at this guide?

@mdbergmann
Copy link
Author

I didn't look at this guide but kind of assumed something similar.
Started from scratch though with the guide, but still facing this problem with resoilving the dependency:

[error] sbt.librarymanagement.ResolveException: Error downloading com.dwijnand:sbt-compat;sbtVersion=1.0;scalaVersion=2.12:1.0.0
[error]   Not found
[error]   Not found
[error]   not found: https://repo1.maven.org/maven2/com/dwijnand/sbt-compat_2.12_1.0/1.0.0/sbt-compat-1.0.0.pom

I've checked maven central, it seems this dependency is not there. Seems to not be a direct dependency.

@Arthurm1
Copy link
Contributor

Sorry - beyond my ken - I'm not that familiar with the codebase. You could ask on the gitter channel.

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.

2 participants