-
Notifications
You must be signed in to change notification settings - Fork 22
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[INTERNAL] Export build processor manifestCreator #648
Changes from 2 commits
aecb9ad
7b0b065
ff8cd13
bc97b3c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,7 +157,7 @@ class LibraryBundle { | |
/* | ||
* Creates the library manifest.json file for a UILibrary. | ||
*/ | ||
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty) { | ||
async function createManifest(libraryResource, libBundle, descriptorVersion, _include3rdParty, minUI5VersionRequired) { | ||
// create a Library wrapper around the .library XML | ||
const library = await Library.from(libraryResource); | ||
|
||
|
@@ -604,7 +604,7 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in | |
} | ||
|
||
function normalizeVersion(version) { | ||
if ( version == null ) { | ||
if ( version == null || !minUI5VersionRequired && !version ) { | ||
return version; | ||
} | ||
const v = new Version(version); | ||
|
@@ -634,6 +634,10 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in | |
} | ||
} | ||
|
||
if ( !minUI5VersionRequired ) { | ||
return ""; | ||
} | ||
|
||
throw new Error( | ||
`Couldn't find version for library '${dependency.getLibraryName()}', project dependency missing?`); | ||
} | ||
|
@@ -652,9 +656,10 @@ async function createManifest(libraryResource, libBundle, descriptorVersion, _in | |
module.exports = function({libraryResource, resources, options}) { | ||
// merge options with defaults | ||
options = Object.assign({ | ||
descriptorVersion: APP_DESCRIPTOR_V22, // TODO change this to type string instead of a semver object | ||
descriptorVersion: APP_DESCRIPTOR_V22, // TODO 3.0: change this to type string instead of a semver object | ||
include3rdParty: true, | ||
prettyPrint: true | ||
prettyPrint: true, | ||
minUI5VersionRequired: true | ||
}, options); | ||
|
||
const resourcePathPrefix = libraryResource.getPath().slice(0, -".library".length); | ||
|
@@ -667,7 +672,8 @@ module.exports = function({libraryResource, resources, options}) { | |
return Promise.resolve(null); // a fulfillment of null indicates that no manifest has been created | ||
} | ||
|
||
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty) | ||
return createManifest(libraryResource, libBundle, options.descriptorVersion, options.include3rdParty, | ||
options.minUI5VersionRequired) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I would prefer a switch to simply omit the minUI5Version instead of trying to resolve it. Maybe In the ui5-server use case, there is no benefit from having the minUI5Version available in some cases. So I think it should never be available in order to keep things simpler. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, let's call it omitMinVersions because not only the minUI5Version but also the minVersion of dependencies could lead to issues. The added versionInfoGenerator test proves that missing (empty string) minVersion/minUI5Version info doesn't affect the result of a sap-ui-version.json |
||
.then((manifest) => { | ||
return new EvoResource({ | ||
path: resourcePathPrefix + "manifest.json", | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think the
getVersion
function is used for more than the minUI5Version. Why not move this if into thegetUI5Version
function instead?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See discussion below #648 (comment)