Skip to content

Commit

Permalink
fix: reenable api generation
Browse files Browse the repository at this point in the history
  • Loading branch information
tonio committed Oct 29, 2020
1 parent 28292d6 commit 492a4dc
Show file tree
Hide file tree
Showing 5 changed files with 53 additions and 37 deletions.
18 changes: 17 additions & 1 deletion geoportal/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,25 @@ RUN \

COPY webpack.*.js Makefile CONST_Makefile /app/
COPY geoportailv3_geoportal/static-ngeo /app/geoportailv3_geoportal/static-ngeo
RUN make apps
# RUN make apps

COPY . /app

# jsapi generation
RUN mkdir /etc/apiv3
WORKDIR /etc/apiv3
RUN node --version
RUN mkdir -p /etc/apiv3/.build/externs && mkdir -p /etc/apiv3/build
RUN curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6.js -o /etc/apiv3/.build/externs/angular-1.6.js && \
curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6-q_templated.js -o /etc/apiv3/.build/externs/angular-1.6-q_templated.js && \
curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/angular-1.6-http-promise_templated.js -o /etc/apiv3/.build/externs/angular-1.6-http-promise_templated.js && \
curl -s https://raw.githubusercontent.com/google/closure-compiler/master/contrib/externs/jquery-1.9.js -o /etc/apiv3/.build/externs/jquery-1.9.js
COPY ./jsapi/package.json /etc/apiv3/
RUN npm install --no-optional && npm cache clear --force
ADD ./jsapi /etc/apiv3/jsapi
RUN /etc/apiv3/jsapi/rebuild_api.sh


