Skip to content

Commit eec3cc9

Browse files
committed
Scooping up last buildAccess references, making the profile system more defaulty and readme tweaks
1 parent e006023 commit eec3cc9

File tree

6 files changed

+81
-36
lines changed

6 files changed

+81
-36
lines changed

.circleci/config.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ jobs:
4848

4949
- run:
5050
name: Compile
51-
command: ./gradlew --refresh-dependencies --info --stacktrace -PbuildAccess=opensource clean assemble
51+
command: ./gradlew --refresh-dependencies --info --stacktrace clean assemble
5252

5353
# # Test
5454
# - run:

Jenkinsfile

+6-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ pipeline {
88
GRADLE_USER_HOME = "$WORKSPACE/.gradle"
99
ARTIFACTORY_CREDENTIALS = credentials('mdk-artifactory-credentials')
1010
TESTRAIL_CREDENTIALS = credentials('mdk-testrail-credentials')
11-
BUILD_ACCESS = credentials('mdk-build-access')
11+
BUILD_PROFILE = credentials('mdk-build-access')
1212
TESTRAIL_HOST = credentials('mdk-testrail-host')
1313
TESTRAIL_SUITE_ID = credentials('mdk-testrail-suite-id')
1414
ARTIFACTORY_URL = credentials('mdk-artifactory-url')
@@ -21,7 +21,7 @@ pipeline {
2121
echo 'TAG_NAME = $TAG_NAME'
2222
sh './gradlew \
2323
-PbuildNumber=$BUILD_NUMBER \
24-
-PbuildAccess=$BUILD_ACCESS \
24+
-PbuildProfile=$BUILD_PROFILE \
2525
-PbuildTag=$TAG_NAME \
2626
-PartifactoryUrl=$ARTIFACTORY_URL \
2727
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
@@ -35,7 +35,7 @@ pipeline {
3535
steps {
3636
sh './gradlew \
3737
-PbuildNumber=$BUILD_NUMBER \
38-
-PbuildAccess=$BUILD_ACCESS \
38+
-PbuildProfile=$BUILD_PROFILE \
3939
-PbuildTag=$TAG_NAME \
4040
-PartifactoryUrl=$ARTIFACTORY_URL \
4141
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
@@ -49,7 +49,7 @@ pipeline {
4949
steps {
5050
sh 'xvfb-run ./gradlew \
5151
-PbuildNumber=$BUILD_NUMBER \
52-
-PbuildAccess=$BUILD_ACCESS \
52+
-PbuildProfile=$BUILD_PROFILE \
5353
-PbuildTag=$TAG_NAME \
5454
-PartifactoryUrl=$ARTIFACTORY_URL \
5555
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
@@ -69,7 +69,7 @@ pipeline {
6969
steps {
7070
sh './gradlew \
7171
-PbuildNumber=$BUILD_NUMBER \
72-
-PbuildAccess=$BUILD_ACCESS \
72+
-PbuildProfile=$BUILD_PROFILE \
7373
-PbuildTag=$TAG_NAME \
7474
-PartifactoryUrl=$ARTIFACTORY_URL \
7575
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \
@@ -86,7 +86,7 @@ pipeline {
8686
steps {
8787
sh './gradlew \
8888
-PbuildNumber=$BUILD_NUMBER \
89-
-PbuildAccess=$BUILD_ACCESS \
89+
-PbuildProfile=$BUILD_PROFILE \
9090
-PbuildTag=$TAG_NAME \
9191
-PartifactoryUrl=$ARTIFACTORY_URL \
9292
-PartifactoryUsername=$ARTIFACTORY_CREDENTIALS_USR \

README.md

+28-11
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ Cameo MDK is a plugin for [Cameo Systems Modeler](https://www.nomagic.com/produc
99
## Prerequisites
1010

1111
* [Cameo Systems Modeler (CSM)](https://www.nomagic.com/products/cameo-systems-modeler) or another No Magic environment bundle that includes the [SysML plugin](https://www.nomagic.com/product-addons/magicdraw-addons/sysml-plugin)
12-
* The latest Cameo MDK is tested with and supports **19.0 SP4**. Compatibility for previous versions of Cameo MDK can be found in the [compatibility matrices](https://github.com/Open-MBEE/open-mbee.github.io/wiki/Compatibilities).
12+
* The latest Cameo MDK is tested with and supports **19.0 SP3** and **19.0 SP4** (you must use a custom profile for SP4). Compatibility for previous versions of Cameo MDK can be found in the [compatibility matrices](https://github.com/Open-MBEE/open-mbee.github.io/wiki/Compatibilities).
1313
#### Versions prior to 5.x:
1414
* [Model Management System (MMS) 3](https://github.com/Open-MBEE/mms-alfresco)
1515
#### Version 5.0+
@@ -19,8 +19,8 @@ Cameo MDK is a plugin for [Cameo Systems Modeler](https://www.nomagic.com/produc
1919

2020
1. [Download](https://github.com/Open-MBEE/mdk/releases/latest) the Cameo MDK plugin, e.g. `mdk-*-plugin.zip`.
2121

22-
*Note: Make sure you are downloading the correct version for your installation of MMS (for mms-alfresco (mms3/donbot) use
23-
version 4.5.x, for mms (mms4/execubots) use versions 5.0+)*
22+
>**Note:** *Make sure you are downloading the correct version for your installation of MMS (for mms-alfresco (mms3/donbot) use
23+
>version 4.5.x, for mms (mms4/execubots) use versions 5.0+)*
2424
2525
2. Run CSM. From the main menu, select "Help" > "Resource/Plugin Manager".
2626
![Resource/Plugin Manager](doc/images/resource-plugin-manager.png)
@@ -48,15 +48,32 @@ To learn how you can get involved in a variety of ways, please see [Contibuting
4848

4949
Cameo MDK is a Java project that uses the [Gradle](https://gradle.org/) build tool. It can be imported as a Gradle project in IDEs like [IntelliJ](https://www.jetbrains.com/idea/) and [Eclipse](https://www.eclipse.org/ide/).
5050

51-
## Common Tasks
52-
*Note starting in version 5.0 you will need to define a build profile (in `./buildProfiles`) which will house the classpath
53-
for your particular version of cameo. In order to retrieve this classpath, copy paste the CLASSPATH entry from your
54-
`${md.install.dir}/bin/(magicraw/csm/cea).properties` file. Copy the entire line into a new file and find replace the `\:`
55-
with `,` for more information refer to the existing `buildProfiles/opensource.properties`. Also, note that that profile should
56-
work for most 19.0sp3 installations.*
5751

58-
In order to use your custom profile run any of the below commands with `-PbuildAccess=<yourProfileName>` otherwise it will
59-
default to using `opensource`.
52+
## Custom Build Profiles
53+
Starting with version 5.0+ you will be able to define custom build profiles (in `./buildProfiles`) which will house
54+
the classpath and other variables previously managed by setting `-buildAccess=internal`. These profiles will allow
55+
customization based on your build process and for your particular version of Cameo.
56+
57+
**NOTE:** By default build profiles are excluded from being committed to git by a `buildProfiles/.gitignore`
58+
59+
### Create a new profile
60+
Create a new java properties file in `buildProfiles/<yourProfileName>.properties`.
61+
In order to use a custom profile to run any of the below commands. Use the command with `-PbuildProfile=<yourProfileName>`
62+
> For more examples of what properties are available in profiles see the example file in `buildProfiles/example.properties`
63+
64+
### For users of non-standard cameo bundles
65+
To retrieve the classpath:
66+
1. Copy the CLASSPATH entry from your `${md.install.dir}/bin/(magicraw/csm/cea).properties` file.
67+
2. Paste the entire line into a new file and find replace the `\:` with `,` and set it equal to `classpath`
68+
3. Save this file to `buildProfiles/<yourProfileName>.properties`
69+
> This is only necessary for custom build repositories or non-SP3 builds, most users will not need to modify the classpath
70+
> and modification of the classpath is not necessary to use profiles!
71+
72+
73+
74+
## Build
75+
>In order to use a custom profile to run any of the below commands. Use the command with `-PbuildProfile=<yourProfileName>` otherwise it will
76+
>default to using `opensource`.
6077
6178
* `./gradlew dependencies` will download all necessary dependencies.
6279
* `./gradlew assemble` will compile Cameo MDK from source.

build.gradle

+29-8
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ import java.util.zip.ZipFile
55
import groovy.json.JsonSlurper;
66

77

8-
String buildAccess = project.getProperties().getOrDefault('buildAccess', 'opensource')
8+
String buildProfile = project.getProperties().getOrDefault('buildProfile', 'opensource')
99
String buildTag = project.getProperties().get('buildTag')
1010
if (buildTag != null && !buildTag.isEmpty() && buildTag != version) {
1111
throw new GradleException('Version mismatch: '+buildTag+' vs '+version)
@@ -16,22 +16,37 @@ if ((buildTag == null || buildTag.isEmpty()) && !version.endsWith('-SNAPSHOT'))
1616

1717
def profiles = new Properties()
1818
def parser = new JsonSlurper()
19-
try {
20-
file("buildProfiles/" + buildAccess + ".properties").withInputStream { profiles.load(it) }
21-
} catch (FileNotFoundException e) {
22-
println "Profile Properties File not found using default:" + e.message
23-
file("buildProfiles/opensource.properties").withInputStream { profiles.load(it) }
19+
def defaults = new Properties()
20+
file("buildProfiles/opensource.properties").withInputStream { defaults.load(it) }
21+
22+
if (buildProfile != 'opensource') {
23+
try {
24+
file("buildProfiles/" + buildProfile + ".properties").withInputStream { profiles.load(it) }
25+
} catch (FileNotFoundException e) {
26+
println "Profile Properties File not found using default:" + e.message
27+
file("buildProfiles/opensource.properties").withInputStream { profiles.load(it) }
28+
}
29+
}
30+
else{
31+
profiles = defaults
2432
}
2533

34+
35+
2636
if (profiles['group'] != null) {
2737
group = group.replace('org.openmbee', profiles['group'])
2838
}
2939
String buildNumber = project.hasProperty('buildNumber') ? project.getProperty('buildNumber') : System.currentTimeSeconds()
3040
String timestamp = DateTimeFormatter.ofPattern("yyyy-MM-dd-HH:mm").format(LocalDateTime.now())
3141

32-
// classpathLibraries as defined in bin/[magicdraw|csm].properties#CLASSPATH are stored in ./buildProfiles
42+
String[] classpathLibraries = null
43+
if (profiles['classpathLibraries'] != null) {
44+
classpathLibraries = profiles["classpathLibraries"].toString().split(',')
45+
}
46+
else{
47+
classpathLibraries = defaults["classpathLibraries"].toString().split(',')
48+
}
3349

34-
String[] classpathLibraries = profiles["classpathLibraries"].toString().split(',')
3550

3651
String docbookNameVersion = 'docbook-xsl-1.79.1'
3752
String fopNameVersion = 'fop-1.1'
@@ -98,6 +113,12 @@ if (profiles['repositories'] != null) {
98113
def ivyRepo = it
99114
repositories.ivy {
100115
url "${ivyRepo.url}"
116+
if (ivyRepo.credentials == true) {
117+
credentials {
118+
username project.getProperties().get('artifactoryUsername')
119+
password project.getProperties().get('artifactoryPassword')
120+
}
121+
}
101122
layout "${ivyRepo.layout.type}", {
102123
artifact '' + ivyRepo.layout.pattern
103124
}

0 commit comments

Comments
 (0)