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

Organization of test project should use test/Project.toml #95

Closed
o314 opened this issue Sep 18, 2019 · 2 comments · Fixed by #61
Closed

Organization of test project should use test/Project.toml #95

o314 opened this issue Sep 18, 2019 · 2 comments · Fixed by #61

Comments

@o314
Copy link

o314 commented Sep 18, 2019

Code at https://github.com/invenia/PkgTemplates.jl/blob/master/src/generate.jl#L141-L162

try
    Pkg.activate(pkg_dir)
    Pkg.add("Test")

    # Move the Test dependency into the [extras] section.
    toml = read(joinpath(pkg_dir, "Project.toml"), String)
    lines = split(toml, "\n")
    idx = findfirst(l -> startswith(l, "Test = "), lines)
    testdep = lines[idx]
    deleteat!(lines, idx)
    toml = join(lines, "\n") * """
    [extras]
    $testdep
    [targets]
    test = ["Test"]
    """
    gen_file(joinpath(pkg_dir, "Project.toml"), toml)
    Pkg.update()  # Regenerate Manifest.toml (this cleans up Project.toml too).
finally
    proj === nothing ? Pkg.activate() : Pkg.activate(proj)
end

does not follow the new organization of test project based on test/Project.toml from Julia v1.2

One does not need to split and shake so much the main project.toml starting from now.
[extras] will become obsolete in v2.

See
https://julialang.github.io/Pkg.jl/v1/creating-packages/#Adding-tests-to-the-package-1

@christopher-dG
Copy link
Member

I don't think I actually want this yet, because Julia 1.0 is still supported and it won't work for that version. Of course we could decide what to do based on the chosen Julia version to support as well.

In #61, the test generation is its own plugin instead of being some special thing, so I think that the best thing to do would be to add a project flag to it (and when it's true, generate a new Project.toml instead of adding the [extras] section).

And FWIW, in #61 the modifications of Project.toml happen via Pkg.TOML and normal Dict updates, rather than the current ugly text substitution 🙂.

@o314
Copy link
Author

o314 commented Sep 20, 2019

Agree that before v2, may be in 2020 something, there's no emergency. It's only (re)-orientation.

So you will go with a big patch fea66ea next time. Lot of work there!

I am borrowing you some of your code i appreciate, thanks.
To be more precise, i follow the programming in the small way you took, but not the programming in the large. Recipes are good, gathering may be less IMHO.

Every successful framework i know today have more or less reimplement a make as an internal dsl and try to generate initial stuff over it. I believe it's the way to go and the one i will follow.

And FWIW, in #61 the modifications of Project.toml happen via Pkg.TOML and normal Dict updates, rather than the current ugly text substitution slightly_smiling_face.

I have seen that
https://github.com/invenia/PkgTemplates.jl/blob/fea66eaf6f303afa697d80f1fb9af673d7e64694/src/plugins/defaults.jl#L157-L162

looks way better 🙂

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