瀏覽代碼

AMBARI-9272 - [WinGA] Views Files, Capacity-Scheduler, Pig views do not compile on Windows

Artem Baranchuk 10 年之前
父節點
當前提交
9a2214f1c0

+ 72 - 13
contrib/views/capacity-scheduler/pom.xml

@@ -77,14 +77,32 @@
 
     <build>
     <plugins>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.5</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${ui.directory}</directory>
+              <followSymlinks>false</followSymlinks>
+               <includes>
+                <include>public/**</include>
+                <include>node_modules/**</include>
+                <include>bower_components/**</include>
+                <include>node/**</include>
+              </includes>
+             </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
       <plugin>
         <groupId>com.github.eirslett</groupId>
         <artifactId>frontend-maven-plugin</artifactId>
         <version>0.0.14</version>
         <configuration>
-            <workingDirectory>src/main/resources/ui</workingDirectory>
+            <workingDirectory>${ui.directory}</workingDirectory>
         </configuration>
-
         <executions>
           <execution>
             <id>install node and npm</id>
@@ -92,22 +110,20 @@
                 <goal>install-node-and-npm</goal>
             </goals>
             <!-- optional: default phase is "generate-resources" -->
-            <phase>generate-resources</phase>
+            <phase>initialize</phase>
             <configuration>
                 <nodeVersion>v0.10.26</nodeVersion>
                 <npmVersion>1.4.3</npmVersion>
             </configuration>
           </execution>
           <execution>
-          <id>npm install</id>
+            <id>npm install</id>
             <goals>
               <goal>npm</goal>
             </goals>
-
             <phase>generate-resources</phase>
-
             <configuration>
-                <arguments>install --unsafe-perm --registry=http://registry.npmjs.eu</arguments>
+              <arguments>install --unsafe-perm --registry=http://registry.npmjs.eu</arguments>
             </configuration>
           </execution>
         </executions>
@@ -117,21 +133,38 @@
         <groupId>org.codehaus.mojo</groupId>
         <version>1.2.1</version>
         <executions>
-            <execution>
+          <execution>
+            <id>node gyp executable</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <skip>${skip.nodegyp.chmod}</skip>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>chmod</executable>
+              <arguments>
+                <argument>+x</argument>
+                <argument>${ui.directory}/node/npm/bin/node-gyp-bin/node-gyp</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
             <id>Brunch build</id>
             <phase>generate-resources</phase>
             <goals>
               <goal>exec</goal>
             </goals>
             <configuration>
-              <workingDirectory>${basedir}/src/main/resources/ui</workingDirectory>
-              <executable>node/node</executable>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>${ui.directory}/node/${node.executable}</executable>
               <arguments>
-                <argument>node_modules/.bin/brunch</argument>
+                <argument>node_modules/brunch/bin/brunch</argument>
                 <argument>build</argument>
+                <argument>--production</argument>
               </arguments>
             </configuration>
-            </execution>
+          </execution>
         </executions>
       </plugin>
       <plugin>
@@ -244,4 +277,30 @@
         </plugins>
     </pluginManagement>
     </build>
-</project>
+    <profiles>
+      <profile>
+        <id>windows</id>
+        <activation>
+          <os>
+            <family>win</family>
+          </os>
+        </activation>
+        <properties>
+          <node.executable>node.exe</node.executable>
+          <skip.nodegyp.chmod>true</skip.nodegyp.chmod>
+        </properties>
+      </profile>
+      <profile>
+        <id>linux</id>
+        <activation>
+          <os>
+            <family>unix</family>
+          </os>
+        </activation>
+        <properties>
+          <node.executable>node</node.executable>
+          <skip.nodegyp.chmod>false</skip.nodegyp.chmod>
+        </properties>
+      </profile>
+    </profiles>
+  </project>

+ 1 - 2
contrib/views/capacity-scheduler/src/main/resources/ui/package.json

@@ -12,8 +12,7 @@
   },
   "scripts": {
     "start": "brunch watch --server",
-    "preinstall": "chmod +x node/npm/bin/node-gyp-bin/node-gyp",
-    "postinstall" : "bash node/with_new_path.sh node node_modules/.bin/bower --allow-root install"
+    "postinstall" : "bower --allow-root install"
   },
   "dependencies": {
     "javascript-brunch": "^1.7.1",

+ 87 - 42
contrib/views/files/pom.xml

@@ -118,79 +118,98 @@
     <build>
 
     <plugins>
-        <plugin>
+      <plugin>
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.5</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${ui.directory}</directory>
+              <followSymlinks>false</followSymlinks>
+              <includes>
+                <include>public/**</include>
+                <include>node_modules/**</include>
+                <include>bower_components/**</include>
+                <include>node/**</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
+      <plugin>
         <groupId>com.github.eirslett</groupId>
         <artifactId>frontend-maven-plugin</artifactId>
         <version>0.0.14</version>
-
-        <!-- optional -->
         <configuration>
-            <workingDirectory>src/main/resources/ui</workingDirectory>
+          <workingDirectory>${ui.directory}</workingDirectory>
         </configuration>
 
         <executions>
-            <execution>
-            <!-- optional: you don't really need execution ids, but it looks nice
-                 in your build log. -->
+          <execution>
             <id>install node and npm</id>
             <goals>
-                <goal>install-node-and-npm</goal>
+              <goal>install-node-and-npm</goal>
             </goals>
             <!-- optional: default phase is "generate-resources" -->
-            <phase>generate-resources</phase>
+            <phase>initialize</phase>
             <configuration>
-                <nodeVersion>v0.10.26</nodeVersion>
-                <npmVersion>1.4.3</npmVersion>
+              <nodeVersion>v0.10.26</nodeVersion>
+              <npmVersion>1.4.3</npmVersion>
             </configuration>
-            </execution>
-            <execution>
+          </execution>
+          <execution>
             <id>npm install</id>
             <goals>
-                <goal>npm</goal>
+              <goal>npm</goal>
             </goals>
-
-            <!-- optional: default phase is "generate-resources" -->
             <phase>generate-resources</phase>
-
             <configuration>
-                <!-- optional: The default argument is actually "install", so unless
-                 you need to run some other npm command, you can remove this whole <configuration>
-                 section. -->
-              <arguments>install --python="${project.basedir}/../src/main/unix/ambari-python-wrap" --unsafe-perm --registry=http://registry.npmjs.eu</arguments>
+              <!-- optional: The default argument is actually "install", so unless
+               you need to run some other npm command, you can remove this whole <configuration>
+               section. -->
+              <arguments>install --unsafe-perm --registry=http://registry.npmjs.eu</arguments>
             </configuration>
-            </execution>
+          </execution>
         </executions>
-        </plugin>
-        <plugin>
+      </plugin>
+      <plugin>
         <artifactId>exec-maven-plugin</artifactId>
         <groupId>org.codehaus.mojo</groupId>
         <version>1.2.1</version>
         <executions>
-            <execution>
+          <execution>
+            <id>node gyp executable</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <skip>${skip.nodegyp.chmod}</skip>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>chmod</executable>
+              <arguments>
+                <argument>+x</argument>
+                <argument>${ui.directory}/node/npm/bin/node-gyp-bin/node-gyp</argument>
+              </arguments>
+            </configuration>
+          </execution>
+          <execution>
             <id>Brunch build</id>
             <phase>generate-resources</phase>
             <goals>
-                <goal>exec</goal>
+              <goal>exec</goal>
             </goals>
             <configuration>
-                <workingDirectory>${basedir}/src/main/resources/ui</workingDirectory>
-                <executable>node/node</executable>
-                <arguments>
-                <argument>node_modules/.bin/brunch</argument>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>${ui.directory}/node/${node.executable}</executable>
+              <arguments>
+                <argument>node_modules/brunch/bin/brunch</argument>
                 <argument>build</argument>
-                </arguments>
+              </arguments>
             </configuration>
-            </execution>
+          </execution>
         </executions>
-        </plugin>
-      <plugin>
-        <groupId>org.apache.maven.plugins</groupId>
-        <artifactId>maven-compiler-plugin</artifactId>
-        <version>3.1</version>
-        <configuration>
-          <source>1.6</source>
-          <target>1.6</target>
-        </configuration>
       </plugin>
       <plugin>
         <artifactId>maven-dependency-plugin</artifactId>
@@ -302,5 +321,31 @@
         </plugin>
         </plugins>
     </pluginManagement>
-    </build>
+  </build>
+  <profiles>
+    <profile>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>win</family>
+        </os>
+      </activation>
+      <properties>
+        <node.executable>node.exe</node.executable>
+        <skip.nodegyp.chmod>true</skip.nodegyp.chmod>
+      </properties>
+    </profile>
+    <profile>
+      <id>linux</id>
+      <activation>
+        <os>
+          <family>unix</family>
+        </os>
+      </activation>
+      <properties>
+        <node.executable>node</node.executable>
+        <skip.nodegyp.chmod>false</skip.nodegyp.chmod>
+      </properties>
+    </profile>
+  </profiles>
 </project>

+ 2 - 3
contrib/views/files/src/main/resources/ui/package.json

@@ -14,15 +14,14 @@
   "scripts": {
     "test": "node_modules/phantomjs/bin/phantomjs runner.js public/tests.html",
     "start": "brunch watch --server",
-    "preinstall": "chmod +x node/npm/bin/node-gyp-bin/node-gyp",
-    "postinstall" : "bash node/with_new_path.sh node node_modules/.bin/bower --allow-root install"
+    "postinstall" : "bower --allow-root install"
   },
   "dependencies": {
     "javascript-brunch": "^1.7.1",
     "css-brunch": "^1.7.0",
     "uglify-js-brunch": "^1.7.7",
     "clean-css-brunch": "^1.7.1",
-    "bower": "^1.2.8",
+    "bower": ">= 1.2.8",
     "brunch": "1.7.17",
     "scaffolt": "^0.4.3",
     "ember-precompiler-brunch": ">= 1.5.0",

+ 75 - 10
contrib/views/pig/pom.xml

@@ -119,10 +119,30 @@
     <ambari.dir>${project.parent.parent.parent.basedir}</ambari.dir>
     <hadoop-version>2.2.0</hadoop-version>
     <ambari.version>2.0.0-SNAPSHOT</ambari.version>
+    <ui.directory>${basedir}/src/main/resources/ui/pig-web</ui.directory>
   </properties>
   <build>
     <plugins>
-
+      <plugin>
+        <!-- Cleanup ui files -->
+        <groupId>org.apache.maven.plugins</groupId>
+        <artifactId>maven-clean-plugin</artifactId>
+        <version>2.5</version>
+        <configuration>
+          <filesets>
+            <fileset>
+              <directory>${ui.directory}</directory>
+              <followSymlinks>false</followSymlinks>
+              <includes>
+                <include>public/**</include>
+                <include>node_modules/**</include>
+                <include>bower_components/**</include>
+                <include>node/**</include>
+              </includes>
+            </fileset>
+          </filesets>
+        </configuration>
+      </plugin>
       <!-- Building frontend -->
       <plugin>
         <groupId>com.github.eirslett</groupId>
@@ -131,44 +151,63 @@
         <configuration>
           <nodeVersion>v0.10.26</nodeVersion>
           <npmVersion>1.4.3</npmVersion>
-          <workingDirectory>src/main/resources/ui/pig-web/</workingDirectory>
+          <workingDirectory>${ui.directory}</workingDirectory>
         </configuration>
         <executions>
           <execution>
             <id>install node and npm</id>
-            <phase>generate-sources</phase>
+            <phase>initialize</phase>
             <goals>
               <goal>install-node-and-npm</goal>
             </goals>
           </execution>
           <execution>
             <id>npm install</id>
-            <phase>generate-sources</phase>
             <goals>
               <goal>npm</goal>
             </goals>
+            <phase>generate-resources</phase>
             <configuration>
-              <arguments>install --python="${project.basedir}/../src/main/unix/ambari-python-wrap" --unsafe-perm</arguments>
+              <!-- optional: The default argument is actually "install", so unless
+                   you need to run some other npm command, you can remove this whole <configuration>
+                   section. -->
+              <arguments>install --unsafe-perm --registry=http://registry.npmjs.eu</arguments>
             </configuration>
           </execution>
         </executions>
       </plugin>
-
       <plugin>
         <artifactId>exec-maven-plugin</artifactId>
         <groupId>org.codehaus.mojo</groupId>
+        <version>1.2.1</version>
         <executions>
+          <execution>
+            <id>node gyp executable</id>
+            <phase>initialize</phase>
+            <goals>
+              <goal>exec</goal>
+            </goals>
+            <configuration>
+              <skip>${skip.nodegyp.chmod}</skip>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>chmod</executable>
+              <arguments>
+                <argument>+x</argument>
+                <argument>${ui.directory}/node/npm/bin/node-gyp-bin/node-gyp</argument>
+              </arguments>
+            </configuration>
+          </execution>
           <execution>
             <id>Brunch build</id>
-            <phase>generate-sources</phase>
+            <phase>generate-resources</phase>
             <goals>
               <goal>exec</goal>
             </goals>
             <configuration>
-              <workingDirectory>${basedir}/src/main/resources/ui/pig-web</workingDirectory>
-              <executable>node/node</executable>
+              <workingDirectory>${ui.directory}</workingDirectory>
+              <executable>${ui.directory}/node/${node.executable}</executable>
               <arguments>
-                <argument>node_modules/.bin/brunch</argument>
+                <argument>node_modules/brunch/bin/brunch</argument>
                 <argument>build</argument>
               </arguments>
             </configuration>
@@ -237,4 +276,30 @@
       </resource>
     </resources>
   </build>
+  <profiles>
+    <profile>
+      <id>windows</id>
+      <activation>
+        <os>
+          <family>win</family>
+        </os>
+      </activation>
+      <properties>
+        <node.executable>node.exe</node.executable>
+        <skip.nodegyp.chmod>true</skip.nodegyp.chmod>
+      </properties>
+    </profile>
+    <profile>
+      <id>linux</id>
+      <activation>
+        <os>
+          <family>unix</family>
+        </os>
+      </activation>
+      <properties>
+        <node.executable>node</node.executable>
+        <skip.nodegyp.chmod>false</skip.nodegyp.chmod>
+      </properties>
+    </profile>
+  </profiles>
 </project>

+ 1 - 2
contrib/views/pig/src/main/resources/ui/pig-web/package.json

@@ -7,8 +7,7 @@
   "scripts": {
     "test": "node_modules/phantomjs/bin/phantomjs runner.js public/tests.html",
     "start": "brunch watch --server",
-    "preinstall": "chmod +x node/npm/bin/node-gyp-bin/node-gyp",
-    "postinstall" : "bash node/with_new_path.sh node node_modules/.bin/bower --allow-root install"
+    "postinstall" : "bower --allow-root install"
   },
   "dependencies": {
     "brunch": "1.7.17",