Skip to content

Commit

Permalink
Fetch License Files at Build Time from Their Official Websites (winer…
Browse files Browse the repository at this point in the history
…y#351)

Official license files (Apache 2.0, EPL 2.0) are fetched during Maven build as text files
and used at runtime by the UI.
An additional "Proprietary" license is added with the text "proprietary". The text file is
stored in assets/licenses.
The generation of the copybara configuration file is changed so it is more robust (not using
magic numbers) but potentially less efficient. The reason is that this operation is only
executed once every month or two, and being fraction of seconds slower is fine regarding that it
is more robust.


Signed-off-by: Ghareeb Falazi <[email protected]>
  • Loading branch information
ghareeb-falazi authored and lharzenetter committed Jul 31, 2018
1 parent ee7b5ca commit 2b73c16
Show file tree
Hide file tree
Showing 28 changed files with 172 additions and 2,422 deletions.
21 changes: 21 additions & 0 deletions checkstyle-suppressions.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?xml version="1.0"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2018 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
~
~ This program and the accompanying materials are made available under the
~ terms of the Eclipse Public License 2.0 which is available at
~ http://www.eclipse.org/legal/epl-2.0, or the Apache Software License 2.0
~ which is available at https://www.apache.org/licenses/LICENSE-2.0.
~
~ SPDX-License-Identifier: EPL-2.0 OR Apache-2.0
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~-->
<!DOCTYPE suppressions PUBLIC
"-//Puppy Crawl//DTD Suppressions 1.1//EN"
"http://www.puppycrawl.com/dtds/suppressions_1_1.dtd">

<suppressions>
<suppress files="[\\/]gen[\\/]" checks="[a-zA-Z0-9]*"/>
</suppressions>
5 changes: 4 additions & 1 deletion checkstyle.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2017 Contributors to the Eclipse Foundation
~ Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
Expand Down Expand Up @@ -41,4 +41,7 @@
</module>
-->
</module>
<module name="SuppressionFilter">
<property name="file" value="checkstyle-suppressions.xml"/>
</module>
</module>
1 change: 1 addition & 0 deletions org.eclipse.winery.repository.ui/.gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ npm-debug.log
/doc/
/dist/
/src/assets/built-codeEdit15_1
/src/assets/licenses/
30 changes: 30 additions & 0 deletions org.eclipse.winery.repository.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,36 @@
<unpack>true</unpack>
</configuration>
</execution>
<execution>
<phase>generate-sources</phase>
<id>download-apache-2.0-license</id>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>
http://www.apache.org/licenses/LICENSE-2.0.txt
</url>
<outputFileName>Apache-2.0.txt</outputFileName>
<outputDirectory>src/assets/licenses</outputDirectory>
<unpack>false</unpack>
</configuration>
</execution>
<execution>
<phase>generate-sources</phase>
<id>download-epl-2.0-license</id>
<goals>
<goal>wget</goal>
</goals>
<configuration>
<url>
https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt
</url>
<outputFileName>EPL-2.0.txt</outputFileName>
<outputDirectory>src/assets/licenses</outputDirectory>
<unpack>false</unpack>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ export class InterfacesComponent implements OnInit {
this.inputParameters = null;
}
this.selectedInterface = selectedInterface;
this.operations = selectedInterface.operation;
this.operations = selectedInterface.operations;
this.selectedOperation = null;
}

Expand Down Expand Up @@ -151,7 +151,7 @@ export class InterfacesComponent implements OnInit {
delete tmp.otherAttributes;
}

