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

Plugin build silently exits when it can't find build config #174

Closed
DarkFighterLuke opened this issue May 4, 2024 · 11 comments · Fixed by #175
Closed

Plugin build silently exits when it can't find build config #174

DarkFighterLuke opened this issue May 4, 2024 · 11 comments · Fixed by #175
Labels
bug Something isn't working support Support request, not issue report

Comments

@DarkFighterLuke
Copy link

DarkFighterLuke commented May 4, 2024

Hi, I am the developer of TubeArchivistMetadata and your tool doesn't work when I build my project, neither on local machine nor in GitHub Actions.
It returns me an empty string as result after the build and it doesn't really output any artifact.

Apart from this, I find this tool very poor documented unfortunately...

@oddstr13
Copy link
Owner

oddstr13 commented May 4, 2024

Nothing silent about this error?

Logs are sent to stderr, not stdout, and exit code is appropriately returning 1, indicating a failure (0 == ok, everything else indicates error).

$ jprm plugin build
Setting project version to 1.2.3.0
Setting project framework to net6.0
MSBuild version 17.4.8+6918b863a for .NET
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

JPRM ran with debug logs shows the dotnet command;

$ jprm -v DEBUG plugin build 
debug: {'dotnet_config': 'Release', 'dotnet_framework': 'net6.0', 'output': '/tmp/tmp5ydb746i', 'max_cpu_count': 1, 'version': '1.2.3.0'}
Setting project version to 1.2.3.0
debug: Old version: 1.2.3.0
debug: Old file version: 1.2.3.0
debug: Old assembly version: 1.2.3.0
Setting project framework to net6.0
debug: ['run_os_command', ['dotnet', 'clean', '--configuration=Release', '--framework=net6.0'], None, False, '.']
MSBuild version 17.4.8+6918b863a for .NET
MSBUILD : error MSB1003: Specify a project or solution file. The current working directory does not contain a project or solution file.

JPRM is self-documenting to a certain level, via the --help argument, try appending it to different commands.
Otherwise, all of Jellyfin's official plugins serve as practical examples.

@oddstr13 oddstr13 closed this as not planned Won't fix, can't repro, duplicate, stale May 4, 2024
@oddstr13 oddstr13 added the support Support request, not issue report label May 4, 2024
@DarkFighterLuke
Copy link
Author

Try to specify the project or solution then and you'll receive nothing in output in shell.
I tried to execute the plugin build both directly in the plugin source folder (Jellyfin.Plugin.TubeArchivistMetadata) and by specifying the folder to build. If you do in one of these ways, you will receive nothing as output and no artifacts as output.
immagine

@oddstr13
Copy link
Owner

oddstr13 commented May 5, 2024

Looks like it silently exits when it can't find the build config (jprm.yaml / build.yaml), that is unintentional.

@oddstr13 oddstr13 reopened this May 5, 2024
@oddstr13 oddstr13 changed the title Build fails silently Plugin build silently exits when it can't find build config May 5, 2024
@oddstr13 oddstr13 added the bug Something isn't working label May 5, 2024
@oddstr13
Copy link
Owner

oddstr13 commented May 6, 2024

I've merged a fix for the lack of errors there, but I've yet to publish a new release.

For now, you can assume that no output means it didn't find the config file in the path supplied.

CONFIG_LOCATIONS = [
"jprm.yaml",
".jprm.yaml",
".ci/jprm.yaml",
".github/jprm.yaml",
".gitlab/jprm.yaml",
"meta.yaml",
"build.yaml",
]

@oddstr13
Copy link
Owner

oddstr13 commented May 6, 2024

Your project is missing a .sln file, which is why the dotnet clean command is erroring btw.
https://learn.microsoft.com/en-us/dotnet/core/tools/dotnet-sln#create-a-solution-file

@DarkFighterLuke
Copy link
Author

My project is missing the .sln file, but it is only required for Visual Studio solutions, the main thing is the .csproj file, which is included in the plugin folder.

@oddstr13
Copy link
Owner

oddstr13 commented May 6, 2024

The dotnet clean command executed by jprm says otherwise.

@DarkFighterLuke
Copy link
Author

If you pass the folder to dotnet clean command it will work as expected even without .sln file.

@DarkFighterLuke
Copy link
Author

DarkFighterLuke commented May 6, 2024

I think I found the issue running with the debugger: the script searches build configuration files in the same specified folder

if build_cfg is None:
build_cfg = get_config(path)
if build_cfg is None:
return None

The reason why it works with .sln file is that it is located outside the plugin source directory, along with build configuration file, while .csproj is inside that folder. If you specify the plugin source folder the script won't find the build configuration file, while if you specify the plugin project root folder the script will find the build configuration file but not the .csproj.

@joshuaboniface
Copy link
Contributor

joshuaboniface commented May 7, 2024

If that's the case, it would seem that your project is using a structure different than our official plugins or any third party plugins that we've seen use the JPRM tool before, though I haven't checked to confirm. I would suggest that you restore the original file layout from the template so that it matches our official plugins, as this is what JPRM is primarily built for. Any additional changes to support this would have to take into account effectively arbitrary plugin repository structures, and I'm not sure that's feasible at this time (though @oddstr13 may be able to confirm in the future if that'll be possible) without introducing too much complexity here.

That said, I agree that it probably shouldn't silently die, perhaps we could have a:

if build_cfg is None: 
    build_cfg = get_config(path) 

    if build_cfg is None: 
        print(f"ERROR: Could not find a valid JPRM metadata file in '{path}'.")
        print("Please see 'Metadata.md' in the JPRM repository for more details on how to configure a plugin for JPRM.")
        return None 

to print an error and reference Metadata.md instead. I see this was already done!

@DarkFighterLuke
Copy link
Author

Yeah, I've restored the .sln file and now it works without problems 🙂.

However I agree with you for the verbosity.

I would also suggest to not leave the instructions entirely to the reading of the code, a documentation, at least minimal (but more than the current), would be a good improvement to understand the pillars this tool assumes. It's not a matter of the --help command in this case, because I think that it's better to declare somewhere that the identical template plugin structure should be used.

Thanks for the help guys 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working support Support request, not issue report
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants