Skip to content

Commit

Permalink
[FIX] Replace copyright and version strings in *.json and .library files
Browse files Browse the repository at this point in the history
Currently only placeholders in *.js files are processed

Fixes #76
  • Loading branch information
RandomByte committed Oct 9, 2018
1 parent 6ee52c3 commit f305429
Show file tree
Hide file tree
Showing 13 changed files with 29 additions and 23 deletions.
6 changes: 3 additions & 3 deletions lib/types/application/ApplicationBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ class ApplicationBuilder extends AbstractBuilder {
constructor({resourceCollections, project, parentLogger}) {
super({project, parentLogger});

// All available library tasks in execution order
// All available application tasks in execution order
this.availableTasks = [
"replaceCopyright",
"replaceVersion",
Expand All @@ -37,7 +37,7 @@ class ApplicationBuilder extends AbstractBuilder {
workspace: resourceCollections.workspace,
options: {
copyright: project.metadata.copyright,
pattern: "/**/*.js"
pattern: "/**/*.{js,json}"
}
});
});
Expand All @@ -47,7 +47,7 @@ class ApplicationBuilder extends AbstractBuilder {
workspace: resourceCollections.workspace,
options: {
version: project.version,
pattern: "/**/*.js"
pattern: "/**/*.{js,json}"
}
});
});
Expand Down
4 changes: 2 additions & 2 deletions lib/types/library/LibraryBuilder.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ class LibraryBuilder extends AbstractBuilder {
workspace: resourceCollections.workspace,
options: {
copyright: project.metadata.copyright,
pattern: "/resources/**/*.js"
pattern: "/resources/**/*.{js,json,library}"
}
});
});
Expand All @@ -49,7 +49,7 @@ class LibraryBuilder extends AbstractBuilder {
workspace: resourceCollections.workspace,
options: {
version: project.version,
pattern: "/resources/**/*.js"
pattern: "/resources/**/*.{js,json,library}"
}
});
});
Expand Down
2 changes: 1 addition & 1 deletion test/expected/build/application.b/dest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"embeds": ["embedded"],
"title": "{{title}}"
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@ jQuery.sap.registerPreloadedModules({
"modules":{
"application/g/Component.js":function(){sap.ui.define(["sap/ui/core/UIComponent"],function(n){"use strict";return n.extend("application.g.Component",{metadata:{manifest:"json"}})});
},
"application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.2.2"},"embeds":["embedded"],"title":"{{title}}"}}'
"application/g/manifest.json":'{"_version":"1.1.0","sap.app":{"_version":"1.1.0","id":"application.g","type":"application","applicationVersion":{"version":"1.0.0"},"embeds":["embedded"],"title":"{{title}}"},"customCopyrightString":"Some fancy copyright"}'
}});
7 changes: 4 additions & 3 deletions test/expected/build/application.g/dest/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"id": "application.g",
"type": "application",
"applicationVersion": {
"version": "1.2.2"
"version": "1.0.0"
},
"embeds": ["embedded"],
"title": "{{title}}"
}
}
},
"customCopyrightString": "Some fancy copyright"
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>library.d</name>
<vendor>SAP SE</vendor>
<copyright>Some fancy copyright</copyright>
<version>${version}</version>
<version>1.0.0</version>

<documentation>Library D</documentation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@

<name>library.d</name>
<vendor>SAP SE</vendor>
<copyright>${copyright}</copyright>
<version>${version}</version>
<copyright>UI development toolkit for HTML5 (OpenUI5)
* (c) Copyright 2009-xxx SAP SE or an SAP affiliate company.
* Licensed under the Apache License, Version 2.0 - see LICENSE.txt.</copyright>
<version>1.0.0</version>

<documentation>Library E</documentation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>library.h</name>
<vendor>SAP SE</vendor>
<copyright>Some fancy copyright</copyright>
<version>${version}</version>
<version>1.0.0</version>

<documentation>Library D</documentation>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<name>library.i</name>
<vendor>SAP SE</vendor>
<copyright>Some fancy copyright</copyright>
<version>${version}</version>
<version>1.0.0</version>

<title>{{title}}</title>
<documentation>{{description}}</documentation>
Expand Down
2 changes: 1 addition & 1 deletion test/fixtures/application.b/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@
"embeds": ["embedded"],
"title": "{{title}}"
}
}
}
7 changes: 4 additions & 3 deletions test/fixtures/application.g/webapp/manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,10 @@
"id": "application.g",
"type": "application",
"applicationVersion": {
"version": "1.2.2"
"version": "${version}"
},
"embeds": ["embedded"],
"title": "{{title}}"
}
}
},
"customCopyrightString": "${copyright}"
}
2 changes: 1 addition & 1 deletion test/fixtures/library.i/main/src/library/i/.library
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@

<name>library.i</name>
<vendor>SAP SE</vendor>
<copyright>Some fancy copyright</copyright>
<copyright>${copyright}</copyright>
<version>${version}</version>

<title>{{title}}</title>
Expand Down
8 changes: 5 additions & 3 deletions test/lib/builder/builder.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ test("Build application.g", (t) => {
});

test("Build application.g with component preload paths", (t) => {
const destPath = "./test/tmp/build/application.g/dest";
const destPath = "./test/tmp/build/application.g/dest2";
const expectedPath = "./test/expected/build/application.g/dest";

return builder.build({
Expand Down Expand Up @@ -387,7 +387,8 @@ const applicationGTree = {
"type": "application",
"metadata": {
"name": "application.g",
"namespace": "application/g"
"namespace": "application/g",
"copyright": "Some fancy copyright"
},
"dependencies": [],
"resources": {
Expand Down Expand Up @@ -420,7 +421,8 @@ const applicationGTreeComponentPreloadPaths = {
"type": "application",
"metadata": {
"name": "application.g",
"namespace": "application/g"
"namespace": "application/g",
"copyright": "Some fancy copyright"
},
"dependencies": [],
"resources": {
Expand Down

0 comments on commit f305429

Please sign in to comment.