this.selectedInterface.operation.push(tmp);
this.selectedInterface.operations.push(tmp);
this.onOperationSelected(tmp);
}
}
Expand Down Expand Up @@ -260,11 +260,11 @@ export class InterfacesComponent implements OnInit {
// region ########## Generate Lifecycle Interface ##########
generateLifecycleInterface(): void {
const lifecycle = new InterfacesApiData('http://opentosca.org/interfaces/lifecycle');
lifecycle.operation.push(new InterfaceOperationApiData('install'));
lifecycle.operation.push(new InterfaceOperationApiData('configure'));
lifecycle.operation.push(new InterfaceOperationApiData('start'));
lifecycle.operation.push(new InterfaceOperationApiData('stop'));
lifecycle.operation.push(new InterfaceOperationApiData('uninstall'));
lifecycle.operations.push(new InterfaceOperationApiData('install'));
lifecycle.operations.push(new InterfaceOperationApiData('configure'));
lifecycle.operations.push(new InterfaceOperationApiData('start'));
lifecycle.operations.push(new InterfaceOperationApiData('stop'));
lifecycle.operations.push(new InterfaceOperationApiData('uninstall'));
this.interfacesData.push(lifecycle);
this.interfaceComponent.selectItem(lifecycle);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ import {WineryComponent} from '../../../model/wineryComponent';
import {NodeOperation, PlanOperation, RelationshipOperation} from './targetInterface/operations';

export class InterfacesApiData {
operation: InterfaceOperationApiData[] = [];
operations: InterfaceOperationApiData[] = [];
name: string;
id: string;
text: string;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,10 +52,10 @@ <h4>Target Interface and Operation</h4>
(selected)="onInterfaceSelected($event)">
</ng-select>
<br>
<div *ngIf="activeInterface.operation">
<div *ngIf="activeInterface.operations">
<label for="operationOperation">Operation</label>
<ng-select id="operationOperation"
[items]="activeInterface.operation"
[items]="activeInterface.operations"
[active]="[activeOperation]"
[textField]="'name'"
[idField]="'name'"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -157,12 +157,12 @@ export class WineryTargetInterfaceComponent implements OnInit, OnChanges {
this.activeInterface = this.interfaces.find((element) => {
return element.name === event.id;
});
this.activeOperation = this.activeInterface.operation[0];
this.activeOperation = this.activeInterface.operations[0];
this.setInterfaceAndOperation();
}

onOperationSelected(event: SelectItem) {
this.activeOperation = this.activeInterface.operation.find((element) => {
this.activeOperation = this.activeInterface.operations.find((element) => {
return element.name === event.id;
});
this.setInterfaceAndOperation();
Expand Down Expand Up @@ -240,7 +240,7 @@ export class WineryTargetInterfaceComponent implements OnInit, OnChanges {
this.activeInterface = nodeInterface ? nodeInterface : this.interfaces[0];

if (!isNullOrUndefined(this.activeInterface)) {
this.activeOperation = this.activeInterface.operation.find((element, id, arr) => {
this.activeOperation = this.activeInterface.operations.find((element, id, arr) => {
return element.name === this.operation.nodeOperation.operationName;
});
}
Expand All @@ -252,14 +252,14 @@ export class WineryTargetInterfaceComponent implements OnInit, OnChanges {
this.activeInterface = relInterface ? relInterface : this.interfaces[0];

if (!isNullOrUndefined(this.activeInterface)) {
this.activeOperation = this.activeInterface.operation.find((element, id, arr) => {
this.activeOperation = this.activeInterface.operations.find((element, id, arr) => {
return element.name === this.operation.relationshipOperation.operationName;
});
}
}

if (!isNullOrUndefined(this.activeInterface) && isNullOrUndefined(this.activeOperation)) {
this.activeOperation = this.activeInterface.operation[0];
this.activeOperation = this.activeInterface.operations[0];
}

this.setInterfaceAndOperation();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,5 +32,5 @@ export class GitChange {
name: string;
type: string;
path: string;
diff: string;
diffs: string;
}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<!--~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
~ Copyright (c) 2017 Contributors to the Eclipse Foundation
~ Copyright (c) 2017-2018 Contributors to the Eclipse Foundation
~
~ See the NOTICE file(s) distributed with this work for additional
~ information regarding copyright ownership.
Expand Down
Loading

0 comments on commit 2b73c16

Please sign in to comment.