Skip to content
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

Create and integrate a new task 'generateLibraryManifest' #26

Merged
merged 4 commits into from
Jun 29, 2018

Conversation

codeworrior
Copy link
Member

The task creates a manifest.json file for libraries that don't have one.
It collects the necessary information from the project structure
(supported themes, versions of dependencies), from the .library file
(name, dependencies, supported themes, thirdparty components, i18n
information...) and from an initLibrary call inside the library.js file
(implemented controls, elements, types and interfaces, noLibraryCSS
flag).

An existing manifest.json won't be modified or overwritten.

@codeworrior codeworrior force-pushed the generate-manifest-json branch from 52bfd6d to acbd0e4 Compare June 21, 2018 10:05
@coveralls
Copy link

coveralls commented Jun 21, 2018

Pull Request Test Coverage Report for Build 182

  • 143 of 237 (60.34%) changed or added relevant lines in 3 files are covered.
  • 11 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-3.7%) to 59.117%

Changes Missing Coverage Covered Lines Changed/Added Lines %
lib/types/library/LibraryBuilder.js 1 3 33.33%
lib/tasks/bundlers/generateLibraryManifest.js 15 21 71.43%
lib/processors/manifestCreator.js 127 213 59.62%
Files with Coverage Reduction New Missed Lines %
lib/tasks/buildThemes.js 5 53.57%
lib/types/library/LibraryBuilder.js 6 81.82%
Totals Coverage Status
Change from base Build 167: -3.7%
Covered Lines: 561
Relevant Lines: 857

💛 - Coveralls

@codeworrior codeworrior force-pushed the generate-manifest-json branch from abe939e to 8de9c49 Compare June 25, 2018 12:40
@codeworrior
Copy link
Member Author

Note: the test failures are due to a bug in the ui5-fs project. The bug has been fixed with SAP/ui5-fs#11, which might be part of 0.0.2.

@RandomByte
Copy link
Member

There's yet no ui5-fs release containing that fix. Will create one later today

The task creates a manifest.json file for libraries that don't have one.
It collects the necessary information from the project structure
(supported themes, versions of dependencies), from the .library file
(name, dependencies, supported themes, thirdparty components, i18n
information...) and from an initLibrary call inside the library.js file
(implemented controls, elements, types and interfaces, noLibraryCSS
flag).

An existing manifest.json won't be modified or overwritten.
- refactor test scenario 'library.h' so that the sub-components reside
  in the namespace of the library
- add new test scenario 'library.i' to test manifest creation with 
  data from .library and library.js file
- add the newly generated manifest.json to the expected content of 
  the other library test scenarios
- enhance all libr<ary test scenarios with a dependency to a fake 
  'sap.ui.core' lib. For UI5 libs, this dependency is mandatory and 
  manifest generations needs it to determine the UI5 version

- fix eslint issues in the new task/processor
- fix functional issues in manifestCreator that came up in the tests

Change-Id: I02f20c09298d65b2818ec0faeb76252c21d93d91
@codeworrior codeworrior force-pushed the generate-manifest-json branch from 8de9c49 to d1725df Compare June 26, 2018 17:09
@matz3
Copy link
Member

matz3 commented Jun 26, 2018

@codeworrior LGTM, I just fixed some minor copy & paste leftovers

return workspace.byGlob("/resources/**/.library").then((libraryIndicatorResources) => {
if (libraryIndicatorResources.length < 1) {
// No library found - nothing to do
log.error(`Could not find a ".library" file for project ${options.projectName}. Skipping library manifest generation.`);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want this to be an error?
I think most of the libraries developed in the wild doesn't have a .library file as it wasn't used at all except by the maven tooling.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we take "manifest first for libraries" serious, we need at least to enforce a manifest.json. So we could check for that and if there's a manifest.json then the .library becomes optional.

But it doesn't have to be this task that complains about it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

More likely the job of the LibraryFormatter.

The ApplicationFormatter already reads an applications manifest, though it doesn't insist on it.

Copy link
Member Author

@codeworrior codeworrior left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

task should be moved one level up, out of the bundlers package, that's also a copy&paste error

Also re-classify log message for missing .library file as 'verbose'
@codeworrior
Copy link
Member Author

any chance to get another review?

@codeworrior
Copy link
Member Author

merci :)

@codeworrior codeworrior merged commit 000a6fe into master Jun 29, 2018
@codeworrior codeworrior deleted the generate-manifest-json branch June 29, 2018 16:18
@codeworrior
Copy link
Member Author

@matz3: when doing this PR, I didn't know about the best practice of exporting everything in index.js. Shouldn't the generateLibraryManifest task also be added there?

@RandomByte
Copy link
Member

For consistency reasons I would say yes.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants