From 2b73c16518161ce682b12ee75144b525bb5e43b2 Mon Sep 17 00:00:00 2001 From: Ghareeb Falazi Date: Tue, 31 Jul 2018 15:25:22 +0200 Subject: [PATCH] Fetch License Files at Build Time from Their Official Websites (#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 --- checkstyle-suppressions.xml | 21 + checkstyle.xml | 5 +- org.eclipse.winery.repository.ui/.gitignore | 1 + org.eclipse.winery.repository.ui/pom.xml | 30 ++ .../interfaces/interfaces.component.ts | 14 +- .../interfaces/interfacesApiData.ts | 2 +- .../wineryTargetInterface.component.html | 4 +- .../wineryTargetInterface.component.ts | 10 +- .../src/app/wineryGitLog/GitLogApiData.ts | 2 +- .../wineryGitLog/wineryGitLog.component.html | 2 +- .../wineryLicenseModule/licenses/AGPL-3.0.ts | 374 ----------------- .../licenses/Apache-2.0.ts | 147 ------- .../licenses/BSD-2-Clause.ts | 28 -- .../licenses/BSD-3-Clause.ts | 32 -- .../wineryLicenseModule/licenses/EPL-1.0.ts | 151 ------- .../wineryLicenseModule/licenses/EPL-2.0.ts | 272 ------------ .../wineryLicenseModule/licenses/GPL-2.0.ts | 188 --------- .../wineryLicenseModule/licenses/GPL-3.0.ts | 392 ------------------ .../wineryLicenseModule/licenses/LGPL-2.1.ts | 290 ------------- .../wineryLicenseModule/licenses/LGPL-3.0.ts | 112 ----- .../app/wineryLicenseModule/licenses/MIT.ts | 26 -- .../wineryLicenseModule/licenses/MPL-2.0.ts | 224 ---------- .../wineryLicenseModule/licenses/Unlicense.ts | 37 -- .../wineryLicense.component.ts | 25 +- .../wineryLicenseModule/wineryLicense.enum.ts | 101 ----- .../wineryLicense.service.ts | 45 +- .../app/wineryLicenseModule/wineryLicense.ts | 32 ++ .../copybaragenerator/CopybaraGenerator.java | 27 +- 28 files changed, 172 insertions(+), 2422 deletions(-) create mode 100644 checkstyle-suppressions.xml delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/AGPL-3.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/Apache-2.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/BSD-2-Clause.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/BSD-3-Clause.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/EPL-1.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/EPL-2.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/GPL-2.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/GPL-3.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/LGPL-2.1.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/LGPL-3.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/MIT.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/MPL-2.0.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/licenses/Unlicense.ts delete mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/wineryLicense.enum.ts create mode 100644 org.eclipse.winery.repository.ui/src/app/wineryLicenseModule/wineryLicense.ts diff --git a/checkstyle-suppressions.xml b/checkstyle-suppressions.xml new file mode 100644 index 0000000000..2ec1e997da --- /dev/null +++ b/checkstyle-suppressions.xml @@ -0,0 +1,21 @@ + + + + + + + diff --git a/checkstyle.xml b/checkstyle.xml index e0032522ea..6ed5c39bf6 100644 --- a/checkstyle.xml +++ b/checkstyle.xml @@ -1,6 +1,6 @@ + + + diff --git a/org.eclipse.winery.repository.ui/.gitignore b/org.eclipse.winery.repository.ui/.gitignore index a75466f562..9f03fa2c9e 100644 --- a/org.eclipse.winery.repository.ui/.gitignore +++ b/org.eclipse.winery.repository.ui/.gitignore @@ -12,3 +12,4 @@ npm-debug.log /doc/ /dist/ /src/assets/built-codeEdit15_1 +/src/assets/licenses/ diff --git a/org.eclipse.winery.repository.ui/pom.xml b/org.eclipse.winery.repository.ui/pom.xml index 2b5cd142d6..bdf47816dc 100644 --- a/org.eclipse.winery.repository.ui/pom.xml +++ b/org.eclipse.winery.repository.ui/pom.xml @@ -63,6 +63,36 @@ true + + generate-sources + download-apache-2.0-license + + wget + + + + http://www.apache.org/licenses/LICENSE-2.0.txt + + Apache-2.0.txt + src/assets/licenses + false + + + + generate-sources + download-epl-2.0-license + + wget + + + + https://www.eclipse.org/org/documents/epl-2.0/EPL-2.0.txt + + EPL-2.0.txt + src/assets/licenses + false + + diff --git a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfaces.component.ts b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfaces.component.ts index 754e13af9b..b10264ce8c 100644 --- a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfaces.component.ts +++ b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfaces.component.ts @@ -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; } @@ -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); } } @@ -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); } diff --git a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfacesApiData.ts b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfacesApiData.ts index 8ca15ecfa9..a887b0d55e 100644 --- a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfacesApiData.ts +++ b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/interfacesApiData.ts @@ -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; diff --git a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/targetInterface/wineryTargetInterface.component.html b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/targetInterface/wineryTargetInterface.component.html index b162a71597..4b6b399612 100644 --- a/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/targetInterface/wineryTargetInterface.component.html +++ b/org.eclipse.winery.repository.ui/src/app/instance/sharedComponents/interfaces/targetInterface/wineryTargetInterface.component.html @@ -52,10 +52,10 @@

Target Interface and Operation

(selected)="onInterfaceSelected($event)">
-
+
{ 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(); @@ -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; }); } @@ -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(); diff --git a/org.eclipse.winery.repository.ui/src/app/wineryGitLog/GitLogApiData.ts b/org.eclipse.winery.repository.ui/src/app/wineryGitLog/GitLogApiData.ts index 7700d6cfa0..f76750d482 100644 --- a/org.eclipse.winery.repository.ui/src/app/wineryGitLog/GitLogApiData.ts +++ b/org.eclipse.winery.repository.ui/src/app/wineryGitLog/GitLogApiData.ts @@ -32,5 +32,5 @@ export class GitChange { name: string; type: string; path: string; - diff: string; + diffs: string; } diff --git a/org.eclipse.winery.repository.ui/src/app/wineryGitLog/wineryGitLog.component.html b/org.eclipse.winery.repository.ui/src/app/wineryGitLog/wineryGitLog.component.html index 6309d8cc50..e6422c286b 100644 --- a/org.eclipse.winery.repository.ui/src/app/wineryGitLog/wineryGitLog.component.html +++ b/org.eclipse.winery.repository.ui/src/app/wineryGitLog/wineryGitLog.component.html @@ -1,5 +1,5 @@