Skip to content

Commit

Permalink
Fix provide/require structure for autogenerated shader files
Browse files Browse the repository at this point in the history
  • Loading branch information
ahocevar committed Aug 29, 2017
1 parent 5cfb1e4 commit cf8c72c
Show file tree
Hide file tree
Showing 28 changed files with 482 additions and 909 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ cache:
- node_modules
before_script:
- rm src/ol/renderer/webgl/*shader.js
- rm src/ol/renderer/webgl/*shader/locations.js
script: make ci
after_success:
- cat coverage/lcov.info | coveralls
Expand Down
21 changes: 13 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ BRANCH := $(shell git rev-parse --abbrev-ref HEAD)

SRC_GLSL := $(shell find src -type f -name '*.glsl')
SRC_SHADER_JS := $(patsubst %shader.glsl,%shader.js,$(SRC_GLSL))
SRC_JS := $(filter-out $(SRC_SHADER_JS),$(shell find src -name '*.js'))
SRC_SHADERLOCATIONS_JS := $(patsubst %shader.glsl,%shader/locations.js,$(SRC_GLSL))
SRC_JS := $(filter-out $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS),$(shell find src -name '*.js'))
SRC_JSDOC = $(shell find src -type f -name '*.jsdoc')

EXAMPLES := $(shell find examples -type f)
Expand Down Expand Up @@ -116,7 +117,7 @@ install: build/timestamps/node-modules-timestamp
npm-install: build/timestamps/node-modules-timestamp

.PHONY: shaders
shaders: $(SRC_SHADER_JS)
shaders: $(SRC_SHADER_JS $(SRC_SHADERLOCATIONS_JS)
.PHONY: serve
serve:
Expand Down Expand Up @@ -167,7 +168,7 @@ build/compiled-examples/all.js: $(EXAMPLES_JS)
@python bin/combine-examples.py $^ > $@
build/compiled-examples/all.combined.js: config/examples-all.json build/compiled-examples/all.js \
$(SRC_JS) $(SRC_SHADER_JS) \
$(SRC_JS) $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
node tasks/build.js $< $@
Expand All @@ -178,14 +179,14 @@ build/compiled-examples/%.json: config/example.json build/examples/%.js \
@sed -e 's|{{id}}|$*|' $< > $@
build/compiled-examples/%.combined.js: build/compiled-examples/%.json \
$(SRC_JS) $(SRC_SHADER_JS) \
$(SRC_JS) $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS)\
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
node tasks/build.js $< $@
build/timestamps/jsdoc-$(BRANCH)-timestamp: config/jsdoc/api/index.md \
config/jsdoc/api/conf.json $(SRC_JS) \
$(SRC_SHADER_JS) \
$(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS) \
$(shell find config/jsdoc/api/template -type f) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
Expand Down Expand Up @@ -236,7 +237,7 @@ build/ol.css: css/ol.css build/timestamps/node-modules-timestamp
@echo "Running cleancss..."
@./node_modules/.bin/cleancss $< > $@
build/ol.js: config/ol.json $(SRC_JS) $(SRC_SHADER_JS) \
build/ol.js: config/ol.json $(SRC_JS) $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
node tasks/build.js $< $@
Expand All @@ -246,12 +247,12 @@ build/ol.js: config/ol.json $(SRC_JS) $(SRC_SHADER_JS) \
@$(STAT_COMPRESSED) /tmp/ol.js.gz
@rm /tmp/ol.js.gz
build/ol.js.map: config/ol.json $(SRC_JS) $(SRC_SHADER_JS) \
build/ol.js.map: config/ol.json $(SRC_JS) $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
node tasks/build.js $< $@
build/ol-debug.js: config/ol-debug.json $(SRC_JS) $(SRC_SHADER_JS) \
build/ol-debug.js: config/ol-debug.json $(SRC_JS) $(SRC_SHADER_JS) $(SRC_SHADERLOCATIONS_JS) \
build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
node tasks/build.js $< $@
Expand All @@ -264,6 +265,10 @@ build/ol-debug.js: config/ol-debug.json $(SRC_JS) $(SRC_SHADER_JS) \
%shader.js: %shader.glsl src/ol/webgl/shader.mustache bin/pyglslunit.py build/timestamps/node-modules-timestamp
@python bin/pyglslunit.py --input $< | ./node_modules/.bin/mustache - src/ol/webgl/shader.mustache > $@
%shader/locations.js: %shader.glsl src/ol/webgl/shaderlocations.mustache bin/pyglslunit.py build/timestamps/node-modules-timestamp
@mkdir -p $(@D)
@python bin/pyglslunit.py --input $< | ./node_modules/.bin/mustache - src/ol/webgl/shaderlocations.mustache > $@
.PHONY: package
package:
@rm -rf build/package
Expand Down
2 changes: 1 addition & 1 deletion src/ol/render/webgl/circlereplay.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ goog.require('ol.extent');
goog.require('ol.obj');
goog.require('ol.geom.flat.transform');
goog.require('ol.render.webgl.circlereplay.defaultshader');
goog.require('ol.render.webgl.circlereplay.defaultshader.Locations');
goog.require('ol.render.webgl.Replay');
goog.require('ol.render.webgl');
goog.require('ol.webgl');
Expand Down Expand Up @@ -202,7 +203,6 @@ ol.render.webgl.CircleReplay.prototype.setUpProgram = function(gl, context, size
// get the locations
var locations;
if (!this.defaultLocations_) {
// eslint-disable-next-line openlayers-internal/no-missing-requires
locations = new ol.render.webgl.circlereplay.defaultshader.Locations(gl, program);
this.defaultLocations_ = locations;
} else {
Expand Down
1 change: 0 additions & 1 deletion src/ol/render/webgl/circlereplay/defaultshader.glsl
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
//! NAMESPACE=ol.render.webgl.circlereplay.defaultshader
//! CLASS=ol.render.webgl.circlereplay.defaultshader


//! COMMON
Expand Down
159 changes: 6 additions & 153 deletions src/ol/render/webgl/circlereplay/defaultshader.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit cf8c72c

Please sign in to comment.