Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Commit 88f7ec0

Browse filesBrowse files
authored
geosolutions-it#6314: Add standard project scripts to @mapstore/project (geosolutions-it#6738)
geosolutions-it#6314: Add standard project scripts to @mapstore/project (geosolutions-it#6738)
1 parent 03fbfa4 commit 88f7ec0
Copy full SHA for 88f7ec0

114 files changed

+2,826-334Lines changed: 2826 additions & 334 deletions

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎build.sh‎

Copy file name to clipboardExpand all lines: build.sh
+9Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,11 +40,20 @@ echo "Building final WAR package"
4040
echo `date`
4141
if [ $# -eq 0 ]
4242
then
43+
cd java
44+
mvn clean install
45+
cd ..
4346
mvn clean install
4447
elif [ $# -eq 1 ]
4548
then
49+
cd java
50+
mvn clean install
51+
cd ..
4652
mvn clean install -Dmapstore2.version=$1
4753
else
54+
cd java
55+
mvn clean install -Dmapstore2.version=$1 -P$2
56+
cd ..
4857
mvn clean install -Dmapstore2.version=$1 -P$2
4958
fi
5059

Collapse file

‎build/buildConfig.js‎

Copy file name to clipboardExpand all lines: build/buildConfig.js
+92-16Lines changed: 92 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,101 @@ const castArray = require('lodash/castArray');
1111
/**
1212
* Webpack configuration builder.
1313
* Returns a webpack configuration object for the given parameters.
14+
* This function takes one single object as first argument, containing all the configurations described below. For backward compatibility, if arguments list is longer then one, the function will get the arguments as the parameters described below in the following order (**the argument list usage has been deprecated and will be removed in the future**).
15+
- bundles,
16+
- themeEntries,
17+
- paths,
18+
- plugins = [],
19+
- prod,
20+
- publicPath,
21+
- cssPrefix,
22+
- prodPlugins = [],
23+
- alias = {},
24+
- proxy,
25+
- devPlugins = []
1426
*
15-
* @param {object} bundles object that defines the javascript (or jsx) entry points and related bundles
27+
* @param {object} config the object containing the various parameters
28+
* @param {object} config.bundles object that defines the javascript (or jsx) entry points and related bundles
1629
* to be built (bundle name -> entry point path)
17-
* @param {object} themeEntries object that defines the css (or less) entry points and related bundles
30+
* @param {object} config.themeEntries object that defines the css (or less) entry points and related bundles
1831
* to be built (bundle name -> entry point path)
19-
* @param {object} paths object with paths used by the configuration builder:
32+
* @param {object} config.paths object with paths used by the configuration builder:
2033
* - dist: path to the output folder for the bundles
2134
* - base: root folder of the project
2235
* - framework: root folder of the MapStore2 framework
2336
* - code: root folder(s) for javascript / jsx code, can be an array with several folders (e.g. framework code and
2437
* project code)
25-
* @param {object} plugins plugin to be added
26-
* @param {boolean} prod flag for production / development mode (true = production)
27-
* @param {string} publicPath web public path for loading bundles (e.g. dist/)
28-
* @param {string} cssPrefix prefix to be appended on every generated css rule (e.g. ms2)
29-
* @param {array} prodPlugins plugins to be used only in production mode
30-
* @param {object} alias aliases to be used by webpack to resolve paths (alias -> real path)
31-
* @param {object} proxy webpack-devserver custom proxy configuration object
38+
* @param {object} config.plugins plugin to be added
39+
* @param {boolean} config.prod flag for production / development mode (true = production)
40+
* @param {string} config.publicPath web public path for loading bundles (e.g. dist/)
41+
* @param {string} config.cssPrefix prefix to be appended on every generated css rule (e.g. ms2)
42+
* @param {array} config.prodPlugins plugins to be used only in production mode
43+
* @param {array} config.devPlugins plugins to be used only in development mode
44+
* @param {object} config.alias aliases to be used by webpack to resolve paths (alias -> real path)
45+
* @param {object} config.proxy webpack-devserver custom proxy configuration object
46+
* @param {object} config.devServer webpack devserver configuration object, available only with object syntax
47+
* @param {object} config.resolveModules webpack resolve configuration object, available only with object syntax
48+
* @param {object} config.projectConfig config mapped to __MAPSTORE_PROJECT_CONFIG__, available only with object syntax
3249
* @returns a webpack configuration object
50+
* @example
51+
* // It's possible to use a single object argument to pass the parameters.
52+
* // this configuration is preferred and it will replace the previous arguments structure
53+
* const buildConfig = require('./buildConfig');
54+
* module.export = buildConfig({
55+
* bundles: {},
56+
* themeEntries: {},
57+
* paths: {
58+
* base: path.join(__dirname, ".."),
59+
* dist: path.join(__dirname, "..", "web", "client", "dist"),
60+
* framework: path.join(__dirname, "..", "web", "client"),
61+
* code: path.join(__dirname, "..", "web", "client")
62+
* },
63+
* plugins: [],
64+
* prod: false,
65+
* publicPath: "dist/"
66+
* });
3367
*/
34-
module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath, cssPrefix, prodPlugins, alias = {}, proxy) => ({
68+
69+
/**
70+
* this function adds support for object argument in buildConfig
71+
* but it keeps compatibility with the previous arguments structure
72+
*/
73+
function mapArgumentsToObject(args, func) {
74+
if (args.length === 1) {
75+
return func(args[0]);
76+
}
77+
const [
78+
bundles,
79+
themeEntries,
80+
paths,
81+
plugins = [],
82+
prod,
83+
publicPath,
84+
cssPrefix,
85+
prodPlugins = [],
86+
alias = {},
87+
proxy,
88+
devPlugins = []
89+
] = args;
90+
return func({ bundles, themeEntries, paths, plugins, prod, publicPath, cssPrefix, prodPlugins, alias, proxy, devPlugins});
91+
}
92+
module.exports = (...args) => mapArgumentsToObject(args, ({
93+
bundles,
94+
themeEntries,
95+
paths,
96+
plugins = [],
97+
prod,
98+
publicPath,
99+
cssPrefix,
100+
prodPlugins = [],
101+
devPlugins = [],
102+
alias = {},
103+
proxy,
104+
// new optional only for single object argument
105+
projectConfig = {},
106+
devServer,
107+
resolveModules
108+
}) => ({
35109
target: "web",
36110
entry: assign({}, bundles, themeEntries),
37111
mode: prod ? "production" : "development",
@@ -42,7 +116,7 @@ module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath,
42116
path: paths.dist,
43117
publicPath,
44118
filename: "[name].js",
45-
chunkFilename: prod ? "[name].[hash].chunk.js" : "[name].js"
119+
chunkFilename: prod ? (paths.chunks || "") + "[name].[hash].chunk.js" : (paths.chunks || "") + "[name].js"
46120
},
47121
plugins: [
48122
new CopyWebpackPlugin([
@@ -65,14 +139,15 @@ module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath,
65139
'NODE_ENV': prod ? '"production"' : '""'
66140
}
67141
}),
142+
new DefinePlugin({ '__MAPSTORE_PROJECT_CONFIG__': JSON.stringify(projectConfig) }),
68143
new ProvidePlugin({
69144
Buffer: ['buffer', 'Buffer']
70145
}),
71146
new NormalModuleReplacementPlugin(/leaflet$/, path.join(paths.framework, "libs", "leaflet")),
72147
new NormalModuleReplacementPlugin(/proj4$/, path.join(paths.framework, "libs", "proj4")),
73148
new NoEmitOnErrorsPlugin()]
74149
.concat(castArray(plugins))
75-
.concat(prod && prodPlugins || []),
150+
.concat(prod ? prodPlugins : devPlugins),
76151
resolve: {
77152
fallback: {
78153
timers: false,
@@ -84,7 +159,8 @@ module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath,
84159
// next libs are added because of this issue https://github.com/geosolutions-it/MapStore2/issues/4569
85160
proj4: '@geosolutions/proj4',
86161
"react-joyride": '@geosolutions/react-joyride'
87-
}, alias)
162+
}, alias),
163+
...(resolveModules && { modules: resolveModules })
88164
},
89165
module: {
90166
noParse: [/html2canvas/],
@@ -192,7 +268,7 @@ module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath,
192268
loader: 'html-loader'
193269
}] : [])
194270
},
195-
devServer: {
271+
devServer: devServer || {
196272
publicPath: "/" + publicPath,
197273
proxy: proxy || {
198274
'/rest': {
@@ -231,4 +307,4 @@ module.exports = (bundles, themeEntries, paths, plugins = [], prod, publicPath,
231307
},
232308

233309
devtool: !prod ? 'eval' : undefined
234-
});
310+
}));
Collapse file

