Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

修改了目录生成结构 升级了yuicompressor-2.4.7.jar #9

Merged
merged 5 commits into from

2 participants

@iamued

修改了目录生成结构 ,稍后不上readme

/Alice/plugins/AntBuild >tree ../../build/
../../build/
├── alice-all-min.css
├── base-min.css
├── min
│   ├── 1px-round-corner-min.css
│   ├── base-min.css
│   ├── custom-file-min.css
│   ├── drop-shadow-min.css
│   ├── equal-height-layout-min.css
│   ├── float-center-min.css
│   ├── force-wrap-min.css
│   ├── ime-disabled-min.css
│   ├── position-fixed-min.css
│   ├── remove-outline-min.css
│   ├── rotate-min.css
│   ├── select-mask-min.css
│   └── vertical-horizoncal-min.css
└── solutions-all-min.css

iamued added some commits
iamued 升级yuicompressor 到yuicompressor-2.4.7版本 6692875
iamued 修改build.xml 生成目录结构
和sofish沟通的
fd32c9b
iamued add README.md
添加说明文件
917f5e8
iamued delete autosaved file 69e48d5
iamued add ant.bat -windows
添加windows下使用的ant.bat
63a4929
@sofish sofish merged commit 2916180 into aliceui:master
@afc163 afc163 referenced this pull request
Closed

alice 开发工具 #39

7 of 7 tasks complete
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Dec 25, 2011
  1. 修改build.xml 生成目录结构

    iamued authored
    和sofish沟通的
  2. add README.md

    iamued authored
    添加说明文件
  3. delete autosaved file

    iamued authored
  4. add ant.bat -windows

    iamued authored
    添加windows下使用的ant.bat
