Skip to content

Commit c748d71

Browse files
swennemersLonwyr
authored andcommitted
[FEATURE] Move sap.ui.fl library from internal sapui5.runtime to OpenUI5
This move resolves some cross respository dependencies as controls get enabled for optional UI flexibility. PS 7-9: Adapted .pom to match openui5 libs PS 10: removal of local eslint file from sap.ui.fl/pom.xml Change-Id: I5cf4f16811abd83ca61ae4b83bde6040b56aad7c
1 parent 4f26a1e commit c748d71

File tree

214 files changed

+28144
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

214 files changed

+28144
-0
lines changed

Gruntfile.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -115,6 +115,10 @@ module.exports = function(grunt) {
115115
name: 'sap.uxap',
116116
path: 'src/sap.uxap'
117117
},
118+
{
119+
name: 'sap.ui.fl',
120+
path: 'src/sap.ui.fl'
121+
},
118122
{
119123
name: 'themelib_sap_bluecrystal',
120124
path: 'src/themelib_sap_bluecrystal',

pom.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
<module>src/sap.tnt</module>
4848
<module>src/sap.ui.demokit</module>
4949
<module>src/sap.uxap</module>
50+
<module>src/sap.ui.fl</module>
5051

5152
<!-- theme libraries -->
5253
<!-- TODO <module>src/themelib_sap_hcb</module> -->

src/sap.ui.fl/.eslintignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# Note: Changes to this file also must be applied to the top level .eslintignore file.
2+
target
3+
test

src/sap.ui.fl/pom.xml

Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
3+
4+
5+
<!--**************************************************************************
6+
* POM SECTION: Maven Model Version Settings
7+
***************************************************************************-->
8+
9+
<modelVersion>4.0.0</modelVersion>
10+
11+
12+
<!--**************************************************************************
13+
* POM SECTION: Parent POM Settings
14+
***************************************************************************-->
15+
16+
<parent>
17+
<groupId>com.sap.openui5</groupId>
18+
<artifactId>reactor</artifactId>
19+
<version>1.43.0-SNAPSHOT</version>
20+
<relativePath>../../pom.xml</relativePath>
21+
</parent>
22+
23+
24+
<!--**************************************************************************
25+
* POM SECTION: Maven Settings
26+
***************************************************************************-->
27+
28+
<artifactId>sap.ui.fl</artifactId>
29+
<packaging>jar</packaging>
30+
31+
32+
<!--**************************************************************************
33+
* POM SECTION: Project Settings
34+
***************************************************************************-->
35+
36+
<name>${project.artifactId}</name>
37+
<description>OpenUI5 UI Library: ${project.artifactId}</description>
38+
39+
<!--**************************************************************************
40+
* POM SECTION: Properties Settings
41+
***************************************************************************-->
42+
43+
<properties>
44+
45+
<!-- source paths for Sonar reporting -->
46+
<sonar.sources>src,pom.xml</sonar.sources>
47+
48+
<!-- enable eslint validation -->
49+
<sap.ui5.eslint.skip.validation>false</sap.ui5.eslint.skip.validation>
50+
51+
</properties>
52+
53+
54+
<!--**************************************************************************
55+
* POM SECTION: Dependency Settings
56+
***************************************************************************-->
57+
58+
<dependencies>
59+
<dependency>
60+
<groupId>com.sap.openui5</groupId>
61+
<artifactId>sap.ui.core</artifactId>
62+
<version>${project.version}</version>
63+
</dependency>
64+
<dependency>
65+
<groupId>com.sap.openui5</groupId>
66+
<artifactId>sap.m</artifactId>
67+
<version>${project.version}</version>
68+
</dependency>
69+
</dependencies>
70+
71+
<!--**************************************************************************
72+
* POM SECTION: Build Settings
73+
***************************************************************************-->
74+
75+
<build>
76+
77+
<resources>
78+
<resource>
79+
<directory>src</directory>
80+
<targetPath>META-INF/resources</targetPath>
81+
<filtering>true</filtering>
82+
</resource>
83+
<resource>
84+
<directory>test</directory>
85+
<targetPath>META-INF/test-resources</targetPath>
86+
</resource>
87+
</resources>
88+
89+
</build>
90+
91+
<!--**************************************************************************
92+
* POM SECTION: Profiles Settings
93+
***************************************************************************-->
94+
95+
<profiles>
96+
<!-- creation of a webjars compatible JAR file -->
97+
<profile>
98+
<id>webjars.build</id>
99+
<build>
100+
<plugins>
101+
<plugin>
102+
<groupId>org.apache.maven.plugins</groupId>
103+
<artifactId>maven-resources-plugin</artifactId>
104+
<version>2.5</version>
105+
<executions>
106+
<execution>
107+
<id>webjars-copy-resources</id>
108+
<phase>prepare-package</phase>
109+
<goals>
110+
<goal>copy-resources</goal>
111+
</goals>
112+
<configuration>
113+
<outputDirectory>${project.build.directory}/webjars/META-INF/resources/openui5/${project.version}</outputDirectory>
114+
<resources>
115+
<resource>
116+
<directory>${project.build.outputDirectory}/META-INF/resources</directory>
117+
</resource>
118+
</resources>
119+
</configuration>
120+
</execution>
121+
</executions>
122+
</plugin>
123+
<plugin>
124+
<groupId>org.apache.maven.plugins</groupId>
125+
<artifactId>maven-jar-plugin</artifactId>
126+
<version>2.3.2</version>
127+
<executions>
128+
<execution>
129+
<id>webjars-jar</id>
130+
<phase>package</phase>
131+
<goals>
132+
<goal>jar</goal>
133+
</goals>
134+
<configuration>
135+
<classesDirectory>${project.build.directory}/webjars</classesDirectory>
136+
<classifier>webjars</classifier>
137+
</configuration>
138+
</execution>
139+
</executions>
140+
</plugin>
141+
</plugins>
142+
</build>
143+
</profile>
144+
145+
</profiles>
146+
147+
</project>

src/sap.ui.fl/src/sap/ui/fl/.library

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
<?xml version="1.0" encoding="UTF-8" ?>
2+
<library xmlns="http://www.sap.com/sap.ui.library.xsd" >
3+
4+
<name>sap.ui.fl</name>
5+
<vendor>SAP SE</vendor>
6+
<copyright>${copyright}</copyright>
7+
<version>${version}</version>
8+
9+
<documentation>SAPUI5 library with sap.ui.fl controls.</documentation>
10+
11+
<dependencies>
12+
<dependency>
13+
<libraryName>sap.ui.core</libraryName>
14+
</dependency>
15+
</dependencies>
16+
17+
<appData>
18+
<selenium xmlns="http://www.sap.com/ui5/buildext/selenium" package="com.sap.ui5.selenium.mobileext" />
19+
<jsdoc xmlns="http://www.sap.com/ui5/buildext/jsdoc" >
20+
<exclude name="sap.ui.fl.js." />
21+
</jsdoc>
22+
<!-- excludes for the JSCoverage -->
23+
<jscoverage xmlns="http://www.sap.com/ui5/buildext/jscoverage" >
24+
<exclude name="sap.ui.fl.js." />
25+
</jscoverage>
26+
<!--
27+
<documentation xmlns="http://www.sap.com/ui5/buildext/documentation"
28+
indexUrl="../../../../test-resources/sap/ui/fl/demokit/docuindex.json"
29+
resolve="lib" />
30+
-->
31+
<releasenotes xmlns="http://www.sap.com/ui5/buildext/releasenotes"
32+
url="../../../../test-resources/sap/ui/fl/relnotes/changes-{major}.{minor}.json"
33+
resolve="lib" />
34+
<ownership xmlns="http://www.sap.com/ui5/buildext/ownership">
35+
<component>CA-UI5-FL</component><!-- default component for library, embedded text as a shortcut for <name>text</name> -->
36+
</ownership>
37+
</appData>
38+
39+
</library>

src/sap.ui.fl/src/sap/ui/fl/Cache.js

Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
/*!
2+
* ${copyright}
3+
*/
4+
5+
sap.ui.define(["sap/ui/fl/Utils"], function (Utils) {
6+
"use strict";
7+
8+
/**
9+
* Helper object to access a change from the backend.
10+
* Access helper object for each change (and variant) which was fetched from the backend
11+
*
12+
* @namespace
13+
* @alias sap.ui.fl.Cache
14+
* @experimental Since 1.25.0
15+
* @author SAP SE
16+
* @version ${version}
17+
*/
18+
var Cache = function () {
19+
};
20+
21+
Cache._isOn = true;
22+
23+
Cache._entries = {};
24+
25+
/**
26+
* Indicates if the cache is active or not (for testing)
27+
*
28+
* @returns {boolean} Is Cache currently active or not
29+
*
30+
* @public
31+
*/
32+
Cache.isActive = function () {
33+
return Cache._isOn;
34+
};
35+
36+
/**
37+
* Sets the active state
38+
*
39+
* @param {boolean} bActive - cache active or not
40+
*
41+
* @public
42+
*/
43+
Cache.setActive = function (bActive) {
44+
Cache._isOn = bActive;
45+
};
46+
47+
/**
48+
* This method retrieves the changes for a given
49+
* component. It answers all subsequent calls with the same promise, which
50+
* will resolve with the same result. In the success case, it will keep the
51+
* promise to resolve all calls in future event loop execution paths with
52+
* the same result. In case of an error, it will delete the initial promise
53+
* to give calls from future execution paths the chance to re-request the
54+
* changes from the backend.
55+
*
56+
* If the cache is not active, the method just delegates the call to the
57+
* loadChanges method of the given LrepConnector.
58+
*
59+
* @param {sap.ui.fl.LrepConnector} oLrepConnector - LrepConnector instance to retrieve the changes with
60+
* @param {string} sComponentName - the component name to retrieve the changes for
61+
* @param {map} mPropertyBag - (optional) contains additional data that are needed for reading of changes
62+
* - appDescriptor that belongs to actual component
63+
* - siteId that belongs to actual component
64+
* @returns {Promise} resolves with the change file for the given component, either from cache or backend
65+
*
66+
* @public
67+
*/
68+
Cache.getChangesFillingCache = function (oLrepConnector, sComponentName, mPropertyBag) {
69+
if (!this.isActive()) {
70+
return oLrepConnector.loadChanges(sComponentName, mPropertyBag);
71+
}
72+
73+
var oCacheEntry = Cache._entries[sComponentName];
74+
75+
if (!oCacheEntry) {
76+
oCacheEntry = Cache._entries[sComponentName] = {};
77+
}
78+
79+
if (oCacheEntry.promise) {
80+
return oCacheEntry.promise;
81+
}
82+
83+
var currentLoadChanges = oLrepConnector.loadChanges(sComponentName, mPropertyBag).then(function (mChanges) {
84+
if (oCacheEntry.file) {
85+
Utils.log.error('sap.ui.fl.Cache: Cached changes for component ' + sComponentName + ' overwritten.');
86+
}
87+
88+
oCacheEntry.file = mChanges;
89+
return oCacheEntry.file;
90+
}, function (err) {
91+
delete oCacheEntry.promise;
92+
throw err;
93+
});
94+
95+
oCacheEntry.promise = currentLoadChanges;
96+
97+
return currentLoadChanges;
98+
};
99+
100+
/**
101+
* @private
102+
*
103+
* @param {string} sComponentName - name of the SAPUI5 component
104+
* @returns {array} Array of changes
105+
*/
106+
Cache._getChangeArray = function (sComponentName) {
107+
var oEntry = Cache._entries[sComponentName];
108+
if (oEntry) {
109+
if (oEntry.file) {
110+
return oEntry.file.changes.changes;
111+
}
112+
}
113+
};
114+
115+
/**
116+
* Add a change for the given component to the cached changes.
117+
*
118+
* @param {string} sComponentName Name of the component
119+
* @param {object} oChange The change in JSON format
120+
* @public
121+
*/
122+
Cache.addChange = function (sComponentName, oChange) {
123+
var aChanges = Cache._getChangeArray(sComponentName);
124+
125+
if (!aChanges) {
126+
return;
127+
}
128+
129+
aChanges.push(oChange);
130+
};
131+
132+
/**
133+
* Updates a change for the given component in the cached changes.
134+
*
135+
* @param {string} sComponentName Name of the component
136+
* @param {object} oChange The change in JSON format
137+
* @public
138+
*/
139+
Cache.updateChange = function (sComponentName, oChange) {
140+
var aChanges = Cache._getChangeArray(sComponentName);
141+
142+
if (!aChanges) {
143+
return;
144+
}
145+
146+
for (var i = 0; i < aChanges.length; i++) {
147+
if (aChanges[i].fileName === oChange.fileName) {
148+
aChanges.splice(i, 1, oChange);
149+
break;
150+
}
151+
}
152+
};
153+
154+
/**
155+
* Delete a change for the given component from the cached changes.
156+
*
157+
* @param {string} sComponentName Name of the SAPUI5 component
158+
* @param {object} oChangeDefinition The change in JSON format
159+
* @public
160+
*/
161+
Cache.deleteChange = function (sComponentName, oChangeDefinition) {
162+
var aChanges = Cache._getChangeArray(sComponentName);
163+
164+
if (!aChanges) {
165+
return;
166+
}
167+
168+
for (var i = 0; i < aChanges.length; i++) {
169+
if (aChanges[i].fileName === oChangeDefinition.fileName) {
170+
aChanges.splice(i, 1);
171+
break;
172+
}
173+
}
174+
};
175+
176+
return Cache;
177+
}, /* bExport= */true);

0 commit comments

Comments
 (0)