YARN-11078. Set env vars in a cross platform compatible way (#4432)

* Maven runs the ember build script.
  The environment variable TMPDIR was
  set as per bash syntax.
* This failed on Windows since the
  Windows command prompt doesn't
  support bash syntax.
* We're now detecting the OS and
  setting a Maven property
  "emberBuildScript" in a cross
  platform compatible way.
This commit is contained in:
Gautham B A 2022-06-15 15:29:55 +05:30 committed by GitHub
parent 5a40224b53
commit dc5460d525
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 31 additions and 2 deletions

View File

@ -38,6 +38,34 @@
<build> <build>
<plugins> <plugins>
<!-- Pkck the appropriate ember build script to use in src/package.json based on the OS -->
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<executions>
<execution>
<phase>validate</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<exportAntProperties>true</exportAntProperties>
<target>
<!-- Set the Maven property emberBuildScript to build:mvn:windows if this is
running on Windows. Set it to build:mvn otherwise. -->
<condition property="emberBuildScript" value="build:mvn:windows" else="build:mvn">
<and>
<os family="windows"/>
</and>
</condition>
<echo>Ember build script to use = ${emberBuildScript}</echo>
</target>
</configuration>
</execution>
</executions>
</plugin>
<!-- Apache RAT --> <!-- Apache RAT -->
<plugin> <plugin>
<groupId>org.apache.rat</groupId> <groupId>org.apache.rat</groupId>
@ -229,7 +257,7 @@
<arguments> <arguments>
<argument>${packageManagerScript}</argument> <argument>${packageManagerScript}</argument>
<argument>run</argument> <argument>run</argument>
<argument>build:mvn</argument> <argument>${emberBuildScript}</argument>
</arguments> </arguments>
</configuration> </configuration>
</execution> </execution>

View File

@ -10,7 +10,8 @@
"scripts": { "scripts": {
"build": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember build", "build": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember build",
"start": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember server", "start": "TMPDIR=tmp node ./node_modules/ember-cli/bin/ember server",
"build:mvn": "TMPDIR=tmp node/node ./node_modules/ember-cli/bin/ember build -prod" "build:mvn": "TMPDIR=tmp node/node ./node_modules/ember-cli/bin/ember build -prod",
"build:mvn:windows": "set TMPDIR=tmp; node/node ./node_modules/ember-cli/bin/ember build -prod"
}, },
"repository": "", "repository": "",
"engines": { "engines": {