This page is out of date. Refresh to see the latest.
View
70 plugins/AntBuild/README.md
@@ -0,0 +1,70 @@
+###关于本工具
+本工具使用ant+yuicompressor来实现 base.css 和 相关 Solutions的压缩合并
+
+>Ant是一种基于Java的build工具。理论上来说,它有些类似于(Unix)C中的make ,但没有make的缺陷。目前的最新版本为:Ant 1.8.2。
+官方站点<http://ant.apache.org/>
+
+有问题欢迎联系我Twitter <https://twitter.com/#!/iamued>
+
+###使用方法
+***windows***
+
+进入Alice目录\plugins\AntBuild目录 执行ant.bat 等待运行完成
+
+就会在Alice目录生成build文件夹里面就是啦
+
+目录结构如下
+<pre>
+build/
+├── alice-all-min.css //base.min.css+solutions-all-min.css
+├── base-min.css //base.css压缩后的文件
+├── min //solution压缩后的单体文件夹
+│   ├── 1px-round-corner-min.css
+│   ├── base-min.css
+│   ├── custom-file-min.css
+│   ├── drop-shadow-min.css
+│   ├── equal-height-layout-min.css
+│   ├── float-center-min.css
+│   ├── force-wrap-min.css
+│   ├── ime-disabled-min.css
+│   ├── position-fixed-min.css
+│   ├── remove-outline-min.css
+│   ├── rotate-min.css
+│   ├── select-mask-min.css
+│   └── vertical-horizoncal-min.css
+└── solutions-all-min.css //合并压缩后的solutions.css 不包含base.css
+</pre>
+
+
+####附:Window下安装Ant方法
+
+######一.下载 & 安装JDK (如本地已经有了可以跳过)
+Ant是基于java环境的构建工具 所以必须要安装JDK
+<http://www.oracle.com/technetwork/java/javase/downloads/index.html>
+下载后直接安装
+
+然后配置环境变量:右击“我的电脑”-->"高级"-->"环境变量"
+
+1. 在系统变量里新建“JAVA_HOME”变量,变量值为:C:\Program Files\Java\jdk1.6.0_14(根据自己的安装路径填写)
+
+2. 新建“classpath”变量,变量值为:.;%JAVA_HOME%\lib;%JAVA_HOME%\lib\tools.jar
+
+3. 在path变量(已存在不用新建)添加变量值:%JAVA_HOME%\bin;%JAVA_HOME%\jre\bin(注意变量值之间用“;”隔开)
+
+4. “开始”-->“运行”-->输入“cmd”-->"Enter"-->执行“javac”,如果能正常打印用法说明配置成功!
+
+######二.下载 & 安装Ant (如本地已经有了可以跳过)
+下载ant安装文件 <http://ant.apache.org/bindownload.cgi>
+
+目前最新版本 <http://labs.renren.com/apache-mirror//ant/binaries/apache-ant-1.8.2-bin.zip>
+
+下载后解压即可,假定Ant解压在c:\ant\目录下。
+然后配置环境变量:右击“我的电脑”-->"高级"-->"环境变量"
+
+1. 在系统变量里新建“ANT_HOME”变量,变量值为::C:\Program Files\Java\jdk1.6.0_14(根据自己的安装路径填写)
+
+2. 在path变量(已存在不用新建)添加变量值:%ANT_HOME%\bin(注意变量值之间用“;”隔开)
+
+3. “开始”-->“运行”-->输入“cmd”-->"Enter"-->执行"ant -version"命令,如果能正常打印ant版本配置成功!
+
+
View
218 plugins/AntBuild/ant.bat
@@ -0,0 +1,218 @@
+@echo off
+
+REM Licensed to the Apache Software Foundation (ASF) under one or more
+REM contributor license agreements. See the NOTICE file distributed with
+REM this work for additional information regarding copyright ownership.
+REM The ASF licenses this file to You under the Apache License, Version 2.0
+REM (the "License"); you may not use this file except in compliance with
+REM the License. You may obtain a copy of the License at
+REM
+REM http://www.apache.org/licenses/LICENSE-2.0
+REM
+REM Unless required by applicable law or agreed to in writing, software
+REM distributed under the License is distributed on an "AS IS" BASIS,
+REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+REM See the License for the specific language governing permissions and
+REM limitations under the License.
+
+REM This is an inordinately troublesome piece of code, particularly because it
+REM tries to work on both Win9x and WinNT-based systems. If we could abandon '9x
+REM support, things would be much easier, but sadly, it is not yet time.
+REM Be cautious about editing this, and only add WinNT specific stuff in code that
+REM only runs on WinNT.
+
+if "%HOME%"=="" goto homeDrivePathPre
+if exist "%HOME%\antrc_pre.bat" call "%HOME%\antrc_pre.bat"
+
+:homeDrivePathPre
+if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePre
+if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePre
+if exist "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_pre.bat"
+
+:userProfilePre
+if "%USERPROFILE%"=="" goto alpha
+if "%USERPROFILE%"=="%HOME%" goto alpha
+if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto alpha
+if exist "%USERPROFILE%\antrc_pre.bat" call "%USERPROFILE%\antrc_pre.bat"
+
+:alpha
+
+if "%OS%"=="Windows_NT" @setlocal
+if "%OS%"=="WINNT" @setlocal
+
+if "%ANT_HOME%"=="" goto setDefaultAntHome
+
+:stripAntHome
+if not _%ANT_HOME:~-1%==_\ goto checkClasspath
+set ANT_HOME=%ANT_HOME:~0,-1%
+goto stripAntHome
+
+:setDefaultAntHome
+rem %~dp0 is expanded pathname of the current script under NT
+set ANT_HOME=%~dp0..
+
+:checkClasspath
+set _USE_CLASSPATH=yes
+rem CLASSPATH must not be used if it is equal to ""
+if "%CLASSPATH%"=="""" set _USE_CLASSPATH=no
+if "%CLASSPATH%"=="" set _USE_CLASSPATH=no
+
+rem Slurp the command line arguments. This loop allows for an unlimited number
+rem of arguments (up to the command line limit, anyway).
+set ANT_CMD_LINE_ARGS=
+:setupArgs
+if ""%1""=="""" goto doneStart
+if ""%1""==""-noclasspath"" goto clearclasspath
+set ANT_CMD_LINE_ARGS=%ANT_CMD_LINE_ARGS% %1
+shift
+goto setupArgs
+
+rem here is there is a -noclasspath in the options
+:clearclasspath
+set _USE_CLASSPATH=no
+shift
+goto setupArgs
+
+rem This label provides a place for the argument list loop to break out
+rem and for NT handling to skip to.
+
+:doneStart
+
+if "%_USE_CLASSPATH%"=="no" goto findAntHome
+
+:stripClasspath
+if not _%CLASSPATH:~-1%==_\ goto findAntHome
+set CLASSPATH=%CLASSPATH:~0,-1%
+goto stripClasspath
+
+:findAntHome
+rem find ANT_HOME if it does not exist due to either an invalid value passed
+rem by the user or the %0 problem on Windows 9x
+if exist "%ANT_HOME%\lib\ant.jar" goto checkJava
+
+rem check for ant in Program Files
+if not exist "%ProgramFiles%\ant" goto checkSystemDrive
+set ANT_HOME=%ProgramFiles%\ant
+goto checkJava
+
+:checkSystemDrive
+rem check for ant in root directory of system drive
+if not exist %SystemDrive%\ant\lib\ant.jar goto checkCDrive
+set ANT_HOME=%SystemDrive%\ant
+goto checkJava
+
+:checkCDrive
+rem check for ant in C:\ant for Win9X users
+if not exist C:\ant\lib\ant.jar goto noAntHome
+set ANT_HOME=C:\ant
+goto checkJava
+
+:noAntHome
+echo ANT_HOME is set incorrectly or ant could not be located. Please set ANT_HOME.
+goto end
+
+:checkJava
+set _JAVACMD=%JAVACMD%
+
+if "%JAVA_HOME%" == "" goto noJavaHome
+if not exist "%JAVA_HOME%\bin\java.exe" goto noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=%JAVA_HOME%\bin\java.exe
+goto checkJikes
+
+:noJavaHome
+if "%_JAVACMD%" == "" set _JAVACMD=java.exe
+
+:checkJikes
+if not "%JIKESPATH%"=="" goto runAntWithJikes
+
+:runAnt
+if "%_USE_CLASSPATH%"=="no" goto runAntNoClasspath
+:runAntWithClasspath
+"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%
+rem Check the error code of the Ant build
+if not "%OS%"=="Windows_NT" goto onError
+set ANT_ERROR=%ERRORLEVEL%
+goto end
+
+:runAntNoClasspath
+"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%
+rem Check the error code of the Ant build
+if not "%OS%"=="Windows_NT" goto onError
+set ANT_ERROR=%ERRORLEVEL%
+goto end
+
+:runAntWithJikes
+
+if not _%JIKESPATH:~-1%==_\ goto checkJikesAndClasspath
+set JIKESPATH=%JIKESPATH:~0,-1%
+goto runAntWithJikes
+
+:checkJikesAndClasspath
+
+if "%_USE_CLASSPATH%"=="no" goto runAntWithJikesNoClasspath
+
+:runAntWithJikesAndClasspath
+"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% -cp "%CLASSPATH%" %ANT_CMD_LINE_ARGS%
+rem Check the error code of the Ant build
+if not "%OS%"=="Windows_NT" goto onError
+set ANT_ERROR=%ERRORLEVEL%
+goto end
+
+:runAntWithJikesNoClasspath
+"%_JAVACMD%" %ANT_OPTS% -classpath "%ANT_HOME%\lib\ant-launcher.jar" "-Dant.home=%ANT_HOME%" "-Djikes.class.path=%JIKESPATH%" org.apache.tools.ant.launch.Launcher %ANT_ARGS% %ANT_CMD_LINE_ARGS%
+rem Check the error code of the Ant build
+if not "%OS%"=="Windows_NT" goto onError
+set ANT_ERROR=%ERRORLEVEL%
+goto end
+
+:onError
+rem Windows 9x way of checking the error code. It matches via brute force.
+for %%i in (1 10 100) do set err%%i=
+for %%i in (0 1 2) do if errorlevel %%i00 set err100=%%i
+if %err100%==2 goto onError200
+if %err100%==0 set err100=
+for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%%i0 set err10=%%i
+if "%err100%"=="" if %err10%==0 set err10=
+:onError1
+for %%i in (0 1 2 3 4 5 6 7 8 9) do if errorlevel %err100%%err10%%%i set err1=%%i
+goto onErrorEnd
+:onError200
+for %%i in (0 1 2 3 4 5) do if errorlevel 2%%i0 set err10=%%i
+if err10==5 for %%i in (0 1 2 3 4 5) do if errorlevel 25%%i set err1=%%i
+if not err10==5 goto onError1
+:onErrorEnd
+set ANT_ERROR=%err100%%err10%%err1%
+for %%i in (1 10 100) do set err%%i=
+
+:end
+rem bug ID 32069: resetting an undefined env variable changes the errorlevel.
+if not "%_JAVACMD%"=="" set _JAVACMD=
+if not "%_ANT_CMD_LINE_ARGS%"=="" set ANT_CMD_LINE_ARGS=
+
+if "%ANT_ERROR%"=="0" goto mainEnd
+
+goto omega
+
+:mainEnd
+
+rem If there were no errors, we run the post script.
+if "%OS%"=="Windows_NT" @endlocal
+if "%OS%"=="WINNT" @endlocal
+
+if "%HOME%"=="" goto homeDrivePathPost
+if exist "%HOME%\antrc_post.bat" call "%HOME%\antrc_post.bat"
+
+:homeDrivePathPost
+if "%HOMEDRIVE%%HOMEPATH%"=="" goto userProfilePost
+if "%HOMEDRIVE%%HOMEPATH%"=="%HOME%" goto userProfilePost
+if exist "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat" call "%HOMEDRIVE%%HOMEPATH%\antrc_post.bat"
+
+:userProfilePost
+if "%USERPROFILE%"=="" goto omega
+if "%USERPROFILE%"=="%HOME%" goto omega
+if "%USERPROFILE%"=="%HOMEDRIVE%%HOMEPATH%" goto omega
+if exist "%USERPROFILE%\antrc_post.bat" call "%USERPROFILE%\antrc_post.bat"
+
+:omega
+
+exit /b %ANT_ERROR%
View
42 plugins/AntBuild/build.xml
@@ -1,8 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
+<!--anthor:richieliu blog:http://www.iamued.com twitter:https://twitter.com/#!/iamued-->
<!-- 对指定目录下的所有css进行压缩,放入指定位置 -->
<project name="cssbuild" default="build">
<property name="lib" location="lib" />
- <property name="yuicompressor.jar" location="${lib}/yuicompressor-2.4.2.jar" />
+ <property name="yuicompressor.jar" location="${lib}/yuicompressor-2.4.7.jar" />
<property name="inputencoding" value="utf8"/>
<property name="outputencoding" value="utf8"/>
@@ -23,19 +24,25 @@
<!-- 压缩完成后, copy要压缩文件至目标目录 -->
<target name="build" depends="css.compress">
<copy file="${temp}/solutions-all-min.css" tofile="${dest.dir}/solutions-all-min.css" overwrite="true" failonerror="false"/>
- <echo message="压缩完成后, 拷贝${temp}/compress-all-pack.js至目标目录"></echo>
+ <copy file="${temp}/base-min.css" tofile="${dest.dir}/base-min.css" overwrite="true" failonerror="false"/>
+ <copy file="${temp}/alice-all-min.css" tofile="${dest.dir}/alice-all-min.css" overwrite="true" failonerror="false"/>
+ <copy todir="${dest.dir}" overwrite="true" failonerror="false">
+ <fileset dir="${temp}" includes="min/*.css"/>
+ </copy>
+ <echo message="compress,copy build files to compress"></echo>
</target>
<target name="copytoone">
- <echo message="将所有solutions文件夹下所有css文件拷贝到${temp}/source">[开始]</echo>
+ <echo message="copy all css file to ${temp}/source">[start]</echo>
<copy todir="${temp}/source" flatten="true">
<fileset dir="${source.dir}" includes="**/*.css"/><!-- 包含的文件类型,注意这里是includes -->
</copy>
+ <copy file="../../base.css" tofile="${temp}/source/base.css" overwrite="true" failonerror="false"/>
</target>
<!-- YUI Compress 压缩合并操作-->
<target name="css.compress" depends="createTemp,copytoone">
<!-- 循环压缩文件 -->
- <echo message="循环压缩${temp}所有css文件">[开始]</echo>
+ <echo message="compress ${temp} all .css file">[start]</echo>
<apply executable="java" parallel="false" failonerror="true">
<fileset dir="${temp}/source" includes="*.css" /> <!-- 源文件及所在目录, 指定下面要循环文件 -->
<arg line="-jar" />
@@ -44,25 +51,34 @@
<srcfile />
<arg line="-o" />
<targetfile />
- <mapper type="glob" from="*.css" to="${temp}/*-min.css" />
+ <mapper type="glob" from="*.css" to="${temp}/min/*-min.css" />
</apply>
- <echo message="循环压缩${temp}所有css文件">[结束]</echo>
+ <echo message="compress ${temp} all .css file">[end]</echo>
- <!-- 连接文件至目标目录 fixlastline="true" 每个文件占一行 -->
- <echo message="连接文件${temp}所有css文件至${temp}/solutions-all-min.css">[开始]</echo>
+ <!-- 连接文件至目标目录 fixlastline="true" 每个文件占一行 -->
+ <!-- 创建 solutions-all-min.css-->
<concat destfile="${temp}/solutions-all-min.css" fixlastline="true" encoding="${inputencoding}" outputencoding="${outputencoding}">
<fileset dir="${temp}">
- <include name="**-min.css" />
- <exclude name="*.js"/> <!-- 排除 -->
+ <include name="min/**-min.css" />
+ <exclude name="*.js"/> <!-- 排除 -->
+ <exclude name="min/base-min.css" /> <!-- 排除 -->
</fileset>
- </concat>
- <echo message="连接文件${temp}所有css文件至${temp}/solutions-all-min.css">[结束]</echo>
+ </concat>
+ <copy file="${temp}/min/base-min.css" tofile="${temp}/base-min.css" overwrite="true" failonerror="false"/>
+ <!-- 创建 alice-all-min.css =base.min.css + olutions-all-min.css-->
+ <concat destfile="${temp}/alice-all-min.css" fixlastline="true" encoding="${inputencoding}" outputencoding="${outputencoding}">
+ <fileset dir="${temp}">
+ <include name="**-min.css" />
+ </fileset>
+ </concat>
+ <echo message="concat ${temp} .css file to ${temp}/solutions-all-min.css and alice-all-min.css ">[end]</echo>
</target>
<!-- 创建临时目录 -->
<target name="createTemp" description="创建临时目录">
<mkdir dir="${temp}"/>
<mkdir dir="${temp}/source"/>
- <echo>创建临时目录${temp}</echo>
+ <mkdir dir="${temp}/min"/>
+ <echo>create temp dir:${temp}</echo>
</target>
</project>
View
BIN  plugins/AntBuild/lib/yuicompressor-2.4.7.jar
Binary file not shown
Something went wrong with that request. Please try again.