‎build/testConfig.js‎

Copy file name to clipboardExpand all lines: build/testConfig.js
+3Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -140,6 +140,9 @@ module.exports = ({browsers = [ 'ChromeHeadless' ], files, path, testFile, singl
140140
new webpack.DefinePlugin({
141141
'process.env.NODE_ENV': JSON.stringify('development')
142142
}),
143+
new webpack.DefinePlugin({
144+
'__MAPSTORE_PROJECT_CONFIG__': JSON.stringify({})
145+
}),
143146
new webpack.ProvidePlugin({
144147
process: 'process/browser'
145148
})
Collapse file

‎docs/developer-guide/building-and-deploying.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/building-and-deploying.md
+3-5Lines changed: 3 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,18 @@ To create the final war, you have several options:
1111

1212
* full build, including submodules and frontend (e.g. GeoStore)
1313

14-
`./build.sh [version_identifier]`
14+
`./build.sh [version_identifier] [profiles]`
1515

16-
Where version_identifier is an optional identifier of the generated war that will be shown in the settings panel of the application.
16+
Where `version_identifier` is an optional identifier of the generated war that will be shown in the settings panel of the application and profiles is an optional list of comma delimited building profiles (e.g. `printing`, `ldap`)
1717

1818
* fast build (will use the last compiled version of submodules and compiled frontend)
1919

20-
`mvn clean install -Dmapstore2.version=[version_identifier]`
20+
`mvn clean install -Dmapstore2.version=[version_identifier] [profiles]`
2121

2222
* release build (produces also the binary)
2323

2424
`mvn clean install -Dmapstore2.version=[version_identifier] -Prelease`
2525

26-
Where `[version_identifier]` is the version you want to export (e.g. 2020.01.00). This version name will appear in "Settings --> version information" and used to create handle bundles version (i.e. caching).
27-
2826
## Building the documentation
2927

3028
MapStore uses JSDoc to annotate the components, so the documentation can be automatically generated using [docma](http://onury.github.io/docma/).
Collapse file

‎docs/developer-guide/configuration-files.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/configuration-files.md
+14-5Lines changed: 14 additions & 5 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -11,27 +11,36 @@ This separation allows to:
1111
## Back-end Configuration Files
1212

1313
They are `.properties` files or `.xml` files, and they allow to configure the various parts of the back-end.
14-
They are located in `web/src/main/resources` and they will be copied in `MapStore.war` under the directory `/WEB-INF/classes`.
14+
They are located in `java/web/src/main/resources` and they will be copied in `MapStore.war` under the directory `/WEB-INF/classes`.
1515

1616
* `proxy.properties`: configuration for the internal proxy (for cross-origin requests). More information [here](https://github.com/geosolutions-it/http-proxy/wiki/Configuring-Http-Proxy>).
1717
* `geostore-datasource-ovr.properties`: provides settings for the database.
1818
* `log4j.properties`: configuration for back-end logging
1919
* `sample-categories.xml`: initial set of categories for back-end resources (MAP, DASHBOARD, GEOSTORY...)
2020
* `mapstore.properties`: allow specific overrides to front-end files, See [externalization system](../externalized-configuration) for more details
2121

22-
Except `mapstore.properties`, all these files are simply overrides of original configuration files coming from the included sub-applications part of the back-end. In `WEB-INF/classes` you will find also some other useful files coming from the original application:
22+
Except for `mapstore.properties` and `ldap.properties`, all these files are simply overrides of original configuration files coming from the included sub-applications part of the back-end. In `WEB-INF/classes` you will find also some other useful files coming from the original application:
2323

24-
* `spring-security.xml`: Provide the security settings and configurations. It can be configured to set-up [LDAP integration](integrations/users/ldap.md). (usually in a custom application).
24+
### Back-end security configuration files
25+
Back-end security can be configured to use different authentication strategies. Maven profiles can be used to switch between these different strategies.
2526

27+
Depending on the chosen profile a different file will be copied from the `product/config` folder to override `WEB-INF/classes/geostore-spring-security.xml` in the final package. In particular:
28+
29+
- **default**: `db\geostore-spring-security-db.xml` (geostore database)
30+
- **ldap**: `ldap\geostore-spring-security-ldap.xml` (LDAP source)
31+
32+
Specific configuration files are available to configure connection details for the chosen profile.
33+
34+
For example, if using LDAP, look at [LDAP integration](integrations/users/ldap.md).
2635

2736
## Front-end Configurations Files
2837

29-
They are JSON files that will be loaded via HTTP from the client, keeping most of the framework working also in an html-only context (when used with different back-ends or no-backend). These JSON files are located in `web/client` directory and they will be copied in the root of the war file.
38+
They are JSON files that will be loaded via HTTP from the client, keeping most of the framework working also in an html-only context (when used with different back-ends or no-backend). These JSON files are located in `web/client/configs` directory and they will be copied in the `configs` of the war file.
3039

3140
Several configuration files (at development and / or run time) are available to configure all the different aspects of an application.
3241

3342
* `localConfig.json`: Dedicated to the application configuration. Defines all general settings of the front-end part, with all the plugins for all the pages. See [Application Configuration](../local-config) for more information.
34-
* `new.json` Can be customized to set-up the inital new map, setting the backgrounds, initial position .. See [Maps configuration](../maps-configuration) for more information.
43+
* `new.json` Can be customized to set-up the initial new map, setting the backgrounds, initial position .. See [Maps configuration](../maps-configuration) for more information.
3544
* `pluginsConfig.json`: Allows to configure the context editor plugins list. See [Context Editor Configuration](context-editor-config.md) for more information.
3645

3746
## Externalize Configurations
Collapse file

‎docs/developer-guide/context-editor-config.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/context-editor-config.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Configuration of Application Context Manager
22

3-
The Application Context Manager can be configured editing the `pluginsConfig.json` file.
3+
The Application Context Manager can be configured editing the `configs/pluginsConfig.json` file.
44

55
The configuration file has this shape:
66

Collapse file

‎docs/developer-guide/database-setup.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/database-setup.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ In the following guide you will learn how to configure MapStore to use an extern
1212

1313
## Externalize properties files
1414

15-
MapStore has a file called `geostore-datasource-ovr.properties`. This file is on the repository in the folder `web/src/main/resources`, in the final mapstore.war package it will be copied into `WEB-INF/classes` path. It contains the set-up for the database connection. Anyway if you edit the file in `WEB-INF/classes` this file will be overridden on the next re-deploy. To preserve your configuration on every deploy you can user a environment variable, `geostore-ovr`, to configure the path to an override file in a different, external directory. In this file the user can re-define the default configuration and so set-up the database configuration.
15+
MapStore has a file called `geostore-datasource-ovr.properties`. This file is on the repository in the folder `java/web/src/main/resources`, in the final mapstore.war package it will be copied into `WEB-INF/classes` path. It contains the set-up for the database connection. Anyway if you edit the file in `WEB-INF/classes` this file will be overridden on the next re-deploy. To preserve your configuration on every deploy you can user a environment variable, `geostore-ovr`, to configure the path to an override file in a different, external directory. In this file the user can re-define the default configuration and so set-up the database configuration.
1616

1717
For instance using tomcat on linux you will have to do something like this to add the environment variable to the JAVA_OPTS
1818
> where to add your JAVA_OPTS depends on your operating system. For instance the file could be `/etc/default/tomcat8`, or similar, in linux debian
Collapse file

‎docs/developer-guide/developing.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/developing.md
+3-3Lines changed: 3 additions & 3 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -158,8 +158,8 @@ When we say "running the back-end", in fact we say that we are running some sort
158158

159159
MapStore is configured to use a tomcat maven plugin-in to build and run mapstore locally. To use it you have to:
160160

161-
* make sure to run at least once `mvn install` in the root directory, to make `mapstore-backend` artifact available.
162-
* `cd web` directory
161+
* make sure to run at least once `mvn install` in the root directory, to make `mapstore-webapp` artifact available.
162+
* `cd product` directory
163163
* run `mvn tomcat7:run-war`
164164

165165
Your local back-end will now start at [http://localhost:8080/mapstore/](http://localhost:8080/mapstore/).
@@ -171,7 +171,7 @@ If you prefer, or if you have some problems with `mvn tomcat7:run-war`, you can
171171
To do so, you can :
172172

173173
* download a tomcat standalone [here](https://mapstore.readthedocs.io/en/latest/developer-guide/requirements/) and extract to a folder of your choice
174-
* To generate a war file that will be deployed on your tomcat server, go to the root of the Mapstore project that was git cloned and run `./build.sh`. This might take some time but at the end a war file named `mapstore.war` will be generated into the `web/target` folder.
174+
* To generate a war file that will be deployed on your tomcat server, go to the root of the Mapstore project that was git cloned and run `./build.sh`. This might take some time but at the end a war file named `mapstore.war` will be generated into the `product/target` folder.
175175
* Copy the `mapstore.war` and then head back to your tomcat folder. Look for a `webapps` folder and paste the `mapstore.war` file there.
176176
* To start tomcat server, go to the terminal, `cd` into the root of your tomcat extracted folder and run `./bin/startup.sh` ( unix systems) or `./bin/startup.bat` (Windows). The server will start on port `8080` and Mapstore will be running at `http://localhost:8080/mapstore`. For development purposes we're only interested in the backend that was started on the tomcat server along with Mapstore.
177177

Collapse file

‎docs/developer-guide/integrations/users/ldap.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/integrations/users/ldap.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ Direct connection is still experimental and not tested in all the possible scena
3838

3939
Configuring MapStore to use the LDAP storage requires:
4040

41-
* filling out the LDAP configuration properties in the web/src/ldap/ldap.properties file to match your LDAP repository structure
41+
* filling out the LDAP configuration properties in the java/web/src/main/resources/ldap.properties file to match your LDAP repository structure
4242
* invoking the build with the **ldap** profile
4343

4444
```bash
Collapse file

‎docs/developer-guide/local-config.md‎

Copy file name to clipboardExpand all lines: docs/developer-guide/local-config.md
+1-1Lines changed: 1 addition & 1 deletion
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Application configuration
22

3-
The application will load by default it will load the `localConfig.json`
3+
The application will load by default it will load the `localConfig.json` which is now stored in the configs\ folder
44

55
You can load a custom configuration by passing the `localConfig` argument in query string:
66

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.