Browse Source

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.
Gautham B A 2 years ago
parent
commit
dc5460d525

+ 29 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/pom.xml

@@ -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>

+ 2 - 1
hadoop-yarn-project/hadoop-yarn/hadoop-yarn-ui/src/main/webapp/package.json

@@ -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": {