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

[hxb] Filter for --hxb output #11490

Closed
Simn opened this issue Jan 14, 2024 · 10 comments · Fixed by #11507
Closed

[hxb] Filter for --hxb output #11490

Simn opened this issue Jan 14, 2024 · 10 comments · Fixed by #11507

Comments

@Simn
Copy link
Member

Simn commented Jan 14, 2024

One thing I've been ignoring so far is that we currently can't really specify what actually goes into a generated .hxb file. For library usage, we typically don't want to include code from std and such, so it would be nice to be able to configure this somehow.

It's probably not super urgent because I'm the kind of guy who will just tell someone to delete things from the generated zip file... but maybe usability could be a little better than that.

@Simn
Copy link
Member Author

Simn commented Jan 14, 2024

Quick idea: allow --hxb whatever.json and have some configuration in there, among which is the path to the actual archive.

@kLabz
Copy link
Contributor

kLabz commented Jan 14, 2024

Yeah I wanted to talk about filtering output too, but kept that problem for "later" (which this issue does perfectly too :D)

Not sure about that json config part (which wouldn't help with --hxb output either)

This would also mean haxe compiler would have to check that file in all requests in case it changes, etc. Not sure we'd really gain much there either (target conditional and such would still be weird in json?)

@Simn
Copy link
Member Author

Simn commented Jan 14, 2024

... I meant --hxb, not --hxb-lib. Seems like a great CLI design if it takes me only 3 issues to confuse the two...

@kLabz
Copy link
Contributor

kLabz commented Jan 14, 2024

I guess it's not really an issue to have a file there then :D But yeah that --hxb isn't very explicit 😕

@Simn
Copy link
Member Author

Simn commented Jan 14, 2024

It aligns with --xml and --json though...

@back2dos
Copy link
Member

back2dos commented Jan 15, 2024

Would be nice if this could be controlled from macros too somehow (beyond fiddling with the zip file in onAfterGenerate).

@PXshadow
Copy link
Contributor

Quick idea: allow --hxb whatever.json and have some configuration in there, among which is the path to the actual archive.

I'd be curious what type of configuration would go into a JSON besides the excluded path names?

I would like it to be possible to be controlled by a macro, and have easy access inside an hxml, so perhaps it could use an api similar to Compiler.exclude and Compiler.excludeFile that way it can also be written in a one line init macro for easy configs.

@Simn
Copy link
Member Author

Simn commented Jan 21, 2024

I was thinking of doing it like this:

typedef HxbConfig = {
	var archivePath:String;
	var exclude:Array<String>; // or something
	// more later
}

class Compiler {
	extern static public function getHxbConfig():HxbConfig;
	extern static public function setHxbConfig(config:HxbConfig):Void;
}

Then normal people can use --hxb hxbConfig.json where the JSON structure corresponds to HxbConfig, and you macro folks can use the Compiler API.

@PXshadow
Copy link
Contributor

I was thinking of doing it like this:

typedef HxbConfig = {
	var archivePath:String;
	var exclude:Array<String>; // or something
	// more later
}

class Compiler {
	extern static public function getHxbConfig():HxbConfig;
	extern static public function setHxbConfig(config:HxbConfig):Void;
}

Then normal people can use --hxb hxbConfig.json where the JSON structure corresponds to HxbConfig, and you macro folks can use the Compiler API.

What's the purpose of setting the archivePath, isn't that the location for --hxb-lib ?

@kLabz
Copy link
Contributor

kLabz commented Jan 22, 2024

This is for export (--hxb), no import (--hxb-lib), and since the json file arg would replace the archive path arg, it needs to include it

This was referenced Jan 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants