how do I setup Ant buildscript project.properties file? - ant

Hello I a having problem setting up Ant BuildScript
When I Run ant, the Java Scripts and CSS are not compressed and the and the stylesheet link is not update to a random number.
In the project.properties file I am using the following.
file.root.stylesheet = screen.css
dir.js = includes/js
dir.js.main = ${dir.js}
#build.css.scss = true
dir.css = css
Build sass is turned off because it is already been compiled by compass
I have tried to have a single js file by putting this line around the js scripts
<!-- //-beg- concat_js -->
<script src="includes/js/script1.js"></script>
<script src="includes/js/script2.js"></script>
<!-- //-end- concat_js -->
The folder structure I am using is the folwing:
css/
img/
includes/sass
foundation.scc, screen.scss
includes/js
includes/file.php
I am getting the following error's
-js.all.minify:
[echo] Minifying scripts
[copy] Copying 4 files to c:\projectfolder\intermediate\includes\js
[apply] c:\projectfolder\includes\js\plugins.js:86: ERROR - Parse error. IE8 (and below) will parse trailing commas in array and object literals incorrectly. If you are targeting newer
versions of JS, set the appropriate language_in option.
[apply] firstName : "required",
[apply] ^
[apply]
[apply] 1 error(s), 0 warning(s)
[apply] Result: 1
-js.main.concat:
[echo] Concatenating Main JS scripts based on index.html...
[exec] Result: 1
[concat] c:\projectfolder\intermediate\Exception does not exist.
[concat] c:\projectfolder\intermediate\in does not exist.
[concat] c:\projectfolder\intermediate\thread does not exist.
[concat] c:\projectfolder\intermediate\"main" does not exist.
[concat] c:\projectfolder\intermediate\java.io.FileNotFoundException: does not exist.
[concat] c:\projectfolder\intermediate\index.html does not exist.
[concat] c:\projectfolder\intermediate\(Het does not exist.
[concat] c:\projectfolder\intermediate\systeem does not exist.
[concat] c:\projectfolder\intermediate\kan does not exist.
[concat] c:\projectfolder\intermediate\het does not exist.
[concat] c:\projectfolder\intermediate\opgegeven does not exist.
[concat] c:\projectfolder\intermediate\bestand does not exist.
[concat] c:\projectfolder\intermediate\niet does not exist.
[concat] c:\projectfolder\intermediate\vinden) does not exist.
[concat] c:\projectfolder\intermediate\at does not exist.
[concat] c:\projectfolder\intermediate\java.io.FileInputStream.open(Native does not exist.
[concat] c:\projectfolder\intermediate\Method) does not exist.
[concat] c:\projectfolder\intermediate\at does not exist.
[concat] c:\projectfolder\intermediate\java.io.FileInputStream.<init>(FileInputStream.java:138) does not exist.
[concat] c:\projectfolder\intermediate\at does not exist.
[concat] c:\projectfolder\intermediate\java.io.FileInputStream.<init>(FileInputStream.java:97) does not exist.
[concat] c:\projectfolder\intermediate\at does not exist.
[concat] c:\projectfolder\intermediate\java.io.FileReader.<init>(FileReader.java:58) does not exist.
[concat] c:\projectfolder\intermediate\at does not exist.
[concat] c:\projectfolder\intermediate\FindAttribute.main(Unknown does not exist.
[concat] c:\projectfolder\intermediate\Source) does not exist.
I have placed a full error log one my jsfiddle account
http://jsfiddle.net/piggybattery/bpxBM/1/
Does anyone know how to chain to this structure?

Fix the trailing comma causing the minification error. that's just a good idea.
Other than that, it looks like there are about a million things that could be going wrong. the build script was created to be pretty easy to use with HTML-Boilerplate structure. When you start to add things like PHP, and SASS and Foundation, there are more and more things that go wrong. It can work with those things, you just need to be aware of the changes your making and reflect them in the build script.
The biggest thing to remember is that the paths in the properties file need to point to real files that Ant and Java can find.
So, from the root of your project (one up from your build directory) make sure the strings that you're building with the dir.* and file.* properties point to things that exist on disk and in your source code. So, for example, if the script can't find your file.root.page (it looks for index.html by default. I'm guessing you don't have an index.html in your project?) it can't concatenate the scripts inside the comments. Additionally, if it can't find your file.root.stylesheet things will go wrong (is your main CSS file in css/screen.css? Is it referenced in your HTML? That's where I swap out the source.) Same for file.root.script other things will go wrong (is file.root.script set to script1.js or script2.js? Again, that helps me change the source) Basically every time you make a change from the default HTML5 Boilderplate structure you need to reflect that in those properties.

Related

Receiving error "include could not find load file" for cmake

Setting up swift-corelibs-xctest for Swift - Windows 10. When file CMakeLists.txt is called find_package is ran to look for FoundationConfig.cmake file
if(NOT CMAKE_SYSTEM_NAME STREQUAL Darwin)
find_package(dispatch CONFIG REQUIRED)
find_package(Foundation CONFIG REQUIRED)
endif()
FoundationConfig.cmake is found but error "include could not find load file: #Foundation_EXPORTS_FILE#"
I'm pretty sure this is due to fact that Foundation file is in a different directory. I only need clarification as to what # Foundation_EXPORTS_FILE# means. I have been unable to find any reference to _EXPORTS_FILE.
Believe I found part of what I was lookin for here.
https://gitlab.kitware.com/cmake/community/-/wikis/doc/cmake/ExportInterface
The other half of the problem was found here -
default search paths for CMake include() vs. find_package()
"include(#Foundation_EXPORTS_FILE#)" Was in reference to the two config files, which are not in the same location, also include() searches for files in CMAKE_MODULE_PATH --- message("Path- ${CMAKE_MODULE_PATH}")

Inkscape can't find the file for includesvg

Having a nightmare including an svg file in my document. It's just a picture of Tux.
Code:
\svgpath{{C:/Users/me/Google\ Drive/foo}}
\includesvg[width = 200pt]{tux}
Error:
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Can't open file: tux.svg (doesn't exist)
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Can't open file: tux.svg (doesn't exist)
** (inkscape.exe:27228): WARNING **: 20:52:43.840: Specified document tux.svg cannot be opened (does not exist or not a valid SVG file)
The system cannot find the file specified.
The system cannot find the file specified.
I wish it would give me more debugging information so I could tell what directory is being used. I've enabled --shell-escape. I've tried various combinations with no success.
EDIT: Minimal example
\documentclass{article}
\usepackage{svg}
\begin{document}
\includesvg{tux}
\end{document}
I created a directory c:\latex
My command line is texify --pdf --engine=luatex --synctex=1 --tex-option=--shell-escape --clean foo
I noticed that it also says there's a log file, but I cannot find a log file with more information
Package svg Warning: The export with Inkscape failed for file
(svg) `tux.svg'
(svg) Troubleshooting: Please check in the log file how
(svg) the invocation of Inkscape took place and try to
(svg) execute it yourself in the terminal on input line 5.
I would love to get my hands on that mythical log file. There's a foo.log file but that just says what my console output was. There's another log file at C:\Users\james\AppData\Local\MiKTeX\2.9\miktex\log\texify.log, but that doesn't have any information about the inkscape command either.
The docs (http://mirror.its.dal.ca/ctan/graphics/svg/doc/svg.pdf) say that I should see runsystem ....
The problem is the --clean option. I figured this out by selected pdflatex in TeXWorks and it suddenly built. Taking out options one by one helped me get to the bottom of this. Going back to post on some other questions.
As #samcarter pointed out, if you don't have to use texify, try not to. One of my packages requires LuaLaTex to typeset, so I selected the LuaLaTeX +MakeIndex +BibTex when I only needed the LuaLaTex plain option. Using that one fixed the issue.
If you have to use texify, though, try removing the --clean.

Unable to create property file using Ant script

I am trying to create a new Property File with the below snippet of Ant script.
<propertyfile file="${path}/sample.properties">
<entry key="k1" value="v1"/>
</propertyfile>
It tries create the property file and I get the below error
(The system cannot find the path specified). Here the path includes the file name as well. I confirmed the parent folder where the property files needs to be created exists.
I created a build file with your snippet and couldn't see an issue. If the directory specified by the path property doesn't exist an exception is thrown but this seems like the correct behaviour.
I suggest you add some tests to confirm the actual value of the path property. Maybe it doesn't hold the value you expect.
build.xml
<project>
<property name="path" value="./test"/>
<propertyfile file="${path}/sample.properties">
<entry key="k1" value="v1"/>
</propertyfile>
</project>
Test Case 1 - 'test' directory not present - expected result FAIL
$ ls test
ls: cannot access test: No such file or directory
$ ant build.xml
Buildfile: /home/owen/stackoverflow/build.xml
[propertyfile] Creating new property file: /home/owen/stackoverflow/test/sample.properties
BUILD FAILED
/home/owen/stackoverflow/build.xml:3: java.io.FileNotFoundException: /home/owen/stackoverflow/test/sample.properties (No such file or directory)
Total time: 0 seconds
Test Case 2 - 'test' directory now available - expected result SUCCESS
$ mkdir test
$ ant
Buildfile: /home/owen/stackoverflow/build.xml
[propertyfile] Creating new property file: /home/owen/stackoverflow/test/sample.properties
BUILD SUCCESSFUL
Total time: 0 seconds
EDIT: Sorry didn't read the section mentioning that the parent folder exists. For me the given snippet works (in Eclipse). What does your path variable contains and which environment you use exactly ?
All folders specified by your path variable must exist before Ant can create the property file, even before any target is executed.

How to integrate LuaJIT with LuaRocks on Windows?

I downloaded the source of LuaJIT and compiled it with msvc120.dll (VS 2013 x64). When I run it from the command line I have no problems executing some basic lua. Now the LuaJIT installation guide mentions moving luajit.exe and lua51.dll into their own folder. From there it says to create a lua folder and under that a jit folder with the contents of src/jit moved underneath the newly created jit folder.
From my understanding my folder should look like and contain:
luajit.exe
lua51.dll
/lua
/jit
bc.lua
[rest of jit files]
vmdef.lua
Is this correct or am I missing files?
Now after I built my luajit I tried to wire it up into my luarocks to act as my interpreter using
install.bat /LUA C:\LuaJIT\2.0.3\[folder with above content]
However this cannot find the header files. I then copied over what are the header files into the folder above and that wires it up, but I can never actually get anything to compile when pointed over to LuaJIT. Edit: The error I get is the following,
C:\LuaJIT\2.0.3\bin\lua51.dll : fatal error LNK1107: invalid or corrupt file: cannot read at 0x2D0
Error: Failed installing dependency: https://rocks.moonscript.org/luafilesystem-1.6.2-2.src.rock - Build error: Failed compiling module lfs.dll
Is the correct way to handle this to simply point to my lua binaries and from there leverage LuaJIT to run my files or am I doing something wrong with wiring up LuaJIT and luarocks? The former seems to work for the most part, since I only ran into one library compilation issue, lua-cjson.
I've run on exactly the same problem, but they've found a solution right here:
https://github.com/keplerproject/luafilesystem/issues/22
I knew that for "linking DLLs statically" there is a so-called "export" .lib file, which is passed to the linker (and not the DLL itself).
So, for example, when compiling, LuaRocks was doing this:
cl /nologo /MD /O2 -c -Fosrc/mime.obj -ID:/LuaJIT-2.0.4/include/ src/mime.c -DLUA_COMPAT_APIINTCASTS -DLUASOCKET_DEBUG -DNDEBUG -DLUASOCKET_API=__declspec(dllexport) -DMIME_API=__declspec(dllexport) mime.c
link -dll -def:core.def -out:mime/core.dll D:/LuaJIT-2.0.4/bin/lua51.dll src/mime.obj
My LuaJIT was compiled from source in D:\LuaJIT-2.0.4\src, but I made two folders myself: D:\LuaJIT-2.0.4\include with all *.h files copied from src and D:\LuaJIT-2.0.4\bin with luajit.exe, lua51.dll, and then later lua51.exp and lua51.lib. Still same error, but this was the right track.
Fix
Now, check where your LuaRocks configs are:
luarocks.bat help
Scroll down to a section like:
CONFIGURATION
Lua version: 5.1
Configuration files:
System: D:/luarocks/config-5.1.lua (ok)
User : (... snip ...)
Edit the System configuration file, specifically see the part:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.dll'
}
Here! LUALIB should be the .lib file. If your export lib is alongside the DLL, you just need to change to:
variables = {
MSVCRT = 'VCRUNTIME140',
LUALIB = 'lua51.lib' -- here!
}
Verification
And now:
luarocks.bat install luasocket
(...)
link -dll -def:core.def -out:socket/core.dll D:/LuaJIT-2.0.4/bin/lua51.lib src/luasocket.obj (...)
(...)
luasocket 3.0rc1-2 is now built and installed in D:\luarocks\systree (license: MIT)
Note the first argument passed to the linker.

scons: source directory does not get copied into build directory

Part of my build process is to create a tar file of an input directory, located at src/bundle/bundle. In src/bundle/SConscript:
Import('*')
bundleDir = Dir("bundle")
jsontar = Command("bundle.tar", bundleDir,
"/home/dbender/bin/mkvgconf $SOURCE $TARGET")
in my SConstruct:
SConscript(Split('src/bundle/SConscript'),
exports='bin_env lib_env', build_dir='tmp/bundle')
When attempting to build:
scons: Reading SConscript files ...
scons: done reading SConscript files.
scons: Building targets ...
/home/dbender/bin/mkvgconf tmp/bundle/bundle tmp/bundle/bundle.tar
Input directory tmp/bundle/bundle not found!
scons: *** [tmp/bundle/bundle.tar] Error 1
scons: building terminated because of errors.
Clearly scons is not copying the src/bundle/bundle to tmp/bundle/bundle, but I am stumped as to why.
Footnotes:
Using absolute pathname for mkvgconf is bad practice but just intermediate until I have this problem solved.
SCons doesn't know anything about the contents of your input src/bundle/bundle - only the program mkvgconf knows what it does with that directory.
One solution is to add an explicit dependency in the SConscript:
import os
Depends('bundle.tar', Glob(str(bundleDir) + os.path.sep + '*'))
That also means that when you update the contents of the bundle directory, the mkvgconf script will be rerun.
PS. you might want to change the build_dir argument name to variant_dir, as the former is deprecated in favor of the latter in recent SCons releases.

Resources