# RUN make checks
RUN make build
RUN mv webpack.apps.js webpack.apps.js.tmpl
Expand All @@ -36,6 +51,7 @@ COPY . /app
COPY --from=builder /app/geoportailv3_geoportal/locale/ /app/geoportailv3_geoportal/locale/
COPY --from=builder /usr/lib/node_modules/ngeo/dist/* /etc/static-ngeo/
COPY --from=builder /etc/static-ngeo/* /etc/static-ngeo/
COPY --from=builder /etc/apiv3/* /etc/apiv3/
COPY --from=builder /app/alembic.ini /app/alembic.yaml ./
RUN chmod go+w /etc/static-ngeo/ \
/app/geoportailv3_geoportal/locale/ \
Expand Down
44 changes: 22 additions & 22 deletions geoportal/jsapi/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,28 +18,28 @@
"exports": ["*"],
"compile": {
"externs": [
"/opt/apiv3/node_modules/openlayers/externs/bingmaps.js",
"/opt/apiv3/node_modules/openlayers/externs/cartodb.js",
"/opt/apiv3/node_modules/openlayers/externs/closure-compiler.js",
"/opt/apiv3/node_modules/openlayers/externs/esrijson.js",
"/opt/apiv3/node_modules/openlayers/externs/geojson.js",
"/opt/apiv3/node_modules/openlayers/externs/proj4js.js",
"/opt/apiv3/node_modules/openlayers/externs/tilejson.js",
"/opt/apiv3/node_modules/openlayers/externs/topojson.js",
"/opt/apiv3/node_modules/ngeo/options/ngeox.js",
"/opt/apiv3/node_modules/openlayers/externs/olx.js",
"/opt/apiv3/node_modules/openlayers/externs/oli.js",
"/opt/apiv3/node_modules/ngeo/externs/d3.js",
"/opt/apiv3/node_modules/ngeo/externs/twbootstrap.js",
"/opt/apiv3/node_modules/ngeo/externs/typeahead.js",
"/opt/apiv3/node_modules/ngeo/externs/mapfish-print-v3.js",
"/opt/apiv3/.build/externs/angular-1.6.js",
"/opt/apiv3/.build/externs/angular-1.6-q_templated.js",
"/opt/apiv3/.build/externs/angular-1.6-http-promise_templated.js",
"/opt/apiv3/jsapi/externs/fuse.js",
"/opt/apiv3/.build/externs/jquery-1.9.js",
"/opt/apiv3/jsapi/externs/autocompletex.js",
"/opt/apiv3/jsapi/externs/luxx.js"
"/etc/apiv3/node_modules/openlayers/externs/bingmaps.js",
"/etc/apiv3/node_modules/openlayers/externs/cartodb.js",
"/etc/apiv3/node_modules/openlayers/externs/closure-compiler.js",
"/etc/apiv3/node_modules/openlayers/externs/esrijson.js",
"/etc/apiv3/node_modules/openlayers/externs/geojson.js",
"/etc/apiv3/node_modules/openlayers/externs/proj4js.js",
"/etc/apiv3/node_modules/openlayers/externs/tilejson.js",
"/etc/apiv3/node_modules/openlayers/externs/topojson.js",
"/etc/apiv3/node_modules/ngeo/options/ngeox.js",
"/etc/apiv3/node_modules/openlayers/externs/olx.js",
"/etc/apiv3/node_modules/openlayers/externs/oli.js",
"/etc/apiv3/node_modules/ngeo/externs/d3.js",
"/etc/apiv3/node_modules/ngeo/externs/twbootstrap.js",
"/etc/apiv3/node_modules/ngeo/externs/typeahead.js",
"/etc/apiv3/node_modules/ngeo/externs/mapfish-print-v3.js",
"/etc/apiv3/.build/externs/angular-1.6.js",
"/etc/apiv3/.build/externs/angular-1.6-q_templated.js",
"/etc/apiv3/.build/externs/angular-1.6-http-promise_templated.js",
"/etc/apiv3/jsapi/externs/fuse.js",
"/etc/apiv3/.build/externs/jquery-1.9.js",
"/etc/apiv3/jsapi/externs/autocompletex.js",
"/etc/apiv3/jsapi/externs/luxx.js"
],
"define": [
"goog.DEBUG=false",
Expand Down
2 changes: 1 addition & 1 deletion geoportal/jsapi/jsdoc/api/template/publish.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ var taffy = require('taffydb').taffy;
var template = require('jsdoc/template');
var util = require('util');
var jsdocType = require("jsdoc/tag/type")
var jsdocOl3 = require('/opt/apiv3/.build/jsdocOl3.js');
var jsdocOl3 = require('/etc/apiv3/.build/jsdocOl3.js');

var htmlsafe = helper.htmlsafe;
var linkto = helper.linkto;
Expand Down
8 changes: 4 additions & 4 deletions geoportal/jsapi/less/geoportailv3.api.less
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@import (inline) '/opt/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.css';
@import (inline) '/opt/apiv3/node_modules/openlayers/css/ol.css';
@import (inline) '/opt/apiv3/node_modules/js-autocomplete/auto-complete.css';
@import "/opt/apiv3/node_modules/bootstrap/less/mixins/vendor-prefixes.less";
@import (inline) '/etc/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.css';
@import (inline) '/etc/apiv3/node_modules/openlayers/css/ol.css';
@import (inline) '/etc/apiv3/node_modules/js-autocomplete/auto-complete.css';
@import "/etc/apiv3/node_modules/bootstrap/less/mixins/vendor-prefixes.less";

@bg: #fff;
@border: 1px solid #8394a0;
Expand Down
18 changes: 9 additions & 9 deletions geoportal/jsapi/rebuild_api.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ cp node_modules/font-awesome/fonts/* /app/geoportailv3_geoportal/jsapi/webfonts/
cp /app/geoportailv3_geoportal/static-ngeo/webfonts/*.* /app/geoportailv3_geoportal/jsapi/build/fonts/
cp /app/geoportailv3_geoportal/static-ngeo/webfonts/*.* /app/geoportailv3_geoportal/jsapi/webfonts/

node node_modules/openlayers/tasks/build.js /opt/apiv3/jsapi/config.json /etc/static-ngeo/build/apiv3.js
node node_modules/openlayers/tasks/build.js /etc/apiv3/jsapi/config.json /etc/static-ngeo/build/apiv3.js
# The sourcemap is nonsensical, probably due to a GCC version way too old
# so it is better to disable it
# echo '//# sourceMappingURL=apiv3.js.map' >> /app/geoportailv3_geoportal/static-ngeo/build/apiv3.js
Expand All @@ -28,22 +28,22 @@ node_modules/js-autocomplete/auto-complete.min.js \
node_modules/promise-polyfill/promise.min.js \
node_modules/url-polyfill/url-polyfill.min.js > /etc/static-ngeo/build/vendor.js

./node_modules/.bin/lessc --clean-css /opt/apiv3/jsapi/less/geoportailv3.api.less /etc/static-ngeo/build/apiv3.css
node /opt/apiv3/jsapi/jsdoc/get-ol3-doc-ref.js > /opt/apiv3/.build/jsdocOl3.js
./node_modules/.bin/lessc --clean-css /etc/apiv3/jsapi/less/geoportailv3.api.less /etc/static-ngeo/build/apiv3.css
node /etc/apiv3/jsapi/jsdoc/get-ol3-doc-ref.js > /etc/apiv3/.build/jsdocOl3.js

node node_modules/.bin/jsdoc /opt/apiv3/jsapi/jsdoc/api/index.md -c /opt/apiv3/jsapi/jsdoc/api/conf.json -d /app/geoportailv3_geoportal/jsapi/build/apidoc
cp -R /opt/apiv3/jsapi/examples /app/geoportailv3_geoportal/jsapi/build/apidoc/


cp /opt/apiv3/node_modules/@camptocamp/closure-util/.deps/library/*/closure/goog/base.js /etc/static-ngeo/build/
cp /opt/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.js.map /etc/static-ngeo/build/
cp /etc/apiv3/node_modules/@camptocamp/closure-util/.deps/library/*/closure/goog/base.js /etc/static-ngeo/build/
cp /etc/apiv3/node_modules/mapbox-gl/dist/mapbox-gl.js.map /etc/static-ngeo/build/

cd /etc/static-ngeo/build/
rm -f jsapi_node_modules; ln -s /opt/apiv3/node_modules jsapi_node_modules
rm -f jsapi_src; ln -s /opt/apiv3/jsapi/src/ jsapi_src
rm -f jsapi_closure; ln -s /opt/apiv3/jsapi/closure/ jsapi_closure
rm -f jsapi_node_modules; ln -s /etc/apiv3/node_modules jsapi_node_modules
rm -f jsapi_src; ln -s /etc/apiv3/jsapi/src/ jsapi_src
rm -f jsapi_closure; ln -s /etc/apiv3/jsapi/closure/ jsapi_closure

python3 /opt/apiv3/jsapi/closure/depswriter.py --root_with_prefix=". ../../.." \
python3 /etc/apiv3/jsapi/closure/depswriter.py --root_with_prefix=". ../../.." \
--root_with_prefix="jsapi_node_modules/openlayers/src ./jsapi_node_modules/openlayers/src" \
--root_with_prefix="jsapi_src jsapi_src" \
--root_with_prefix="jsapi_closure jsapi_closure" \
Expand Down

0 comments on commit 492a4dc

Please sign in to comment.