@@ -12,7 +12,7 @@ const build = {
1212
1313build . builder = function ( cli ) {
1414 return cli
15- . command ( "dev " , "Dev build: Skips non-essential and time-intensive tasks during build " , {
15+ . command ( "archive " , "Archive build: Creates a reusable build archive of the project " , {
1616 handler : handleBuild ,
1717 builder : noop ,
1818 middlewares : [ baseMiddleware ]
@@ -29,7 +29,7 @@ build.builder = function(cli) {
2929 } )
3030 . command ( "self-contained" ,
3131 "Build project and create self-contained bundle. " +
32- "Recommended to be used in conjunction with --all " , {
32+ "Recommended to be used in conjunction with --include-dependencies " , {
3333 handler : handleBuild ,
3434 builder : noop ,
3535 middlewares : [ baseMiddleware ]
@@ -40,35 +40,42 @@ build.builder = function(cli) {
4040 default : false ,
4141 type : "boolean"
4242 } )
43+ . deprecateOption ( "all" , "Use --include-dependencies" )
44+ . option ( "include-all-dependencies" , {
45+ describe : "Include all dependencies in the build result" ,
46+ alias : [ "d" , "deps" ] ,
47+ default : false ,
48+ type : "boolean"
49+ } )
4350 . option ( "include-dependency" , {
44- describe : "A list of dependencies to be included into the build process . You can use the asterisk '*' as" +
45- " an alias for including all dependencies into the build process . The listed dependencies cannot be" +
51+ describe : "A list of dependencies to be included in the build result . You can use the asterisk '*' as" +
52+ " an alias for including all dependencies in the build result . The listed dependencies cannot be" +
4653 " overruled by dependencies defined in 'exclude-dependency'." ,
4754 type : "array"
4855 } )
4956 . option ( "include-dependency-regexp" , {
50- describe : "A list of regular expressions defining dependencies to be included into the build process ." +
57+ describe : "A list of regular expressions defining dependencies to be included in the build result ." +
5158 " This list is prioritized like 'include-dependency'." ,
5259 type : "array"
5360 } )
5461 . option ( "include-dependency-tree" , {
55- describe : "A list of dependencies to be included into the build process . Transitive dependencies are" +
62+ describe : "A list of dependencies to be included in the build result . Transitive dependencies are" +
5663 " implicitly included and do not need to be part of this list. These dependencies overrule" +
5764 " the selection of 'exclude-dependency-tree' but can be overruled by 'exclude-dependency'." ,
5865 type : "array"
5966 } )
6067 . option ( "exclude-dependency" , {
61- describe : "A list of dependencies to be excluded from the build process . The listed dependencies can" +
68+ describe : "A list of dependencies to be excluded from the build result . The listed dependencies can" +
6269 " be overruled by dependencies defined in 'include-dependency'." ,
6370 type : "array"
6471 } )
6572 . option ( "exclude-dependency-regexp" , {
66- describe : "A list of regular expressions defining dependencies to be excluded from the build process ." +
73+ describe : "A list of regular expressions defining dependencies to be excluded from the build result ." +
6774 " This list is prioritized like 'exclude-dependency'." ,
6875 type : "array"
6976 } )
7077 . option ( "exclude-dependency-tree" , {
71- describe : "A list of dependencies to be excluded from the build process . Transitive dependencies are" +
78+ describe : "A list of dependencies to be excluded from the build result . Transitive dependencies are" +
7279 " implicitly included and do not need to be part of this list." ,
7380 type : "array"
7481 } )
@@ -82,18 +89,13 @@ build.builder = function(cli) {
8289 default : false ,
8390 type : "boolean"
8491 } )
85- . option ( "dev-exclude-project" , {
86- describe :
87- "A list of specific projects to be excluded from dev mode " +
88- "(dev mode must be active for this to be effective)" ,
89- type : "array"
90- } )
9192 . option ( "include-task" , {
92- describe : "A list of specific tasks to be included to the default/dev set" ,
93+ describe : "A list of tasks to be added to the default execution set. " +
94+ "This option takes precedence over any excludes." ,
9395 type : "array"
9496 } )
9597 . option ( "exclude-task" , {
96- describe : "A list of specific tasks to be excluded from default/dev set" ,
98+ describe : "A list of tasks to be excluded from the default task execution set" ,
9799 type : "array"
98100 } )
99101 . option ( "framework-version" , {
@@ -107,12 +109,9 @@ build.builder = function(cli) {
107109 default : false ,
108110 type : "boolean"
109111 } )
110- . option ( "x-graph-mode" , {
111- describe : "Uses an experimental project graph instead of a dependency tree" ,
112- default : false ,
113- type : "boolean"
114- } )
115112 . example ( "ui5 build" , "Preload build for project without dependencies" )
113+
114+ // TODO 3.0: Update examples
116115 . example ( "ui5 build self-contained --all" , "Self-contained build for project including dependencies" )
117116 . example ( "ui5 build --all --exclude-task=* --include-task=createDebugFiles generateAppPreload" ,
118117 "Build project and dependencies but only apply the createDebugFiles- and generateAppPreload tasks" )
@@ -125,60 +124,51 @@ build.builder = function(cli) {
125124 . example ( "ui5 build dev" ,
126125 "Build project and dependencies in dev mode. Only a set of essential tasks is executed." )
127126 . example ( "ui5 build --experimental-css-variables" ,
128- "Preload build for project without dependencies but with CSS variable artefacts " ) ;
127+ "Preload build for project without dependencies but with CSS variable artifacts " ) ;
129128} ;
130129
131130async function handleBuild ( argv ) {
132- const normalizer = require ( "@ui5/project" ) . normalizer ;
133- const builder = require ( "@ui5/builder" ) . builder ;
134131 const logger = require ( "@ui5/logger" ) ;
132+ const { generateProjectGraph, builder} = require ( "@ui5/project" ) ;
135133
136134 const command = argv . _ [ argv . _ . length - 1 ] ;
137135 logger . setShowProgress ( true ) ;
138136
139- const normalizerOptions = {
140- translatorName : argv . translator ,
141- configPath : argv . config
142- } ;
143-
144- if ( argv . frameworkVersion ) {
145- normalizerOptions . frameworkOptions = {
146- versionOverride : argv . frameworkVersion
147- } ;
137+ if ( argv . all ) {
138+ logger . warn (
139+ "CLI option --all is deprecated. Dependencies are now built automatically in case they are required" ) ;
148140 }
149141
150- let tree ;
151142 let graph ;
152- if ( argv . xGraphMode ) {
153- graph = await normalizer . generateProjectGraph ( normalizerOptions ) ;
143+ if ( argv . dependencyDefinition ) {
144+ graph = await generateProjectGraph . usingStaticFile ( {
145+ filePath : argv . dependencyDefinition ,
146+ versionOverride : argv . frameworkVersion
147+ } ) ;
154148 } else {
155- tree = await normalizer . generateProjectTree ( normalizerOptions ) ;
149+ graph = await generateProjectGraph . usingNodePackageDependencies ( {
150+ rootConfigPath : argv . config ,
151+ versionOverride : argv . frameworkVersion
152+ } ) ;
156153 }
157- const buildSettings = ( tree . builder && tree . builder . settings ) || { } ;
158-
159- const { includedDependencies, excludedDependencies} = buildHelper . createDependencyLists ( {
160- tree : tree ,
161- includeDependency : argv [ "include-dependency" ] ,
162- includeDependencyRegExp : argv [ "include-dependency-regexp" ] ,
163- includeDependencyTree : argv [ "include-dependency-tree" ] ,
164- excludeDependency : argv [ "exclude-dependency" ] ,
165- excludeDependencyRegExp : argv [ "exclude-dependency-regexp" ] ,
166- excludeDependencyTree : argv [ "exclude-dependency-tree" ] ,
167- defaultIncludeDependency : buildSettings . includeDependency ,
168- defaultIncludeDependencyRegExp : buildSettings . includeDependencyRegExp ,
169- defaultIncludeDependencyTree : buildSettings . includeDependencyTree
170- } ) ;
171- const buildAll = buildHelper . alignWithBuilderApi ( argv . all , includedDependencies , excludedDependencies ) ;
172-
173- await builder . build ( {
174- tree : tree ,
175- graph : graph ,
154+ const buildSettings = graph . getRoot ( ) . getBuilderSettings ( ) || { } ;
155+ await builder ( {
156+ graph,
176157 destPath : argv . dest ,
177158 cleanDest : argv [ "clean-dest" ] ,
178- buildDependencies : buildAll ,
179- includedDependencies : includedDependencies ,
180- excludedDependencies : excludedDependencies ,
181- dev : command === "dev" ,
159+ composeProjectList : {
160+ includeAllDependencies : argv [ "include-all-dependencies" ] ,
161+ includeDependency : argv [ "include-dependency" ] ,
162+ includeDependencyRegExp : argv [ "include-dependency-regexp" ] ,
163+ includeDependencyTree : argv [ "include-dependency-tree" ] ,
164+ excludeDependency : argv [ "exclude-dependency" ] ,
165+ excludeDependencyRegExp : argv [ "exclude-dependency-regexp" ] ,
166+ excludeDependencyTree : argv [ "exclude-dependency-tree" ] ,
167+ defaultIncludeDependency : buildSettings . includeDependency ,
168+ defaultIncludeDependencyRegExp : buildSettings . includeDependencyRegExp ,
169+ defaultIncludeDependencyTree : buildSettings . includeDependencyTree
170+ } ,
171+ archive : command === "archive" ,
182172 selfContained : command === "self-contained" ,
183173 jsdoc : command === "jsdoc" ,
184174 devExcludeProject : argv [ "dev-exclude-project" ] ,
0 commit comments