Breaks hermetic build.

Revert "Minor fixes for the Bazel build of GUI2"

This reverts commit 42db831c4ac2bb0c9afc5e4dc34c9d766a9d6034.

Change-Id: I3bf0793753c0bedfbcbf242108736fc7247e29b3
This commit is contained in:
Thomas Vachuska 2018-08-29 17:59:47 +00:00
parent 42db831c4a
commit 277ec4e2f4
10 changed files with 69 additions and 88 deletions

View File

@ -108,7 +108,7 @@ genrule(
" export HOME=. &&" +
" export XDG_CONFIG_HOME=$(@D)/config &&" + # npm config cache to the sandbos
" export BABEL_DISABLE_CACHE=1 &&" + # turn off babel cache
" if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS='--proxy $$HTTP_PROXY --without-ssl --insecure'; else NPM_ARGS=''; fi &&" +
' if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS="--proxy $$HTTP_PROXY --without-ssl --insecure"; else NPM_ARGS=""; fi &&' +
" NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
" mkdir -p tools/gui &&" +
" cd tools/gui &&" +
@ -205,15 +205,6 @@ osgi_jar_with_tests(
deps = COMPILE_DEPS,
)
filegroup(
name = "onos-gui-java-for-gui2",
srcs = glob([
"src/main/java/org/onosproject/ui/impl/Main*Resource.java",
"src/main/java/org/onosproject/ui/impl/ApplicationResource.java",
]),
visibility = ["//visibility:public"],
)
"""
Builds the tar ball for the ONOS GUI
"""

View File

@ -120,11 +120,10 @@ genrule(
" export HOME=. &&" +
" export XDG_CONFIG_HOME=$(@D)/config &&" + # npm config cache to the sandbox
" export BABEL_DISABLE_CACHE=1 &&" + # turn off babel cache
" if [[ ! -z $${HTTP_PROXY-} ]]; then NPM_ARGS='--proxy $$HTTP_PROXY --without-ssl --insecure'; else NPM_ARGS=''; fi &&" +
" NPM=$$ROOT/$(location @nodejs//:bin/npm) &&" +
" mkdir -p web/gui2 &&" +
" cd web/gui2 &&" +
" $$NPM $$NPM_ARGS install --no-cache --loglevel=error > $$ROOT/$(location onos-gui2-npm-install.log) 2>&1 &&" +
" $$NPM install --no-cache --loglevel=error > $$ROOT/$(location onos-gui2-npm-install.log) 2>&1 &&" +
" jar Mcf $$ROOT/$(location onos-gui2-npm-install.jar) . &&" +
" touch $$ROOT/$(location onos-gui2-npm-install.log)", # to get the log always as the 2nd file
visibility = ["//visibility:public"],
@ -301,9 +300,9 @@ genrule(
osgi_jar_with_tests(
name = "_onos-gui2-base-jar",
srcs = [
"src/main/java/org/onosproject/ui/impl/gui2/LogoutResource.java",
"//web/gui:onos-gui-java-for-gui2",
exclude_tests = [
"org.onosproject.ui.impl.AbstractUiImplTest",
"org.onosproject.ui.impl.topo.model.AbstractTopoModelTest",
],
test_deps = TEST_DEPS,
web_context = "/onos/ui2",
@ -320,7 +319,6 @@ genrule(
":_onos-gui2-ng-build",
":_onos-gui2-base-jar",
":_web_inf_classes_files",
"src/main/webapp/WEB-INF/web.xml",
],
outs = ["onos-gui2.jar"],
cmd = " ROOT=`pwd` &&" +
@ -331,7 +329,7 @@ genrule(
" (cd WEB-INF/classes && jar xf $$ROOT/$${BUILD_FILES[1]}) &&" +
" jar xf $$ROOT/$(location :_onos-gui2-base-jar) &&" +
" find . -type f -exec touch -t 201808280000 {} \; &&" +
" jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/web.xml WEB-INF/classes",
" jar cmf META-INF/MANIFEST.MF $$ROOT/$@ WEB-INF/classes",
output_to_bindir = 1,
visibility = ["//visibility:public"],
)

View File

@ -81,7 +81,11 @@ Run `ng generate component component-name` to generate a new component. You can
## Build
The build is handled through the web/gui2/BUCK file. This downloads Node, NPM and Angular CLI
It runs ```ng build --prod --extract-css``` and copies everything over in to WEB-INF/classes/dist
It runs ```ng build --prod --extract-css``` and copies everything over in to WEB-INF/classes/dist (there
is something weird in BUCK resources - if there is a file in the root dir of the
outputted folder this is copied to the sources root directory, where as files
are copied to WEB-INF/classes. To get around this I put all the outputted stuff in to
```dist``` and it gets copied to /WEB-INF/classes/dist/ )
To run it manually in Angular CLI run `ng build` (and add on --prod --extract-css --watch as necessary to alter its behaviour)

View File

@ -0,0 +1,34 @@
/*
* Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ui.impl;
/**
* A dummy class to satisfy Bazel build.
* Since all classes implementing the REST interface to the GUI framework for GUI2
* are in the /web/gui project, no classes are needed here.
*/
public final class DummyClass {
private static final String DUMMY_ATTRIBUTE = "test";
private DummyClass() {
//Hidden
}
static String getDummyAttribute() {
return DUMMY_ATTRIBUTE;
}
}

View File

@ -1,46 +0,0 @@
/*
* Copyright 2018-present Open Networking Foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.onosproject.ui.impl.gui2;
import org.onlab.rest.BaseResource;
import javax.servlet.http.HttpServletRequest;
import javax.ws.rs.GET;
import javax.ws.rs.Path;
import javax.ws.rs.core.Context;
import javax.ws.rs.core.Response;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
/**
* Application upload resource for GUI 2.
*/
@Path("logout")
public class LogoutResource extends BaseResource {
@Context
private HttpServletRequest servletRequest;
@GET
public Response logout() throws IOException, URISyntaxException {
servletRequest.getSession().invalidate();
String url = servletRequest.getRequestURL().toString();
url = url.replaceFirst("/onos/ui2/.*", "/onos/ui2/login.html");
return Response.temporaryRedirect(new URI(url)).build();
}
}

View File

@ -15,6 +15,6 @@
*/
/**
* Set of resources providing data for the ONOS GUI2.
* Set of resources providing data for the ONOS GUI.
*/
package org.onosproject.ui.impl.gui2;
package org.onosproject.ui.impl;

View File

@ -135,25 +135,25 @@
<!--<url-pattern>/raw/*</url-pattern>-->
<!--</servlet-mapping>-->
<servlet>
<servlet-name>JAX-RS Service</servlet-name>
<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>
<init-param>
<param-name>jersey.config.server.provider.classnames</param-name>
<param-value>
org.glassfish.jersey.media.multipart.MultiPartFeature,
org.onosproject.ui.impl.gui2.LogoutResource,
<!--<servlet>-->
<!--<servlet-name>JAX-RS Service</servlet-name>-->
<!--<servlet-class>org.glassfish.jersey.servlet.ServletContainer</servlet-class>-->
<!--<init-param>-->
<!--<param-name>jersey.config.server.provider.classnames</param-name>-->
<!--<param-value>-->
<!--org.glassfish.jersey.media.multipart.MultiPartFeature,-->
<!--org.onosproject.ui.impl.LogoutResource,-->
<!--org.onosproject.ui.impl.TopologyResource,-->
org.onosproject.ui.impl.ApplicationResource
</param-value>
</init-param>
<load-on-startup>1</load-on-startup>
</servlet>
<!--org.onosproject.ui.impl.ApplicationResource-->
<!--</param-value>-->
<!--</init-param>-->
<!--<load-on-startup>1</load-on-startup>-->
<!--</servlet>-->
<servlet-mapping>
<servlet-name>JAX-RS Service</servlet-name>
<url-pattern>/rs/*</url-pattern>
</servlet-mapping>
<!--<servlet-mapping>-->
<!--<servlet-name>JAX-RS Service</servlet-name>-->
<!--<url-pattern>/rs/*</url-pattern>-->
<!--</servlet-mapping>-->
<!--<servlet>-->
<!--<servlet-name>Web Socket Service</servlet-name>-->

View File

@ -118,7 +118,7 @@
</td>
<td class="table-icon">
<!-- The path below gets the app icon from the old GUI path -->
<img src="rs/applications/{{app.icon}}/icon"
<img src="../../ui/rs/applications/{{app.icon}}/icon"
height="24px" width="24px" />
</td>
<td>{{ app.title }}</td>

View File

@ -39,7 +39,7 @@ const DRAGDROPMSG1 = 'Drag and drop one file at a time';
const DRAGDROPMSGEXT = 'Only files ending in .oar can be dropped';
/** Prefix to access the REST service for applications */
export const APPURLPREFIX = 'rs/applications/';
export const APPURLPREFIX = '../../ui/rs/applications/'; // TODO: This is a hack to work off GUIv1 URL
/** Suffix to access the icon of the application - gives back an image */
export const ICONURLSUFFIX = '/icon';

View File

@ -17,15 +17,15 @@ package org.onosproject.ui.impl;
import org.junit.Test;
import static org.junit.Assert.assertTrue;
import static org.junit.Assert.assertEquals;
/**
* This is just a dummy file to satisfy Bazel's need for a file to be present.
* This is just a dummy file to get BUCK going.
*/
public class DummyTest {
@Test
public void dummyTest() {
assertTrue(true);
assertEquals("test", DummyClass.getDummyAttribute());
}
}