Sean Condon | 83fc39f | 2018-04-19 18:56:13 +0100 | [diff] [blame] | 1 | |
| 2 | COMPILE_DEPS = [ |
| 3 | '//lib:CORE_DEPS', |
| 4 | '//lib:JACKSON', |
| 5 | '//lib:KRYO', |
| 6 | '//lib:javax.ws.rs-api', |
| 7 | '//lib:servlet-api', |
| 8 | '//lib:jetty-websocket', |
| 9 | '//lib:jetty-util', |
| 10 | '//lib:jersey-media-multipart', |
| 11 | '//lib:org.apache.karaf.shell.console', |
| 12 | '//cli:onos-cli', |
| 13 | '//lib:jersey-server', |
| 14 | '//incubator/api:onos-incubator-api', |
| 15 | '//incubator/net:onos-incubator-net', |
| 16 | '//utils/rest:onlab-rest', |
| 17 | '//core/store/serializers:onos-core-serializers', |
| 18 | ':node-release-v8.11.1', |
| 19 | ':node-bin-v8.11.1', |
| 20 | '//web/gui2:onos-web-gui2-build', |
| 21 | ] |
| 22 | |
| 23 | TEST_DEPS = [ |
| 24 | '//lib:TEST', |
| 25 | '//core/api:onos-api-tests', |
| 26 | '//drivers/default:onos-drivers-default', |
| 27 | ] |
| 28 | |
| 29 | include_defs('//bucklets/node.bucklet') |
| 30 | |
| 31 | fetch_node(version = 'v8.11.1') |
| 32 | |
| 33 | genrule( |
| 34 | name = 'onos-web-gui2-build', |
| 35 | srcs = glob([ |
| 36 | './**/*.json', |
| 37 | 'src/main/webapp/**/*.ts', |
| 38 | 'src/main/webapp/**/*.html', |
| 39 | 'src/main/webapp/**/*.css', |
| 40 | 'src/main/webapp/**/*.png' |
| 41 | ], excludes = [ |
| 42 | 'dist/**/*', |
| 43 | 'node_modules/**/*', |
| 44 | 'src/main/webapp/dist/**/*' |
| 45 | ]), |
| 46 | bash = |
| 47 | #To avoid any older 'NodeJS' installations it is necessary to use only the one |
| 48 | # associated with this project - Angular 6 won't work on older releases |
| 49 | 'export PATH=$(location :node-bin-v8.11.1)/bin:$PATH; ' |
| 50 | + 'echo $PATH;' |
| 51 | + '$(location :node-bin-v8.11.1)/bin/node -v;' |
| 52 | + 'ORIGPATH=`pwd`;' |
| 53 | + 'cd $(location :node-bin-v8.11.1)/bin &&' |
| 54 | + 'ln -sf ../lib/node_modules/npm/bin/npm-cli.js npm5 &&' |
| 55 | + 'cd $ORIGPATH &&' |
| 56 | # The symlink to npm is not always created properly by the BUCK job that |
| 57 | # untars it. It's safer to have our own symlink 'npm5' |
| 58 | + 'npm5 -v;' |
| 59 | + 'npm5 install -g @angular/cli@6.0.0 2>&1;' |
| 60 | + 'npm5 install -g @compodoc/compodoc 2>&1;' |
| 61 | + 'npm5 install 2>&1;' |
| 62 | + 'ng -v;' |
| 63 | + 'ng build --preserve-symlinks --base-href /onos/ui2/dist/ --deploy-url /onos/ui2/dist/ --output-path=$OUT 2>&1;', |
| 64 | out = 'dist', |
| 65 | visibility = [ 'PUBLIC' ], |
| 66 | ) |
| 67 | |
| 68 | osgi_jar_with_tests ( |
| 69 | name = 'onos-gui2', |
| 70 | deps = COMPILE_DEPS, |
| 71 | test_deps = TEST_DEPS, |
| 72 | resources = [':onos-web-gui2-build'], |
| 73 | resources_root = '.', |
| 74 | web_context = '/onos/ui2', |
| 75 | do_javadocs = False, |
| 76 | ) |