shaka-project / shaka-player

JavaScript player library / DASH & HLS client / MSE-EME player
Apache License 2.0
7.19k stars 1.34k forks source link

[build] missing dist directory except run all.py first #2973

Closed kocoten1992 closed 4 years ago

kocoten1992 commented 4 years ago

Have you read the FAQ and checked for duplicate open issues? Not related

What version of Shaka Player are you using? v3.0.5

Can you reproduce the issue with our latest release version? yes

Can you reproduce the issue with the latest code from master? yes (although current master build is bug right now - so I'm using v3.0.5)

What did you do?

git clone https://github.com/google/shaka-player
cd shaka-player && git checkout v3.0.5 && python3 build/build.py

What did you expect to happen? It should work

What actually happened? Except when we run build/all.py first and foremost

# Make the dist/ folder, ignore errors.
base = shakaBuildHelpers.get_source_base()
try:
  os.mkdir(os.path.join(base, 'dist'))
except OSError:
  pass

If we don't run all.py first, we running into bug missing dist directory when build/apps.py, build/build.py, build/check.py...

Sometimes people only interested in build.py (because it a released version - not much reason to run check.py or to generate docs).

I've a few ideas in mind:

Do you have any thoughts ?

kocoten1992 commented 4 years ago

This is a much deep problem than it seem.

Originally I want to build compiled shaka-player and shaka-player.ui but (build.py only build uncompiled UI - why is that :disappointed: ), and right now we consider changing build system https://github.com/google/shaka-player/issues/1858.

Maybe when done switching to new build system, we could revisit this.

joeyparrish commented 4 years ago

Yes, our build system is a mess. I'm so sorry!

This is a legitimate bug, even in the current system. Every command should create dist/, and that wouldn't be very difficult to do.

The default build includes everything (equivalent to build.py @complete), which means it includes the UI. So I'm not sure what you mean by:

build.py only build uncompiled UI - why is that 😞

kocoten1992 commented 4 years ago

@joeyparrish, correct me if I'm wrong, I'm just as confusing.

So the issue is missing dist directory ? If I'm create a directory then the build pass, exit code is 0. But nothing except shaka.ui uncompiled was build, reproducing as following code:

git clone https://github.com/google/shaka-player
cd shaka-player && git checkout v3.0.5 && mkdir dist && python3 build/build.py

The reason I'm dig into this is because I'm trying to write a plugin for shaka player (and will write docs back contribute back :+1: ).

If this don't work, then the idea

python build/build.py +@complete +my_plugin.js

It should not work (but I don't see anyone complain about it, so I'm guessing it somehow work).

P/s: if you confirm this second bug, then I'll try dig into it more, atleast it should return a positive exit code instead of 0

joeyparrish commented 4 years ago

I ran your exact commands:

git clone https://github.com/google/shaka-player

cd shaka-player && git checkout v3.0.5 && mkdir dist && python3 build/build.py

And in dist/, I see:

$ ls dist/
locales.js  shaka-player.ui.externs.js  shaka-player.ui.js  shaka-player.ui.map  wrapper.js

That looks correct to me. The UI-enabled, compiled output is dist/shaka-player.ui.js, with a source map in dist/shaka-player.ui.map and compiler externs in dist/shaka-player.ui.externs.js. The rest are intermediate files generated, then used in compilation (locales.js, wrapper.js).

Does this help?

kocoten1992 commented 4 years ago

Thanks! I've figure out where I got confused.

There are 3 points:

For now, I'll just create pull request for dist, just letting you know.